Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetDiskSerialNumber() returns 0 sometimes ?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00779447
Message ID:
00779479
Vues:
19
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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform