![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Aug 2004
Location: The Netherlands
Posts: 111
Rep Power: 5
![]() |
CreateRemoteThread interest
Hi all,
i was writing a program which needed a thread so i went to msdn to read up on CreateThread. Well program works fine, problem solved. But i saw CreateRemoteThread there and it made me curious, it has exactly the same parameters except for an extra handle to the target process. So i decided to try it out using a simple function like the one here: ThreadProc(LPARAM lpara)
{
MessageBox(NULL,"I'm inside another process.","lepricaun",MB_OK);
return 0;
}this function works fine in CreateThread(NULL,0,ThreadProc,0,0,NULL); But as you can guess it gives an error if trying to create a remote thread in another process (although it does return a handle to the thread). What am i missing here? i can imagin i need to copy the code to the memory of the target process first, but how do i retrieve the starting address of the procedure once in memory? Thanks in advance!
__________________
http://www.white-scorpion.nl |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
IIRC, you want the address of the function:
CreateThread(NULL, 0, &ThreadProc, 0, 0, NULL); |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Aug 2004
Location: The Netherlands
Posts: 111
Rep Power: 5
![]() |
thanks for your response Ooble.
But i do need to write the procedure to the processes memory first don't i?
__________________
http://www.white-scorpion.nl |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Try it - I think that was how I did it when I was playing with threads.
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Aug 2004
Location: The Netherlands
Posts: 111
Rep Power: 5
![]() |
unfortunately that didn't work
i even tried rewriting it in masm using the same API's and then:offset ThreadProc addr ThreadProc ThreadProc all of the above give the same error as well, so there must be something else wrong, but what?
__________________
http://www.white-scorpion.nl |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|