Пример #1
0
        public virtual void Uninstall()
        {
            if (!isHooked)
            {
                return;
            }

            byte *pTarget = (byte *)_targetPtr.ToPointer();

            for (int i = 0; i < _headSize; i++)
            {
                *pTarget++ = _proxyPtr[i];
            }
            isHooked = false;
            HookerPool.RemoveHooker(_targetPtr);
        }
Пример #2
0
        //protected static readonly byte[] s_jmpBuffArm32 = new byte[] // 8 bytes
        //{
        //    0x04, 0xF0, 0x1F, 0xE5,                             // LDR PC, [PC, #-4]
        //    0x00, 0x00, 0x00, 0x00,                             // $val
        //};
        //protected static readonly byte[] s_jmpBuffArm64 = new byte[]
        //{
        //    0x04, 0xF0, 0x1F, 0xE5,                             // LDR PC, [PC, #-4]
        //    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     // $val
        //};

        protected void Install()
        {
            if (NativeAPI.IsiOS()) // iOS 不支持修改 code 所在区域 page
            {
                return;
            }

            if (isHooked)
            {
                return;
            }

            HookerPool.AddHooker(_targetPtr, this);

            BackupHeader();
            PatchTargetMethod();
            PatchProxyMethod();
            UnityEngine.Debug.Log("installed");
            isHooked = true;
        }