Use CreateFileW instead of OpenFile (doesn't exist on Windows CE)

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1576
This commit is contained in:
Simon Howard 2009-06-07 23:41:10 +00:00
parent d9be068243
commit bdeaec12d0

View file

@ -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;
}