6#if defined(DART_HOST_OS_WINDOWS)
17#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
18#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
26 static constexpr int kInvalidFlag = -1;
29 saved_output_cp_ = kInvalidFlag;
30 saved_input_cp_ = kInvalidFlag;
37 const int output_cp = GetConsoleOutputCP();
38 const int input_cp = GetConsoleCP();
39 if (output_cp != CP_UTF8) {
40 SetConsoleOutputCP(CP_UTF8);
41 saved_output_cp_ = output_cp;
43 if (input_cp != CP_UTF8) {
44 SetConsoleCP(CP_UTF8);
45 saved_input_cp_ = input_cp;
50 ModifyMode(STD_OUTPUT_HANDLE, ENABLE_VIRTUAL_TERMINAL_PROCESSING);
52 ModifyMode(STD_ERROR_HANDLE, ENABLE_VIRTUAL_TERMINAL_PROCESSING);
53 saved_stdin_mode_ = ModifyMode(STD_INPUT_HANDLE, 0);
64 if (saved_stdout_mode_ != kInvalidFlag) {
65 CleanupDevices(
"CONOUT$", STD_OUTPUT_HANDLE, saved_stdout_mode_);
66 saved_stdout_mode_ = kInvalidFlag;
68 if (saved_stderr_mode_ != kInvalidFlag) {
69 CleanupDevices(
"CONERR$", STD_ERROR_HANDLE, saved_stderr_mode_);
71 if (saved_stdin_mode_ != kInvalidFlag) {
72 CleanupDevices(
"CONIN$", STD_INPUT_HANDLE, saved_stdin_mode_);
74 if (saved_output_cp_ != kInvalidFlag) {
75 SetConsoleOutputCP(saved_output_cp_);
76 saved_output_cp_ = kInvalidFlag;
78 if (saved_input_cp_ != kInvalidFlag) {
79 SetConsoleCP(saved_input_cp_);
80 saved_input_cp_ = kInvalidFlag;
85 static int saved_output_cp_;
86 static int saved_input_cp_;
87 static DWORD saved_stdout_mode_;
88 static DWORD saved_stderr_mode_;
89 static DWORD saved_stdin_mode_;
92 if (signal == CTRL_C_EVENT) {
99 HANDLE h = GetStdHandle(handle);
101 DWORD old_mode = kInvalidFlag;
114 SetConsoleMode(
h, request);
120 static void CleanupDevices(
const char*
device,
123 const intptr_t kWideBufLen = 64;
124 wchar_t widebuf[kWideBufLen];
126 MultiByteToWideChar(CP_UTF8, 0,
device, -1, widebuf, kWideBufLen);
128 HANDLE h = CreateFileW(widebuf, GENERIC_READ | GENERIC_WRITE,
129 FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
131 SetStdHandle(STD_OUTPUT_HANDLE,
h);
132 if (orig_flags != kInvalidFlag) {
133 SetConsoleMode(
h, orig_flags);
142int ConsoleWin::saved_output_cp_ = ConsoleWin::kInvalidFlag;
143int ConsoleWin::saved_input_cp_ = ConsoleWin::kInvalidFlag;
144DWORD ConsoleWin::saved_stdout_mode_ = ConsoleWin::kInvalidFlag;
145DWORD ConsoleWin::saved_stderr_mode_ = ConsoleWin::kInvalidFlag;
146DWORD ConsoleWin::saved_stdin_mode_ = ConsoleWin::kInvalidFlag;
static void RestoreConfig()
FlutterSemanticsFlag flags
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static void SignalHandler(int signal)
void Initialize(zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
#define INVALID_HANDLE_VALUE