mirror of https://github.com/x64dbg/GleeBug
void Debugger::exceptionGuardPage(const EXCEPTION_RECORD & exceptionRecord, bool firstChance)
>_> with spaces.
This commit is contained in:
parent
642fe75742
commit
b57b716449
|
|
@ -172,11 +172,9 @@ namespace GleeBug
|
||||||
|
|
||||||
void Debugger::exceptionGuardPage(const EXCEPTION_RECORD & exceptionRecord, bool firstChance)
|
void Debugger::exceptionGuardPage(const EXCEPTION_RECORD & exceptionRecord, bool firstChance)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* old code ~Duncan~
|
/* old code ~Duncan~
|
||||||
char error[128] = "";
|
char error[128] = "";
|
||||||
auto exceptionAddress = ptr(exceptionRecord.ExceptionInformation[1]);
|
auto exceptionAddress = ptr(exceptionRecord.ExceptionInformation[1]);
|
||||||
|
|
||||||
//check if the exception address is directly in the range of a memory breakpoint
|
//check if the exception address is directly in the range of a memory breakpoint
|
||||||
auto foundRange = mProcess->memoryBreakpointRanges.find(Range(exceptionAddress, exceptionAddress));
|
auto foundRange = mProcess->memoryBreakpointRanges.find(Range(exceptionAddress, exceptionAddress));
|
||||||
if (foundRange == mProcess->memoryBreakpointRanges.end())
|
if (foundRange == mProcess->memoryBreakpointRanges.end())
|
||||||
|
|
@ -196,7 +194,6 @@ namespace GleeBug
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//find the breakpoint associated with the hit breakpoint range
|
//find the breakpoint associated with the hit breakpoint range
|
||||||
auto foundInfo = mProcess->breakpoints.find({ BreakpointType::Memory, foundRange->first });
|
auto foundInfo = mProcess->breakpoints.find({ BreakpointType::Memory, foundRange->first });
|
||||||
if (foundInfo == mProcess->breakpoints.end())
|
if (foundInfo == mProcess->breakpoints.end())
|
||||||
|
|
@ -205,22 +202,17 @@ namespace GleeBug
|
||||||
cbInternalError(error);
|
cbInternalError(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the memory breakpoint is disabled (meaning we shouldn't intercept the exception)
|
//check if the memory breakpoint is disabled (meaning we shouldn't intercept the exception)
|
||||||
//TODO: think about what happens with multiple breakpoints in one page where only one is disabled
|
//TODO: think about what happens with multiple breakpoints in one page where only one is disabled
|
||||||
const auto info = foundInfo->second;
|
const auto info = foundInfo->second;
|
||||||
if (!info.enabled)
|
if (!info.enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("memory breakpoint: 0x%p (size: %d)\n", info.address, info.internal.memory.size);
|
printf("memory breakpoint: 0x%p (size: %d)\n", info.address, info.internal.memory.size);
|
||||||
|
|
||||||
//TODO: check if the right type is accessed (ExceptionInformation[0])
|
//TODO: check if the right type is accessed (ExceptionInformation[0])
|
||||||
//TODO: execute the user callback (if present)
|
//TODO: execute the user callback (if present)
|
||||||
//TODO: single step and restore page protection
|
//TODO: single step and restore page protection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//New code ~Marques~
|
//New code ~Marques~
|
||||||
|
|
||||||
/* 0xcc breakpoing
|
/* 0xcc breakpoing
|
||||||
mThread->StepInternal(std::bind([this, info]()
|
mThread->StepInternal(std::bind([this, info]()
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +220,6 @@ namespace GleeBug
|
||||||
if (mProcess->breakpoints.find({ BreakpointType::Software, info.address }) != mProcess->breakpoints.end())
|
if (mProcess->breakpoints.find({ BreakpointType::Software, info.address }) != mProcess->breakpoints.end())
|
||||||
mProcess->MemWriteUnsafe(info.address, info.internal.software.newbytes, info.internal.software.size);
|
mProcess->MemWriteUnsafe(info.address, info.internal.software.newbytes, info.internal.software.size);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char error[128] = "";
|
char error[128] = "";
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,8 @@ namespace GleeBug
|
||||||
if (data.Refcount)
|
if (data.Refcount)
|
||||||
{
|
{
|
||||||
//TODO: properly determine the new protection flag
|
//TODO: properly determine the new protection flag
|
||||||
|
//Are there any other protections left?
|
||||||
|
//If so add the guard
|
||||||
if (data.Type & ~uint32(info.internal.memory.type))
|
if (data.Type & ~uint32(info.internal.memory.type))
|
||||||
data.NewProtect = data.OldProtect | PAGE_GUARD;
|
data.NewProtect = data.OldProtect | PAGE_GUARD;
|
||||||
Protect = data.NewProtect;
|
Protect = data.NewProtect;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue