1
0
Fork 0

Compare commits

...

3 Commits

5 changed files with 19 additions and 16 deletions

View File

@ -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'.');
@ -2014,7 +2017,7 @@ BRIDGE_IMPEXP DWORD GuiGetMainThreadId()
BRIDGE_IMPEXP bool GuiIsDebuggerFocused()
{
return (bool)(duint)_gui_sendmessage(GUI_IS_DEBUGGER_FOCUSED, nullptr, nullptr);
return !!(duint)_gui_sendmessage(GUI_IS_DEBUGGER_FOCUSED, nullptr, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)

View File

@ -374,7 +374,7 @@ bool cbInstrMovdqu(int argc, char* argv[])
String srcText = argv[2];
duint address = 0;
DWORD registerindex = 0;
if(srcText[0] == '[' && srcText[srcText.length() - 1] == ']' && memicmp(dstText.c_str(), "xmm", 3) == 0)
if(srcText[0] == '[' && srcText[srcText.length() - 1] == ']' && _memicmp(dstText.c_str(), "xmm", 3) == 0)
{
char newValue[16];
// movdqu xmm0, [address]
@ -404,7 +404,7 @@ bool cbInstrMovdqu(int argc, char* argv[])
GuiUpdateAllViews(); //refresh disassembly/dump/etc
return true;
}
else if(dstText[0] == '[' && dstText[dstText.length() - 1] == ']' && memicmp(srcText.c_str(), "xmm", 3) == 0)
else if(dstText[0] == '[' && dstText[dstText.length() - 1] == ']' && _memicmp(srcText.c_str(), "xmm", 3) == 0)
{
// movdqu [address], xmm0
srcText = srcText.substr(3);
@ -434,7 +434,7 @@ bool cbInstrMovdqu(int argc, char* argv[])
GuiUpdateAllViews(); //refresh disassembly/dump/etc
return true;
}
else if(memicmp(srcText.c_str(), "xmm", 3) == 0 && memicmp(dstText.c_str(), "xmm", 3) == 0)
else if(_memicmp(srcText.c_str(), "xmm", 3) == 0 && _memicmp(dstText.c_str(), "xmm", 3) == 0)
{
// movdqu xmm0, xmm1
srcText = srcText.substr(3);

View File

@ -885,7 +885,7 @@ bool ModLoad(duint Base, duint Size, const char* FullPath, bool loadSymbols)
// Get information from the local buffer
// TODO: this does not properly work for file offset -> rva conversions (since virtual modules are SEC_IMAGE)
info.loadedSize = Size;
info.loadedSize = (DWORD)Size;
GetModuleInfo(info, (ULONG_PTR)info.mappedData());
}

View File

@ -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)

View File

@ -576,6 +576,7 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
QString stylePath(":/css/default.css");
QString settingsPath;
QString applicationDirPath = QCoreApplication::applicationDirPath();
if(*selectedTheme)
{
// Handle the icon theme
@ -583,7 +584,7 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
if(strcmp(selectedTheme, "Default") == 0)
{
// The Default theme needs some special handling to allow overriding
auto overrideDir = QCoreApplication::applicationDirPath() + "/../themes/Default";
auto overrideDir = applicationDirPath + "/../themes/Default";
if(QDir(overrideDir).exists("index.theme"))
{
/*
@ -611,7 +612,7 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
}
else
{
auto themesDir = QCoreApplication::applicationDirPath() + "/../themes";
auto themesDir = applicationDirPath + "/../themes";
if(QDir(themesDir).exists(QString("%1/index.theme").arg(selectedTheme)))
{
searchPaths << themesDir;
@ -625,17 +626,17 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
QIcon::setThemeSearchPaths(searchPaths);
}
QString themePath = QString("%1/../themes/%2/style.css").arg(QCoreApplication::applicationDirPath()).arg(selectedTheme);
QString themePath = QString("%1/../themes/%2/style.css").arg(applicationDirPath).arg(selectedTheme);
if(!QFile(themePath).exists())
themePath = QString("%1/../themes/%2/theme.css").arg(QCoreApplication::applicationDirPath()).arg(selectedTheme);
themePath = QString("%1/../themes/%2/theme.css").arg(applicationDirPath).arg(selectedTheme);
if(QFile(themePath).exists())
stylePath = themePath;
auto tryIni = [&settingsPath, &selectedTheme](const char* name)
auto tryIni = [&applicationDirPath, &settingsPath, &selectedTheme](const char* name)
{
if(!settingsPath.isEmpty())
return;
QString iniPath = QString("%1/../themes/%2/%3").arg(QCoreApplication::applicationDirPath(), selectedTheme, name);
QString iniPath = QString("%1/../themes/%2/%3").arg(applicationDirPath, selectedTheme, name);
if(QFile(iniPath).exists())
settingsPath = iniPath;
};
@ -654,10 +655,10 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
{
auto style = QTextStream(&cssFile).readAll();
cssFile.close();
style = style.replace("url(./", QString("url(../themes/%2/").arg(selectedTheme));
style = style.replace("url(\"./", QString("url(\"../themes/%2/").arg(selectedTheme));
style = style.replace("url('./", QString("url('../themes/%2/").arg(selectedTheme));
style = style.replace("$RELPATH", QString("../themes/%2/").arg(selectedTheme));
style = style.replace("url(./", QString("url(%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("url(\"./", QString("url(\"%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("url('./", QString("url('%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("$RELPATH", QString("%1/../themes/%2").arg(applicationDirPath, selectedTheme));
qApp->setStyleSheet(style);
}