Exemple #1
0
 public Task AttachToProcess(int pid, AttachProcessFlags attachFlag = AttachProcessFlags.Invasive)
 {
     return(RunAsync(() => {
         Client.AttachProcess(0, (uint)pid, (DEBUG_ATTACH)attachFlag).ThrowIfFailed();
         WaitForEvent().ThrowIfFailed();
     }));
 }
Exemple #2
0
        public Task DebugProcess(string commandLine, string args, AttachProcessFlags attachFlags, bool debugChildProcesses = false)
        {
            return(RunAsync(() => {
                var options = new DEBUG_CREATE_PROCESS_OPTIONS {
                    CreateFlags = DEBUG_CREATE_PROCESS.DEBUG_PROCESS
                };
                if (!debugChildProcesses)
                {
                    options.CreateFlags |= DEBUG_CREATE_PROCESS.DEBUG_ONLY_THIS_PROCESS;
                }

                Client.CreateProcessAndAttach2Wide(0, commandLine + " " + (args ?? string.Empty), ref options, (uint)Marshal.SizeOf <DEBUG_CREATE_PROCESS_OPTIONS>(),
                                                   null, null, 0, (DEBUG_ATTACH)attachFlags).ThrowIfFailed();
                WaitForEvent().ThrowIfFailed();
            }));
        }