Esempio n. 1
0
        internal Detour(Delegate target, Delegate hook, string name, MemoryBase memory)
        {
            _memory         = memory;
            Name            = name;
            _targetDelegate = target;
            _target         = Marshal.GetFunctionPointerForDelegate(target);
            _hookDelegate   = hook;
            _hook           = Marshal.GetFunctionPointerForDelegate(hook);

            //Store the orginal bytes
            _orginal = new List <byte>();
            _orginal.AddRange(memory.ReadBytes(_target, 6));

            //Setup the detour bytes
            _new = new List <byte> {
                0x68
            };
            var tmp = BitConverter.GetBytes(_hook.ToInt32());

            _new.AddRange(tmp);
            _new.Add(0xC3);

            var parHack = new Hack(_target, _orginal.ToArray(), _new.ToArray(), Name);

            HookWardenMemScan.AddHack(parHack);
        }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Patch" /> class.
 /// </summary>
 /// <param name="address">The address where the patch is located in Memory.</param>
 /// <param name="patchWith">The bytes to be written.</param>
 /// <param name="name">The name that represents the current instance.</param>
 /// <param name="memoryBase">The <see cref="MemoryManagement.MemoryBase" /> reference.</param>
 public Patch(IntPtr address, byte[] patchWith, string name, MemoryBase memoryBase)
 {
     Name          = name;
     MemoryBase    = memoryBase;
     Address       = address;
     PatchBytes    = patchWith;
     OriginalBytes = memoryBase.ReadBytes(address, patchWith.Length);
 }
Esempio n. 3
0
 internal Patch(IntPtr address, byte[] patchWith, string name, MemoryBase memory)
 {
     Name           = name;
     _memory        = memory;
     _address       = address;
     _patchBytes    = patchWith;
     _originalBytes = _memory.ReadBytes(address, patchWith.Length);
 }
Esempio n. 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Patch" /> class.
 /// </summary>
 /// <param name="address">The address where the patch is located in Memory.</param>
 /// <param name="patchWith">The bytes to be written.</param>
 /// <param name="name">The name that represents the current instance.</param>
 /// <param name="memoryBase">The <see cref="MemoryManagement.MemoryBase" /> reference.</param>
 public Patch(IntPtr address, byte[] patchWith, string name, MemoryBase memoryBase)
 {
     Name = name;
     MemoryBase = memoryBase;
     Address = address;
     PatchBytes = patchWith;
     OriginalBytes = memoryBase.ReadBytes(address, patchWith.Length);
 }
Esempio n. 5
0
        internal Detour(Delegate target, Delegate hook, string name, MemoryBase memory)
        {
            _memory         = memory;
            Name            = name;
            _targetDelegate = target;
            _target         = (uint)Marshal.GetFunctionPointerForDelegate(target);
            _hookDelegate   = hook;
            _hook           = Marshal.GetFunctionPointerForDelegate(hook);

            //Store the orginal bytes
            _orginal = new List <byte>();
            _orginal.AddRange(memory.ReadBytes(_target, 6));

            //Setup the detour bytes
            _new = new List <byte> {
                0x68
            };
            byte[] tmp = BitConverter.GetBytes(_hook.ToInt32());
            _new.AddRange(tmp);
            _new.Add(0xC3);
        }
Esempio n. 6
0
 /// <summary>
 ///     States if the Patch is enabled.
 /// </summary>
 /// <returns>
 ///     <c>true</c>
 ///     if this instance is enabled; otherwise, <c>false</c>
 ///     .
 /// </returns>
 public bool CheckIfEnabled()
 {
     return(MemoryBase.ReadBytes(Address, PatchBytes.Length).SequenceEqual(PatchBytes));
 }