From cdc2a798cfef4e2f9cc21c569f093780b55ba657 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 7 May 2019 20:30:24 +0530 Subject: [PATCH 1/2] uwp: workaround a false positive in certification of glib It seems that the Windows App Certification Kit searches all files and binaries for the regex '\' (or something like it) and throws errors if it exists. Supposedly this is for preventing apps from running REG.EXE https://blogs.msdn.microsoft.com/appconsult/2017/08/16/how-to-validate-if-your-application-is-compliant-with-the-windows-store-polices-windows-10-and-windows-10-s/ --- gio/gregistrysettingsbackend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c index 70d391a32..26de2518c 100644 --- a/gio/gregistrysettingsbackend.c +++ b/gio/gregistrysettingsbackend.c @@ -408,7 +408,7 @@ registry_cache_add_item (GNode *parent, item->block_count = 0; item->readable = FALSE; - trace ("\treg cache: adding %s to %s\n", + trace ("\tregistry cache: adding %s to %s\n", name, ((RegistryCacheItem *)parent->data)->name); cache_node = g_node_new (item); From be56d90fe93e1e9cefe3251e2d038b826341dcd7 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 6 May 2019 19:13:35 +0530 Subject: [PATCH 2/2] gmodule: Add support for loading UWP packaged DLLs LoadLibrary() is not available when building for the Universal Windows Platform, which is used for shipping apps to the Windows Store on all devices (Windows Desktop, Windows Phone, Surface, XBox, etc). Apps are not allowed to load arbitrary DLLs from the system. The only DLLs they can load are those that are bundled with the app as assets. LoadPackagedLibrary() can be used to access those assets by filename. The function is meant to be a drop-in replacement for LoadLibrary(), and the HANDLE returned can be treated the same as before. --- gmodule/gmodule-win32.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index 20459f372..1c7226a68 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -39,6 +39,12 @@ #include #endif +/* Default family is DESKTOP_APP which is DESKTOP | APP + * We want to know when we're only building for apps */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#define G_WINAPI_ONLY_APP +#endif + static void set_error (const gchar *format, ...) @@ -84,7 +90,15 @@ _g_module_open (const gchar *file_name, success = SetThreadErrorMode (SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS, &old_mode); if (!success) set_error (""); + + /* When building for UWP, load app asset DLLs instead of filesystem DLLs. + * Needs MSVC, Windows 8 and newer, and is only usable from apps. */ +#if _WIN32_WINNT >= 0x0602 && defined(G_WINAPI_ONLY_APP) + handle = LoadPackagedLibrary (wfilename, 0); +#else handle = LoadLibraryW (wfilename); +#endif + if (success) SetThreadErrorMode (old_mode, NULL); g_free (wfilename);