Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b98fa82

Browse filesBrowse files
bzozMylesBorins
authored andcommitted
deps: cherry-pick e7f4e9e from upstream libuv
Original commit message: tty, win: get SetWinEventHook pointer at startup SetWinEventHook is not available on some Windows versions. Fixes: #16603 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> PR-URL: #16724 Fixes: #16603 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
1 parent a776639 commit b98fa82
Copy full SHA for b98fa82

File tree

Expand file treeCollapse file tree

3 files changed

+42
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+42
-7
lines changed
Open diff view settings
Collapse file

‎deps/uv/src/win/tty.c‎

Copy file name to clipboardExpand all lines: deps/uv/src/win/tty.c
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff 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)) {
Collapse file

‎deps/uv/src/win/winapi.c‎

Copy file name to clipboardExpand all lines: deps/uv/src/win/winapi.c
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
5252
/* Powrprof.dll function pointer */
5353
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
5454

55+
/* User32.dll function pointer */
56+
sSetWinEventHook pSetWinEventHook;
57+
5558

5659
void 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
}
Collapse file

‎deps/uv/src/win/winapi.h‎

Copy file name to clipboardExpand all lines: deps/uv/src/win/winapi.h
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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 */
47304749
extern sRtlNtStatusToDosError pRtlNtStatusToDosError;
@@ -4753,4 +4772,7 @@ extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
47534772
/* Powrprof.dll function pointer */
47544773
extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
47554774

4775+
/* User32.dll function pointer */
4776+
extern sSetWinEventHook pSetWinEventHook;
4777+
47564778
#endif /* UV_WIN_WINAPI_H_ */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.