Re: Win32 TerminateProcess problem
Joacim Jacobsson <[email protected]>
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Message-ID | <[email protected]> |
Provide fake P2 that simply returns the error code you want? When in doubt, cheat. //Joacim Jacobsson On 4 feb 2010, at 09.53, Emil Dotchevski <[email protected]> wrote: > On Thu, Feb 4, 2010 at 12:20 AM, Jim Tilander <[email protected]> > wrote: >> On Wed, Feb 3, 2010 at 11:22 PM, Emil Dotchevski <[email protected] >> > >> wrote: >>> >>> On Wed, Feb 3, 2010 at 10:47 PM, Jim Tilander <[email protected]> >>> wrote: >> Considering the case where we are trying to terminate / exit a >> process >> that's out of our control, I still believe that TerminateProcess is >> a bad >> thing to call routinely and you should do the CreateRemoteThread >> (which of >> course might call TerminateProcess in turn, but not *always*, which >> makes a >> huge difference if you are killing thousands of these buggers). >> It's simply >> the lesser of two evils. > > The way I read that post is that *if* your threads happen to crap out > during an ExitProcess, Vista and on will just Terminate you, whereas > on XP something worse than that could happen (I'm speculating here, > but I don't see why else they'd consider Terminate to be the better > choice when things go bad.) > >>> In my particular use case however, I'm calling TerminateProcess on >>> another process before any of its DLLs have a chance to load. So I >>> still need a way to get the exit code I pass to TerminateProcess >>> propagate correctly... >> >> I digress though, I'm interested in how you know that in your case >> you have >> code before the DLLs have attached? > > My situation is this: my process, P0, is the debugger for another > process P1; P0 gets notified when P1 launches a process P2. In > handling that notification, I want P0 to kill P2 passing an exit code > of my choosing to P1. > > I realize now though that while the main thread of P2 hasn't had a > chance to run, this doesn't mean that the DLLs haven't been attached. > However I can't think how they would be, considering that the debugger > is notified for each loaded DLL too, and obviously this has to happen > after it has been notified about the process being launched. Right? > > Emil Dotchevski > Reverge Studios, Inc. > http://www.revergestudios.com/reblog/index.php?n=ReCode > _______________________________________________ > Sweng-Gamedev mailing list > [email protected] > http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com _______________________________________________ Sweng-Gamedev mailing list [email protected] http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com