Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Floppy Serial Number
Message
 
To
28/03/1998 06:33:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00087886
Message ID:
00087907
Views:
31
>How can capture de serial number of a Floppy Disk..

In order to retrieve the serial number of a floppy diskette, CD-ROM, or hard drive, you'll need the following Windows API call:
DECLARE SHORT GetVolumeInformation IN Win32API;
  STRING @lpRootPathName,;
  STRING @lpVolumeNameBuffer,;
  INTEGER nVolumeNameSize,;
  INTEGER @lpVolumeSerialNumber,;
  INTEGER @lpMaximumComponentLength,;
  INTEGER @lpFileSystemFlags,;
  STRING @lpFileSystemNameBuffer,;
  INTEGER nFileSystemNameSize
Here's what each of those parameters are:

lpRootPathName is the root path of the drive: A:\, C:\, etc.

lpVolumeNameBuffer receives the volume name.

nVolumeNameSize is the length of the name buffer.

lpVolumeSerialNumber is the serial number of the disk.

lpMaximumComponentLength is maximum file name component length (the number characters between backslashes).

lpFileSystemFlags returns information regard the file system and is a combination of one or more of the following values:
#DEFINE FS_CASE_SENSITIVE          1 && Supports case sensitive file names
#DEFINE FS_CASE_IS_PRESERVED       2 && Case is stored on disk
#DEFINE FS_UNICODE_STORED_ON_DISK  4 && System supports UNICODE
#DEFINE FS_PERSISTENT_ACLS         8 && Supports and efforces ACLs (NTFS file systems)
#DEFINE FS_FILE_COMPRESSION       16 && Supports file compression
#DEFINE FS_VOL_IS_COMPRESSED   32768 && Volume is compressed.
pFileSystemNameBuffer receives the file system name (FATS, NTFS, etc.)

nFileSystemNameSize the length of the system name buffer.

When the function is called it will return a non-zero value if it succeeds. If so, lpVolumeSerialNumber will contain the serial number as an integer. Note that if a serial number doesn't exist, this value will be zero. The value that you'll see when you do a directory listing is a string containing the hexadecimal characters with the high order word separated from the low order word by a hyphen. In order to get this value, you'll need a function like the following:
FUNCTION ValToHex
* Converts a value to a hex string

LPARAMETER pnvalue

LOCAL lchexstring, lnmask, lnvalue, lni, lcresult, lnnybble
lnvalue = pnvalue
lnmask = 15
lchexstring = '0123456789ABCDEF'
lcresult = ""
FOR lni = 1 TO 8
  lnnybble = BITAND(lnvalue, lnmask)
  lcresult = SUBSTR(lchexstring, lnnybble + 1, 1) + lcresult
  lnvalue = BITRSHIFT(lnvalue, 4)
NEXT
RETURN lcresult
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform