aboutsummaryrefslogtreecommitdiff
path: root/lib/fstream/win32/ostream.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fstream/win32/ostream.c')
-rw-r--r--lib/fstream/win32/ostream.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/fstream/win32/ostream.c b/lib/fstream/win32/ostream.c
index 7b5bd3e..61dae37 100644
--- a/lib/fstream/win32/ostream.c
+++ b/lib/fstream/win32/ostream.c
@@ -128,12 +128,17 @@ ostream_t *ostream_open_file(const char *path, int flags)
sqfs_object_t *obj = (sqfs_object_t *)file;
ostream_t *strm = (ostream_t *)file;
int access_flags, creation_mode;
+ WCHAR *wpath = NULL;
if (file == NULL) {
perror(path);
return NULL;
}
+ wpath = path_to_windows(path);
+ if (wpath == NULL)
+ goto fail_free;
+
file->path = strdup(path);
if (file->path == NULL) {
perror(path);
@@ -148,14 +153,16 @@ ostream_t *ostream_open_file(const char *path, int flags)
creation_mode = CREATE_NEW;
}
- file->hnd = CreateFile(path, access_flags, 0, NULL, creation_mode,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ file->hnd = CreateFileW(wpath, access_flags, 0, NULL, creation_mode,
+ FILE_ATTRIBUTE_NORMAL, NULL);
if (file->hnd == INVALID_HANDLE_VALUE) {
w32_perror(path);
goto fail_path;
}
+ free(wpath);
+
if (flags & OSTREAM_OPEN_SPARSE)
strm->append_sparse = file_append_sparse;
@@ -168,6 +175,7 @@ fail_path:
free(file->path);
fail_free:
free(file);
+ free(wpath);
return NULL;
}