[glib/nirbheek/preliminary-uwp-support: 2/2] gmodule: Add support for loading UWP packaged DLLs
- From: Nirbheek Chauhan <nirbheekc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/nirbheek/preliminary-uwp-support: 2/2] gmodule: Add support for loading UWP packaged DLLs
- Date: Tue, 25 Jun 2019 07:50:32 +0000 (UTC)
commit f38a395e3b28edb8e8b5452cb8f5dff239ffc447
Author: Nirbheek Chauhan <nirbheek centricular com>
Date: Mon May 6 19:13:35 2019 +0530
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 | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c
index 20459f372..364afd4d8 100644
--- a/gmodule/gmodule-win32.c
+++ b/gmodule/gmodule-win32.c
@@ -84,7 +84,13 @@ _g_module_open (const gchar *file_name,
success = SetThreadErrorMode (SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS, &old_mode);
if (!success)
set_error ("");
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+ handle = LoadPackagedLibrary (wfilename, 0);
+#else
handle = LoadLibraryW (wfilename);
+#endif
+
if (success)
SetThreadErrorMode (old_mode, NULL);
g_free (wfilename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]