Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hard disk number and what else?
Message
 
À
14/09/2005 14:37:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01049583
Message ID:
01049611
Vues:
13
2 Versions
drvPath="c:\"
ofs=CreateObject('Scripting.FilesystemObject')
drv = ofs.GetDrive(ofs.GetDriveName(drvPath))
? drv.SerialNumber
FUNCTION DiskSerial

LPARAMETER cDisk

DECLARE SHORT GetVolumeInformation IN Win32API ;
        STRING wroot, ;
        STRING wnombuf, ;
        LONG wnomsize, ;
        STRING wnumero, ;
        STRING wmx, ;
        STRING wflag, ;
        STRING wsysbuf, ;
        INTEGER wsyssize

LOCAL wroot, wnombuf, wnumero, wmx
LOCAL wflag, wsysbuf, wnomsize, wsyssize
LOCAL n1,n2,n3,n4, w1,w2,w3,w4

wroot = IIF(EMPTY(cDisk), SYS(5), cDisk + ':') + "\" && disque courant
wnombuf = SPACE(255)
wnumero = SPACE(10)
wmx = SPACE(255)
wflag = SPACE(255)
wsysbuf = SPACE(255)
wnomsize = 255
wsyssize = 255

GetVolumeInformation (wroot, @wnombuf, @wnomsize, @wnumero, ;
                      @wmx, @wflag, @wsysbuf, @wsyssize)

*** récupérer la valeur numérique décimale de chaque c retourné
*** (en inversant car les c sont retournés dans l'ordre 4, 3, 2, 1)
n4 = ASC(SUBSTR(wnumero,1,1))
n3 = ASC(SUBSTR(wnumero,2,1))
n2 = ASC(SUBSTR(wnumero,3,1))
n1 = ASC(SUBSTR(wnumero,4,1))

*** transformer la valeur décimale en valeur hexadécimale
w1 = TRANSFORM(n1,'@0')
w2 = TRANSFORM(n2,'@0')
w3 = TRANSFORM(n3,'@0')
w4 = TRANSFORM(n4,'@0')

RETURN RIGHT(w1,2) + RIGHT(w2,2) + "-" + RIGHT(w3,2) + RIGHT(w4,2)
>I know it's possible to get the hard disk number from VFP. This could be a good information to limit access to an application.
>
>Beside the hard disk identification what could be other things that could be tested to make that copy protection more effective?
>
>Please provide sample source code to do those additional checkings.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform