Probleme mit DebugActiveProcessStop()
-
Hi
Mit folgendem Stück Code debuge ich ein ProgrammXY ...
... ... SetDebugPrivilege(); pid = (unsigned long) atol(argv[1]); if( ! DebugActiveProcess(pid) ) { return 1; } for(;;) { WaitForDebugEvent(&dbgevent ,INFINITE); ContinueDebugEvent(dbgevent.dwProcessId ,dbgevent.dwThreadId ,DBG_CONTINUE); }
Wenn ich nun in einem anderen Thread den ich habe ein Shutdownsignal erhalte beende ich den debug Vorgang mit
DebugActiveProcessStop(pid);
Unter 2000 bis XP Okey. Doch unter Vista und höher führt dies zu einer abrupten Termination des ge-debugten Programm. Beide Programme laufen unter System Privilegien. Was mache ich falsch?
-
Soll ein sogenannter selfdebug Mechanismus sein.
-
Das entspricht doch genau der Dokumentation:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms679295(v=vs.85).aspx
To stop debugging the process, you must exit the process or call the DebugActiveProcessStop function. Exiting the debugger also exits the process unless you use the DebugSetProcessKillOnExit function.
-
Unter Win7 x64, ich benutze
$use "ntdll.lib" declare stdcall import,DbgUiStopDebugging(HANDLE) // detach debugger
-
Und wie mach ich das jetz das der Zielprocess nicht beendet wird?
-
Martin Richter schrieb:
Exiting the debugger also exits the process unless you use the DebugSetProcessKillOnExit function.
-
Sorry & danke!