delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/28/15:49:43

From: defaultuser AT domain DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: This is not a problem but...
Date: Sun, 28 Jun 1998 07:00:01 -0600
Organization: Symbios Logic
Lines: 33
Message-ID: <35963E50.78F62F96@domain.com>
References: <3593D789 DOT DCC99FC4 AT netrover DOT com>
NNTP-Posting-Host: ahadleypc.co.symbios.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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?
>
> Nicolas Blais.

If you take a look at the assembler output it puts the input string from
printf into data blocks of string. Eg.main() {printf("Hello world!"); }

asm
    ...
    mov ax, offset DGROUP:s@
    push ax
    call near ptr _printf
    ...
s@ label byte
    db    'Hello world!'

This is why your string is seen by the world inside the .EXE. So the
trick is code the string initially from the world-- this involves
physically placing coded string in place of "Hello world!" then decode
using a function.
eg.
main() { printf("%s",decode("IrFTfpq#KB"));}

-Andrew




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019