From 61ff3759e827fed5ea47897af1291443aeb5172e Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 21 Oct 2025 11:51:49 +0900 Subject: common,dirmngr:w32: Fix for semi-hosted environment. * common/init.c [HAVE_W32_SYSTEM] (windows_semihosted_by_wine): New. (_init_common_subsystems): Initialize the variable. * common/stringhelp.c (change_slashes): Don't change slashes under semi-hosted environment. * common/util.h [HAVE_W32_SYSTEM] (windows_semihosted_by_wine): New. * dirmngr/dns-stuff.c [HAVE_W32_SYSTEM] (check_inet_support): Disable the check by "..localmachine" under semi-hosted environment. -- GnuPG-bug-id: 7138 Signed-off-by: NIIBE Yutaka --- common/init.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common/init.c') diff --git a/common/init.c b/common/init.c index 8ea51c8b0..ebe73ee6a 100644 --- a/common/init.c +++ b/common/init.c @@ -73,6 +73,9 @@ gpg_err_source_t default_errsource = 0; #if HAVE_W32_SYSTEM static void prepare_w32_commandline (int *argcp, char ***argvp); + +/* Whether or not if this program is running under Wine. */ +int windows_semihosted_by_wine; #endif /*HAVE_W32_SYSTEM*/ @@ -167,6 +170,12 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) WSAStartup (0x202, &wsadat); } + { + HMODULE hntdll = GetModuleHandle ("ntdll.dll"); + if (hntdll + && GetProcAddress (hntdll, "wine_get_version")) + windows_semihosted_by_wine = 1; + } #endif if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) -- cgit