← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2185: remove 0.698-imposed empty token workaround; add DEP

 

------------------------------------------------------------
revno: 2185
committer: cologic <ne5@xxxxxxxxxxx>
branch nick: dcplusplus
timestamp: Thu 2010-07-22 11:31:17 -0400
message:
  remove 0.698-imposed empty token workaround; add DEP
modified:
  dcpp/ConnectionManager.cpp
  win32/WinUtil.cpp
  win32/WinUtil.h
  win32/main.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/ConnectionManager.cpp'
--- dcpp/ConnectionManager.cpp	2010-06-18 09:27:23 +0000
+++ dcpp/ConnectionManager.cpp	2010-07-22 15:31:17 +0000
@@ -677,8 +677,7 @@
 
 			const string& to = (*i)->getToken();
 
-			// 0.698 would send an empty token in some cases...remove this bugfix at some point
-			if(to == token || token.empty()) {
+			if(to == token) {
 				down = true;
 			}
 		}

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2010-07-10 14:36:48 +0000
+++ win32/WinUtil.cpp	2010-07-22 15:31:17 +0000
@@ -45,6 +45,7 @@
 #include "PrivateFrame.h"
 
 #include <dwt/DWTException.h>
+#include <dwt/LibraryLoader.h>
 
 // def taken from <gettextP.h>
 extern "C" const char *_nl_locale_name_default(void);
@@ -261,6 +262,16 @@
 	::HtmlHelp(NULL, NULL, HH_UNINITIALIZE, helpCookie);
 }
 
+void WinUtil::enableDEP() {
+	dwt::LibraryLoader kernel(_T("kernel32.dll"));
+	typedef WINBASEAPI BOOL WINAPI (*SPDP)(DWORD);
+	SPDP spdp = (SPDP)kernel.getProcAddress(_T("SetProcessDEPPolicy"));
+	if (spdp)
+		dcdebug("SetProcessDEPPolicy %s\n", (*spdp)(1)?"succeeded":"failed");
+	else
+		dcdebug("SetProcessDEPPolicy not present\n");	
+}
+
 tstring WinUtil::encodeFont(LOGFONT const& font) {
 	tstring res(font.lfFaceName);
 	res += _T(',');

=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h	2010-05-08 16:17:17 +0000
+++ win32/WinUtil.h	2010-07-22 15:31:17 +0000
@@ -95,6 +95,8 @@
 	static void init();
 	static void uninit();
 
+	static void enableDEP();
+
 	static tstring encodeFont(LOGFONT const& font);
 	static void decodeFont(const tstring& setting, LOGFONT &dest);
 

=== modified file 'win32/main.cpp'
--- win32/main.cpp	2010-06-18 12:09:55 +0000
+++ win32/main.cpp	2010-07-22 15:31:17 +0000
@@ -72,6 +72,7 @@
 int SmartWinMain(dwt::Application& app) {
 	dcdebug("StartWinMain\n");
 
+	WinUtil::enableDEP();
 	Util::initialize();
 
 	string configPathHash;