diff options
author | Simon Howard | 2009-06-07 23:41:10 +0000 |
---|---|---|
committer | Simon Howard | 2009-06-07 23:41:10 +0000 |
commit | bdeaec12d0f79c5cd15b49105a11988ac5ec545c (patch) | |
tree | 33554af693f6f2dd11332abf46851d1cf7ca3f49 | |
parent | d9be068243f518d50bd4577db58693219b3acd57 (diff) | |
download | chocolate-doom-bdeaec12d0f79c5cd15b49105a11988ac5ec545c.tar.gz chocolate-doom-bdeaec12d0f79c5cd15b49105a11988ac5ec545c.tar.bz2 chocolate-doom-bdeaec12d0f79c5cd15b49105a11988ac5ec545c.zip |
Use CreateFileW instead of OpenFile (doesn't exist on Windows CE)
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1576
-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; } |