2019-05-03 00:29:04 +02:00
|
|
|
/*++
|
|
|
|
Copyright (c) Microsoft Corporation
|
|
|
|
Licensed under the MIT license.
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
- VtInputThread.hpp
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
- Defines methods that wrap the thread that reads VT input from a pipe and
|
|
|
|
feeds it into the console's input buffer.
|
|
|
|
|
|
|
|
Author(s):
|
|
|
|
- Mike Griese (migrie) 15 Aug 2017
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "..\terminal\parser\StateMachine.hpp"
|
|
|
|
#include "utf8ToWideCharParser.hpp"
|
|
|
|
|
|
|
|
namespace Microsoft::Console
|
|
|
|
{
|
|
|
|
class VtInputThread
|
|
|
|
{
|
|
|
|
public:
|
2019-09-21 00:43:11 +02:00
|
|
|
VtInputThread(wil::unique_hfile hPipe,
|
|
|
|
wil::shared_event shutdownEvent,
|
|
|
|
const bool inheritCursor);
|
|
|
|
|
|
|
|
~VtInputThread();
|
2019-05-03 00:29:04 +02:00
|
|
|
|
2019-06-11 22:27:09 +02:00
|
|
|
[[nodiscard]] HRESULT Start();
|
2019-05-17 22:32:51 +02:00
|
|
|
static DWORD WINAPI StaticVtInputThreadProc(_In_ LPVOID lpParameter);
|
2019-09-21 00:43:11 +02:00
|
|
|
|
|
|
|
[[nodiscard]] HRESULT DoReadInput();
|
2019-05-03 00:29:04 +02:00
|
|
|
|
|
|
|
private:
|
2019-06-11 22:27:09 +02:00
|
|
|
[[nodiscard]] HRESULT _HandleRunInput(_In_reads_(cch) const byte* const charBuffer, const int cch);
|
2019-05-03 00:29:04 +02:00
|
|
|
DWORD _InputThread();
|
2019-09-21 00:43:11 +02:00
|
|
|
[[nodiscard]] HRESULT _ReadInput();
|
|
|
|
|
|
|
|
wil::shared_event _shutdownEvent;
|
|
|
|
std::future<void> _shutdownWatchdog;
|
2019-05-03 00:29:04 +02:00
|
|
|
|
|
|
|
wil::unique_hfile _hFile;
|
|
|
|
wil::unique_handle _hThread;
|
|
|
|
DWORD _dwThreadId;
|
|
|
|
|
2019-05-30 20:14:21 +02:00
|
|
|
std::unique_ptr<Microsoft::Console::VirtualTerminal::StateMachine> _pInputStateMachine;
|
2019-05-03 00:29:04 +02:00
|
|
|
Utf8ToWideCharParser _utf8Parser;
|
|
|
|
};
|
|
|
|
}
|