private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ILStubDiagnosticSessionController controller =
                ILStubDiagnosticSessionController.GetInstance();

            if (controller.IsEnabled)
            {
                controller.DisableILStubSession();
            }

            // Force the Kernel Process Trace thread to exit.
            // We do not need to stop the "NT Kernel Logger" session.
            controller.ExitKernelTraceProcess();

            Environment.Exit(0);
        }
        private void toolStripButtonControlSession_Click(object sender, EventArgs e)
        {
            ILStubDiagnosticSessionController controller =
                ILStubDiagnosticSessionController.GetInstance();

            if (controller.IsEnabled)
            {
                controller.DisableILStubSession();
                toolStripLabelRunning.Visible             = false;
                toolStripButtonControlSession.Image       = m_startButtonImage;
                toolStripButtonControlSession.Text        = ButtonControllerEnableText;
                toolStripButtonControlSession.ToolTipText = ButtonControllerEnableToolTipText;
            }
            else
            {
                controller.EnableILStubSession();
                toolStripLabelRunning.Visible             = true;
                toolStripButtonControlSession.Image       = m_stopButtonImage;
                toolStripButtonControlSession.Text        = ButtonControllerDisableText;
                toolStripButtonControlSession.ToolTipText = ButtonControllerDisableToolTipText;
            }
        }