1
0
Fork 0

GUI: added Binary->Paste (Ignore Size) in Disassembly/Stack

This commit is contained in:
Mr. eXoDia 2014-07-06 15:24:02 +02:00
parent 31454f35ba
commit 4712566802
5 changed files with 49 additions and 3 deletions

View File

@ -255,6 +255,11 @@ void CPUDisassembly::setupRightClickContextMenu()
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
// Labels
mSetLabel = new QAction("Label", this);
mSetLabel->setShortcutContext(Qt::WidgetShortcut);
@ -895,3 +900,19 @@ void CPUDisassembly::binaryPasteSlot()
mMemPage->write(patched.constData(), selStart, selSize);
GuiUpdateAllViews();
}
void CPUDisassembly::binaryPasteIgnoreSizeSlot()
{
HexEditDialog hexEdit(this);
int_t selStart = getSelectionStart();
int_t selSize = getSelectionEnd() - selStart + 1;
QClipboard *clipboard = QApplication::clipboard();
hexEdit.mHexEdit->setData(clipboard->text());
byte_t* data = new byte_t[selSize];
mMemPage->read(data, selStart, selSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
GuiUpdateAllViews();
}

View File

@ -63,6 +63,7 @@ public slots:
void binaryFillSlot();
void binaryCopySlot();
void binaryPasteSlot();
void binaryPasteIgnoreSizeSlot();
private:
@ -79,6 +80,7 @@ private:
QAction* mBinaryFillAction;
QAction* mBinaryCopyAction;
QAction* mBinaryPasteAction;
QAction* mBinaryPasteIgnoreSizeAction;
QAction* mToggleInt3BpAction;
QAction* mSetHwBpAction;
QAction* mClearHwBpAction;

View File

@ -108,8 +108,8 @@ void CPUDump::setupContextMenu()
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
//Binary->Paste
mBinaryPasteIgnoreSizeAction = new QAction("&Paste (Ignore Size)", this);
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
@ -1086,7 +1086,7 @@ void CPUDump::binaryPasteIgnoreSizeSlot()
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUDump::findPattern()

View File

@ -79,6 +79,11 @@ void CPUStack::setupContextMenu()
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
#ifdef _WIN64
mGotoSp = new QAction("Follow R&SP", this);
mGotoBp = new QAction("Follow R&BP", this);
@ -408,6 +413,22 @@ void CPUStack::binaryPasteSlot()
GuiUpdateAllViews();
}
void CPUStack::binaryPasteIgnoreSizeSlot()
{
HexEditDialog hexEdit(this);
int_t selStart = getSelectionStart();
int_t selSize = getSelectionEnd() - selStart + 1;
QClipboard *clipboard = QApplication::clipboard();
hexEdit.mHexEdit->setData(clipboard->text());
byte_t* data = new byte_t[selSize];
mMemPage->read(data, selStart, selSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
GuiUpdateAllViews();
}
void CPUStack::findPattern()
{
HexEditDialog hexEdit(this);

View File

@ -39,6 +39,7 @@ public slots:
void binaryCopySlot();
void binaryPasteSlot();
void findPattern();
void binaryPasteIgnoreSizeSlot();
private:
uint_t mCsp;
@ -48,6 +49,7 @@ private:
QAction* mBinaryFillAction;
QAction* mBinaryCopyAction;
QAction* mBinaryPasteAction;
QAction* mBinaryPasteIgnoreSizeAction;
QAction* mGotoSp;
QAction* mGotoBp;
QAction* mGotoExpression;