` Printed Icetips Article

Icetips Article



Par2: 32 bit Disk serial number
1998-12-20 -- Arnor Baldvinsson
 
>The 16 Bit versions of getting the disk information (int86x) returns the
>Serial Number, the Volume Label, and the File System Type (FAT32, FAT16,
>Etc). Could someone please point me in the right direction to the 32 Bit
>version of this routine?

For this you can use the GetVolumeInformation api call - it does a lot
more than just get the volume label.  Here are some code snippets:

"After global includes"

FORMAT_MESSAGE_ALLOCATE_BUFFER EQUATE(00000100H)
FORMAT_MESSAGE_ARGUMENT_ARRAY  EQUATE(00002000H)
FORMAT_MESSAGE_FROM_HMODULE    EQUATE(00000800H)
FORMAT_MESSAGE_FROM_STRING     EQUATE(00000400H)
FORMAT_MESSAGE_FROM_SYSTEM     EQUATE(00001000H)
FORMAT_MESSAGE_IGNORE_INSERTS  EQUATE(00000200H)
FORMAT_MESSAGE_MAX_WIDTH_MASK  EQUATE(000000FFH)

va_list         EQUATE(LONG)            !*LPCSTR


"Inside the global Map" 

COMPILE('***',_WIDTH32_)
MODULE('WIN32.LIB')
   GetDriveType(*LPCSTR),UNSIGNED,PASCAL,RAW,NAME('GetDriveTypeA')
   CopyFileA(*LPCSTR,*LPCSTR,BOOL),BOOL,PASCAL,RAW
   GetVolumeInformationA(*LPCSTR,*LPSTR,DWORD,*DWORD,*DWORD,*DWORD,|
                         *LPSTR ,DWORD),BOOL,PASCAL,RAW
   GetLastError(),DWORD,PASCAL
   FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,*LPSTR,DWORD,va_list),DWORD,PASCAL,RAW
END
***

Some code:

GetVolumeID        ROUTINE

LOC:RootPathName = CHR(64+LOC:Entries) & ':\'
LOC:VolNameSize  = SIZE(LOC:VolNameBuffer)
LOC:FileSystemSize = SIZE(LOC:FileSystem)
X# =  GetVolumeInformationA(LOC:RootPathName, |
                             LOC:VolNameBuffer, |
                             LOC:VolNameSize, |
                             LOC:VolSerialNr, |
                             LOC:MaxFCL, |
                             LOC:MaxFCF, |
                             LOC:FileSystem, |
                             LOC:FileSystemSize)

LOC:VolNameBuffer = LOWER(LOC:VolNameBuffer)

Variables:

LOC:RootPathName         CSTRING(255)
LOC:VolNameBuffer        CSTRING(255)
LOC:VolNameSize          ULONG
LOC:VolSerialNr          ULONG
LOC:MaxFCL               ULONG
LOC:MaxFCF               ULONG
LOC:FileSystem           CSTRING(255)
LOC:FileSystemSize       LONG



Printed November 21, 2024, 11:13 am
This article has been viewed/printed 35226 times.