internal Patch(IntPtr address, byte[] patchWith, string name)
 {
     Name            = name;
     m_address       = address;
     m_patchBytes    = patchWith;
     m_originalBytes = HookMemory.Read(address, patchWith.Length);
 }
Example #2
0
        internal Detour(Delegate target, Delegate hook, string name)
        {
            Name             = name;
            m_targetDelegate = target;
            m_target         = Marshal.GetFunctionPointerForDelegate(target);
            m_hookDelegate   = hook;
            m_hook           = Marshal.GetFunctionPointerForDelegate(hook);

            //Orginal bytes
            m_orginal = new List <byte>();
            m_orginal.AddRange(HookMemory.Read(m_target, 6));

            //Detour bytes
            m_new = new List <byte> {
                0x68
            };
            byte[] tmp = BitConverter.GetBytes(m_hook.ToInt32());
            m_new.AddRange(tmp);
            m_new.Add(0xC3);
        }