Is anyone out there able to convert the following FoxPro code to FWH?
- Code: Select all Expand view
DECLARE INTEGER Accdd1 IN "Aas973.dll" STRING @St
DECLARE INTEGER Fddig1 IN "Aas973.dll" INTEGER D
#DEFINE AccM1 0x313628FA
#DEFINE AccM2 0x7F03F6E4
#DEFINE AccM3 0x6589E678
#DEFINE AccM4 0x1654265F
#DEFINE AccM5 0x066E3FE0
#DEFINE AccM6 0x7C1B0162
#DEFINE AccM7 0x7C5612EE
#DEFINE AccM8 0x62EDDCAD
#DEFINE AccM9 0x69DF0765
DO CallMf
PROCEDURE CallMf
DIMENSION AccA(100)
LOCAL AccR1, AccR2, AccR3, AccR4, AccNa, AccUr, AccTem, K, I
LOCAL St, Stt
LOCAL LicIn, LicType, TokenId1, TokenId2
LOCAL OrigDrive, DriveChar
OrigDrive = .F.
FOR I = 1 TO 100
AccA(I) = INT(RAND() * 0x7FFFFFFF)
ENDFOR
AccUr = 0
FOR I = 1 TO 99
K = BITXOR(AccA(1 + I), BITAND(0xFF, AccUr)) % 99
AccUr = BITXOR(AccA(1 + K), BITRSHIFT(AccUr, 8))
ENDFOR
AccUr = BITAND(0xFFFF, BITXOR(AccM6, AccUr))
K = Fddig1(0)
IF (K < 7)
?"No Key drive in the USB port"
ELSE
St = ""
FOR I = 1 TO 100
St = St + CHR(BITAND(AccA(I), 0xFF)) +;
CHR(BITAND(BITRSHIFT(AccA(I), 8), 0xFF)) +;
CHR(BITAND(BITRSHIFT(AccA(I), 16), 0xFF)) +;
CHR(BITAND(BITRSHIFT(AccA(I), 24), 0xFF))
ENDFOR
= Accdd1(@St)
FOR I = 1 TO 100
Stt = SUBSTR(St, 4*I - 3, 4)
AccA(I) = ASC(SUBSTR(Stt, 1, 1)) +;
BITLSHIFT(ASC(SUBSTR(Stt, 2, 1)), 8) +;
BITLSHIFT(ASC(SUBSTR(Stt, 3, 1)), 16) +;
BITLSHIFT(ASC(SUBSTR(Stt, 4, 1)), 24)
ENDFOR
AccNa = BITAND(BITXOR(AccA(100), AccM5), 1061109567)
AccR1 = BITXOR(AccM1, AccA(1 + BITAND(AccNa, 0xFF)))
AccR2 = BITXOR(AccM2, AccA(1 + BITAND(0xFF, BITRSHIFT(AccNa, 8))))
AccR3 = BITXOR(AccM3, AccA(1 + BITAND(0xFF, BITRSHIFT(AccNa, 16))))
AccR4 = BITXOR(AccM4, AccA(1 + BITAND(0xFF, BITRSHIFT(AccNa, 24))))
AccTem = BITXOR((AccR2 - INT(BITNOT(AccR1) / AccUr)), AccR3)
IF (AccR4 = (AccTem - AccUr))
OrigDrive = .T.
ELSE
?"NOT Original Drive"
ENDIF
ENDIF
IF OrigDrive
LicIn = 79 + (BITAND(0xFF, BITRSHIFT(AccNa, 24)) % 21)
K = AccA(LicIn)
I = BITXOR(K, AccA(1 + BITAND(AccNa, 0xFF)))
LicType = 0
IF (I = BITXOR(BITXOR(AccM1, AccM3), BITXOR(AccM4, AccM5)))
LicType = 1
ENDIF
IF (I = BITXOR(BITXOR(AccM1, AccM2), BITXOR(AccM4, AccM5)))
LicType = 2
ENDIF
TokenId1 = BITXOR(AccM7, AccA(2 + BITAND(0xFF, AccNa)))
TokenId2 = BITXOR(AccM8, AccA(2 + BITAND(0xFF, BITRSHIFT(AccNa, 8))))
K = (BITXOR(AccM8, AccM9) % 64) + 1
DriveChar = CHR(BITXOR(AccA(LicIn - 8), AccA(K)) + 65)
?"Original Drive: ", DriveChar
?
?"License Type = ", LicType
?"TokenId1 = ", TokenId1
?"TokenId2 = ", TokenId2
ENDIF
ENDPROC