From 11390430fbad4a0d5a70671f922bd374defc715b Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 3 Apr 2020 13:25:14 +0200
Subject: [PATCH 2/2] Don't call CreateFileA on Winstore builds

The API is only available on desktop builds.
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
---
 src/share/win_utf8_io/win_utf8_io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
index 1e0c1e86..e634efd9 100644
--- a/src/share/win_utf8_io/win_utf8_io.c
+++ b/src/share/win_utf8_io/win_utf8_io.c
@@ -154,7 +154,11 @@ int get_utf8_argv(int *argc, char ***argv)
 HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
 {
 	if (!flac_internal_get_utf8_filenames()) {
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 
 		return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
+#else
+		return INVALID_HANDLE_VALUE;
+#endif
 	} else {
 		wchar_t *wname;
 		HANDLE handle = INVALID_HANDLE_VALUE;
-- 
2.26.0.windows.1

