From cc6d0d761ad248d9d9ecbe527fdc9ed3ba8aefff Mon Sep 17 00:00:00 2001 From: Erin Melucci Date: Thu, 23 May 2024 14:52:11 +0200 Subject: [PATCH] Stub out access to FILE_TYPE_DISK when targeting WINAPI_FAMILY_GAMES ACL is only supported when targeting the desktop --- lib/zip_source_file_win32_named.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/zip_source_file_win32_named.c b/lib/zip_source_file_win32_named.c index 855e605a9..a406d32f0 100644 --- a/lib/zip_source_file_win32_named.c +++ b/lib/zip_source_file_win32_named.c @@ -33,6 +33,13 @@ #include "zip_source_file_win32.h" +/* ACL is not available when targeting the games API partition */ +#if defined(WINAPI_FAMILY_PARTITION) && defined(WINAPI_PARTITION_GAMES) +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES) +#define ACL_UNSUPPORTED +#endif +#endif + static zip_int64_t _zip_win32_named_op_commit_write(zip_source_file_context_t *ctx); static zip_int64_t _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx); static bool _zip_win32_named_op_open(zip_source_file_context_t *ctx); @@ -110,7 +117,11 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) { if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) { si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION; + #ifdef ACL_UNSUPPORTED + success = ERROR_NOT_SUPPORTED; + #else success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd); + #endif if (success == ERROR_SUCCESS) { sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = FALSE;