I don't really understand why
Kill
is not working. You can always use
System.Diagnostics.Process.Kill
to kill any process (not only .NET application).
However, this might not be a valid solution, because your process does important post-mortal actions on Ctrl+C (as I understand, you don't have access to source code, otherwise embedding of the code in your assembly would not be a problem). You can make 100% perfect imitation of Ctrl+C by using P/Invoke for Windows API
SendInput
,
http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[
^]. I tested it, works in all cases, because this is a very low-level even simulation, almost like coming out of hardware.
—SA