public int OutputLineMaskDisabled(DebugUtilities d)
            {
                if (string.IsNullOrEmpty(Data.ToString()))
                {
                    return(S_OK);
                }
                DEBUG_OUTCTL outctl;

                if (d.IsFirstCommand)
                {
                    outctl = DEBUG_OUTCTL.ALL_CLIENTS;
                }
                else
                {
                    outctl = DEBUG_OUTCTL.THIS_CLIENT | DEBUG_OUTCTL.NOT_LOGGED;
                }

                if (IsDML)
                {
                    outctl |= DEBUG_OUTCTL.DML;
                }

                d.DebugClient.FlushCallbacks();
                d.OutputMaskRestore();
                var hr = d.ControlledOutputWide(outctl, Mask, Data.ToString());

                d.OutputMaskDisableAll();
                d.DebugClient.FlushCallbacks();

                return(hr);
            }
        private SimpleOutputHandler2(DebugUtilities executionUtilities, DebugUtilities passthroughUtilities, OUTPUT_FILTER outputFilter, bool wantsDml, bool passThrough, bool passThroughOnly)
        {
            ExecutionUtilities   = executionUtilities;
            PassthroughUtilities = passthroughUtilities;
            Installed            = false;
            PreviousCallbacks    = IntPtr.Zero;
            if (passThroughOnly == false)
            {
                DataBuffer = new DbgStringBuilder(executionUtilities, 1024);
            }
            passthroughUtilities.OutputMaskSave();
            passthroughUtilities.OutputMaskDisableAll();
            //LineBuffer = new DbgStringBuilder(executionUtilities, 1024);
            OutputFilter    = outputFilter;
            PassThrough     = passThrough;
            PassThroughOnly = passThroughOnly;
            InterestMask    = wantsDml ? DEBUG_OUTCBI.DML : DEBUG_OUTCBI.TEXT;

            executionUtilities.DebugClient.GetOutputCallbacks(out PreviousCallbacks); /* We will need to release this */

            ThisIDebugOutputCallbacksPtr = Marshal.GetComInterfaceForObject(this, typeof(IDebugOutputCallbacks2));
            InstallationHRESULT          = executionUtilities.DebugClient.SetOutputCallbacks(ThisIDebugOutputCallbacksPtr);
            if (SUCCEEDED(InstallationHRESULT))
            {
                Installed         = true;
                InstalledThreadId = Thread.CurrentThread.ManagedThreadId;
                BufferedOutput    = new List <BufferLine>(1024);
            }
            else
            {
                Dispose();
            }
        }
        private AdvancedOutputHandler(DebugUtilities executionUtilities, DebugUtilities passthroughUtilities, OUTPUT_FILTER outputFilter, bool wantsDml)
        {
            if (_installed == true)
            {
                Revert();
                throw new Exception("Can not install an Output Handler more than once.");
            }

            _executionUtilities   = executionUtilities;
            _passthroughUtilities = passthroughUtilities;
            _previousCallbacks    = IntPtr.Zero;

            passthroughUtilities.OutputMaskSave();
            passthroughUtilities.OutputMaskDisableAll();
            passthroughUtilities.DebugClient.FlushCallbacks();
            executionUtilities.DebugClient.FlushCallbacks();
            _outputFilter = outputFilter;

            _interestMask = wantsDml ? DEBUG_OUTCBI.DML : DEBUG_OUTCBI.TEXT;

            executionUtilities.DebugClient.GetOutputCallbacks(out _previousCallbacks); /* We will need to release this */

            _thisIDebugOutputCallbacksPtr = Marshal.GetComInterfaceForObject(this, typeof(IDebugOutputCallbacks2));
            _installationHresult          = executionUtilities.DebugClient.SetOutputCallbacks(_thisIDebugOutputCallbacksPtr);
            if (SUCCEEDED(_installationHresult))
            {
                _installed         = true;
                _installedThreadId = Thread.CurrentThread.ManagedThreadId;
                _bufferedOutput    = new List <CallbackData>(128);
            }
            else
            {
                Dispose();
            }
        }