示例#1
0
 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
     );
示例#2
0
        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.");
        }
示例#3
0
        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);
        }