From 8b4e11060b37ad70754aa665ad59744eadd2dd1e Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 22 Feb 2013 19:28:54 +0100 Subject: - bugfix: update on overwrite directory leads files incorrectly being assigned to it - bugfix: getfullpathname reroute now correctly handles relative paths - bugfix: cwd change to overwrite is now handled too - bugfix: using the external fomod installer to merge a mod caused error messages because directories couldn't be renamed - bugfix: The memory for file dialogs wasn't saved to the ini file - file category (main, update, optional, old) is now stored with the download for future use - when overwriting a mod, the version of the mod is only increased, never reduced. This is less correct for the unusual case that the user is downgrading but more correct for the more commen case he is installing an optional file with incorrect version number - the install mod dialog now uses the file dialog memory --- src/shared/util.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/shared/util.cpp') diff --git a/src/shared/util.cpp b/src/shared/util.cpp index c256e959..a6378a74 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -19,8 +19,11 @@ along with Mod Organizer. If not, see . #include "util.h" #include "windows_error.h" +#include "error_report.h" + #include #include +#include namespace MOShared { @@ -119,4 +122,35 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName) } } -} // namespace MOShared + + + +std::string GetStack() +{ +#ifdef DEBUG + HANDLE process = ::GetCurrentProcess(); + static bool firstCall = true; + if (firstCall) { + ::SymInitialize(process, NULL, TRUE); + firstCall = false; + } + + LPVOID stack[32]; + WORD frames = ::CaptureStackBackTrace(0, 100, stack, NULL); + SYMBOL_INFO_PACKAGE symbol; + symbol.si.SizeOfStruct = sizeof(SYMBOL_INFO); + symbol.si.MaxNameLen = MAX_SYM_NAME; + + std::ostringstream stackStream; + for(unsigned int i = 0; i < frames; ++i) { + ::SymFromAddr(process, (DWORD64)(stack[i]), 0, &symbol.si); + stackStream << frames - i - 1 << ": " << symbol.si.Name << "\n"; + } + return stackStream.str(); +#else + return ""; +#endif +} + + +} // namespace MOShared -- cgit v1.3.1