Exemplo n.º 1
0
        // 한 번만 한다
        static NativeThisPointer()
        {
            NativeThisPointer instance = new NativeThisPointer();
            Type me = instance.GetType();

            RuntimeMethodHandle handle = me.GetMethod(nameof(ReplacedTest), Helper.mflag1).MethodHandle;

            RuntimeHelpers.PrepareMethod(handle);
            Helper.ReplaceMethod(me.GetMethod(nameof(GetTest), Helper.mflag0), handle.GetFunctionPointer());

            instance.GetTest(magic, magic);
        }
Exemplo n.º 2
0
 private static void ReplacedTest(NativeThisPointer instance, IntPtr ptr, IntPtr t1, IntPtr t2) =>
 hasThisPtr = t1 == t2 && t1 == magic;