win: replace GetModuleHandleA with GetModuleHandleW (#4812)
This commit is contained in:
parent
513751e2fc
commit
2545ffe74c
@ -284,7 +284,7 @@ int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) {
|
||||
static void uv__thread_name_init_once(void) {
|
||||
HMODULE m;
|
||||
|
||||
m = GetModuleHandleA("api-ms-win-core-processthreads-l1-1-3.dll");
|
||||
m = GetModuleHandleW(L"api-ms-win-core-processthreads-l1-1-3.dll");
|
||||
if (m != NULL) {
|
||||
pGetThreadDescription = (void*) GetProcAddress(m, "GetThreadDescription");
|
||||
pSetThreadDescription = (void*) GetProcAddress(m, "SetThreadDescription");
|
||||
|
||||
@ -55,9 +55,9 @@ void uv__winapi_init(void) {
|
||||
HMODULE ws2_32_module;
|
||||
HMODULE api_win_core_file_module;
|
||||
|
||||
ntdll_module = GetModuleHandleA("ntdll.dll");
|
||||
ntdll_module = GetModuleHandleW(L"ntdll.dll");
|
||||
if (ntdll_module == NULL) {
|
||||
uv_fatal_error(GetLastError(), "GetModuleHandleA");
|
||||
uv_fatal_error(GetLastError(), "GetModuleHandleW");
|
||||
}
|
||||
|
||||
pRtlGetVersion = (sRtlGetVersion) GetProcAddress(ntdll_module,
|
||||
@ -123,20 +123,20 @@ void uv__winapi_init(void) {
|
||||
GetProcAddress(powrprof_module, "PowerRegisterSuspendResumeNotification");
|
||||
}
|
||||
|
||||
user32_module = GetModuleHandleA("user32.dll");
|
||||
user32_module = GetModuleHandleW(L"user32.dll");
|
||||
if (user32_module != NULL) {
|
||||
pSetWinEventHook = (sSetWinEventHook)
|
||||
GetProcAddress(user32_module, "SetWinEventHook");
|
||||
}
|
||||
|
||||
ws2_32_module = GetModuleHandleA("ws2_32.dll");
|
||||
ws2_32_module = GetModuleHandleW(L"ws2_32.dll");
|
||||
if (ws2_32_module != NULL) {
|
||||
pGetHostNameW = (uv_sGetHostNameW) GetProcAddress(
|
||||
ws2_32_module,
|
||||
"GetHostNameW");
|
||||
}
|
||||
|
||||
api_win_core_file_module = GetModuleHandleA("api-ms-win-core-file-l2-1-4.dll");
|
||||
api_win_core_file_module = GetModuleHandleW(L"api-ms-win-core-file-l2-1-4.dll");
|
||||
if (api_win_core_file_module != NULL) {
|
||||
pGetFileInformationByName = (sGetFileInformationByName)GetProcAddress(
|
||||
api_win_core_file_module, "GetFileInformationByName");
|
||||
|
||||
@ -223,7 +223,7 @@ static int maybe_run_test(int argc, char **argv) {
|
||||
ASSERT_GT((intptr_t) closed_fd, 0);
|
||||
ASSERT_GT((intptr_t) open_fd, 0);
|
||||
ASSERT_NE(0, GetHandleInformation(open_fd, &flags));
|
||||
kernelbase_module = GetModuleHandleA("kernelbase.dll");
|
||||
kernelbase_module = GetModuleHandleW(L"kernelbase.dll");
|
||||
pCompareObjectHandles = (sCompareObjectHandles)
|
||||
GetProcAddress(kernelbase_module, "CompareObjectHandles");
|
||||
ASSERT_NE(pCompareObjectHandles == NULL || \
|
||||
|
||||
@ -1701,7 +1701,7 @@ TEST_IMPL(spawn_fs_open) {
|
||||
#ifdef _WIN32
|
||||
ASSERT_NE(0, DuplicateHandle(GetCurrentProcess(), fd, GetCurrentProcess(), &dup_fd,
|
||||
0, /* inherit */ TRUE, DUPLICATE_SAME_ACCESS));
|
||||
kernelbase_module = GetModuleHandleA("kernelbase.dll");
|
||||
kernelbase_module = GetModuleHandleW("kernelbase.dll");
|
||||
pCompareObjectHandles = (sCompareObjectHandles)
|
||||
GetProcAddress(kernelbase_module, "CompareObjectHandles");
|
||||
ASSERT_NE(pCompareObjectHandles == NULL ||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user