Mail Archives: djgpp/1998/06/29/05:18:07
Nicolas Blais wrote:
> When I compile my program, and edit my exe file, I can modify all my
> strings used with printf. I don't want people to do so, is there a way
> to conteract this?
IMHO, the best way to protect your string from editing is separating them
to so-called resource area. This just a separate .h file where you declare
all of
you strings as follows :
char szHello="Hello world!";
char szError="Error:";
etc.
At normal condition (read developing time) you just use string variables to
do screen output
printf("%s\n",szHello);
Then you ready to publish your code you pass resource file through some
scrambler (the ROT-13 is the
most known or just XOR). SO, your strings now looks like a garbage and
can't be visibly located in you code.
At startup you run revers decoder to restore the original contents of
strings.
--
____ ____
| \ / Dim Zegebart
____/____
Moscow Russia
WWW - http://www.geocities.com/siliconvalley/pines/7817
DZcomm - comm library for Allegro
Palantir - multitasking kernel for Allegro (based on PDMLWP)
- Raw text -