Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop debuggee without stopping the debugger

Status
Not open for further replies.

tchouch

Programmer
Apr 18, 2001
300
DE
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.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top