mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
w32: Make sure DEP is enabled.
* common/init.c (_init_common_subsystems): Test and set the DEP Policy. -- Note that this change will now definitely require Windows XP SP3.
This commit is contained in:
parent
17b985787e
commit
f618731f7e
@ -30,6 +30,9 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
# if _WIN32_WINNT < 0x0600
|
||||||
|
# define _WIN32_WINNT 0x0600 /* Required for SetProcessDEPPolicy. */
|
||||||
|
# endif
|
||||||
# ifdef HAVE_WINSOCK2_H
|
# ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# endif
|
# endif
|
||||||
@ -239,7 +242,21 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
|
|||||||
log_set_socket_dir_cb (gnupg_socketdir);
|
log_set_socket_dir_cb (gnupg_socketdir);
|
||||||
|
|
||||||
#if HAVE_W32_SYSTEM
|
#if HAVE_W32_SYSTEM
|
||||||
/* For Standard Windows we use our own parser for the command line
|
/* Make sure that Data Execution Prevention is enabled. */
|
||||||
|
if (GetSystemDEPPolicy () >= 2)
|
||||||
|
{
|
||||||
|
DWORD flags;
|
||||||
|
BOOL perm;
|
||||||
|
|
||||||
|
if (!GetProcessDEPPolicy (GetCurrentProcess (), &flags, &perm))
|
||||||
|
log_info ("error getting DEP policy: %s\n",
|
||||||
|
w32_strerror (GetLastError()));
|
||||||
|
else if (!(flags & PROCESS_DEP_ENABLE)
|
||||||
|
&& !SetProcessDEPPolicy (PROCESS_DEP_ENABLE))
|
||||||
|
log_info ("Warning: Enabling DEP failed: %s (%d,%d)\n",
|
||||||
|
w32_strerror (GetLastError ()), (int)flags, (int)perm);
|
||||||
|
}
|
||||||
|
/* On Windows we use our own parser for the command line
|
||||||
* so that we can return an array of utf-8 encoded strings. */
|
* so that we can return an array of utf-8 encoded strings. */
|
||||||
prepare_w32_commandline (argcp, argvp);
|
prepare_w32_commandline (argcp, argvp);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user