ref: bdeaec12d0f79c5cd15b49105a11988ac5ec545c
parent: d9be068243f518d50bd4577db58693219b3acd57
author: Simon Howard <[email protected]>
date: Sun Jun 7 19:41:10 EDT 2009
Use CreateFileW instead of OpenFile (doesn't exist on Windows CE) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1576
--- a/src/w_file_win32.c
+++ b/src/w_file_win32.c
@@ -94,12 +94,24 @@
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;
}