diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index f91b5b571..c191b3419 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -388,7 +388,7 @@ namespace Dalamud __result = (IntPtr)0xFFFFFFFF; } - //Log.Verbose($"Process.Handle // {__instance.ProcessName} // {__result:X}"); + // Log.Verbose($"Process.Handle // {__instance.ProcessName} // {__result:X}"); } private void ApplyProcessPatch() diff --git a/Dalamud/Hooking/Internal/HookManager.cs b/Dalamud/Hooking/Internal/HookManager.cs index e955b43a1..483a0e4af 100644 --- a/Dalamud/Hooking/Internal/HookManager.cs +++ b/Dalamud/Hooking/Internal/HookManager.cs @@ -169,15 +169,14 @@ namespace Dalamud.Hooking.Internal break; } + var snippet = originalBytes[0..i]; + if (i > 0) { - Log.Verbose($"Reverting hook at 0x{address.ToInt64():X}"); - fixed (byte* original = originalBytes) - { - MemoryHelper.ChangePermission(address, i, MemoryProtection.ExecuteReadWrite, out var oldPermissions); - MemoryHelper.WriteRaw(address, originalBytes); - MemoryHelper.ChangePermission(address, i, oldPermissions); - } + Log.Verbose($"Reverting hook at 0x{address.ToInt64():X} ({snippet.Length} bytes)"); + MemoryHelper.ChangePermission(address, i, MemoryProtection.ExecuteReadWrite, out var oldPermissions); + MemoryHelper.WriteRaw(address, snippet); + MemoryHelper.ChangePermission(address, i, oldPermissions); } } }