Ok, now it appears something is going wrong on my machine.
I have VC++ Express and it's not compiling - not compiling in Builder 6 either.
Could you send me the executable to
[email protected] (rename extension to .txt) so I can debug it here.
Thanks mingis. I appreciate your help. If you are interested, I am looking for a tutorial on the following , and willing to pay for it --> This is my post on a "pay for answer" type of board which I will not mention...
If you are interested, please email me at
[email protected]
Thanks again, mingis.
Trope!
-------------------------- my other post
First of all, I am new to C++. I am designing an application that will operate ONLY if the user has the correct password. Simple enough.
My question is this: How can I prevent the casual 'cracker' from simply disassembling my program and patching the byte that TEST's the valid serial? I realize we cannot 100% prevent my program from being cracked, but I want to discourage the casual cracker - if I can crack my own program, something is wrong!
My program is VERY simple, and will look something like this:
if(validPassword==TRUE){
// Program Continues
} else {
// Program Ends
}
When assembled, may equate to something like this:
99999991 TEST EAX, EAX
99999992 JNE some location
99999993 Good Code Here
Now it is simple cracking-101 to know that all we have to do here is replace address 99999992 with a couple NOP's and the program will work no matter what.
So... I want the program to immediately check the value at 99999992 and if it is a NOP (90h) then I want to change it back , or Quit the program - whatever is easier for you to answer this question with.
Now I will tell you that I have been studying Self Modifying Code for 2 straight days now, and can't even get this simple code to work:
//---------------------------------------------------------
LPVOID address;
// Get the address of the dword we need to change
_asm mov dword ptr address,offset [myloop+3]
// Ask windows for permission to modify the code
result = VirtualProtect(address,4,PAGE_WRITECOPY,&oldprotect);
// Modify it in assembly.
// This is equivelelent to *(LPLONG)address = 0x87654321
_asm mov ebx,dword ptr address
_asm mov dword ptr [ebx],0x87654321
// All done
result = VirtualProtect(address,4,PAGE_EXECUTE,&oldprotect);
myloop:
_asm mov dword ptr a,0x12345678
//------------------------------------------------------------------------
I was just using that code to practice with. But no luck.
Anyways, I am looking for a simple example similar to the way my program will work. If the byte has been changed, quit or change it back (preferably change it back).
Thanks, and anxiously awaiting your answer!
Trope