Esempio n. 1
0
        public HookHandle(IntPtr hookedFunc, IntPtr newFunc)
        {
            //byte[] NewIntro = new byte[] { 0xE9, 0x90, 0x90, 0x90, 0x90, 0xC3 };
            byte[] NewIntro = new byte[] { 0xE9, 0x90, 0x90, 0x90, 0x90, 0xC3 };

            Array.Copy(BitConverter.GetBytes(newFunc.ToInt64() - hookedFunc.ToInt64() - 5), 0, NewIntro, 1, 4);

            byte[] OrigIntro;
            using (MemoryManagement.Protect(hookedFunc, NewIntro.Length, MemProtection.ExecReadWrite)) {
                OrigIntro = new byte[NewIntro.Length];
                Marshal.Copy(hookedFunc, OrigIntro, 0, OrigIntro.Length);
            }
            Init(hookedFunc, OrigIntro, NewIntro);
        }
Esempio n. 2
0
 void WriteIntro(byte[] Intro)
 {
     using (MemoryManagement.Protect(HookedFunc, Intro.Length, MemProtection.ExecReadWrite)) {
         Marshal.Copy(Intro, 0, HookedFunc, Intro.Length);
     }
 }