diff --git a/Source/Tools/FEXOfflineCompiler/Main.cpp b/Source/Tools/FEXOfflineCompiler/Main.cpp index e969af057..af3bb7723 100644 --- a/Source/Tools/FEXOfflineCompiler/Main.cpp +++ b/Source/Tools/FEXOfflineCompiler/Main.cpp @@ -413,7 +413,7 @@ static std::optional GenerateSingleCache(FEXCore::ExecutableFileInf #ifndef _WIN32 auto HostFeatures = FEX::FetchHostFeatures(); #else - const auto NtDll = GetModuleHandle("ntdll.dll"); + const auto NtDll = GetModuleHandleW(L"ntdll.dll"); const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version"); auto HostFeatures = FEX::Windows::CPUFeatures::FetchHostFeatures( IsWine, Is64Bit ? FEXCore::HostFeatures::HostTypeEnum::Arm64ec : FEXCore::HostFeatures::HostTypeEnum::Wow64); diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index 6ceecd878..ab3e7a35e 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -268,7 +268,7 @@ void ParseWineSyscallNumbers(HMODULE NtDll) { void InitSyscalls() { // The ntdll exports called by GetModuleHandle/GetProcAddress aren't known to be patched before JIT init by any current // software so are safe to call, but if that changes the loader structures in the PEB could be parsed manually. - const auto NtDll = GetModuleHandle("ntdll.dll"); + const auto NtDll = GetModuleHandleW(L"ntdll.dll"); NtDllBase = reinterpret_cast(NtDll); const auto WineSyscallDispatcherPtr = reinterpret_cast(GetProcAddress(NtDll, "__wine_syscall_dispatcher")); @@ -593,7 +593,7 @@ NTSTATUS ProcessInit() { SignalDelegator = fextl::make_unique(); SyscallHandler = fextl::make_unique(); - const auto NtDll = GetModuleHandle("ntdll.dll"); + const auto NtDll = GetModuleHandleW(L"ntdll.dll"); const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version"); OvercommitTracker.emplace(IsWine); diff --git a/Source/Windows/Common/Logging.cpp b/Source/Windows/Common/Logging.cpp index c8b0e826d..8980bda8d 100644 --- a/Source/Windows/Common/Logging.cpp +++ b/Source/Windows/Common/Logging.cpp @@ -39,7 +39,7 @@ void Init() { return; } - WineDbgOut = reinterpret_cast(GetProcAddress(GetModuleHandleA("ntdll.dll"), "__wine_dbg_output")); + WineDbgOut = reinterpret_cast(GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "__wine_dbg_output")); if (!WineDbgOut) { const auto Path = fextl::fmt::format("{}\\fex-{}.log", getenv("LOCALAPPDATA"), GetCurrentProcessId()); LogFile = fopen(Path.c_str(), "a"); diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index f62302315..515a553b7 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -527,7 +527,7 @@ void BTCpuProcessInit() { SignalDelegator = fextl::make_unique(); SyscallHandler = fextl::make_unique(); - const auto NtDll = GetModuleHandle("ntdll.dll"); + const auto NtDll = GetModuleHandleW(L"ntdll.dll"); const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version"); OvercommitTracker.emplace(IsWine);