Damian
2011-01-31 10:42:21 UTC
Hi,
Following is sample code which is used to get the Volume Serial no. of
a given drive.
What we have noticed is when the following is run from different OSes
to get the HD serial no. of a Server drive it results in different
values.
eg. A computer with XP returns a positive no. with 10 digits where a
computer with Windows7 returns a negative no. with 10 digits.
Could someone please advice what may be going wrong and what need to
be done get cnsistant HD serial no.s when accessed from different
OSes ?
** VFP sample code
lcDrive = "\\Domain-server\Shared\"
LOCAL lcVolumeNameBuffer, lcVolSerial, lnVolumeNameSize, ;
lnMaximumComponentLength, lnFileSystemFlags, lcFileSystemNameBuffer, ;
lnFileSystemNameSize, lnVolumeSerialNumber
STORE SPACE(256) TO lcVolumeNameBuffer, lcFileSystemNameBuffer
STORE 256 TO
lnVolumeNameSize,lnMaximumComponentLength,lnFileSystemNameSize
STORE 0 TO lnFileSystemFlags, lnVolumeSerialNumber
DECLARE INTEGER GetVolumeInformation IN Win32API AS GetVolInfo ;
STRING @lpRootPathName, ;
STRING @lpVolumeNameBuffer, ;
INTEGER nVolumeNameSize, ;
INTEGER @lpVolumeSerialNumber, ;
INTEGER @lpMaximumComponentLength, ;
INTEGER @lpFileSystemFlags, ;
STRING @lpFileSystemNameBuffer, ;
INTEGER nFileSystemNameSize
GetVolInfo(;
@lcDrive, ;
@lcVolumeNameBuffer, ;
lnVolumeNameSize, ;
@lnVolumeSerialNumber, ;
@lnMaximumComponentLength, ;
@lnFileSystemFlags, ;
@lcFileSystemNameBuffer, ;
lnFileSystemNameSize)
RETURN lnVolumeSerialNumber
Following is sample code which is used to get the Volume Serial no. of
a given drive.
What we have noticed is when the following is run from different OSes
to get the HD serial no. of a Server drive it results in different
values.
eg. A computer with XP returns a positive no. with 10 digits where a
computer with Windows7 returns a negative no. with 10 digits.
Could someone please advice what may be going wrong and what need to
be done get cnsistant HD serial no.s when accessed from different
OSes ?
** VFP sample code
lcDrive = "\\Domain-server\Shared\"
LOCAL lcVolumeNameBuffer, lcVolSerial, lnVolumeNameSize, ;
lnMaximumComponentLength, lnFileSystemFlags, lcFileSystemNameBuffer, ;
lnFileSystemNameSize, lnVolumeSerialNumber
STORE SPACE(256) TO lcVolumeNameBuffer, lcFileSystemNameBuffer
STORE 256 TO
lnVolumeNameSize,lnMaximumComponentLength,lnFileSystemNameSize
STORE 0 TO lnFileSystemFlags, lnVolumeSerialNumber
DECLARE INTEGER GetVolumeInformation IN Win32API AS GetVolInfo ;
STRING @lpRootPathName, ;
STRING @lpVolumeNameBuffer, ;
INTEGER nVolumeNameSize, ;
INTEGER @lpVolumeSerialNumber, ;
INTEGER @lpMaximumComponentLength, ;
INTEGER @lpFileSystemFlags, ;
STRING @lpFileSystemNameBuffer, ;
INTEGER nFileSystemNameSize
GetVolInfo(;
@lcDrive, ;
@lcVolumeNameBuffer, ;
lnVolumeNameSize, ;
@lnVolumeSerialNumber, ;
@lnMaximumComponentLength, ;
@lnFileSystemFlags, ;
@lcFileSystemNameBuffer, ;
lnFileSystemNameSize)
RETURN lnVolumeSerialNumber