Posted April 19, 200916 yr Will blocking ExitProcess() prevent the main thread from shutting down the application when it ends?I ask because I am working on a dll which is injected into a target application. And I don't want the application to be exited before the dll is finished and ready to exit.
April 20, 200916 yr If you are certain the main thread is calling ExitProcess to close/terminate the application, you could hook it and call WaitForSingleObject with your threads handle to force the application to wait for your thread to finish. Then let ExitProcess continue as normal.
April 20, 200916 yr I think once the main thread returns to kernel32.dll, t calls ExitProcess, at least on XP...However, it's not very safe to assume kernel32.dll calls ExitProcess on every Windows version.TerminateThread on the main thread terminates the process as well, and I doubt it calls ExitProcess internally.Guess you gotta hook a few more APIs apart from ExitProcess there to be 100%ly sure.
Create an account or sign in to comment