mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 00:07:49 +01:00
Merge pull request #542 from daemitus/hookManager
This commit is contained in:
commit
b0f2486215
2 changed files with 7 additions and 8 deletions
|
|
@ -388,7 +388,7 @@ namespace Dalamud
|
||||||
__result = (IntPtr)0xFFFFFFFF;
|
__result = (IntPtr)0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log.Verbose($"Process.Handle // {__instance.ProcessName} // {__result:X}");
|
// Log.Verbose($"Process.Handle // {__instance.ProcessName} // {__result:X}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyProcessPatch()
|
private void ApplyProcessPatch()
|
||||||
|
|
|
||||||
|
|
@ -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