Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetDiskSerialNumber() returns 0 sometimes ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00779447
Message ID:
00779685
Views:
20
Thanks Sergey,

That was a great help.

Aashish
>Hi Ashish,
>
>Check Re: API GetVolumeInformation Thread #497258 Message #497928 and the whole thread.
>
>>Dear Friends,
>>
>>Calling a function named _GetDiskSerialNumber("C:\") sometime results in 0 (this misbehaviour is only noticed in exe) which i picked from levelextreme.com.
>>
>>Any idea for this kind behaviour?
>>
>>Regards
>>Aashish
>>
>>LParameters pDiskId
>>*Function GetDiskSerialNumber && Retorna o Número Serial de um Drive Local (HD)
>>*-------- -------------------
>>
>>
>>* Chamada: Numérico: nSerialNumber = GetDiskSerialNumber ("C:\")
>>* Em Hexa: cHexSerialNumber = Substr (Transform (nSerialNumber, "@0"), 3)
>>
>> Local cDiskId , ;
>> cVolumeName , ;
>> nVolumeNameSize , ;
>> nVolumeSerial , ;
>> nMaxCompLength , ;
>> nFileSysFlag , ;
>> cFileSysNameBuf , ;
>> nFileSysNameSize
>>
>> Declare Integer GetVolumeInformation in Win32API String @lpRootPathName , ;
>> String @lpDiskIdNameBuffer , ;
>> Integer nVolumeNameSize , ;
>> Integer @lpDiskIdSerialNumber , ;
>> Integer @lpMaximumComponentLength, ;
>> Integer @lpFileSystemFlags , ;
>> String @lpFileSystemNameBuffer , ;
>> Integer nFileSystemNameSize
>>
>> cDiskId = AllTrim (pDiskId)
>> cVolumeName = Space (256)
>> nVolumeNameSize = 256
>> nVolumeSerial = 0
>> nMaxCompLength = 256
>> nFileSysFlag = 0
>> cFileSysNameBuf = Space (256)
>> nFileSysNameSize = 256
>>
>> nReturn = 0
>>
>> nReturn = GetVolumeInformation (@cDiskId , ;
>> @cVolumeName , ;
>> nVolumeNameSize , ;
>> @nVolumeSerial , ;
>> @nMaxCompLength , ;
>> @nFileSysFlag , ;
>> @cFileSysNameBuf, ;
>> nFileSysNameSize)
>>
>> If nReturn >= 0
>> If nVolumeSerial < 0
>> nVolumeSerial = 4294967296 + nVolumeSerial && 2^32 = 4294967296
>> endif
>> endif
>>
>> Return nVolumeSerial
>>
>> EndFunc && of GetDiskSerialNumber
--
--
Aashish Sharma
Tele Nos: +1-201-490-5405
Mobile: +91-9821053938
E-Mail:
aashish@aashishsharma.com
write2aashish@gmail.com

You better believe in yourself... if you don't, who else will ?
TODAY is a gift, that's why it's called PRESENT
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform