summaryrefslogtreecommitdiff
path: root/src/libFLAC/windows_unicode_filenames.c
diff options
context:
space:
mode:
authorAlberto Fustinoni <claudiuslollarius@gmail.com>2018-01-05 15:39:04 +0900
committerErik de Castro Lopo <erikd@mega-nerd.com>2018-01-06 17:49:14 +1100
commit972454edf8ac5773955a63d97f83970267093613 (patch)
tree0255908fe2415d72522baee66d9d9e72cebe8937 /src/libFLAC/windows_unicode_filenames.c
parent20a2100d7d7e304f2f332e1a8adafe1b43988d61 (diff)
downloadflac-972454edf8ac5773955a63d97f83970267093613.tar.gz
UWP build fix
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Diffstat (limited to 'src/libFLAC/windows_unicode_filenames.c')
-rw-r--r--src/libFLAC/windows_unicode_filenames.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libFLAC/windows_unicode_filenames.c b/src/libFLAC/windows_unicode_filenames.c
index 2404e319..3c916681 100644
--- a/src/libFLAC/windows_unicode_filenames.c
+++ b/src/libFLAC/windows_unicode_filenames.c
@@ -185,6 +185,16 @@ int flac_internal_rename_utf8(const char *oldname, const char *newname)
HANDLE WINAPI flac_internal_CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
+#if _MSC_VER > 1900 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+ wchar_t *wname;
+ HANDLE handle = INVALID_HANDLE_VALUE;
+
+ if ((wname = wchar_from_utf8(lpFileName)) != NULL) {
+
+ handle = CreateFile2(wname, dwDesiredAccess, dwShareMode, CREATE_ALWAYS, NULL);
+ free(wname);
+ }
+#else
if (!utf8_filenames) {
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
} else {
@@ -198,4 +208,5 @@ HANDLE WINAPI flac_internal_CreateFile_utf8(const char *lpFileName, DWORD dwDesi
return handle;
}
+#endif
}