mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 10:00:16 +02:00
Merge pull request #5780 from mrpippy/unicode
Windows: Fixes around using Unicode functions
This commit is contained in:
6 files changed
+11
-8
No files matched your search
@@ -195,6 +195,9 @@ if (ENABLE_GDB_SYMBOLS)
|
||||
endif()
|
||||
|
||||
add_compile_definitions(_LARGEFILE64_SOURCE)
|
||||
if (WIN32)
|
||||
add_compile_definitions(UNICODE _UNICODE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
@@ -413,7 +413,7 @@ static std::optional<std::string> 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);
|
||||
|
||||
@@ -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<uintptr_t>(NtDll);
|
||||
|
||||
const auto WineSyscallDispatcherPtr = reinterpret_cast<void**>(GetProcAddress(NtDll, "__wine_syscall_dispatcher"));
|
||||
@@ -593,7 +593,7 @@ NTSTATUS ProcessInit() {
|
||||
SignalDelegator = fextl::make_unique<FEX::DummyHandlers::DummySignalDelegator>();
|
||||
SyscallHandler = fextl::make_unique<Exception::ECSyscallHandler>();
|
||||
|
||||
const auto NtDll = GetModuleHandle("ntdll.dll");
|
||||
const auto NtDll = GetModuleHandleW(L"ntdll.dll");
|
||||
const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version");
|
||||
OvercommitTracker.emplace(IsWine);
|
||||
|
||||
|
||||
@@ -247,8 +247,8 @@ SHMSlotResult AllocateSHMSlots(void* SHMBase, uint32_t MapSize, uint32_t MaxSize
|
||||
}
|
||||
|
||||
// Opaque handle path, doesn't support resizing.
|
||||
auto handle = CreateFile(fextl::fmt::format("/dev/shm/fex-{}-stats", Illegal::linux_getpid()).c_str(), GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
auto handle = CreateFileA(fextl::fmt::format("/dev/shm/fex-{}-stats", Illegal::linux_getpid()).c_str(), GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
|
||||
// Create the section mapping for the file handle for the full size.
|
||||
HANDLE SectionMapping;
|
||||
@@ -284,7 +284,7 @@ void DeleteSHMStatsFile() {
|
||||
}
|
||||
|
||||
// Legacy Proton path.
|
||||
DeleteFile(fextl::fmt::format("/dev/shm/fex-{}-stats", Illegal::linux_getpid()).c_str());
|
||||
DeleteFileA(fextl::fmt::format("/dev/shm/fex-{}-stats", Illegal::linux_getpid()).c_str());
|
||||
}
|
||||
|
||||
} // namespace FEX::Windows::UnixLib
|
||||
@@ -39,7 +39,7 @@ void Init() {
|
||||
return;
|
||||
}
|
||||
|
||||
WineDbgOut = reinterpret_cast<decltype(WineDbgOut)>(GetProcAddress(GetModuleHandleA("ntdll.dll"), "__wine_dbg_output"));
|
||||
WineDbgOut = reinterpret_cast<decltype(WineDbgOut)>(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");
|
||||
|
||||
@@ -527,7 +527,7 @@ void BTCpuProcessInit() {
|
||||
|
||||
SignalDelegator = fextl::make_unique<FEX::DummyHandlers::DummySignalDelegator>();
|
||||
SyscallHandler = fextl::make_unique<WowSyscallHandler>();
|
||||
const auto NtDll = GetModuleHandle("ntdll.dll");
|
||||
const auto NtDll = GetModuleHandleW(L"ntdll.dll");
|
||||
const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version");
|
||||
OvercommitTracker.emplace(IsWine);
|
||||
|
||||
|
||||
Reference in new issue
Block a user