Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Número serial do HD
Message
From
07/05/2004 12:09:30
 
 
To
07/05/2004 12:04:22
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00901957
Message ID:
00901959
Views:
32
This message has been marked as the solution to the initial question of the thread.
Olá Roberto,

Tenta esta rotina:
 Function GetDiskSerialNumber    &&  Retorna o Número Serial de um Drive Local (HD ou Diskette)
*-------- -------------------
 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  = Len     (cDiskId)
 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
Espero que ajude!

Fernando
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform