1
0
Fork 0

Get rid of the wLocal variable naming convention (mostly)

This commit is contained in:
Duncan Ogilvie 2023-08-26 10:58:36 +02:00
parent 6fba4478fb
commit 812c91d361
55 changed files with 1534 additions and 1550 deletions

View File

@ -326,7 +326,7 @@ void AbstractStdTable::updateColors()
void AbstractStdTable::mouseMoveEvent(QMouseEvent* event)
{
bool wAccept = true;
bool accept = true;
int y = transY(event->y());
if(mGuiState == AbstractStdTable::MultiRowsSelectionState)
@ -335,18 +335,18 @@ void AbstractStdTable::mouseMoveEvent(QMouseEvent* event)
if(y >= 0 && y <= this->getTableHeight())
{
int wRowIndex = getTableOffset() + getIndexOffsetFromY(y);
auto rowIndex = getTableOffset() + getIndexOffsetFromY(y);
if(wRowIndex < getRowCount())
if(rowIndex < getRowCount())
{
if(mIsMultiSelectionAllowed)
expandSelectionUpTo(wRowIndex);
expandSelectionUpTo(rowIndex);
else
setSingleSelection(wRowIndex);
setSingleSelection(rowIndex);
updateViewport();
wAccept = false;
accept = false;
}
}
else if(y < 0)
@ -359,13 +359,13 @@ void AbstractStdTable::mouseMoveEvent(QMouseEvent* event)
}
}
if(wAccept)
if(accept)
AbstractTableView::mouseMoveEvent(event);
}
void AbstractStdTable::mousePressEvent(QMouseEvent* event)
{
bool wAccept = false;
bool accept = false;
if(((event->buttons() & Qt::LeftButton) != 0) && ((event->buttons() & Qt::RightButton) == 0))
{
@ -373,26 +373,26 @@ void AbstractStdTable::mousePressEvent(QMouseEvent* event)
{
if(event->y() > getHeaderHeight())
{
int wRowIndex = getTableOffset() + getIndexOffsetFromY(transY(event->y()));
auto rowIndex = getTableOffset() + getIndexOffsetFromY(transY(event->y()));
if(wRowIndex < getRowCount())
if(rowIndex < getRowCount())
{
if(mIsMultiSelectionAllowed && (event->modifiers() & Qt::ShiftModifier))
expandSelectionUpTo(wRowIndex);
expandSelectionUpTo(rowIndex);
else
setSingleSelection(wRowIndex);
setSingleSelection(rowIndex);
mGuiState = AbstractStdTable::MultiRowsSelectionState;
updateViewport();
wAccept = true;
accept = true;
}
}
}
}
if(!wAccept)
if(!accept)
AbstractTableView::mousePressEvent(event);
}
@ -405,7 +405,7 @@ void AbstractStdTable::mouseDoubleClickEvent(QMouseEvent* event)
void AbstractStdTable::mouseReleaseEvent(QMouseEvent* event)
{
bool wAccept = true;
bool accept = true;
if((event->buttons() & Qt::LeftButton) == 0)
{
@ -415,11 +415,11 @@ void AbstractStdTable::mouseReleaseEvent(QMouseEvent* event)
updateViewport();
wAccept = false;
accept = false;
}
}
if(wAccept)
if(accept)
AbstractTableView::mouseReleaseEvent(event);
}
@ -436,8 +436,8 @@ void AbstractStdTable::keyPressEvent(QKeyEvent* event)
key == Qt::Key_A ||
key == Qt::Key_C)
{
dsint wBotIndex = getTableOffset();
dsint wTopIndex = wBotIndex + getNbrOfLineToPrint() - 1;
auto botIndex = getTableOffset();
auto topIndex = botIndex + getNbrOfLineToPrint() - 1;
switch(key)
{
@ -500,11 +500,11 @@ void AbstractStdTable::keyPressEvent(QKeyEvent* event)
break;
}
if(getInitialSelection() < wBotIndex)
if(getInitialSelection() < botIndex)
{
setTableOffset(getInitialSelection());
}
else if(getInitialSelection() >= wTopIndex)
else if(getInitialSelection() >= topIndex)
{
setTableOffset(getInitialSelection() - getNbrOfLineToPrint() + 2);
}
@ -552,46 +552,46 @@ void AbstractStdTable::expandSelectionUpTo(int to)
void AbstractStdTable::expandUp()
{
int wRowIndex = mSelection.firstSelectedIndex - 1;
if(wRowIndex >= 0)
auto rowIndex = mSelection.firstSelectedIndex - 1;
if(rowIndex >= 0)
{
if(wRowIndex < mSelection.fromIndex)
if(rowIndex < mSelection.fromIndex)
{
mSelection.fromIndex = wRowIndex;
mSelection.firstSelectedIndex = wRowIndex;
mSelection.fromIndex = rowIndex;
mSelection.firstSelectedIndex = rowIndex;
}
else
{
mSelection.firstSelectedIndex = wRowIndex;
mSelection.toIndex = wRowIndex;
mSelection.firstSelectedIndex = rowIndex;
mSelection.toIndex = rowIndex;
}
emit selectionChangedSignal(wRowIndex);
emit selectionChanged(rowIndex);
}
}
void AbstractStdTable::expandDown()
{
int wRowIndex = mSelection.firstSelectedIndex + 1;
int endIndex = getRowCount() - 1;
if(wRowIndex <= endIndex)
auto rowIndex = mSelection.firstSelectedIndex + 1;
auto endIndex = getRowCount() - 1;
if(rowIndex <= endIndex)
{
if(wRowIndex > mSelection.toIndex)
if(rowIndex > mSelection.toIndex)
{
mSelection.firstSelectedIndex = wRowIndex;
mSelection.toIndex = wRowIndex;
mSelection.firstSelectedIndex = rowIndex;
mSelection.toIndex = rowIndex;
}
else
{
mSelection.fromIndex = wRowIndex;
mSelection.firstSelectedIndex = wRowIndex;
mSelection.fromIndex = rowIndex;
mSelection.firstSelectedIndex = rowIndex;
}
emit selectionChangedSignal(wRowIndex);
emit selectionChanged(rowIndex);
}
}
@ -605,10 +605,10 @@ void AbstractStdTable::expandTop()
void AbstractStdTable::expandBottom()
{
int endIndex = getRowCount() - 1;
if(endIndex >= 0)
auto rowCount = getRowCount();
if(rowCount > 0)
{
expandSelectionUpTo(endIndex);
expandSelectionUpTo(rowCount - 1);
}
}
@ -646,7 +646,7 @@ void AbstractStdTable::selectStart()
void AbstractStdTable::selectEnd()
{
int endIndex = getRowCount() - 1;
auto endIndex = getRowCount() - 1;
if(endIndex >= 0)
{
setSingleSelection(endIndex);
@ -1002,6 +1002,8 @@ void AbstractStdTable::setCopyMenuOnly(bool bSet, bool bDebugOnly)
void AbstractStdTable::contextMenuRequestedSlot(const QPoint & pos)
{
if(pos.y() < getHeaderHeight())
return;
if(!mCopyMenuOnly)
{
emit contextMenuSignal(pos);
@ -1009,14 +1011,14 @@ void AbstractStdTable::contextMenuRequestedSlot(const QPoint & pos)
}
if(mCopyMenuDebugOnly && !DbgIsDebugging())
return;
QMenu wMenu(this);
QMenu wCopyMenu(tr("&Copy"), this);
setupCopyMenu(&wCopyMenu);
if(wCopyMenu.actions().length())
auto menu = new QMenu(this);
auto copyMenu = new QMenu(tr("&Copy"), this);
setupCopyMenu(copyMenu);
if(copyMenu->actions().length())
{
wMenu.addSeparator();
wMenu.addMenu(&wCopyMenu);
wMenu.exec(mapToGlobal(pos));
menu->addSeparator();
menu->addMenu(copyMenu);
menu->popup(mapToGlobal(pos));
}
}

View File

@ -465,21 +465,21 @@ void AbstractTableView::mousePressEvent(QMouseEvent* event)
{
if(((event->buttons() & Qt::LeftButton) != 0) && ((event->buttons() & Qt::RightButton) == 0))
{
if(mColResizeData.splitHandle == true)
if(mColResizeData.splitHandle)
{
int wColIndex = getColumnDisplayIndexFromX(event->x());
int wDisplayIndex = getColumnDisplayIndexFromX(event->x());
int wStartPos = getColumnPosition(wDisplayIndex); // Position X of the start of column
int colIndex = getColumnDisplayIndexFromX(event->x());
int displayIndex = getColumnDisplayIndexFromX(event->x());
int startPos = getColumnPosition(displayIndex); // Position X of the start of column
mGuiState = AbstractTableView::ResizeColumnState;
if(event->x() <= (wStartPos + 2))
if(event->x() <= (startPos + 2))
{
mColResizeData.index = wColIndex - 1;
mColResizeData.index = colIndex - 1;
}
else
{
mColResizeData.index = wColIndex;
mColResizeData.index = colIndex;
}
mColResizeData.lastPosX = event->x();
@ -488,16 +488,16 @@ void AbstractTableView::mousePressEvent(QMouseEvent* event)
{
mReorderStartX = event->x();
int wColIndex = getColumnIndexFromX(event->x());
if(mColumnList[wColIndex].header.isClickable)
int colIndex = getColumnIndexFromX(event->x());
if(mColumnList[colIndex].header.isClickable)
{
//qDebug() << "Button " << wColIndex << "has been pressed.";
emit headerButtonPressed(wColIndex);
//qDebug() << "Button " << colIndex << "has been pressed.";
emit headerButtonPressed(colIndex);
mColumnList[wColIndex].header.isPressed = true;
mColumnList[wColIndex].header.isMouseOver = true;
mColumnList[colIndex].header.isPressed = true;
mColumnList[colIndex].header.isMouseOver = true;
mHeader.activeButtonIndex = wColIndex;
mHeader.activeButtonIndex = colIndex;
mGuiState = AbstractTableView::HeaderButtonPressed;
@ -536,9 +536,8 @@ void AbstractTableView::mouseReleaseEvent(QMouseEvent* event)
}
else if(mGuiState == AbstractTableView::HeaderButtonPressed)
{
if(mColumnList[mHeader.activeButtonIndex].header.isMouseOver == true)
if(mColumnList[mHeader.activeButtonIndex].header.isMouseOver)
{
//qDebug() << "Button " << mHeader.activeButtonIndex << "has been released.";
emit headerButtonReleased(mHeader.activeButtonIndex);
}
mGuiState = AbstractTableView::NoState;
@ -662,28 +661,34 @@ void AbstractTableView::leaveEvent(QEvent* event)
*/
void AbstractTableView::keyPressEvent(QKeyEvent* event)
{
int wKey = event->key();
auto key = event->key();
if(event->modifiers() != Qt::NoModifier && event->modifiers() != Qt::KeypadModifier)
return;
return QAbstractScrollArea::keyPressEvent(event);
if(wKey == Qt::Key_Up)
if(key == Qt::Key_Up)
{
verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
}
else if(wKey == Qt::Key_Down)
else if(key == Qt::Key_Down)
{
verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
}
else if(wKey == Qt::Key_PageUp)
else if(key == Qt::Key_PageUp)
{
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
}
else if(wKey == Qt::Key_PageDown)
else if(key == Qt::Key_PageDown)
{
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
}
else if(wKey == Qt::Key_Return || wKey == Qt::Key_Enter) //user pressed enter
else if(key == Qt::Key_Return || key == Qt::Key_Enter) //user pressed enter
{
emit enterPressedSignal();
}
else
{
QAbstractScrollArea::keyPressEvent(event);
}
}
/************************************************************************************
@ -918,26 +923,26 @@ int AbstractTableView::getIndexOffsetFromY(int y) const
*/
int AbstractTableView::getColumnIndexFromX(int x) const
{
int wX = -horizontalScrollBar()->value();
int wColIndex = 0;
int scrollX = -horizontalScrollBar()->value();
duint colIndex = 0;
while(wColIndex < getColumnCount())
while(colIndex < getColumnCount())
{
int col = mColumnOrder[wColIndex];
auto col = mColumnOrder[colIndex];
if(getColumnHidden(col))
{
wColIndex++;
colIndex++;
continue;
}
wX += getColumnWidth(col);
scrollX += getColumnWidth(col);
if(x <= wX)
if(x <= scrollX)
{
return mColumnOrder[wColIndex];
return mColumnOrder[colIndex];
}
else if(wColIndex < getColumnCount())
else if(colIndex < getColumnCount())
{
wColIndex++;
colIndex++;
}
}
return getColumnCount() > 0 ? mColumnOrder[getColumnCount() - 1] : -1;
@ -952,26 +957,26 @@ int AbstractTableView::getColumnIndexFromX(int x) const
*/
int AbstractTableView::getColumnDisplayIndexFromX(int x)
{
int wX = -horizontalScrollBar()->value();
int wColIndex = 0;
int scrollX = -horizontalScrollBar()->value();
int colIndex = 0;
while(wColIndex < getColumnCount())
while(colIndex < getColumnCount())
{
int col = mColumnOrder[wColIndex];
auto col = mColumnOrder[colIndex];
if(getColumnHidden(col))
{
wColIndex++;
colIndex++;
continue;
}
wX += getColumnWidth(col);
scrollX += getColumnWidth(col);
if(x <= wX)
if(x <= scrollX)
{
return wColIndex;
return colIndex;
}
else if(wColIndex < getColumnCount())
else if(colIndex < getColumnCount())
{
wColIndex++;
colIndex++;
}
}
return getColumnCount() - 1;
@ -1014,7 +1019,7 @@ int AbstractTableView::transY(int y) const
}
/**
* @brief Returns the number of viewable rows in the current window (Partially viewable rows are aslo counted).
* @brief Returns the number of viewable rows in the current window (Partially viewable rows are also counted).
*
* @return Number of viewable rows.
*/
@ -1178,7 +1183,7 @@ int AbstractTableView::getColumnOrder(int index) const
int AbstractTableView::getHeaderHeight() const
{
if(mHeader.isVisible == true)
if(mHeader.isVisible)
return mHeader.height;
else
return 0;
@ -1211,7 +1216,7 @@ void AbstractTableView::setShowHeader(bool show)
int AbstractTableView::getCharWidth() const
{
return QFontMetrics(this->font()).width(QChar(' '));
return mFontMetrics->width(' ');
}
/************************************************************************************

View File

@ -67,7 +67,7 @@ QString HistoryLineEdit::addHistoryClear()
void HistoryLineEdit::keyPressEvent(QKeyEvent* event)
{
int wKey = event->key();
int key = event->key();
//This fixes a very annoying bug on some systems
if(bSixPressed)
@ -79,14 +79,14 @@ void HistoryLineEdit::keyPressEvent(QKeyEvent* event)
return;
}
}
if(wKey == Qt::Key_6)
if(key == Qt::Key_6)
bSixPressed = true;
if(wKey == Qt::Key_Up || wKey == Qt::Key_Down)
if(key == Qt::Key_Up || key == Qt::Key_Down)
{
if(wKey == Qt::Key_Up)
if(key == Qt::Key_Up)
mCmdIndex++;
else if(wKey == Qt::Key_Down)
else if(key == Qt::Key_Down)
mCmdIndex--;
mCmdIndex = mCmdIndex < -1 ? -1 : mCmdIndex;

View File

@ -203,7 +203,7 @@ void ReferenceView::addCommand(QString title, QString command)
mCommands.append(command);
}
void ReferenceView::referenceContextMenu(QMenu* wMenu)
void ReferenceView::referenceContextMenu(QMenu* menu)
{
if(!mCurList->getRowCount())
return;
@ -213,39 +213,39 @@ void ReferenceView::referenceContextMenu(QMenu* wMenu)
return;
if(DbgMemIsValidReadPtr(addr))
{
wMenu->addAction(mFollowAddress);
wMenu->addAction(mFollowDumpAddress);
menu->addAction(mFollowAddress);
menu->addAction(mFollowDumpAddress);
dsint apiaddr = apiAddressFromString(mCurList->getCellContent(mCurList->getInitialSelection(), 1));
if(apiaddr)
wMenu->addAction(mFollowApiAddress);
wMenu->addSeparator();
wMenu->addAction(mToggleBreakpoint);
wMenu->addAction(mSetBreakpointOnAllCommands);
wMenu->addAction(mRemoveBreakpointOnAllCommands);
menu->addAction(mFollowApiAddress);
menu->addSeparator();
menu->addAction(mToggleBreakpoint);
menu->addAction(mSetBreakpointOnAllCommands);
menu->addAction(mRemoveBreakpointOnAllCommands);
if(apiaddr)
{
char label[MAX_LABEL_SIZE] = "";
if(DbgGetLabelAt(apiaddr, SEG_DEFAULT, label))
{
wMenu->addSeparator();
menu->addSeparator();
mSetBreakpointOnAllApiCalls->setText(tr("Set breakpoint on all calls to %1").arg(label));
wMenu->addAction(mSetBreakpointOnAllApiCalls);
menu->addAction(mSetBreakpointOnAllApiCalls);
mRemoveBreakpointOnAllApiCalls->setText(tr("Remove breakpoint on all calls to %1").arg(label));
wMenu->addAction(mRemoveBreakpointOnAllApiCalls);
menu->addAction(mRemoveBreakpointOnAllApiCalls);
}
}
wMenu->addSeparator();
wMenu->addAction(mToggleBookmark);
menu->addSeparator();
menu->addAction(mToggleBookmark);
}
if(this->mCommands.size() > 0)
{
wMenu->addSeparator();
menu->addSeparator();
for(auto i = 0; i < this->mCommandTitles.size(); i++)
{
QAction* newCommandAction = new QAction(this->mCommandTitles.at(i), wMenu);
QAction* newCommandAction = new QAction(this->mCommandTitles.at(i), menu);
newCommandAction->setData(QVariant(mCommands.at(i)));
connect(newCommandAction, SIGNAL(triggered()), this, SLOT(referenceExecCommand()));
wMenu->addAction(newCommandAction);
menu->addAction(newCommandAction);
}
}
}
@ -292,30 +292,30 @@ void ReferenceView::setBreakpointAt(int row, BPSetAction action)
if(!mCurList->getRowCount())
return;
QString addrText = mCurList->getCellContent(row, 0).toUtf8().constData();
duint wVA;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &wVA))
duint va = 0;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &va))
return;
if(!DbgMemIsValidReadPtr(wVA))
if(!DbgMemIsValidReadPtr(va))
return;
BPXTYPE wBpType = DbgGetBpxTypeAt(wVA);
QString wCmd;
BPXTYPE bpType = DbgGetBpxTypeAt(va);
QString cmd;
if((wBpType & bp_normal) == bp_normal)
if((bpType & bp_normal) == bp_normal)
{
if(action == Toggle || action == Remove)
wCmd = "bc " + ToPtrString(wVA);
cmd = "bc " + ToPtrString(va);
else if(action == Disable)
wCmd = "bpd " + ToPtrString(wVA);
cmd = "bpd " + ToPtrString(va);
else if(action == Enable)
wCmd = "bpe " + ToPtrString(wVA);
cmd = "bpe " + ToPtrString(va);
}
else if(wBpType == bp_none && (action == Toggle || action == Enable))
else if(bpType == bp_none && (action == Toggle || action == Enable))
{
wCmd = "bp " + ToPtrString(wVA);
cmd = "bp " + ToPtrString(va);
}
DbgCmdExecDirect(wCmd);
DbgCmdExecDirect(cmd);
}
void ReferenceView::toggleBreakpoint()
@ -384,17 +384,17 @@ void ReferenceView::toggleBookmark()
if(!mCurList->getRowCount())
return;
QString addrText = mCurList->getCellContent(mCurList->getInitialSelection(), 0);
duint wVA;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &wVA))
duint va = 0;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &va))
return;
if(!DbgMemIsValidReadPtr(wVA))
if(!DbgMemIsValidReadPtr(va))
return;
bool result;
if(DbgGetBookmarkAt(wVA))
result = DbgSetBookmarkAt(wVA, false);
if(DbgGetBookmarkAt(va))
result = DbgSetBookmarkAt(va, false);
else
result = DbgSetBookmarkAt(wVA, true);
result = DbgSetBookmarkAt(va, true);
if(!result)
SimpleErrorBox(this, tr("Error!"), tr("DbgSetBookmarkAt failed!"));
GuiUpdateAllViews();

View File

@ -26,7 +26,7 @@ public slots:
void setSingleSelection(int index, bool scroll);
void addCommand(QString title, QString command);
void referenceContextMenu(QMenu* wMenu);
void referenceContextMenu(QMenu* menu);
void followAddress();
void followDumpAddress();
void followApiAddress();

View File

@ -297,16 +297,16 @@ void SearchListView::clearFilter()
void SearchListView::listContextMenu(const QPoint & pos)
{
QMenu wMenu(this);
emit listContextMenuSignal(&wMenu);
wMenu.addSeparator();
wMenu.addAction(mSearchAction);
QMenu wCopyMenu(tr("&Copy"), this);
wCopyMenu.setIcon(DIcon("copy"));
mCurList->setupCopyMenu(&wCopyMenu);
if(wCopyMenu.actions().length())
wMenu.addMenu(&wCopyMenu);
wMenu.exec(mCurList->mapToGlobal(pos));
QMenu menu(this);
emit listContextMenuSignal(&menu);
menu.addSeparator();
menu.addAction(mSearchAction);
QMenu copyMenu(tr("&Copy"), this);
copyMenu.setIcon(DIcon("copy"));
mCurList->setupCopyMenu(&copyMenu);
if(copyMenu.actions().length())
menu.addMenu(&copyMenu);
menu.exec(mCurList->mapToGlobal(pos));
}
void SearchListView::doubleClickedSlot()

View File

@ -32,7 +32,7 @@ private slots:
signals:
void enterPressedSignal();
void listContextMenuSignal(QMenu* wMenu);
void listContextMenuSignal(QMenu* menu);
void emptySearchResult();
protected:

View File

@ -10,8 +10,7 @@ StdTable::StdTable(QWidget* parent) : AbstractStdTable(parent)
************************************************************************************/
bool StdTable::SortBy::AsText(const QString & a, const QString & b)
{
auto i = QString::compare(a, b);
return i < 0;
return QString::compare(a, b) < 0;
}
bool StdTable::SortBy::AsInt(const QString & a, const QString & b)

View File

@ -358,11 +358,11 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
char* text = (char*)param2;
if(!text || !parVA || !DbgIsDebugging())
return 0;
byte_t wBuffer[16];
if(!DbgMemRead(parVA, wBuffer, 16))
byte_t buffer[16];
if(!DbgMemRead(parVA, buffer, 16))
return 0;
QBeaEngine disasm(int(ConfigUint("Disassembler", "MaxModuleSize")));
Instruction_t instr = disasm.DisassembleAt(wBuffer, 16, 0, parVA);
QBeaEngine disasm(int(ConfigUint("Disassembler", "MaxModuleSize")), Bridge::getArch());
Instruction_t instr = disasm.DisassembleAt(buffer, 16, 0, parVA);
QString finalInstruction;
for(const auto & curToken : instr.tokens.tokens)
finalInstruction += curToken.text;

View File

@ -331,25 +331,25 @@ Instruction_t QBeaEngine::DecodeDataAt(const byte_t* data, duint size, duint ori
_tokenizer.TokenizeData(mnemonic, datastr, cap);
Instruction_t wInst;
wInst.instStr = mnemonic + " " + datastr;
wInst.dump = QByteArray((const char*)data, len);
wInst.rva = origInstRVA;
wInst.length = len;
wInst.branchType = Instruction_t::None;
wInst.branchDestination = 0;
wInst.tokens = cap;
wInst.prefixSize = 0;
wInst.opcodeSize = len;
wInst.group1Size = 0;
wInst.group2Size = 0;
wInst.group3Size = 0;
wInst.vectorElementType[0] = Zydis::VETDefault;
wInst.vectorElementType[1] = Zydis::VETDefault;
wInst.vectorElementType[2] = Zydis::VETDefault;
wInst.vectorElementType[3] = Zydis::VETDefault;
Instruction_t inst;
inst.instStr = mnemonic + " " + datastr;
inst.dump = QByteArray((const char*)data, len);
inst.rva = origInstRVA;
inst.length = len;
inst.branchType = Instruction_t::None;
inst.branchDestination = 0;
inst.tokens = cap;
inst.prefixSize = 0;
inst.opcodeSize = len;
inst.group1Size = 0;
inst.group2Size = 0;
inst.group3Size = 0;
inst.vectorElementType[0] = Zydis::VETDefault;
inst.vectorElementType[1] = Zydis::VETDefault;
inst.vectorElementType[2] = Zydis::VETDefault;
inst.vectorElementType[3] = Zydis::VETDefault;
return wInst;
return inst;
}
void QBeaEngine::UpdateDataInstructionMap()

View File

@ -138,12 +138,12 @@ retryFindWindow:
}
}
void AttachDialog::processListContextMenu(QMenu* wMenu)
void AttachDialog::processListContextMenu(QMenu* menu)
{
// Don't show menu options if nothing is listed
if(!mSearchListView->mCurList->getRowCount())
return;
wMenu->addAction(mAttachAction);
wMenu->addAction(mRefreshAction);
menu->addAction(mAttachAction);
menu->addAction(mRefreshAction);
}

View File

@ -23,7 +23,7 @@ private slots:
void on_btnAttach_clicked();
void on_btnFindWindow_clicked();
void refresh();
void processListContextMenu(QMenu* wMenu);
void processListContextMenu(QMenu* menu);
private:
Ui::AttachDialog* ui;

View File

@ -570,10 +570,10 @@ void BreakpointsView::tokenizerConfigUpdatedSlot()
void BreakpointsView::contextMenuSlot(const QPoint & pos)
{
QMenu wMenu(this);
mMenuBuilder->build(&wMenu);
if(!wMenu.actions().isEmpty())
wMenu.exec(mapToGlobal(pos));
QMenu menu(this);
mMenuBuilder->build(&menu);
if(!menu.actions().isEmpty())
menu.exec(mapToGlobal(pos));
}
void BreakpointsView::followBreakpointSlot()

View File

@ -120,12 +120,12 @@ void CPUArgumentWidget::refreshData()
mTable->reloadData();
}
static void configAction(QMenu & wMenu, const QIcon & icon, QAction* action, const QString & value, const QString & name)
static void configAction(QMenu & menu, const QIcon & icon, QAction* action, const QString & value, const QString & name)
{
action->setText(QApplication::translate("CPUArgumentWidget", "Follow %1 in %2").arg(value).arg(name));
action->setIcon(icon);
action->setObjectName(value);
wMenu.addAction(action);
menu.addAction(action);
}
void CPUArgumentWidget::contextMenuSlot(QPoint pos)
@ -136,7 +136,7 @@ void CPUArgumentWidget::contextMenuSlot(QPoint pos)
if(int(mArgumentValues.size()) <= selection)
return;
auto value = mArgumentValues[selection];
QMenu wMenu(this);
QMenu menu(this);
if(DbgMemIsValidReadPtr(value))
{
duint valueAddr;
@ -152,27 +152,27 @@ void CPUArgumentWidget::contextMenuSlot(QPoint pos)
return addr >= base && addr < base + size;
};
configAction(wMenu, DIcon(ArchValue("processor32", "processor64")), mFollowDisasm, valueText, tr("Disassembler"));
configAction(wMenu, DIcon("dump"), mFollowDump, valueText, tr("Dump"));
configAction(menu, DIcon(ArchValue("processor32", "processor64")), mFollowDisasm, valueText, tr("Disassembler"));
configAction(menu, DIcon("dump"), mFollowDump, valueText, tr("Dump"));
if(inStackRange(value))
configAction(wMenu, DIcon("stack"), mFollowStack, valueText, tr("Stack"));
configAction(menu, DIcon("stack"), mFollowStack, valueText, tr("Stack"));
if(DbgMemIsValidReadPtr(valueAddr))
{
configAction(wMenu, DIcon(ArchValue("processor32", "processor64")), mFollowAddrDisasm, valueAddrText, tr("Disassembler"));
configAction(wMenu, DIcon("dump"), mFollowDump, valueAddrText, tr("Dump"));
configAction(menu, DIcon(ArchValue("processor32", "processor64")), mFollowAddrDisasm, valueAddrText, tr("Disassembler"));
configAction(menu, DIcon("dump"), mFollowDump, valueAddrText, tr("Dump"));
if(inStackRange(valueAddr))
configAction(wMenu, DIcon("stack"), mFollowAddrStack, valueAddrText, tr("Stack"));
configAction(menu, DIcon("stack"), mFollowAddrStack, valueAddrText, tr("Stack"));
}
}
QMenu wCopyMenu(tr("&Copy"));
wCopyMenu.setIcon(DIcon("copy"));
mTable->setupCopyMenu(&wCopyMenu);
if(wCopyMenu.actions().length())
QMenu copyMenu(tr("&Copy"));
copyMenu.setIcon(DIcon("copy"));
mTable->setupCopyMenu(&copyMenu);
if(copyMenu.actions().length())
{
wMenu.addSeparator();
wMenu.addMenu(&wCopyMenu);
menu.addSeparator();
menu.addMenu(&copyMenu);
}
wMenu.exec(mTable->mapToGlobal(pos));
menu.exec(mTable->mapToGlobal(pos));
}
void CPUArgumentWidget::followDisasmSlot()

View File

@ -256,13 +256,13 @@ void CPUDisassembly::setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isRef
*/
void CPUDisassembly::contextMenuEvent(QContextMenuEvent* event)
{
QMenu wMenu(this);
QMenu menu(this);
if(!mHighlightContextMenu)
mMenuBuilder->build(&wMenu);
mMenuBuilder->build(&menu);
else if(mHighlightToken.text.length())
mHighlightMenuBuilder->build(&wMenu);
if(wMenu.actions().length())
wMenu.exec(event->globalPos());
mHighlightMenuBuilder->build(&menu);
if(menu.actions().length())
menu.exec(event->globalPos());
}
/************************************************************************************
@ -898,12 +898,12 @@ void CPUDisassembly::assembleSlot()
do
{
dsint wRVA = getInitialSelection();
duint wVA = rvaToVa(wRVA);
unfold(wRVA);
QString addr_text = ToPtrString(wVA);
dsint rva = getInitialSelection();
duint va = rvaToVa(rva);
unfold(rva);
QString addr_text = ToPtrString(va);
Instruction_t instr = this->DisassembleAt(wRVA);
Instruction_t instr = this->DisassembleAt(rva);
QString actual_inst = instr.instStr;

File diff suppressed because it is too large Load Diff

View File

@ -17,9 +17,9 @@ public:
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
void setupContextMenu();
void getAttention();
void contextMenuEvent(QContextMenuEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void contextMenuEvent(QContextMenuEvent* event) override;
void mouseDoubleClickEvent(QMouseEvent* event) override;
void mouseMoveEvent(QMouseEvent* event) override;
signals:
void displayReferencesWidget();

View File

@ -26,7 +26,7 @@ CPUInfoBox::CPUInfoBox(QWidget* parent) : StdTable(parent)
connect(Bridge::getBridge(), SIGNAL(addInfoLine(QString)), this, SLOT(addInfoLine(QString)));
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
connect(this, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));
curAddr = 0;
mCurAddr = 0;
// Deselect any row (visual reasons only)
setSingleSelection(-1);
@ -148,11 +148,11 @@ QString CPUInfoBox::formatSSEOperand(const QByteArray & data, unsigned char vect
return hex;
}
void CPUInfoBox::disasmSelectionChanged(dsint parVA)
void CPUInfoBox::disasmSelectionChanged(duint parVA)
{
curAddr = parVA;
curRva = -1;
curOffset = -1;
mCurAddr = parVA;
mCurRva = -1;
mCurOffset = -1;
if(!DbgIsDebugging() || !DbgMemIsValidReadPtr(parVA))
return;
@ -163,10 +163,10 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
setCellContent(1, 0, "");
setCellContent(2, 0, "");
Instruction_t wInst;
Instruction_t inst;
unsigned char instructiondata[MAX_DISASM_BUFFER];
DbgMemRead(parVA, &instructiondata, MAX_DISASM_BUFFER);
wInst = mDisasm->DisassembleAt(instructiondata, MAX_DISASM_BUFFER, 0, parVA);
inst = mDisasm->DisassembleAt(instructiondata, MAX_DISASM_BUFFER, 0, parVA);
DISASM_INSTR instr; //Fix me: these disasm methods are so messy
DbgDisasmAt(parVA, &instr);
BASIC_INSTRUCTION_INFO basicinfo;
@ -174,7 +174,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
int start = 0;
bool commentThis = !ConfigBool("Disassembler", "OnlyCipAutoComments") || parVA == DbgValFromString("cip");
if(wInst.branchType == Instruction_t::Conditional && commentThis) //jump
if(inst.branchType == Instruction_t::Conditional && commentThis) //jump
{
bool taken = DbgIsJumpGoingToExecute(parVA);
if(taken)
@ -262,7 +262,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
{
setInfoLine(j, sizeName + "[" + argMnemonic + "]=???");
}
else if(knownsize && wInst.vectorElementType[i] == Zydis::VETDefault) // MOVSD/MOVSS instruction
else if(knownsize && inst.vectorElementType[i] == Zydis::VETDefault) // MOVSD/MOVSS instruction
{
QString addrText = getSymbolicNameStr(arg.memvalue);
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + addrText);
@ -274,7 +274,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
memset(data.data(), 0, data.size());
if(DbgMemRead(arg.value, data.data(), data.size()))
{
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + formatSSEOperand(data, wInst.vectorElementType[i]));
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + formatSSEOperand(data, inst.vectorElementType[i]));
}
else
{
@ -315,72 +315,72 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
REGDUMP registers;
DbgGetRegDumpEx(&registers, sizeof(registers));
if(mnemonic == "xmm0")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[0], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[0], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm1")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[1], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[1], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm2")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[2], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[2], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm3")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[3], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[3], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm4")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[4], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[4], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm5")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[5], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[5], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm6")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[6], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[6], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm7")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[7], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[7], 16), inst.vectorElementType[i]);
#ifdef _WIN64
else if(mnemonic == "xmm8")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[8], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[8], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm9")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[9], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[9], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm10")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[10], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[10], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm11")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[11], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[11], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm12")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[12], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[12], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm13")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[13], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[13], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm14")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[14], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[14], 16), inst.vectorElementType[i]);
else if(mnemonic == "xmm15")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[15], 16), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.XmmRegisters[15], 16), inst.vectorElementType[i]);
#endif //_WIN64
else if(mnemonic == "ymm0")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[0], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[0], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm1")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[1], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[1], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm2")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[2], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[2], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm3")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[3], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[3], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm4")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[4], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[4], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm5")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[5], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[5], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm6")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[6], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[6], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm7")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[7], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[7], 32), inst.vectorElementType[i]);
#ifdef _WIN64
else if(mnemonic == "ymm8")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[8], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[8], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm9")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[9], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[9], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm10")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[10], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[10], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm11")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[11], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[11], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm12")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[12], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[12], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm13")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[13], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[13], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm14")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[14], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[14], 32), inst.vectorElementType[i]);
else if(mnemonic == "ymm15")
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[15], 32), wInst.vectorElementType[i]);
valText = formatSSEOperand(QByteArray((const char*)&registers.regcontext.YmmRegisters[15], 32), inst.vectorElementType[i]);
#endif //_WIN64
else if(mnemonic == "st0")
valText = ToLongDoubleString(&registers.x87FPURegisters[registers.x87StatusWordFields.TOP & 7]);
@ -498,13 +498,13 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
info += " " + QString(mod);
// Module RVA
curRva = parVA - modbase;
mCurRva = parVA - modbase;
if(modbase)
info += QString(":$%1").arg(ToHexString(curRva));
info += QString(":$%1").arg(ToHexString(mCurRva));
// File offset
curOffset = DbgFunctions()->VaToFileOffset(parVA);
info += QString(" #%1").arg(ToHexString(curOffset));
mCurOffset = DbgFunctions()->VaToFileOffset(parVA);
info += QString(" #%1").arg(ToHexString(mCurOffset));
}
// Function/label name
@ -554,13 +554,13 @@ void CPUInfoBox::modifySlot()
{
duint addrVal = 0;
DbgFunctions()->ValFromString(action->objectName().toUtf8().constData(), &addrVal);
WordEditDialog wEditDialog(this);
WordEditDialog editDialog(this);
dsint value = 0;
DbgMemRead(addrVal, &value, sizeof(dsint));
wEditDialog.setup(tr("Modify Value"), value, sizeof(dsint));
if(wEditDialog.exec() != QDialog::Accepted)
editDialog.setup(tr("Modify Value"), value, sizeof(dsint));
if(editDialog.exec() != QDialog::Accepted)
return;
value = wEditDialog.getVal();
value = editDialog.getVal();
DbgMemWrite(addrVal, &value, sizeof(dsint));
GuiUpdateAllViews();
}
@ -572,7 +572,7 @@ void CPUInfoBox::findXReferencesSlot()
return;
if(!mXrefDlg)
mXrefDlg = new XrefBrowseDialog(this);
mXrefDlg->setup(curAddr, [](duint address)
mXrefDlg->setup(mCurAddr, [](duint address)
{
DbgCmdExec(QString("disasm %1").arg(ToPtrString(address)));
});
@ -590,13 +590,13 @@ void CPUInfoBox::addModifyValueMenuItem(QMenu* menu, QString name, duint value)
connect(newAction, SIGNAL(triggered()), this, SLOT(modifySlot()));
}
void CPUInfoBox::setupModifyValueMenu(QMenu* menu, duint wVA)
void CPUInfoBox::setupModifyValueMenu(QMenu* menu, duint va)
{
menu->setIcon(DIcon("modify"));
//add follow actions
DISASM_INSTR instr;
DbgDisasmAt(wVA, &instr);
DbgDisasmAt(va, &instr);
for(int i = 0; i < instr.argcount; i++)
{
@ -650,17 +650,17 @@ void CPUInfoBox::addFollowMenuItem(QMenu* menu, QString name, duint value)
/**
* @brief CPUInfoBox::setupFollowMenu Set up a follow menu.
* @param menu The menu to create
* @param wVA The selected VA
* @param va The selected VA