From 45a4dfc4f082bf4ec1382baa8ac4a62e6b8cbb6e Mon Sep 17 00:00:00 2001 From: momo5502 Date: Tue, 22 Oct 2024 20:12:20 +0200 Subject: [PATCH] Always open in binary mode --- src/windows-emulator/syscalls.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/windows-emulator/syscalls.cpp b/src/windows-emulator/syscalls.cpp index 44c1dc8..8dae5cf 100644 --- a/src/windows-emulator/syscalls.cpp +++ b/src/windows-emulator/syscalls.cpp @@ -1525,7 +1525,7 @@ namespace const wchar_t* map_mode(const ACCESS_MASK desired_access, const ULONG create_disposition) { - const wchar_t* mode = L""; + const auto* mode = L""; switch (create_disposition) { @@ -1533,7 +1533,7 @@ namespace case FILE_SUPERSEDE: if (desired_access & GENERIC_WRITE) { - mode = L"w"; + mode = L"wb"; } break; @@ -1541,11 +1541,11 @@ namespace case FILE_OPEN_IF: if (desired_access & GENERIC_WRITE) { - mode = L"r+"; + mode = L"r+b"; } else if (desired_access & GENERIC_READ) { - mode = L"r"; + mode = L"rb"; } break; @@ -1553,7 +1553,7 @@ namespace case FILE_OVERWRITE_IF: if (desired_access & GENERIC_WRITE) { - mode = L"w+"; + mode = L"w+b"; } break; @@ -1564,7 +1564,7 @@ namespace if (desired_access & FILE_APPEND_DATA) { - mode = L"a"; + mode = L"a+b"; } return mode;