From 66c945fb7d22ff797a88b18213ad4a4d9cb46211 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 11 Nov 2001 00:08:02 +0000 Subject: [PATCH] Implemented a part of CreateFile so save games work. --- src/winapi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/winapi.c b/src/winapi.c index 648df71..fb4687f 100644 --- a/src/winapi.c +++ b/src/winapi.c @@ -46,10 +46,19 @@ HANDLE CreateFile(const char *file, int mode, int x, int y, int flags, int flags } fd = open(file, O_RDONLY); if (fd == -1) - return -1; + return INVALID_HANDLE_VALUE; break; case GENERIC_WRITE: -// break; + if (flags != CREATE_ALWAYS) { + fprintf(stderr, "CreateFile: GENERIC_WRITE flags = %d\n", flags); + exit(EXIT_FAILURE); + } + fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR); + if (fd == -1) { + perror("CreateFile"); + return INVALID_HANDLE_VALUE; + } + break; case GENERIC_READ|GENERIC_WRITE: // break; default: