Afternoon, Thomas.

You could use this with the debug version of your proggy.
The following info is from the Platform SDK:


Warning The TerminateProcess function should be used only in extreme circumstances, since it does not allow threads to clean up or save data and does not notify attached DLLs. If you need to have one process terminate another process, the following steps provide a better solution:

Have both processes call the RegisterWindowMessage function to create a private message.
One process can terminate the other process by broadcasting the private message using the BroadcastSystemMessage function as follows:
BroadcastSystemMessage(
BSF_IGNORECURRENTTASK, // do not send message to this process
BSM_APPLICATIONS, // broadcast only to applications
private message, // message registered in previous step
wParam, // message-specific value
lParam ); // message-specific value

The process receiving the private message calls ExitProcess to terminate its execution.
Note When the system is terminating a process, it does not terminate any child processes that the process has created.

:alright:
You may have to do the same for any child processes in your proggy.

Once you've finished debugging your proggy, just remove the 'RegisterWindowMessage' stuff.

Cheers,
Scronty
Posted on 2001-07-19 06:57:09 by Scronty
ummm you have a pid right?... use OpenProcess() to get the handle of it and then use TerminateProcess() to kill it... if you feel like using TerminateProcess()
Posted on 2001-07-19 07:09:46 by NervGaz
Afternoon, NervGaz.

'TerminateProcess' doesn't clean up the processes DLL's.
If anyone uses 'TerminateProcess' in quick succession, it usually eats up memory until the OS hangs.:(

However, as you can see, M$'s solution is a bit awkward. I guess it all depends on how often the debug proggy is run.

Cheers,
Scronty
Posted on 2001-07-19 07:23:34 by Scronty
My point was only that since he has a PID he could use OpenProcess() instead of the toolhelp crap wich can be a real bitch to work with...
Posted on 2001-07-19 09:26:33 by NervGaz
Thanks everyone!
Posted on 2001-07-19 13:04:28 by Thomas
You could modify the context of the thread and modify its EIP pointer to jump to an exit procedure. I've never tested it, but there is more information in the Win32 Debug API tutorial by Iczelion.
Posted on 2001-07-19 16:07:49 by Dr. Manhattan