summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/winapi.c13
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: