public void Abort()
        {
            if (inputHandle == IntPtr.Zero)
            {
                return;
            }

            try
            {
                int nwrite = 0;
                var record = new INPUT_RECORD
                {
                    EventType = INPUT_RECORD_TYPE.KEY_EVENT,
                    KeyEvent  =
                    {
                        dwControlKeyState = ControlKeyStates.CTRL_PRESSED,
                        UnicodeChar       = 'z',
                        wVirtualKeyCode   = 'z',
                        wRepeatCount      =                             1,
                        bKeyDown          = true
                    }
                };
                WriteConsoleInput(inputHandle, &record, 1, out nwrite);
                var recordEnter = new INPUT_RECORD
                {
                    EventType = INPUT_RECORD_TYPE.KEY_EVENT,
                    KeyEvent  =
                    {
                        dwControlKeyState =    0,
                        UnicodeChar       = '\r',
                        wVirtualKeyCode   = '\r',
                        wRepeatCount      =    1,
                        bKeyDown          = true
                    }
                };
                WriteConsoleInput(inputHandle, &recordEnter, 1, out nwrite);
            }
            catch
            {
            }
        }
 extern static bool ReadConsoleInput(IntPtr handle, out INPUT_RECORD record, int length, out int nread);
 extern static bool PeekConsoleInput(IntPtr handle, out INPUT_RECORD record, int length, out int eventsRead);