aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/win32/ostream.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/io/src/win32/ostream.c')
-rw-r--r--lib/io/src/win32/ostream.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/lib/io/src/win32/ostream.c b/lib/io/src/win32/ostream.c
index 5b099a4..5b584e5 100644
--- a/lib/io/src/win32/ostream.c
+++ b/lib/io/src/win32/ostream.c
@@ -176,39 +176,19 @@ fail_free:
sqfs_ostream_t *ostream_open_file(const char *path, int flags)
{
- int access_flags, creation_mode;
- WCHAR *wpath = NULL;
+ sqfs_file_handle_t hnd;
sqfs_ostream_t *out;
- HANDLE hnd;
-
- access_flags = GENERIC_WRITE;
-
- if (flags & SQFS_FILE_OPEN_OVERWRITE) {
- creation_mode = CREATE_ALWAYS;
- } else {
- creation_mode = CREATE_NEW;
- }
- if (flags & SQFS_FILE_OPEN_NO_CHARSET_XFRM) {
- hnd = CreateFileA(path, access_flags, 0, NULL, creation_mode,
- FILE_ATTRIBUTE_NORMAL, NULL);
- } else {
- wpath = path_to_windows(path);
- if (wpath == NULL)
- return NULL;
-
- hnd = CreateFileW(wpath, access_flags, 0, NULL, creation_mode,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ if (sqfs_open_native_file(&hnd, path, flags)) {
+ w32_perror(path);
+ return NULL;
}
if (hnd == INVALID_HANDLE_VALUE) {
w32_perror(path);
- free(wpath);
return NULL;
}
- free(wpath);
-
out = ostream_open_handle(path, hnd, flags);
if (out == NULL)
CloseHandle(hnd);