summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
authorBartosz Sosnowski <bartosz@janeasystems.com>2017-11-03 12:18:52 +0100
committerMyles Borins <mylesborins@google.com>2017-11-03 23:29:39 -0500
commit92f86632d534125aa7a86fe11a34d7b794b22991 (patch)
tree00e55f4e3563cb49e031f31c8e5af364490a7447 /deps/uv
parenta5f3b3a6dab18e32ee5e7d0d79a63cec0d5d5cc5 (diff)
downloadandroid-node-v8-92f86632d534125aa7a86fe11a34d7b794b22991.tar.gz
android-node-v8-92f86632d534125aa7a86fe11a34d7b794b22991.tar.bz2
android-node-v8-92f86632d534125aa7a86fe11a34d7b794b22991.zip
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: https://github.com/nodejs/node/issues/16603 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> PR-URL: https://github.com/nodejs/node/pull/16724 Fixes: https://github.com/https://github.com/nodejs/node/issues/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>
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/src/win/tty.c17
-rw-r--r--deps/uv/src/win/winapi.c10
-rw-r--r--deps/uv/src/win/winapi.h22
3 files changed, 42 insertions, 7 deletions
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index 4cd1c72129..05a11e8830 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -2285,13 +2285,16 @@ static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param) {
uv__tty_console_width = sb_info.dwSize.X;
uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
- if (!SetWinEventHook(EVENT_CONSOLE_LAYOUT,
- EVENT_CONSOLE_LAYOUT,
- NULL,
- uv__tty_console_resize_event,
- 0,
- 0,
- WINEVENT_OUTOFCONTEXT))
+ if (pSetWinEventHook == NULL)
+ return 0;
+
+ if (!pSetWinEventHook(EVENT_CONSOLE_LAYOUT,
+ EVENT_CONSOLE_LAYOUT,
+ NULL,
+ uv__tty_console_resize_event,
+ 0,
+ 0,
+ WINEVENT_OUTOFCONTEXT))
return 0;
while (GetMessage(&msg, NULL, 0, 0)) {
diff --git a/deps/uv/src/win/winapi.c b/deps/uv/src/win/winapi.c
index aa5d719fbe..4ccdf0a5f9 100644
--- a/deps/uv/src/win/winapi.c
+++ b/deps/uv/src/win/winapi.c
@@ -52,11 +52,15 @@ sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
/* Powrprof.dll function pointer */
sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
+/* User32.dll function pointer */
+sSetWinEventHook pSetWinEventHook;
+
void uv_winapi_init(void) {
HMODULE ntdll_module;
HMODULE kernel32_module;
HMODULE powrprof_module;
+ HMODULE user32_module;
ntdll_module = GetModuleHandleA("ntdll.dll");
if (ntdll_module == NULL) {
@@ -156,4 +160,10 @@ void uv_winapi_init(void) {
GetProcAddress(powrprof_module, "PowerRegisterSuspendResumeNotification");
}
+ user32_module = LoadLibraryA("user32.dll");
+ if (user32_module != NULL) {
+ pSetWinEventHook = (sSetWinEventHook)
+ GetProcAddress(user32_module, "SetWinEventHook");
+ }
+
}
diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h
index 6c699bfe17..cc54b79b08 100644
--- a/deps/uv/src/win/winapi.h
+++ b/deps/uv/src/win/winapi.h
@@ -4725,6 +4725,25 @@ typedef DWORD (WINAPI *sPowerRegisterSuspendResumeNotification)
HANDLE Recipient,
_PHPOWERNOTIFY RegistrationHandle);
+/* from Winuser.h */
+typedef VOID (CALLBACK* WINEVENTPROC)
+ (HWINEVENTHOOK hWinEventHook,
+ DWORD event,
+ HWND hwnd,
+ LONG idObject,
+ LONG idChild,
+ DWORD idEventThread,
+ DWORD dwmsEventTime);
+
+typedef HWINEVENTHOOK (WINAPI *sSetWinEventHook)
+ (UINT eventMin,
+ UINT eventMax,
+ HMODULE hmodWinEventProc,
+ WINEVENTPROC lpfnWinEventProc,
+ DWORD idProcess,
+ DWORD idThread,
+ UINT dwflags);
+
/* Ntdll function pointers */
extern sRtlNtStatusToDosError pRtlNtStatusToDosError;
@@ -4753,4 +4772,7 @@ extern sGetFinalPathNameByHandleW pGetFinalPathNameByHandleW;
/* Powrprof.dll function pointer */
extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification;
+/* User32.dll function pointer */
+extern sSetWinEventHook pSetWinEventHook;
+
#endif /* UV_WIN_WINAPI_H_ */