Commit ed0fbd8 1 parent 185229e commit ed0fbd8 Copy full SHA for ed0fbd8
File tree 3 files changed +42
-7
lines changed
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) {
2285
2285
uv__tty_console_width = sb_info .dwSize .X ;
2286
2286
uv__tty_console_height = sb_info .srWindow .Bottom - sb_info .srWindow .Top + 1 ;
2287
2287
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 ))
2295
2298
return 0 ;
2296
2299
2297
2300
while (GetMessage (& msg , NULL , 0 , 0 )) {
Original file line number Diff line number Diff line change @@ -52,11 +52,15 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
52
52
/* Powrprof.dll function pointer */
53
53
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification ;
54
54
55
+ /* User32.dll function pointer */
56
+ sSetWinEventHook pSetWinEventHook ;
57
+
55
58
56
59
void uv_winapi_init (void ) {
57
60
HMODULE ntdll_module ;
58
61
HMODULE kernel32_module ;
59
62
HMODULE powrprof_module ;
63
+ HMODULE user32_module ;
60
64
61
65
ntdll_module = GetModuleHandleA ("ntdll.dll" );
62
66
if (ntdll_module == NULL ) {
@@ -156,4 +160,10 @@ void uv_winapi_init(void) {
156
160
GetProcAddress (powrprof_module , "PowerRegisterSuspendResumeNotification" );
157
161
}
158
162
163
+ user32_module = LoadLibraryA ("user32.dll" );
164
+ if (user32_module != NULL ) {
165
+ pSetWinEventHook = (sSetWinEventHook )
166
+ GetProcAddress (user32_module , "SetWinEventHook" );
167
+ }
168
+
159
169
}
Original file line number Diff line number Diff line change @@ -4725,6 +4725,25 @@ typedef DWORD (WINAPI *sPowerRegisterSuspendResumeNotification)
4725
4725
HANDLE Recipient ,
4726
4726
_PHPOWERNOTIFY RegistrationHandle );
4727
4727
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
+
4728
4747
4729
4748
/* Ntdll function pointers */
4730
4749
extern sRtlNtStatusToDosError pRtlNtStatusToDosError ;
@@ -4753,4 +4772,7 @@ extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
4753
4772
/* Powrprof.dll function pointer */
4754
4773
extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification ;
4755
4774
4775
+ /* User32.dll function pointer */
4776
+ extern sSetWinEventHook pSetWinEventHook ;
4777
+
4756
4778
#endif /* UV_WIN_WINAPI_H_ */
You can’t perform that action at this time.
0 commit comments