Any update on this ?
Just as in gettimeofday, one cannot use LoadLibrary to load system DLLs
in UWP builds. But they are available by static linking with windowsapp
and are guaranteed to be there.
On 2020-05-19 8:26, Steve Lhomme wrote:
LoadLibrary is forbidden in such apps (can only load DLLs from within the app
package).
The API entries are available to all apps linking with the Windows API as found
here:
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis
windowsapp.lib (and mincore.lib for Windows 8) are both available in MinGW as
well.
GetFinalPathNameByHandleA is only allowed in Win10 UWP apps
GetFileInformationByHandleEx is allowed in Win8 and Win10 UWP apps.
---
lib/stat-w32.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/stat-w32.c b/lib/stat-w32.c
index 106d25120..6900dfcf5 100644
--- a/lib/stat-w32.c
+++ b/lib/stat-w32.c
@@ -61,6 +61,15 @@ static BOOL initialized = FALSE;
static void
initialize (void)
{
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ /* LoadLibrary not allowed but the functions are available with the windows
runtime */
+#if _GL_WINDOWS_STAT_INODES == 2
+ GetFileInformationByHandleExFunc = GetFileInformationByHandleEx;
+#endif
+#if _WIN32_WINNT >= 0x0A00 /* _WIN32_WINNT_WIN10 */
+ GetFinalPathNameByHandleFunc = GetFinalPathNameByHandleA;
+#endif
+#else /* WINAPI_PARTITION_DESKTOP */
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
if (kernel32 != NULL)
{
@@ -71,6 +80,7 @@ initialize (void)
GetFinalPathNameByHandleFunc =
(GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32,
"GetFinalPathNameByHandleA");
}
+#endif /* WINAPI_PARTITION_DESKTOP */
initialized = TRUE;
}
--
2.26.2