public static extern bool CreateProcess( string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandles, CreateProcessFlags dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, STARTUPINFO lpStartupInfo, PROCESS_INFORMATION lpProcessInformation );
public void Detach() { if (pi == null) throw new InvalidOperationException("There is no process to detach from"); Kernel32.DebugSetProcessKillOnExit(false); Kernel32.DebugActiveProcessStop(pi.dwProcessId); State = TargetState.Detached; pi = null; Program.OutputMessage("Detached."); }
public void Dispose() { if (disposed) return; disposed = true; if (pi != null) { Kernel32.TerminateProcess(pi.hProcess, 1); Program.OutputMessage("Target terminated."); pi = null; } GC.SuppressFinalize(this); }