How can I stop debugged Process without stopping my debugger? I make a Program with some debug functions, it is not WinDbg or Visual Studio debugger. This code does not work:
GetThreadContext( m_Process_Information.hThread, &Context );
if(!TerminateProcess(hProcess, 0x1)) {
if(!CreateRemoteThread(hProcess, 0,0,
(LPTHREAD_START_ROUTINE)(lpAddressOfExitFunction), 0, 0,
&dwThreadID ))
{
Context.Eip =(DWORD)(lpAddressOfExitFunction);
SetThreadContext ( hThread, &Context);
}
}
CloseHandle(hThread);
CloseHandle(hProcess);
Here lpAddressOfExitFunction - Address of exported from Kernel32.dll function ExitProcess(UINT). All another combinations of these commands does not work too (for example,only that:
Context.Eip = (DWORD)((DWORD)lpAddressOfExitFunction);
SetThreadContext ( hThread, &Context);
Etc.).
After these Commands debugged Process does not work more, but it's Window is visible (but not operable of course), it closes after my debugger has exited.
hProcess, hThread and Context are valid, Access Rights too (Windows NT 4.0), handles were not closed before. I try with suspended threads and without they etc. etc.
Thanks.
GetThreadContext( m_Process_Information.hThread, &Context );
if(!TerminateProcess(hProcess, 0x1)) {
if(!CreateRemoteThread(hProcess, 0,0,
(LPTHREAD_START_ROUTINE)(lpAddressOfExitFunction), 0, 0,
&dwThreadID ))
{
Context.Eip =(DWORD)(lpAddressOfExitFunction);
SetThreadContext ( hThread, &Context);
}
}
CloseHandle(hThread);
CloseHandle(hProcess);
Here lpAddressOfExitFunction - Address of exported from Kernel32.dll function ExitProcess(UINT). All another combinations of these commands does not work too (for example,only that:
Context.Eip = (DWORD)((DWORD)lpAddressOfExitFunction);
SetThreadContext ( hThread, &Context);
Etc.).
After these Commands debugged Process does not work more, but it's Window is visible (but not operable of course), it closes after my debugger has exited.
hProcess, hThread and Context are valid, Access Rights too (Windows NT 4.0), handles were not closed before. I try with suspended threads and without they etc. etc.
Thanks.