Implemented a part of CreateFile so save games work.
This commit is contained in:
parent
2c9d8cc68e
commit
66c945fb7d
1 changed files with 11 additions and 2 deletions
13
src/winapi.c
13
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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue