/// <summary> /// Assembles an absolute jump either from the end of the hook back, or to the hook. /// </summary> /// <param name="is64Bit">Set to true to assemble a 64bit jump, else 32bit.</param> /// <param name="jumpAddress">The address to jump to.</param> /// <returns>An bytes for an absolute jump back to the end of the hook.</returns> private byte[] AssembleJump(bool is64Bit, IntPtr jumpAddress) { return(is64Bit ? HookCommon.X64AssembleAbsoluteJump(jumpAddress, new X64ReloadedFunctionAttribute(X64CallingConventions.Microsoft)): HookCommon.X86AssembleAbsoluteJump(jumpAddress)); }
/// <summary> /// Assembles a dummy jump to an absolute address in order to get the length of an absolute jump under /// X86/X64. /// </summary> /// <param name="is64Bit">Set to true to calculate a 64bit absolute jump length.</param> /// <returns></returns> private int GetDefaultHookLength(bool is64Bit) { return(is64Bit ? HookCommon.X64AssembleAbsoluteJump((IntPtr)0x11223344, new X64ReloadedFunctionAttribute(X64CallingConventions.Microsoft)).Length : HookCommon.X86AssembleAbsoluteJump((IntPtr)0x11223344).Length); }