From 0e5e31aedc74c12917f52f95f0f5cd1434f00995 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 1 Aug 2023 14:39:40 +0200 Subject: [PATCH] Set the current directory earlier in the initialization process --- src/bridge/bridgemain.cpp | 3 +++ src/dbg/x64dbg.cpp | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bridge/bridgemain.cpp b/src/bridge/bridgemain.cpp index c1809f42..2b4e0b66 100644 --- a/src/bridge/bridgemain.cpp +++ b/src/bridge/bridgemain.cpp @@ -78,6 +78,9 @@ static const wchar_t* InitializeUserDirectory() *backslash = L'\0'; + // Set the current directory to the application directory + SetCurrentDirectoryW(szUserDirectory); + // Extract the file name of the x64dbg executable (without extension) auto fileNameWithoutExtension = backslash + 1; auto period = wcschr(fileNameWithoutExtension, L'.'); diff --git a/src/dbg/x64dbg.cpp b/src/dbg/x64dbg.cpp index dd16b271..8c32bd63 100644 --- a/src/dbg/x64dbg.cpp +++ b/src/dbg/x64dbg.cpp @@ -752,7 +752,6 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit() } } dprintf(QT_TRANSLATE_NOOP("DBG", "Symbol Path: %s\n"), szSymbolCachePath); - SetCurrentDirectoryW(StringUtils::Utf8ToUtf16(szProgramDir).c_str()); dputs(QT_TRANSLATE_NOOP("DBG", "Allocating message stack...")); gMsgStack = MsgAllocStack(); if(!gMsgStack)