Look to the redbox! This is the address we need to jump to after our injected code.
If we jump here after the injection the program will execute like without our injection :)
But there is one thing we need to do at least!
Compare the "new" origin with the old one you've pasted into a clipboard.
You will see that there are a few lines overwritten! But this lines are needed to run
the programm without errors. Identify the lines which get overwritten.
In my case the overwritten lines are:
Click on the first line (our JMP) and press ENTER.
You'll dropped to your MessageBox invokation!
After our CALL MessageBoxA we need to insert now the overwritten lines AND the jump back!
NOW you're done!
(If you want to test the "JumpBack"-Jump just select it and press ENTER.
If you get to the right line you can be sure that's ok! If not check Offset!)
To save the "new" Notepad take a look the the following picture:
If you press on "All modifications" a new little window will be shown.
Press on "Copy All" on this window.
A new window with the new ASM code will be shown.
Close the new window (THE CHILD WINDOW! NOT OLLY DBG WINDOW!).
Then a save dialog let you choose a new filename.
Save the file and run it. If you're successful you will get this result:
Press on OK and Notepad will start normally ;)
GM: You'd need incredible skill to win this pod race.
Qui-Gon: What, like a Cheddar monk?
GM: Jedi knight. Well, yes.
Qui-Gon: Easy! I teach the kid everything I know.
GM: Overnight? Besides, only one in a million people has Force sensitivity. The boy doesn't.
Qui-Gon: From those mini-chlorine things, right?
GM: Uh... Right.
Qui-Gon: I get out my first aid kit.
Anakin: What are you doing?
Qui-Gon: You're going to need better stats. I'm transferring some of my mini-chlorines to your blood.
Anakin: A blood transfusion? What?!
Qui-Gon: They'll multiply there and grant you lightning fast reflexes and skill points in driving.
Anakin: That's crazy!
Obi-Wan: No, he's right. Since the Force has a biochemical origin, it must be transferable with the midi-chlorians.
Obi-Wan: It all makes sense now. This is a hard science campaign, right? None of that wishy-washy in-born "psychic abilities" stuff?
GM: Uh, I guess...
GM: I'd better fill in a character sheet for the boy, then.
GM: What was his name again?