From 6a269202c392537dfda2b4f6cf6bd22d76440e7d Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Fri, 31 Jul 2015 19:56:51 +0200 Subject: [PATCH] DBG: resolved issue #343 (portable symbol path with custom behavior) --- x64_dbg_dbg/x64_dbg.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/x64_dbg_dbg/x64_dbg.cpp b/x64_dbg_dbg/x64_dbg.cpp index bb90b527..095b956b 100644 --- a/x64_dbg_dbg/x64_dbg.cpp +++ b/x64_dbg_dbg/x64_dbg.cpp @@ -283,22 +283,31 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit() if(!BridgeSettingGet("Symbols", "CachePath", cachePath) || !*cachePath) { strcpy_s(szSymbolCachePath, szLocalSymbolPath); - BridgeSettingSet("Symbols", "CachePath", szLocalSymbolPath); + BridgeSettingSet("Symbols", "CachePath", ".\\symbols"); } else { - // Trim the buffer to fit inside MAX_PATH - strncpy_s(szSymbolCachePath, cachePath, _TRUNCATE); + if (_strnicmp(cachePath, ".\\", 2) == 0) + { + strncpy_s(szSymbolCachePath, dir, _TRUNCATE); + strncat_s(szSymbolCachePath, cachePath + 1, _TRUNCATE); + } + else + { + // Trim the buffer to fit inside MAX_PATH + strncpy_s(szSymbolCachePath, cachePath, _TRUNCATE); + } if(strstr(szSymbolCachePath, "http://") || strstr(szSymbolCachePath, "https://")) { if(Script::Gui::MessageYesNo("It is strongly discouraged to use symbol servers in your path directly (use the store option instead).\n\nDo you want me to fix this?")) { strcpy_s(szSymbolCachePath, szLocalSymbolPath); - BridgeSettingSet("Symbols", "CachePath", szLocalSymbolPath); + BridgeSettingSet("Symbols", "CachePath", ".\\symbols"); } } } + dputs(szSymbolCachePath); SetCurrentDirectoryW(StringUtils::Utf8ToUtf16(dir).c_str()); dputs("Allocating message stack..."); gMsgStack = MsgAllocStack();