Skip to content

Commit 8eab288

Browse files
committed
Complete merge
1 parent a4e013b commit 8eab288

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

contrib/win32/win32compat/shell-host.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ BOOL bRet = FALSE;
9090
BOOL bNoScrollRegion = FALSE;
9191
BOOL bStartup = TRUE;
9292
BOOL bAnsi = FALSE;
93+
BOOL bHookEvents = FALSE;
9394

9495
HANDLE child_out = INVALID_HANDLE_VALUE;
9596
HANDLE child_in = INVALID_HANDLE_VALUE;
@@ -413,7 +414,7 @@ void SizeWindow(HANDLE hInput) {
413414
matchingFont.FontWeight = FW_NORMAL;
414415
wcscpy(matchingFont.FaceName, L"Consolas");
415416

416-
bSuccess = __SetCurrentConsoleFontEx(child_out, FALSE, &matchingFont);
417+
bSuccess = SetCurrentConsoleFontEx(child_out, FALSE, &matchingFont);
417418

418419
// This information is the live screen
419420
ZeroMemory(&consoleInfo, sizeof(consoleInfo));
@@ -1083,13 +1084,6 @@ int start_with_pty(int ac, wchar_t **av) {
10831084
HANDLE hEventHook = NULL;
10841085
HMODULE hm_kernel32 = NULL, hm_user32 = NULL;
10851086

1086-
if ((hm_kernel32 = LoadLibraryW(L"kernel32.dll")) == NULL ||
1087-
(hm_user32 = LoadLibraryW(L"user32.dll")) == NULL ||
1088-
(__SetCurrentConsoleFontEx = GetProcAddress(hm_kernel32, "SetCurrentConsoleFontEx")) == NULL ||
1089-
(__UnhookWinEvent = GetProcAddress(hm_user32, "UnhookWinEvent")) == NULL ||
1090-
(__SetWinEventHook = GetProcAddress(hm_user32, "SetWinEventHook")) == NULL)
1091-
return -1;
1092-
10931087
pipe_in = GetStdHandle(STD_INPUT_HANDLE);
10941088
pipe_out = GetStdHandle(STD_OUTPUT_HANDLE);
10951089
pipe_err = GetStdHandle(STD_ERROR_HANDLE);
@@ -1114,7 +1108,7 @@ int start_with_pty(int ac, wchar_t **av) {
11141108

11151109
InitializeCriticalSection(&criticalSection);
11161110

1117-
hEventHook = __SetWinEventHook(EVENT_CONSOLE_CARET, EVENT_CONSOLE_LAYOUT, NULL,
1111+
hEventHook = SetWinEventHook(EVENT_CONSOLE_CARET, EVENT_CONSOLE_LAYOUT, NULL,
11181112
ConsoleEventProc, 0, 0, WINEVENT_OUTOFCONTEXT);
11191113

11201114
memset(&si, 0, sizeof(STARTUPINFO));
@@ -1123,6 +1117,12 @@ int start_with_pty(int ac, wchar_t **av) {
11231117
// Copy our parent buffer sizes
11241118
si.cb = sizeof(STARTUPINFO);
11251119
si.dwFlags = 0;
1120+
if (fnSetWinEventHook == NULL) {
1121+
si.hStdInput = INVALID_HANDLE_VALUE;
1122+
si.hStdOutput = pipe_out;
1123+
si.hStdError = pipe_err;
1124+
si.dwFlags = STARTF_USESTDHANDLES;
1125+
}
11261126

11271127
/* disable inheritance on pipe_in*/
11281128
GOTO_CLEANUP_ON_FALSE(SetHandleInformation(pipe_in, HANDLE_FLAG_INHERIT, 0));
@@ -1189,7 +1189,7 @@ int start_with_pty(int ac, wchar_t **av) {
11891189
if (ux_thread != INVALID_HANDLE_VALUE)
11901190
TerminateThread(ux_thread, S_OK);
11911191
if (hEventHook)
1192-
__UnhookWinEvent(hEventHook);
1192+
UnhookWinEvent(hEventHook);
11931193

11941194
FreeConsole();
11951195

0 commit comments

Comments
 (0)