diff options
| -rw-r--r-- | common/init.c | 9 | ||||
| -rw-r--r-- | common/stringhelp.c | 3 | ||||
| -rw-r--r-- | common/util.h | 1 | ||||
| -rw-r--r-- | dirmngr/dns-stuff.c | 7 |
4 files changed, 20 insertions, 0 deletions
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)) diff --git a/common/stringhelp.c b/common/stringhelp.c index 9a2265258..9347c3551 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -71,6 +71,9 @@ change_slashes (char *name) #ifdef HAVE_DOSISH_SYSTEM char *p; + if (windows_semihosted_by_wine) + return name; + if (strchr (name, '\\')) { for (p=name; *p; p++) diff --git a/common/util.h b/common/util.h index 8f54ffaa5..a326704eb 100644 --- a/common/util.h +++ b/common/util.h @@ -242,6 +242,7 @@ const char *get_keyalgo_string (enum gcry_pk_algos algo, /*-- homedir.c --*/ #ifdef HAVE_W32_SYSTEM int gnupg_isatty (int fd); +extern int windows_semihosted_by_wine; #else #define gnupg_isatty(a) isatty ((a)) #endif diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index 270717215..4f8fb5f8a 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -2436,6 +2436,12 @@ check_inet_support (int *r_v4, int *r_v6) struct addrinfo *aibuf = NULL; struct addrinfo *ai; + if (windows_semihosted_by_wine) + { + *r_v4 = *r_v6 = 1; + goto leave; + } + ret = getaddrinfo ("..localmachine", NULL, NULL, &aibuf); if (ret) { @@ -2489,6 +2495,7 @@ check_inet_support (int *r_v4, int *r_v6) if (aibuf) freeaddrinfo (aibuf); } + leave: #else /*!HAVE_W32_SYSTEM*/ { /* For now we assume that we have both protocols. */ |
