Exemplo n.º 1
0
        public void AttachToProcessByName(string imageName)
        {
            if (_debugKernel)
            {
                throw new DebugMonitorException("The monitor is debugging a kernel.");
            }

            try
            {
                uint procId = _debuggee.GetSystemId(imageName, GetRunningProcessSystemIdByExecutableNameFlags.ProcOnlyMatch);
                _debuggee.AttachProcess(procId, AttachFlags.InvasiveNoInitialBreak | AttachFlags.InvasiveResumeProcess);
                _debuggerUpdatedEvent.Set();
            }
            catch (InvalidCastException ic)
            {
                throw new DebugMonitorException("Attach failed.", ic);
            }
        }