Ejemplo n.º 1
0
 // Token: 0x0600000B RID: 11 RVA: 0x00002AA0 File Offset: 0x00000CA0
 private static void LoadHooks()
 {
     MethodBase[] array = new MethodBase[]
     {
         typeof(PlayerLook).GetMethod("recoil", BindingFlags.Instance | BindingFlags.Public),
         typeof(PLook).GetMethod("recoil", BindingFlags.Instance | BindingFlags.Public)
     };
     //MethodBase[] array2 = new MethodBase[]
     //{
     //	typeof(PlayerLook).GetMethod("enableScope", BindingFlags.Instance | BindingFlags.Public),
     //	typeof(PLook).GetMethod("enableScope", BindingFlags.Instance | BindingFlags.Public)
     //};
     MethodBase[] array3 = new MethodBase[]
     {
         typeof(Player).GetMethod("askScreenshot", BindingFlags.Instance | BindingFlags.Public),
         typeof(HPlr).GetMethod("askScreenshot", BindingFlags.Instance | BindingFlags.Public)
     };
     MethodBase[] array4 = new MethodBase[]
     {
         typeof(SteamChannel).GetMethod("write", new Type[]
         {
             typeof(object)
         }),
         typeof(SChannel).GetMethod("write", new Type[]
         {
             typeof(object)
         })
     };
     //MethodUtil.Hook(array[0], array[1]);
     //MethodUtil.Hook(array2[0], array2[1]);
     MethodUtil.Hook(array4[0], array4[1]);
     //MethodUtil.Hook(array3[0], array3[1]);
 }
Ejemplo n.º 2
0
        // Token: 0x06000020 RID: 32 RVA: 0x0000336C File Offset: 0x0000156C
        internal unsafe static void Hook(MethodBase from, MethodBase to)
        {
            IntPtr address  = MethodUtil.GetAddress(from);
            IntPtr address2 = MethodUtil.GetAddress(to);

            if (IntPtr.Size == 8)
            {
                byte *ptr = (byte *)address.ToPointer();
                *     ptr = 73;
                ptr[1]             = 187;
                *(long *)(ptr + 2) = address2.ToInt64();
                ptr[10]            = 65;
                ptr[11]            = byte.MaxValue;
                ptr[12]            = 227;
                return;
            }
            if (IntPtr.Size == 4)
            {
                byte *ptr2 = (byte *)address.ToPointer();
                ptr2[1]             = 187;
                *(long *)(ptr2 + 2) = (long)address2.ToInt32();
                ptr2[11]            = byte.MaxValue;
                ptr2[12]            = 227;
            }
        }