← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2899: fix crash logs on XP

 

------------------------------------------------------------
revno: 2899
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2012-04-15 23:10:05 +0200
message:
  fix crash logs on XP
modified:
  win32/CrashLogger.cpp
  win32/MainWindow.cpp
  win32/WinUtil.cpp
  win32/WinUtil.h


--
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 'win32/CrashLogger.cpp'
--- win32/CrashLogger.cpp	2012-01-13 20:55:20 +0000
+++ win32/CrashLogger.cpp	2012-04-15 21:10:05 +0000
@@ -507,7 +507,12 @@
 
 #ifdef __MINGW32__
 		// read DWARF debugging info if available.
-		getDebugInfo(module.LoadedImageName, frame.AddrPC.Offset, file, line, column, function);
+		if(module.LoadedImageName[0] ||
+			// LoadedImageName is not always correcly filled in XP...
+			::GetModuleFileNameA(reinterpret_cast<HMODULE>(module.BaseOfImage), module.LoadedImageName, sizeof(module.LoadedImageName)))
+		{
+			getDebugInfo(module.LoadedImageName, frame.AddrPC.Offset, file, line, column, function);
+		}
 #endif
 
 		/* this is the usual Windows PDB reading method. we try it on MinGW too if reading DWARF

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2012-03-11 16:36:44 +0000
+++ win32/MainWindow.cpp	2012-04-15 21:10:05 +0000
@@ -1452,7 +1452,7 @@
 }
 
 LRESULT MainWindow::handleCopyData(LPARAM lParam) {
-	parseCommandLine(Text::toT(WinUtil::getAppName() + " ") + reinterpret_cast<LPCTSTR>(reinterpret_cast<COPYDATASTRUCT*>(lParam)->lpData));
+	parseCommandLine(dwt::Application::instance().getModuleFileName() + _T(" ") + reinterpret_cast<LPCTSTR>(reinterpret_cast<COPYDATASTRUCT*>(lParam)->lpData));
 	return TRUE;
 }
 

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2012-03-21 22:50:43 +0000
+++ win32/WinUtil.cpp	2012-04-15 21:10:05 +0000
@@ -1321,7 +1321,7 @@
 		::RegCloseKey(hk);
 	}
 
-	tstring app = _T("\"") + Text::toT(WinUtil::getAppName()) + _T("\" %1");
+	tstring app = _T("\"") + dwt::Application::instance().getModuleFileName() + _T("\" %1");
 	if(Util::stricmp(app.c_str(), Buf) == 0) {
 		// already registered to us
 		return true;
@@ -1345,7 +1345,7 @@
 	if(::RegCreateKeyEx(HKEY_CURRENT_USER, (_T("Software\\Classes\\") + name + _T("\\DefaultIcon")).c_str(),
 		0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hk, NULL) == ERROR_SUCCESS)
 	{
-		app = Text::toT(WinUtil::getAppName());
+		app = dwt::Application::instance().getModuleFileName();
 		::RegSetValueEx(hk, _T(""), 0, REG_SZ, (LPBYTE) app.c_str(), sizeof(TCHAR) * (app.length() + 1));
 		::RegCloseKey(hk);
 	}

=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h	2012-03-18 17:52:34 +0000
+++ win32/WinUtil.h	2012-04-15 21:10:05 +0000
@@ -303,12 +303,6 @@
 	static void registerHubHandlers();
 	static void registerMagnetHandler();
 
-	static string getAppName() {
-		TCHAR buf[MAX_PATH+1];
-		DWORD x = GetModuleFileName(NULL, buf, MAX_PATH);
-		return Text::fromT(tstring(buf, x));
-	}
-
 	static void addUserItems(Menu* menu, const HintedUserList& users, TabViewPtr parent, const StringList& dirs = StringList());
 
 	/* utility functions to create icons. use these throughout the prog to make it easier to change