Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25- C loader and copy protection
Message
From
18/09/2002 04:07:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00701158
Message ID:
00701649
Views:
36
This message has been marked as the solution to the initial question of the thread.
>The usual, the Disk Serial no. My main aim for the copy protection is casual copy protection. Serious hackers will break any if they want to.
>
>

You don't need a C routine to check disk format serial number. If C routine is correct it still works under w2K, XP. In FPD2.x you can load and call binary routines.
*SerialBinTest.prg
parameters driveletter
set talk off
clear
mp = chr(asc(upper(driveletter))-ASC("A")+1)+chr(0)+;
	space(22) && 24 bytes total
load serial
call serial with mp   && execute binary code
? substr(mp,2+1) && First two bytes are always chr(0)
cSerial1 = substr(mp,1+2,1)
cSerial2 = substr(mp,2+2,1)
cSerial3 = substr(mp,3+2,1)
cSerial4 = substr(mp,4+2,1)

? asc(cSerial4)  && Disk serial number
? asc(cSerial3)  && is a doubleword
? asc(cSerial2)  && So read in reverse order
? asc(cSerial1)  && as shown in dir
* Now print in hex format just like dir
? "Disk serial number is "
?? padl(dec2hex(asc(cSerial4)),2,"0")
?? padl(dec2hex(asc(cSerial3)),2,"0")
?? ":"
?? padl(dec2hex(asc(cSerial2)),2,"0")
?? padl(dec2hex(asc(cSerial1)),2,"0")
?

function Dec2Hex
parameters nDecimal
n=0
do while floor(nDecimal/16^n) > 15
 n = n+1
enddo
cHEX = ""
for ix=n to 0 step -1
 cHEX = cHex + DecDigit2HexDigit(floor(nDecimal/16^ix))
 nDecimal = nDecimal % 16
endfor
return cHex

function DecDigit2HexDigit
parameters nDecimal
return iif(ndecimal>9,chr(asc("A")+nDecimal%10),str(nDecimal,1))
*Create bin - run once
handle=fcreate('Serial.Bin')
=FWRITE(handle,CHR(83)+CHR(184)+;
  CHR(0)+CHR(105)+CHR(139)+CHR(211)+;
  CHR(139)+CHR(31)+CHR(205)+CHR(33)+;
  CHR(91)+CHR(203))
=fclose(handle)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform