The API is forbidden [1] and HANDLE_FLAG_INHERIT would never be set as exec()
is not allowed either [2].

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-gethandleinformation
[2] 
https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps
---
 lib/fcntl.c         | 13 +++++++++++++
 lib/windows-spawn.c | 13 +++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/lib/fcntl.c b/lib/fcntl.c
index e220800845..39f5402b30 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -45,6 +45,19 @@
 #  include <io.h>
 # endif
 
+# if defined WINAPI_FAMILY && 
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+/* GetHandleInformation is not available in UWP, the flags it would provide
+   are also not available, so we just return 0.
+   
<https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-gethandleinformation>
+   <https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis> */
+static inline BOOL GetHandleInformation(HANDLE h, DWORD *pf)
+{
+  *pf = 0;
+  return TRUE;
+}
+#  define HANDLE_FLAG_INHERIT          (1)
+# endif /*  WINAPI_PARTITION_DESKTOP */
+
 /* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
 # define OPEN_MAX_MAX 0x10000
 
diff --git a/lib/windows-spawn.c b/lib/windows-spawn.c
index f864db1317..1eb0052e8d 100644
--- a/lib/windows-spawn.c
+++ b/lib/windows-spawn.c
@@ -39,6 +39,19 @@
 
 #include "findprog.h"
 
+#if defined WINAPI_FAMILY && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+/* GetHandleInformation is not available in UWP, the flags it would provide
+   are also not available, so we just return 0.
+   
<https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-gethandleinformation>
+   <https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis> */
+static inline BOOL GetHandleInformation(HANDLE h, DWORD *pf)
+{
+  *pf = 0;
+  return TRUE;
+}
+# define HANDLE_FLAG_INHERIT          (1)
+#endif /*  WINAPI_PARTITION_DESKTOP */
+
 /* Don't assume that UNICODE is not defined.  */
 #undef STARTUPINFO
 #define STARTUPINFO STARTUPINFOA
-- 
2.39.2


Reply via email to