mirror of https://github.com/x64dbg/TitanEngine
fix: ensure write-only breakpoints trigger on Copy-on-Write pages
- Replaced the implicit bit-shift logic with an explicit mapping to prevent the OS from silently duplicating pages via Copy-on-Write. - Added explicit cases for PAGE_WRITECOPY and PAGE_EXECUTE_WRITECOPY.
This commit is contained in:
parent
e6570203cc
commit
ebdc74d23b
|
|
@ -251,13 +251,17 @@ DWORD GetPageProtectionForMemoryBreakpoint(const MemoryBreakpointPageDetail & pa
|
|||
|
||||
if(page.writeBps > 0)
|
||||
{
|
||||
// Remove write access e.g. PAGE_EXECUTE_READWRITE => PAGE_EXECUTE
|
||||
// Remove write access (and copy-on-write) e.g. PAGE_EXECUTE_READWRITE => PAGE_EXECUTE
|
||||
DWORD dwBase = newProtect & 0xFF;
|
||||
switch(dwBase)
|
||||
{
|
||||
case PAGE_READWRITE:
|
||||
case PAGE_WRITECOPY:
|
||||
newProtect = (newProtect & 0xFFFFFF00) | PAGE_READONLY;
|
||||
break;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
newProtect = (newProtect & 0xFFFFFF00) | (dwBase >> 1);
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
newProtect = (newProtect & 0xFFFFFF00) | PAGE_EXECUTE_READ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue