Skip to main content

Class Unhooker

A class which stores a copy of the bytes at a location which will be hooked in the future, such that those bytes can be restored later to "unhook" the function.

Assembly: Dalamud.dll
View Source
Declaration
public class Unhooker

Methods

TrimAfterHook()

When called after a hook is created, checks the pre-hook original bytes and post-hook modified bytes, trimming the original bytes stored and removing unmodified bytes from the end of the byte sequence. Assuming no concurrent actions modified the same address space, this should result in storing only the minimum bytes required to unhook the function.

View Source
Declaration
public void TrimAfterHook()

Unhook()

Attempts to unhook the function by replacing the hooked bytes with the original bytes. If Dalamud.Hooking.Internal.Unhooker.TrimAfterHook() was called, the trimmed original bytes stored at that time will be used for unhooking. Otherwise, a naive algorithm which only restores bytes until the first unchanged byte will be used in order to avoid overwriting adjacent data.

View Source
Declaration
public void Unhook()