diff --git a/src/common/impl/io_windows.c b/src/common/impl/io_windows.c index 7e04ca86c..838b3cb1b 100644 --- a/src/common/impl/io_windows.c +++ b/src/common/impl/io_windows.c @@ -455,10 +455,10 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char* while (true) { - if (WaitForSingleObjectEx(hInput, FF_IO_TERM_RESP_WAIT_MS, TRUE) != WAIT_OBJECT_0) + if (NtWaitForSingleObject(hInput, TRUE, &(LARGE_INTEGER) { .QuadPart = (int64_t) FF_IO_TERM_RESP_WAIT_MS * -10000 }) != STATUS_WAIT_0) { SetConsoleMode(hInput, inputMode); - return "WaitForSingleObject() failed or timeout"; + return "NtWaitForSingleObject() failed or timeout"; } // Ignore all unexpected input events diff --git a/src/common/impl/processing_windows.c b/src/common/impl/processing_windows.c index 1098c6ab7..4811031d9 100644 --- a/src/common/impl/processing_windows.c +++ b/src/common/impl/processing_windows.c @@ -179,7 +179,7 @@ const char* ffProcessReadOutput(FFProcessHandle* handle, FFstrbuf* buffer) default: CancelIo(hChildPipeRead); TerminateProcess(hProcess, 1); - return "WaitForSingleObject(hReadEvent) failed"; + return "NtWaitForSingleObject(hReadEvent) failed"; } } diff --git a/src/common/thread.h b/src/common/thread.h index c7670452d..9af7eff42 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -21,7 +21,7 @@ static inline void ffThreadDetach(FFThreadType thread) { NtClose(thread); } static inline bool ffThreadJoin(FFThreadType thread, uint32_t timeout) { - if (WaitForSingleObject(thread, timeout == 0 ? (DWORD) -1 : timeout) != 0 /*WAIT_OBJECT_0*/) + if (NtWaitForSingleObject(thread, TRUE, timeout == 0 ? NULL : &(LARGE_INTEGER) { .QuadPart = (int64_t) timeout * -10000 }) != STATUS_WAIT_0) { TerminateThread(thread, (DWORD) -1); NtClose(thread); diff --git a/src/detection/gamepad/gamepad_windows.c b/src/detection/gamepad/gamepad_windows.c index 68d5c01d7..da7e280fa 100644 --- a/src/detection/gamepad/gamepad_windows.c +++ b/src/detection/gamepad/gamepad_windows.c @@ -3,7 +3,6 @@ #include "common/mallocHelper.h" #include "common/windows/unicode.h" -#include #include #include @@ -159,7 +158,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) OVERLAPPED overlapped = { }; DWORD nBytes; if (ReadFile(hHidFile, reportBuffer, caps.InputReportByteLength, &nBytes, &overlapped) || - (WaitForSingleObject(hHidFile, FF_IO_TERM_RESP_WAIT_MS) == WAIT_OBJECT_0 && GetOverlappedResult(hHidFile, &overlapped, &nBytes, FALSE))) + GetOverlappedResultEx(hHidFile, &overlapped, &nBytes, FF_IO_TERM_RESP_WAIT_MS, TRUE)) { if (rdi.hid.dwVendorId == 0x054C) {