public void AttachProcess(int pid)
        {
            if (_disposed)
            {
                throw new ApplicationException("Object already disposed");
            }

            logger.Debug("AttachProcess: " + pid);

            count++;

            dbgClient.AttachProcess(0, (uint)pid, 0);

            try
            {
                while (!exitDebugger.WaitOne(0, false) && !handledException.WaitOne(0, false))
                {
                    dbgControl.WaitForEvent(0, 100);
                }
            }
            catch (Exception ex)
            {
                logger.Debug(ex.ToString());
                //Debugger.Break();
            }

            logger.Debug("EndSession");
            dbgClient.EndSession((uint)Const.DEBUG_END_ACTIVE_TERMINATE);
        }
Example #2
0
 public Task AttachToProcess(int pid, AttachProcessFlags attachFlag = AttachProcessFlags.Invasive)
 {
     return(RunAsync(() => {
         Client.AttachProcess(0, (uint)pid, (DEBUG_ATTACH)attachFlag).ThrowIfFailed();
         WaitForEvent().ThrowIfFailed();
     }));
 }
Example #3
0
        public bool AttachTo(int pid)
        {
            int hr = _client.AttachProcess(0, (uint)pid, DEBUG_ATTACH.DEFAULT);

            return(hr >= 0);
        }