How can i Execute a function in the same thread

  • Thread starter Thread starter Yordy Corrales
  • Start date Start date
Y

Yordy Corrales

Guest
I need to know what i need to execute a function with this:

CONTEXT ctx;
str=opt;
ctx.ContextFlags = CONTEXT_FULL;
HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, m_TID);
SuspendThread(hThread);
GetThreadContext(hThread, &ctx);
eipx=ctx.Eip;
ctx.Eip = (DWORD)patch;
SetThreadContext(hThread, &ctx);
ResumeThread(hThread);

The function it's called "Patch" and this code works... the problem it's when it does the RTCvariable comparation, it doesnt match the ESI or the ESP or the EBP.... i don't know what i need to do...

I have this ASM code:

__declspec( naked ) void patch()
{
_asm
{
push dword ptr [str]
call OM
pop dword ptr [str]
leave
ret
}
}

So... this code it's called and it opens the function OM with one global parameter.... and works, but when i close the main windows it shows the problem, sometimes in another part... so What i need to put in it?


Thanks for all the help


Yordy Corrales

Continue reading...
 
Back
Top