示例#1
0
文件: Program.cs 项目: StrixG/MTAEir
        //--------

        static void TestNonStaticMethodHook()
        {
            SampleClass cls = new SampleClass();

            object o = cHook.Hook(typeof(SampleClass), "Call", new Type[] { typeof(string), typeof(string) },
                                  typeof(MySampleClass), "Call", new Type[] { typeof(string), typeof(string) });

            cls.Call("Non-Static Method Hook\r\rThis should be hooked", "HookTest");
            cHook.Unhook(o);

            cls.Call("Non-Static Method Hook\r\rThis should NOT be hooked", "HookTest");

            //find the method we want to hook
            //replace with our method. REMEMBER THAT FUNCTION SIGNATURE MUST MATCH!!
        }
示例#2
0
文件: Program.cs 项目: StrixG/MTAEir
            public DialogResult Call(string text, string caption)
            {
                SampleClass _this = (object)this as SampleClass;

                return(_this.Call(text, "HOOKED!!!"));
            }
示例#3
0
        //--------
        static void TestNonStaticMethodHook()
        {
            SampleClass cls = new SampleClass();

            object o = cHook.Hook(typeof(SampleClass), "Call", new Type[] { typeof(string), typeof(string) },
                                  typeof(MySampleClass), "Call", new Type[] { typeof(string), typeof(string) });
            cls.Call("Non-Static Method Hook\r\rThis should be hooked", "HookTest");
            cHook.Unhook(o);

            cls.Call("Non-Static Method Hook\r\rThis should NOT be hooked", "HookTest");

            //find the method we want to hook
            //replace with our method. REMEMBER THAT FUNCTION SIGNATURE MUST MATCH!!
        }