Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Self Modifying Code - Newbie Question

Status
Not open for further replies.

Trope

Programmer
May 14, 2001
110
US
I am writing a simple C++ application that allows the user to test the app IF they have a password.

I would like to prevent the casual cracker from modifying the code to bypass this password check.

Here is some psuedocode:

if(!password){
// Quit program
}

and in assembly might result in some sort of TEST or JNE or some other JMP, right?

Let's say I am done with my program, and see where the patch could be made, for example, let's say here:

TEST EAX, EAX
JNE somewhere

So I know to look for a NOP at the JNE somewhere, which would bypass the check.

How would I prevent this in my C++ program? Is it even possible?

Any help would be greatly appreciated!

Regards.
Trope


 
I'e seen it done but it was a very long time ago so I may not have the source code anymore. I believe that you set something up in a #if...#define code. I'll see if I can find it.



James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top