GUI: patch -> save to file is now working!
This commit is contained in:
parent
d9907a9fc8
commit
cc1a3125e9
|
@ -724,7 +724,7 @@ void CPUDisassembly::assembleAt()
|
||||||
return;
|
return;
|
||||||
Config()->setBool("Disassembler", "FillNOPs", mLineEdit.bChecked);
|
Config()->setBool("Disassembler", "FillNOPs", mLineEdit.bChecked);
|
||||||
|
|
||||||
char error[256]="";
|
char error[MAX_ERROR_SIZE]="";
|
||||||
if(!DbgFunctions()->AssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, mLineEdit.bChecked))
|
if(!DbgFunctions()->AssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, mLineEdit.bChecked))
|
||||||
{
|
{
|
||||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to assemble instruction \"" + mLineEdit.editText + "\" (" + error + ")");
|
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to assemble instruction \"" + mLineEdit.editText + "\" (" + error + ")");
|
||||||
|
|
|
@ -212,7 +212,7 @@ void MainWindow::loadMRUList(int maxItems)
|
||||||
char currentFile[MAX_PATH]="";
|
char currentFile[MAX_PATH]="";
|
||||||
if(!BridgeSettingGet("Recent Files", QString().sprintf("%.2d", i+1).toUtf8().constData(), currentFile))
|
if(!BridgeSettingGet("Recent Files", QString().sprintf("%.2d", i+1).toUtf8().constData(), currentFile))
|
||||||
break;
|
break;
|
||||||
if(QString(currentFile).size())
|
if(QString(currentFile).size() && QFile(currentFile).exists())
|
||||||
mMRUList.push_back(currentFile);
|
mMRUList.push_back(currentFile);
|
||||||
}
|
}
|
||||||
updateMRUMenu();
|
updateMRUMenu();
|
||||||
|
@ -223,7 +223,10 @@ void MainWindow::saveMRUList()
|
||||||
{
|
{
|
||||||
int mruSize=mMRUList.size();
|
int mruSize=mMRUList.size();
|
||||||
for(int i=0; i<mruSize; i++)
|
for(int i=0; i<mruSize; i++)
|
||||||
|
{
|
||||||
|
if(QFile(mMRUList.at(i)).exists())
|
||||||
BridgeSettingSet("Recent Files", QString().sprintf("%.2d", i+1).toUtf8().constData(), mMRUList.at(i).toUtf8().constData());
|
BridgeSettingSet("Recent Files", QString().sprintf("%.2d", i+1).toUtf8().constData(), mMRUList.at(i).toUtf8().constData());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addMRUEntry(QString entry)
|
void MainWindow::addMRUEntry(QString entry)
|
||||||
|
@ -453,15 +456,15 @@ void MainWindow::startScylla() //this is executed
|
||||||
void MainWindow::restartDebugging()
|
void MainWindow::restartDebugging()
|
||||||
{
|
{
|
||||||
char filename[MAX_SETTING_SIZE]="";
|
char filename[MAX_SETTING_SIZE]="";
|
||||||
if(!BridgeSettingGet("Recent Files", "01", filename)) //most recent file
|
if(!mMRUList.size())
|
||||||
return;
|
return;
|
||||||
|
strcpy(filename, mMRUList.at(0).toUtf8().constData());
|
||||||
if(DbgIsDebugging())
|
if(DbgIsDebugging())
|
||||||
{
|
{
|
||||||
DbgCmdExec("stop"); //close current file (when present)
|
DbgCmdExec("stop"); //close current file (when present)
|
||||||
Sleep(400);
|
Sleep(400);
|
||||||
}
|
}
|
||||||
QString cmd;
|
DbgCmdExec(QString().sprintf("init \"%s\"", filename).toUtf8().constData());
|
||||||
DbgCmdExec(cmd.sprintf("init \"%s\"", filename).toUtf8().constData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayBreakpointWidget()
|
void MainWindow::displayBreakpointWidget()
|
||||||
|
|
|
@ -411,17 +411,8 @@ void PatchDialog::on_btnPatchFile_clicked()
|
||||||
msg.exec();
|
msg.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int_t modBase=DbgFunctions()->ModBaseFromName(mod.toUtf8().constData());
|
|
||||||
if(!modBase)
|
|
||||||
{
|
|
||||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to get module base...");
|
|
||||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
|
||||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
|
||||||
msg.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
char szModName[MAX_PATH]="";
|
char szModName[MAX_PATH]="";
|
||||||
if(!GetModuleFileNameA((HMODULE)modBase, szModName, MAX_PATH))
|
if(!DbgFunctions()->ModPathFromAddr(DbgFunctions()->ModBaseFromName(mod.toUtf8().constData()), szModName, MAX_PATH))
|
||||||
{
|
{
|
||||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to get module filename...");
|
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to get module filename...");
|
||||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||||
|
@ -442,17 +433,20 @@ void PatchDialog::on_btnPatchFile_clicked()
|
||||||
|
|
||||||
//call patchSave function
|
//call patchSave function
|
||||||
DBGPATCHINFO* dbgPatchList = new DBGPATCHINFO[patchList.size()];
|
DBGPATCHINFO* dbgPatchList = new DBGPATCHINFO[patchList.size()];
|
||||||
bool patched=DbgFunctions()->PatchFile(dbgPatchList, patchList.size(), filename.toUtf8().constData());
|
for(int i=0; i<patchList.size(); i++)
|
||||||
|
dbgPatchList[i]=patchList.at(i);
|
||||||
|
char error[MAX_ERROR_SIZE]="";
|
||||||
|
int patched=DbgFunctions()->PatchFile(dbgPatchList, patchList.size(), filename.toUtf8().constData(), error);
|
||||||
delete [] dbgPatchList;
|
delete [] dbgPatchList;
|
||||||
if(!patched)
|
if(patched==-1)
|
||||||
{
|
{
|
||||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to save patched file...");
|
QMessageBox msg(QMessageBox::Critical, "Error!", QString("Failed to save patched file (" + QString(error) + ")"));
|
||||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||||
msg.exec();
|
msg.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMessageBox msg(QMessageBox::Information, "Information", "Patched file saved!");
|
QMessageBox msg(QMessageBox::Information, "Information", QString().sprintf("%d/%d patch(es) applied!", patched, patchList.size()));
|
||||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||||
msg.setParent(this, Qt::Dialog);
|
msg.setParent(this, Qt::Dialog);
|
||||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||||
|
|
Loading…
Reference in New Issue