File tree Expand file tree Collapse file tree 3 files changed +42
-7
lines changed Expand file tree Collapse file tree 3 files changed +42
-7
lines changed Original file line number Diff line number Diff line change @@ -2285,13 +2285,16 @@ static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param) {
22852285 uv__tty_console_width = sb_info .dwSize .X ;
22862286 uv__tty_console_height = sb_info .srWindow .Bottom - sb_info .srWindow .Top + 1 ;
22872287
2288- if (!SetWinEventHook (EVENT_CONSOLE_LAYOUT ,
2289- EVENT_CONSOLE_LAYOUT ,
2290- NULL ,
2291- uv__tty_console_resize_event ,
2292- 0 ,
2293- 0 ,
2294- WINEVENT_OUTOFCONTEXT ))
2288+ if (pSetWinEventHook == NULL )
2289+ return 0 ;
2290+
2291+ if (!pSetWinEventHook (EVENT_CONSOLE_LAYOUT ,
2292+ EVENT_CONSOLE_LAYOUT ,
2293+ NULL ,
2294+ uv__tty_console_resize_event ,
2295+ 0 ,
2296+ 0 ,
2297+ WINEVENT_OUTOFCONTEXT ))
22952298 return 0 ;
22962299
22972300 while (GetMessage (& msg , NULL , 0 , 0 )) {
Original file line number Diff line number Diff line change @@ -52,11 +52,15 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
5252/* Powrprof.dll function pointer */
5353sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification ;
5454
55+ /* User32.dll function pointer */
56+ sSetWinEventHook pSetWinEventHook ;
57+
5558
5659void uv_winapi_init (void ) {
5760 HMODULE ntdll_module ;
5861 HMODULE kernel32_module ;
5962 HMODULE powrprof_module ;
63+ HMODULE user32_module ;
6064
6165 ntdll_module = GetModuleHandleA ("ntdll.dll" );
6266 if (ntdll_module == NULL ) {
@@ -156,4 +160,10 @@ void uv_winapi_init(void) {
156160 GetProcAddress (powrprof_module , "PowerRegisterSuspendResumeNotification" );
157161 }
158162
163+ user32_module = LoadLibraryA ("user32.dll" );
164+ if (user32_module != NULL ) {
165+ pSetWinEventHook = (sSetWinEventHook )
166+ GetProcAddress (user32_module , "SetWinEventHook" );
167+ }
168+
159169}
Original file line number Diff line number Diff line change @@ -4725,6 +4725,25 @@ typedef DWORD (WINAPI *sPowerRegisterSuspendResumeNotification)
47254725 HANDLE Recipient ,
47264726 _PHPOWERNOTIFY RegistrationHandle );
47274727
4728+ /* from Winuser.h */
4729+ typedef VOID (CALLBACK * WINEVENTPROC )
4730+ (HWINEVENTHOOK hWinEventHook ,
4731+ DWORD event ,
4732+ HWND hwnd ,
4733+ LONG idObject ,
4734+ LONG idChild ,
4735+ DWORD idEventThread ,
4736+ DWORD dwmsEventTime );
4737+
4738+ typedef HWINEVENTHOOK (WINAPI * sSetWinEventHook )
4739+ (UINT eventMin ,
4740+ UINT eventMax ,
4741+ HMODULE hmodWinEventProc ,
4742+ WINEVENTPROC lpfnWinEventProc ,
4743+ DWORD idProcess ,
4744+ DWORD idThread ,
4745+ UINT dwflags );
4746+
47284747
47294748/* Ntdll function pointers */
47304749extern sRtlNtStatusToDosError pRtlNtStatusToDosError ;
@@ -4753,4 +4772,7 @@ extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
47534772/* Powrprof.dll function pointer */
47544773extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification ;
47554774
4775+ /* User32.dll function pointer */
4776+ extern sSetWinEventHook pSetWinEventHook ;
4777+
47564778#endif /* UV_WIN_WINAPI_H_ */
You can’t perform that action at this time.
0 commit comments