mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 16:27:44 +01:00
revert only the required length of bytes
This commit is contained in:
parent
85bcf3c30f
commit
1d9d383348
1 changed files with 6 additions and 7 deletions
|
|
@ -169,15 +169,14 @@ namespace Dalamud.Hooking.Internal
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var snippet = originalBytes[0..i];
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
Log.Verbose($"Reverting hook at 0x{address.ToInt64():X}");
|
Log.Verbose($"Reverting hook at 0x{address.ToInt64():X} ({snippet.Length} bytes)");
|
||||||
fixed (byte* original = originalBytes)
|
MemoryHelper.ChangePermission(address, i, MemoryProtection.ExecuteReadWrite, out var oldPermissions);
|
||||||
{
|
MemoryHelper.WriteRaw(address, snippet);
|
||||||
MemoryHelper.ChangePermission(address, i, MemoryProtection.ExecuteReadWrite, out var oldPermissions);
|
MemoryHelper.ChangePermission(address, i, oldPermissions);
|
||||||
MemoryHelper.WriteRaw(address, originalBytes);
|
|
||||||
MemoryHelper.ChangePermission(address, i, oldPermissions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue