Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inconsistentent Behaviour of a Code
Message
De
29/05/2013 06:54:58
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Inconsistentent Behaviour of a Code
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01575038
Message ID:
01575038
Vues:
80
I am using some code to generate Serail Number of a computer system so that I can use the same serail number for the purpose of locking my software with a particular system.

The problem is the LOCK NUMBER being generated is sometimes "067A067$FB780:050:050:300:301:53VM/S1172" while sometimes it is "067A067AFB780:050:050:300:301:53VM/S1172".

The 8th digit i.e "$" is replaced by "A " and sometimes $ comes. What is the bug, how to overcome it.

Here is my code
M=0
HDDNO=GetVolumeSerial()

*CPUID Type-I*
LOCAL lcComputerName, loWMI, lowmiWin32Objects, lowmiWin32Object
lcComputerName = GETWORDNUM(SYS(0),1)
loWMI = GETOBJECT("WinMgmts://" + lcComputerName)
lowmiWin32Objects = loWMI.InstancesOf("Win32_Processor")
FOR EACH lowmiWin32Object IN lowmiWin32Objects
    WITH lowmiWin32Object
        cIDTYPEONE= TRANSFORM(.ProcessorId)
    ENDWITH
ENDFOR

*CPUID Type-II*
declare string CpuID IN utility.dll
cIDTYPETWO= CPUID()



***Get MAC Number*********

LOCAL lcComputerName, loWMIService, loItems, loItem, lcMACAddress
lcComputerName = "."
loWMIService = GETOBJECT("winmgmts:\\" + lcComputerName + "\root\cimv2")
loItems = loWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
FOR EACH loItem IN loItems

    lcMACAddress = loItem.MACAddress
    IF !ISNULL(lcMACAddress)
M=M+1
IF M=1
MA1=loItem.MACAddress
ENDIF
IF M=2
MA2=loItem.MACAddress
ENDIF
IF M=3
MA3=loItem.MACAddress
ENDIF
IF M=4
MA4=loItem.MACAddress
ENDIF
IF M=5
MA5=loItem.MACAddress
ENDIF
ENDIF
ENDFOR

*******GET mother Board Number**********
loWMI = GETOBJECT("WinMgmts://./root/cimv2")
BaseBoards = loWMI.InstancesOf("Win32_BaseBoard")
FOR EACH MotherBoard IN BaseBoards
MB_product=MotherBoard.Product
MB_serial=MotherBoard.SerialNumber
MBP=MB_product
MBS=MB_serial
NEXT
Slighthaze = NULL

LOCK=ALLTRIM(RIGHT(cIDTYPEONE,4))+;
ALLTRIM(RIGHT(cIDTYPETWO,4))+;
ALLTRIM(RIGHT(HDDNO,4))+;
ALLTRIM(RIGHT(MA1,4))+;
ALLTRIM(RIGHT(MA2,4))+;
ALLTRIM(RIGHT(MA3,4))+;
ALLTRIM(RIGHT(MA4,4))+;
ALLTRIM(RIGHT(MA5,4))+;
ALLTRIM(RIGHT(MBP,4))+;
ALLTRIM(RIGHT(+MBS,4))
WAIT WINDOW LOCk
IF LOCK=="067A067$FB780:050:050:300:301:53VM/S1172" .OR. LOCK=="067A067AFB780:050:050:300:301:53VM/S1172"
Pirated=0
Unit="O/o Telecom District Manager,BSNL,Chindwada"
Circle="Madhya Pradesh Telecom Circle"
ELSE
Pirated=1
ENDIF
RETURN
Harsh
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform