Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HDD Serial number
Message
 
To
31/08/1999 11:45:59
Martin Joncas
Foxprostudio.Com
Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00259700
Message ID:
00260042
Views:
16
*--
*   Store Volume information in the passed array.
*
*     1- Volume Name
*     2- Volume Serial (numeric)
*     3- Volume Serial (hexadecimal string)
*
*   Parameters
*
*     pcDrive - Drive Letter of the drive to get information.
*     paDriveinfo - Variable passed by reference.
*                   It is dimensioned as an 3 element array.
*   Example :
*
*     Local aVolinfo
*     GetVolInfo("C", @aVolinfo)
*     ? aVolInfo(3)     && serial number in hex. format.
*--

PROCEDURE GetVolInfo
    LParam pcDrive, paDriveInfo

    Declare Integer GetVolumeInformation In Win32API ;
            String @, String @, Integer, Integer  ;
            @, Integer @, Integer @, String @, Integer

    Local LcDrive, LcHex
    Local Lcroot, Lcvolbuffer, Lnvolsize, Lnvolsernum
    Local Lnmaxlen, Lnfsflags, Lcfsnmbuff, Lnfsnmsz

    Lcdrive = Upper(Left(Ltrim(pcDrive), 1)) 
    Lcroot = Lcdrive+":\"

    Lnvolsize = 260
    Lnfsnmsz  = 260
    Lcvolbuffer = Replicate(chr(0),260)
    Lcfsnmbuff = Replicate(chr(0),260)

    Lnmaxlen = 0
    Lnvolsernum = 0
    Lnfsflags = 0

    Lnerror = GetVolumeInformation(@Lcroot,@Lcvolbuffer, Lnvolsize, ;
              @Lnvolsernum, @Lnmaxlen,@Lnfsflags, @Lcfsnmbuff, Lnfsnmsz)

    IF Lnvolsernum < 0
       Lnvolsernum = 0xFFFFFFFF + Lnvolsernum + 1
    Endif
    LcHex = Right(Transform(Lnvolsernum, '@0'),8)

    If type('paDriveinfo(1)')='U' .or. ALen(paDriveInfo,1)<3
       Dimension paDriveinfo(3)
    Endif

    paDriveInfo(1) = Left(Lcvolbuffer, At(Chr(0), Lcvolbuffer) -1)
    paDriveInfo(2) = Lnvolsernum
    paDriveInfo(3) = Left(lcHex,4)+'-'+Right(lcHex, 4)

Endproc
>Hello all,
>
>Do you no program, command or function to get serial number of the HardDrive?
>
>Also... a good Encryption function.
>
>Any suggest, comment, URL are welcome....
>
>Tkx.

Just an opinion... Not a fact.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform