Skip to content

Commit

Permalink
Relax INT3 check in method hooking
Browse files Browse the repository at this point in the history
  • Loading branch information
gix committed Apr 10, 2022
1 parent b806a53 commit 384364a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/PresentationTheme.Aero/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,10 @@ private static MemoryPatch PatchMemory(IntPtr address, byte[] instructions)
{
var backup = new byte[instructions.Length];
Marshal.Copy(address, backup, 0, backup.Length);
if (backup.Any(x => x == 0xCC))
if (backup[0] == 0xCC) {
throw new InvalidOperationException(
"Refusing to patch memory due to breakpoints/INT3 in target memory.");
"Refusing to patch memory due to breakpoint/INT3 in target memory.");
}

WriteMemory(address, instructions);
return new MemoryPatch(address, backup);
Expand Down

0 comments on commit 384364a

Please sign in to comment.