TIP: Click on subject to list as thread! ANSI
echo: delphi
to: RICKY FOLTZ
from: SIMON AVERY
date: 1998-01-24 11:03:00
subject: CRC-checking

"There's Rickys on the starboard bow, starboard bow..."
 RF> I need to know how to make CRC-checks against potential hex-editing.
 RF> For example, if someone hexes my program, I want it to refuse to run.
 RF> How can I do this in Delphi?
Unsure about Delphi - I do it in C
 >> :) Tag-O-Matic V.13 Founder and CEO, Minions Are Us 27/1
Has a self-checking routine. (Try unpacking or hexing it to find out)
AS I don't know Pascal, I'll do it in pseudo-code and hopefully you
can figure it out.
After compiling, run a little tool that does a simlistic (or complex)
CRC on the file, excluding the header. Then store that header in 
the EXE header. Now - unsure about Windows exe's, but DOS ones have
a two-byte value for this, although it's never (IME) checked by DOS
and never by anti-virus software. (See DOSREF, IIRC, it's at offset 18dec)
Now, in the program - include a function to open argv[0] (path and
file to itself) and check the file (excluding header) using the same
method as above. If that value and the one in the header don't match - 
it's been virused or hexed. If that happens, refuse to run. 
You can play around with the algorithm to calculate the value - use
XOR or 32-bit CRC calculation. Note that it's a good idea to use a 
seperate modifier for each of your programs, otherwise if someone cracks
your key on one program, it doesn't null all your others.
Also note that in DOS, (and probably Windows) there are ways and means
to get around this (a friend of mine proved it to me with Tag-O-Matic)
but for first-line defence it's remarkably good.
Hope you get the idea
Simon
... I like Ricky. He isn't as weird as the other two
--- FMailX 1.22
---------------
* Origin: Tag-O-Matic - Freq T-MATIC from Origin (2:255/90)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.