diff --git a/win32/win32.c b/win32/win32.c index 9cbd07f..7a60341 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5863,16 +5863,18 @@ console_emulator_p(void) #ifdef _WIN32_WCE return FALSE; #else - const void *const func = WriteConsoleW; HMODULE k; + FARPROC func; MEMORY_BASIC_INFORMATION m; + k = GetModuleHandle("kernel32"); + if (!k) return FALSE; + func = GetProcAddress(k, "WriteConsoleW"); + if (!func) return FALSE; memset(&m, 0, sizeof(m)); if (!VirtualQuery(func, &m, sizeof(m))) { return FALSE; } - k = GetModuleHandle("kernel32.dll"); - if (!k) return FALSE; return (HMODULE)m.AllocationBase != k; #endif }