Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About Harddisk Serial Number
Message
From
26/09/2002 04:30:06
 
 
To
26/09/2002 03:56:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00704582
Message ID:
00704585
Views:
27
Hi
 Function GetDiskSerialNumber    &&  Retorna o Número Serial de um Drive Local (HD)
*-------- -------------------
 LParameters pDiskId

* 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


Pedro Silva

world is wonderful with your help .

Previous
Reply
Map
View

Click here to load this message in the networking platform