--- ssh2/src/agent.c.orig	2016-05-09 17:39:46.474593275 +0200
+++ ssh2/src/agent.c	2016-05-09 17:40:03.058578212 +0200
@@ -251,7 +251,7 @@
 };
 #endif  /* PF_UNIX */
 
-#ifdef WIN32
+#if defined(WIN32) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 /* Code to talk to Pageant was taken from PuTTY.
  *
  * Portions copyright Robert de Bath, Joris van Rantwijk, Delian
@@ -353,7 +353,7 @@
     const char *name;
     struct agent_ops *ops;
 } supported_backends[] = {
-#ifdef WIN32
+#if defined(WIN32) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
     {"Pageant", &agent_ops_pageant},
 #endif  /* WIN32 */
 #ifdef PF_UNIX
--- ssh2/src/agent_win.c.orig	2022-05-27 20:17:14.311901449 +0200
+++ ssh2/src/agent_win.c	2022-05-27 20:16:25.851861610 +0200
@@ -55,7 +55,7 @@
 #include <stdlib.h>
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 /* Code to talk to OpenSSH was taken and modified from the Win32 port of
  * Portable OpenSSH by the PowerShell team. Commit
  * 8ab565c53f3619d6a1f5ac229e212cad8a52852c of
