Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25- C loader and copy protection
Message
 
To
28/09/2002 08:32:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00701158
Message ID:
00705825
Views:
28
So I guess I am reading the wrong offset of fat32 and ntfs using absread(). Is there a link to find out a way in C to know the fat type and the offset of the serial no.

Thanks for responsing.

>You're comparing serial no get/set to absread. However depending on format (fat16, fat32, ntfs) serial no is not in the same offsett and in ntfs it's 64 bits value.
>Cetin
>
>>Hi Cetin
>>
>>Your suggestion is working very well. But while I was testing I noticed that the serial no. returned by your routine and what absread() returned are different representation of the same thing. First I was planning that if there is already a srno in the stub file then I will cross check it with your routine's return value. As the stub worked on a 260mb HDD I compared it and they were poles apart, is it some byte placement kind of thing?
>>
>>>>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
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform