mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-14 21:47:19 +02:00
w32: Almost everywhere include winsock2.h before windows.h.
-- This is required by newer mingw toolchain versions which demand that winsock2.h is included before windows.h. Now, due to the use of socket definitions in pth.h we need to include winsock2.h also in pth.h, now pth.h is often included after an include of windows.h and thus the compiler spits out a warning. To avoid that we include winsock2.h at all places the compiler complains about.
This commit is contained in:
parent
a557a74615
commit
40ca0022a7
20 changed files with 436 additions and 380 deletions
|
@ -23,6 +23,9 @@
|
|||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
#include <shlobj.h>
|
||||
#ifndef CSIDL_APPDATA
|
||||
#define CSIDL_APPDATA 0x001a
|
||||
|
@ -97,7 +100,7 @@ standard_homedir (void)
|
|||
if (!dir)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
|
||||
|
||||
/* It might be better to use LOCAL_APPDATA because this is
|
||||
defined as "non roaming" and thus more likely to be kept
|
||||
locally. For private keys this is desired. However, given
|
||||
|
@ -105,13 +108,13 @@ standard_homedir (void)
|
|||
using a system roaming services might be better than to let
|
||||
them do it manually. A security conscious user will anyway
|
||||
use the registry entry to have better control. */
|
||||
if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
|
||||
NULL, 0, path) >= 0)
|
||||
if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
|
||||
NULL, 0, path) >= 0)
|
||||
{
|
||||
char *tmp = xmalloc (strlen (path) + 6 +1);
|
||||
strcpy (stpcpy (tmp, path), "\\gnupg");
|
||||
dir = tmp;
|
||||
|
||||
|
||||
/* Try to create the directory if it does not yet exists. */
|
||||
if (access (dir, F_OK))
|
||||
CreateDirectory (dir, NULL);
|
||||
|
@ -137,7 +140,7 @@ default_homedir (void)
|
|||
if (!dir || !*dir)
|
||||
{
|
||||
static const char *saved_dir;
|
||||
|
||||
|
||||
if (!saved_dir)
|
||||
{
|
||||
if (!dir || !*dir)
|
||||
|
@ -154,7 +157,7 @@ default_homedir (void)
|
|||
if (tmp)
|
||||
saved_dir = tmp;
|
||||
}
|
||||
|
||||
|
||||
if (!saved_dir)
|
||||
saved_dir = standard_homedir ();
|
||||
}
|
||||
|
@ -191,7 +194,7 @@ w32_rootdir (void)
|
|||
else
|
||||
{
|
||||
log_debug ("bad filename `%s' returned for this process\n", dir);
|
||||
*dir = 0;
|
||||
*dir = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,8 +213,8 @@ w32_commondir (void)
|
|||
{
|
||||
char path[MAX_PATH];
|
||||
|
||||
if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
|
||||
NULL, 0, path) >= 0)
|
||||
if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
|
||||
NULL, 0, path) >= 0)
|
||||
{
|
||||
char *tmp = xmalloc (strlen (path) + 4 +1);
|
||||
strcpy (stpcpy (tmp, path), "\\GNU");
|
||||
|
@ -226,7 +229,7 @@ w32_commondir (void)
|
|||
dir = xstrdup (w32_rootdir ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return dir;
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
@ -388,42 +391,42 @@ gnupg_module_name (int which)
|
|||
strcpy (stpcpy (name, s), s2); \
|
||||
} \
|
||||
return name; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
switch (which)
|
||||
{
|
||||
case GNUPG_MODULE_NAME_AGENT:
|
||||
#ifdef GNUPG_DEFAULT_AGENT
|
||||
return GNUPG_DEFAULT_AGENT;
|
||||
#else
|
||||
#else
|
||||
X(bindir, "gpg-agent");
|
||||
#endif
|
||||
|
||||
|
||||
case GNUPG_MODULE_NAME_PINENTRY:
|
||||
#ifdef GNUPG_DEFAULT_PINENTRY
|
||||
return GNUPG_DEFAULT_PINENTRY;
|
||||
#else
|
||||
#else
|
||||
X(bindir, "pinentry");
|
||||
#endif
|
||||
|
||||
case GNUPG_MODULE_NAME_SCDAEMON:
|
||||
#ifdef GNUPG_DEFAULT_SCDAEMON
|
||||
return GNUPG_DEFAULT_SCDAEMON;
|
||||
#else
|
||||
#else
|
||||
X(libexecdir, "scdaemon");
|
||||
#endif
|
||||
|
||||
case GNUPG_MODULE_NAME_DIRMNGR:
|
||||
#ifdef GNUPG_DEFAULT_DIRMNGR
|
||||
return GNUPG_DEFAULT_DIRMNGR;
|
||||
#else
|
||||
#else
|
||||
X(bindir, "dirmngr");
|
||||
#endif
|
||||
|
||||
case GNUPG_MODULE_NAME_PROTECT_TOOL:
|
||||
#ifdef GNUPG_DEFAULT_PROTECT_TOOL
|
||||
return GNUPG_DEFAULT_PROTECT_TOOL;
|
||||
#else
|
||||
#else
|
||||
X(libexecdir, "gpg-protect-tool");
|
||||
#endif
|
||||
|
||||
|
@ -442,7 +445,7 @@ gnupg_module_name (int which)
|
|||
case GNUPG_MODULE_NAME_GPGCONF:
|
||||
X(bindir, "gpgconf");
|
||||
|
||||
default:
|
||||
default:
|
||||
BUG ();
|
||||
}
|
||||
#undef X
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue