@@ -90,6 +90,7 @@ BOOL bRet = FALSE;
90
90
BOOL bNoScrollRegion = FALSE;
91
91
BOOL bStartup = TRUE;
92
92
BOOL bAnsi = FALSE;
93
+ BOOL bHookEvents = FALSE;
93
94
94
95
HANDLE child_out = INVALID_HANDLE_VALUE ;
95
96
HANDLE child_in = INVALID_HANDLE_VALUE ;
@@ -413,7 +414,7 @@ void SizeWindow(HANDLE hInput) {
413
414
matchingFont .FontWeight = FW_NORMAL ;
414
415
wcscpy (matchingFont .FaceName , L"Consolas" );
415
416
416
- bSuccess = __SetCurrentConsoleFontEx (child_out , FALSE, & matchingFont );
417
+ bSuccess = SetCurrentConsoleFontEx (child_out , FALSE, & matchingFont );
417
418
418
419
// This information is the live screen
419
420
ZeroMemory (& consoleInfo , sizeof (consoleInfo ));
@@ -1083,13 +1084,6 @@ int start_with_pty(int ac, wchar_t **av) {
1083
1084
HANDLE hEventHook = NULL ;
1084
1085
HMODULE hm_kernel32 = NULL , hm_user32 = NULL ;
1085
1086
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
-
1093
1087
pipe_in = GetStdHandle (STD_INPUT_HANDLE );
1094
1088
pipe_out = GetStdHandle (STD_OUTPUT_HANDLE );
1095
1089
pipe_err = GetStdHandle (STD_ERROR_HANDLE );
@@ -1114,7 +1108,7 @@ int start_with_pty(int ac, wchar_t **av) {
1114
1108
1115
1109
InitializeCriticalSection (& criticalSection );
1116
1110
1117
- hEventHook = __SetWinEventHook (EVENT_CONSOLE_CARET , EVENT_CONSOLE_LAYOUT , NULL ,
1111
+ hEventHook = SetWinEventHook (EVENT_CONSOLE_CARET , EVENT_CONSOLE_LAYOUT , NULL ,
1118
1112
ConsoleEventProc , 0 , 0 , WINEVENT_OUTOFCONTEXT );
1119
1113
1120
1114
memset (& si , 0 , sizeof (STARTUPINFO ));
@@ -1123,6 +1117,12 @@ int start_with_pty(int ac, wchar_t **av) {
1123
1117
// Copy our parent buffer sizes
1124
1118
si .cb = sizeof (STARTUPINFO );
1125
1119
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
+ }
1126
1126
1127
1127
/* disable inheritance on pipe_in*/
1128
1128
GOTO_CLEANUP_ON_FALSE (SetHandleInformation (pipe_in , HANDLE_FLAG_INHERIT , 0 ));
@@ -1189,7 +1189,7 @@ int start_with_pty(int ac, wchar_t **av) {
1189
1189
if (ux_thread != INVALID_HANDLE_VALUE )
1190
1190
TerminateThread (ux_thread , S_OK );
1191
1191
if (hEventHook )
1192
- __UnhookWinEvent (hEventHook );
1192
+ UnhookWinEvent (hEventHook );
1193
1193
1194
1194
FreeConsole ();
1195
1195
0 commit comments