Injecting/Executing Code in a processes Main Thread.... how to??
Posted on 2009-07-10
Long time no talk! Honestly didnt know I was still paying for this account lol Might as well use it!
Ok guys, So Im working with a few languages, But I have a personal goal to make a C++/C# UDF(Include) for Autoit that can do all of the C++ functions and such,. ive done pretty well so far .. injecting and executing my own code into my own thread etc. BUT im stuck on something so heres my question...
Im trying to Inject and Execute ASM (converted to OPCodes) into a extrernal processes Main thread then execute the code.. Like I said before Im able to do this in my own thread but the task im trying to do must be executed in the main thread of the process since the process has some sort of check stopping me from executing some functions in my own thread..
So first off im running WinXP not lower..
Second, I need some sort of example please in functions, (DLL Functions that can be called if possible.. Kernel32.dll, user32 etc)
Heres exactly what I need to do..
1. I need to be able to get the handle of the processes Main thread
2. Suspend the main thread (SuspendThread -->Kernel32.dll)
3. Allocate memory (VirtualAllocEx)
4. Inject the ASM
5. Execute the code
7. Resume the main thread (ResumeThread) **WITHOUT CRASHING THE APP!* xp
This is a personal project im working on for learning purposes and for the debugging/enhancement of my own apps.
Thank you to who ever can help me.