high6 Posted April 19, 2009 Posted April 19, 2009 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.
atom0s Posted April 20, 2009 Posted April 20, 2009 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.
Killboy Posted April 20, 2009 Posted April 20, 2009 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now