浏览代码

Windows: Stop calling SetProcessDEPPolicy() on 64-bit Windows

It is not supported, and always fails. Some compilers warn about the
function pointer cast on 64-bit Windows.

Fixes bug 27461; bugfix on 0.2.2.23-alpha.
teor 6 年之前
父节点
当前提交
8ef4bb7f3e
共有 2 个文件被更改,包括 13 次插入0 次删除
  1. 5 0
      changes/bug27461
  2. 8 0
      src/or/main.c

+ 5 - 0
changes/bug27461

@@ -0,0 +1,5 @@
+  o Minor bugfixes (compilation):
+    - Stop calling SetProcessDEPPolicy() on 64-bit Windows. It is not
+      supported, and always fails. Some compilers warn about the function
+      pointer cast on 64-bit Windows.
+      Fixes bug 27461; bugfix on 0.2.2.23-alpha.

+ 8 - 0
src/or/main.c

@@ -3433,6 +3433,13 @@ tor_main(int argc, char *argv[])
 #endif
 #endif
   /* On heap corruption, just give up; don't try to play along. */
   /* On heap corruption, just give up; don't try to play along. */
   HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
   HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
+
+  /* SetProcessDEPPolicy is only supported on 32-bit Windows.
+   * (On 64-bit Windows it always fails, and some compilers don't like the
+   * PSETDEP cast.)
+   * 32-bit Windows defines _WIN32.
+   * 64-bit Windows defines _WIN32 and _WIN64. */
+#ifndef _WIN64
   /* Call SetProcessDEPPolicy to permanently enable DEP.
   /* Call SetProcessDEPPolicy to permanently enable DEP.
      The function will not resolve on earlier versions of Windows,
      The function will not resolve on earlier versions of Windows,
      and failure is not dangerous. */
      and failure is not dangerous. */
@@ -3446,6 +3453,7 @@ tor_main(int argc, char *argv[])
       setdeppolicy(3);
       setdeppolicy(3);
     }
     }
   }
   }
+#endif /* !defined(_WIN64) */
 #endif
 #endif
 
 
   configure_backtrace_handler(get_version());
   configure_backtrace_handler(get_version());