diff options
| author | Steven Fuller <relnev@icculus.org> | 2001-11-11 00:08:02 +0000 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 02:22:36 +0200 |
| commit | 66c945fb7d22ff797a88b18213ad4a4d9cb46211 (patch) | |
| tree | 7516debb3453b653aa3058be7cfe5c2d64b51ae5 | |
| parent | 2c9d8cc68efd02ee71758bbe049bba84d0e15dc1 (diff) | |
Implemented a part of CreateFile so save games work.
| -rw-r--r-- | src/winapi.c | 13 |
1 files 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: |
