/pidgin/main: 3d82cc32b7a2: Use SetProcessDEPPolicy to permanent...
Daniel Atallah
datallah at pidgin.im
Thu Sep 6 00:31:12 EDT 2012
Changeset: 3d82cc32b7a2df6f62bd2059f87ad81b888f40b8
Author: Daniel Atallah <datallah at pidgin.im>
Date: 2012-09-06 04:38 +0100
Branch: release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/3d82cc32b7a2
Description:
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
versions of Windows. Refs #15290
diffstat:
pidgin/win32/winpidgin.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (38 lines):
diff --git a/pidgin/win32/winpidgin.c b/pidgin/win32/winpidgin.c
--- a/pidgin/win32/winpidgin.c
+++ b/pidgin/win32/winpidgin.c
@@ -41,6 +41,7 @@
typedef int (CALLBACK* LPFNPIDGINMAIN)(HINSTANCE, int, char**);
typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCWSTR);
typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD);
+typedef BOOL (WINAPI* LPFNSETPROCESSDEPPOLICY)(DWORD);
static BOOL portable_mode = FALSE;
@@ -642,16 +643,24 @@ WinMain (struct HINSTANCE__ *hInstance,
}
}
+ /* Permanently enable DEP if the OS supports it */
+ if ((hmod = GetModuleHandleW(L"kernel32.dll"))) {
+ LPFNSETPROCESSDEPPOLICY MySetProcessDEPPolicy =
+ (LPFNSETPROCESSDEPPOLICY)
+ GetProcAddress(hmod, "SetProcessDEPPolicy");
+ if (MySetProcessDEPPolicy)
+ MySetProcessDEPPolicy(1); //PROCESS_DEP_ENABLE
+ }
+
if (debug || help || version) {
/* If stdout hasn't been redirected to a file, alloc a console
* (_istty() doesn't work for stuff using the GUI subsystem) */
if (_fileno(stdout) == -1 || _fileno(stdout) == -2) {
LPFNATTACHCONSOLE MyAttachConsole = NULL;
- if ((hmod = GetModuleHandleW(L"kernel32.dll"))) {
+ if (hmod)
MyAttachConsole =
(LPFNATTACHCONSOLE)
GetProcAddress(hmod, "AttachConsole");
- }
if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS))
|| AllocConsole()) {
freopen("CONOUT$", "w", stdout);
More information about the Commits
mailing list