Skip to content

Commit

Permalink
Merge pull request x64dbg#3298 from torusrxxx/patch000000fd
Browse files Browse the repository at this point in the history
Add symbol online search to symbol view
  • Loading branch information
mrexodia authored Jan 5, 2024
2 parents b683fc6 + 8cb5459 commit 9f6d396
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/Src/Gui/CPUDisassembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ void CPUDisassembly::labelHelpSlot()
QString baseUrl(setting);
QString fullUrl = baseUrl.replace("@topic", topic);

if(fullUrl.startsWith("execute://"))
if(baseUrl.startsWith("execute://"))
{
QString command = fullUrl.right(fullUrl.length() - 10);
QProcess::execute(command);
Expand Down
34 changes: 33 additions & 1 deletion src/gui/Src/Gui/SymbolView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "StdIconSearchListView.h"
#include "ZehSymbolTable.h"
#include "DisassemblyPopup.h"

#include <QDesktopServices>
#include <QVBoxLayout>
#include <QProcess>
#include <QFileDialog>
Expand Down Expand Up @@ -321,6 +321,9 @@ void SymbolView::setupContextMenu()
mSymbolSearchList->addAction(mToggleBookmark);
connect(mToggleBookmark, SIGNAL(triggered()), this, SLOT(toggleBookmark()));

mLabelHelp = new QAction(DIcon("help"), tr("Help on Symbolic Name"), this);
connect(mLabelHelp, SIGNAL(triggered()), this, SLOT(labelHelpSlot()));

//Modules
mFollowModuleAction = new QAction(disassembler, tr("&Follow in Disassembler"), this);
mFollowModuleAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
Expand Down Expand Up @@ -529,6 +532,7 @@ void SymbolView::symbolContextMenu(QMenu* menu)
menu->addAction(mFollowSymbolDumpAction);
if(mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), 1) == tr("Import"))
menu->addAction(mFollowSymbolImportAction);
menu->addAction(mLabelHelp);
menu->addSeparator();
menu->addAction(mToggleBreakpoint);
menu->addAction(mToggleBookmark);
Expand Down Expand Up @@ -580,6 +584,34 @@ void SymbolView::symbolSelectModule(duint base)
}
}

void SymbolView::labelHelpSlot()
{
QString topic = mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), ZehSymbolTable::ColUndecorated);
if(topic.isEmpty())
topic = mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), ZehSymbolTable::ColDecorated);
if(topic.isEmpty())
return;
char setting[MAX_SETTING_SIZE] = "";
if(!BridgeSettingGet("Misc", "HelpOnSymbolicNameUrl", setting))
{
//"execute://winhlp32.exe -k@topic ..\\win32.hlp";
strcpy_s(setting, "https://www.google.com/search?q=@topic");
BridgeSettingSet("Misc", "HelpOnSymbolicNameUrl", setting);
}
QString baseUrl(setting);
QString fullUrl = baseUrl.replace("@topic", topic);

if(baseUrl.startsWith("execute://"))
{
QString command = fullUrl.right(fullUrl.length() - 10);
QProcess::execute(command);
}
else
{
QDesktopServices::openUrl(QUrl(fullUrl));
}
}

void SymbolView::enterPressedSlot()
{
auto addr = DbgValFromString(mSymbolList->mCurList->getCellContent(mSymbolList->mCurList->getInitialSelection(), 0).toUtf8().constData());
Expand Down
2 changes: 2 additions & 0 deletions src/gui/Src/Gui/SymbolView.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private slots:
void enterPressedSlot();
void symbolContextMenu(QMenu* menu);
void symbolRefreshCurrent();
void labelHelpSlot();
void moduleContextMenu(QMenu* menu);
void moduleFollow();
void moduleEntryFollow();
Expand Down Expand Up @@ -90,6 +91,7 @@ private slots:
QAction* mFollowInMemMap;
QAction* mLoadLib;
QAction* mFreeLib;
QAction* mLabelHelp;
QMenu* mPluginMenu;

static void cbSymbolEnum(SYMBOLINFO* symbol, void* user);
Expand Down

0 comments on commit 9f6d396

Please sign in to comment.