summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am1
-rw-r--r--src/w_file.c7
-rw-r--r--src/w_file_win32.c9
3 files changed, 13 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8757d351..e43cb7f0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,7 @@ w_wad.c w_wad.h \
w_file.c w_file.h \
w_file_stdc.c \
w_file_posix.c \
+w_file_win32.c \
z_zone.c z_zone.h
# source files needed for FEATURE_DEHACKED
diff --git a/src/w_file.c b/src/w_file.c
index eed68230..75c2eae4 100644
--- a/src/w_file.c
+++ b/src/w_file.c
@@ -33,12 +33,19 @@
extern wad_file_class_t stdc_wad_file;
+#ifdef _WIN32
+extern wad_file_class_t win32_wad_file;
+#endif
+
#ifdef HAVE_MMAP
extern wad_file_class_t posix_wad_file;
#endif
static wad_file_class_t *wad_file_classes[] =
{
+#ifdef _WIN32
+ &win32_wad_file,
+#endif
#ifdef HAVE_MMAP
&posix_wad_file,
#endif
diff --git a/src/w_file_win32.c b/src/w_file_win32.c
index 1e7061ef..40f68973 100644
--- a/src/w_file_win32.c
+++ b/src/w_file_win32.c
@@ -31,6 +31,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include "i_system.h"
#include "w_file.h"
#include "z_zone.h"
@@ -55,7 +56,7 @@ static void MapFile(win32_wad_file_t *wad, char *filename)
if (wad->handle_map == NULL)
{
fprintf(stderr, "W_Win32_OpenFile: Unable to CreateFileMapping() "
- "for %s\n" filename);
+ "for %s\n", filename);
return;
}
@@ -88,7 +89,7 @@ static wad_file_t *W_Win32_OpenFile(char *path)
HANDLE handle;
OFSTRUCT fileinfo;
- handle = OpenFile(path, &fileinfo, OF_READ);
+ handle = (HANDLE) OpenFile(path, &fileinfo, OF_READ);
if (handle == (HANDLE) HFILE_ERROR)
{
@@ -119,7 +120,7 @@ static void W_Win32_CloseFile(wad_file_t *wad)
if (win32_wad->wad.mapped != NULL)
{
- UnmapViewOfFile(win32->wad.mapped);
+ UnmapViewOfFile(win32_wad->wad.mapped);
}
if (win32_wad->handle_map != NULL)
@@ -151,7 +152,7 @@ size_t W_Win32_Read(wad_file_t *wad, unsigned int offset,
// Jump to the specified position in the file.
- result = SetFilePointer(win32_wad->handle, offset, NULL, FILE_START);
+ result = SetFilePointer(win32_wad->handle, offset, NULL, FILE_BEGIN);
if (result == INVALID_SET_FILE_POINTER)
{