diff options
-rw-r--r-- | src/w_file_win32.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/w_file_win32.c b/src/w_file_win32.c index d5e60579..ec17cf6c 100644 --- a/src/w_file_win32.c +++ b/src/w_file_win32.c @@ -94,12 +94,24 @@ unsigned int GetFileLength(HANDLE handle) static wad_file_t *W_Win32_OpenFile(char *path) { win32_wad_file_t *result; + wchar_t wpath[MAX_PATH + 1]; HANDLE handle; - OFSTRUCT fileinfo; - handle = (HANDLE) OpenFile(path, &fileinfo, OF_READ); + // Open the file: - if (handle == (HANDLE) HFILE_ERROR) + MultiByteToWideChar(CP_OEMCP, 0, + path, strlen(path) + 1, + wpath, sizeof(wpath)); + + handle = CreateFileW(wpath, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { return NULL; } |