DBG: MemPatch/assemble dialog now show errors when unable to write memory
This commit is contained in:
parent
dc1cd2ebc1
commit
e19196781c
|
@ -68,14 +68,26 @@ bool assembleat(duint addr, const char* instruction, int* size, char* error, boo
|
|||
*size = destSize;
|
||||
|
||||
bool ret = MemPatch(addr, dest, destSize);
|
||||
if(ret && fillnop && nopsize)
|
||||
{
|
||||
if(size)
|
||||
*size += nopsize;
|
||||
|
||||
// Ignored if the memory patch for NOPs fail (although it should not)
|
||||
MemPatch(addr + destSize, nops, nopsize);
|
||||
if (ret)
|
||||
{
|
||||
if (fillnop && nopsize)
|
||||
{
|
||||
if (size)
|
||||
*size += nopsize;
|
||||
|
||||
// Ignored if the memory patch for NOPs fail (although it should not)
|
||||
MemPatch(addr + destSize, nops, nopsize);
|
||||
}
|
||||
|
||||
// Update GUI if any patching succeeded
|
||||
GuiUpdatePatches();
|
||||
}
|
||||
GuiUpdatePatches();
|
||||
return true;
|
||||
else
|
||||
{
|
||||
// Tell the user writing is blocked
|
||||
strcpy_s(error, MAX_ERROR_SIZE, "Error while writing process memory");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -297,10 +297,18 @@ bool MemPatch(duint BaseAddress, const void* Buffer, duint Size, duint* NumberOf
|
|||
return false;
|
||||
}
|
||||
|
||||
for(duint i = 0; i < Size; i++)
|
||||
PatchSet(BaseAddress + i, oldData()[i], ((const unsigned char*)Buffer)[i]);
|
||||
// Are we able to write on this page?
|
||||
if (MemWrite(BaseAddress, Buffer, Size, NumberOfBytesWritten))
|
||||
{
|
||||
for (duint i = 0; i < Size; i++)
|
||||
PatchSet(BaseAddress + i, oldData()[i], ((const unsigned char*)Buffer)[i]);
|
||||
|
||||
return MemWrite(BaseAddress, Buffer, Size, NumberOfBytesWritten);
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
||||
// Unable to write memory
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MemIsValidReadPtr(duint Address)
|
||||
|
|
|
@ -934,7 +934,7 @@ void CPUDisassembly::assembleAt()
|
|||
LineEditDialog mLineEdit(this);
|
||||
mLineEdit.setText(actual_inst);
|
||||
mLineEdit.setWindowTitle("Assemble at " + addr_text);
|
||||
mLineEdit.setCheckBoxText("&Fill with NOP's");
|
||||
mLineEdit.setCheckBoxText("&Fill with NOPs");
|
||||
mLineEdit.enableCheckBox(true);
|
||||
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FillNOPs"));
|
||||
if(mLineEdit.exec() != QDialog::Accepted)
|
||||
|
|
Loading…
Reference in New Issue