コード例 #1
0
        /// <summary>
        ///     Init the hook and set enabled to true
        /// </summary>
        private SignalEventHook()
        {
            Console.WriteLine("SignalEventHook loaded");
            // Pointer the delegate to our c# function
            _SignalEventDelegate = _EventSignalHook;
            // get PTR for our c# function
            var addrToDetour = Marshal.GetFunctionPointerForDelegate(_SignalEventDelegate);

            // Alloc space for the ASM part of our detour
            string[] asmCode =
            {
                SendOvers.EventSignal[0],
                SendOvers.EventSignal[1],
                SendOvers.EventSignal[2],
                SendOvers.EventSignal[3],
                SendOvers.EventSignal[4],
                SendOvers.EventSignal[5],
                SendOvers.EventSignal[6],
                SendOvers.EventSignal[7],
                SendOvers.EventSignal[8],
                SendOvers.EventSignal[9],
                SendOvers.EventSignal[10],
                SendOvers.EventSignal[11],
                SendOvers.EventSignal[12].Replace("[|addr|]","0x" + ((uint)addrToDetour).ToString("X")),
                SendOvers.EventSignal[13],
                SendOvers.EventSignal[14],
                SendOvers.EventSignal[15].Replace("[|addr|]","0x" + ((uint)(Offsets.Hooks.SignalEvent + 7)).ToString("X"))
            };
            // Inject the asm code which calls our c# function
            var codeCave = Memory.InjectAsm(asmCode, "EventSignalDetour");

            // set the jmp from WoWs code to my injected code
            Memory.InjectAsm((uint)Offsets.Hooks.SignalEvent, "jmp " + codeCave, "EventSignalDetourJmp");
        }
コード例 #2
0
        /// <summary>
        ///     Init the hook and set enabled to true
        /// </summary>
        private SignalEventHook()
        {
            Console.WriteLine("SignalEventHook loaded");
            // Pointer the delegate to our c# function
            _SignalEventDelegate = _EventSignalHook;
            // get PTR for our c# function
            var addrToDetour = Marshal.GetFunctionPointerForDelegate(_SignalEventDelegate);

            // Alloc space for the ASM part of our detour
            string[] asmCode =
            {
                "PUSH EBX",
                "PUSH ESI",
                "CALL 0x007040D0",
                "pushfd",
                "pushad",
                "mov EAX, EBP",
                "ADD EAX, 0x10",
                "push eax",
                "mov EAX, [EBP + 0xC]",
                "push EAX",
                "mov EDI, [EDI]",
                "push EDI",
                "call " + "0x" + ((uint)addrToDetour).ToString("X"),
                "popad",
                "popfd",
                "jmp " + "0x" + ((uint)(Offsets.Hooks.SignalEvent + 7)).ToString("X")
            };
            // Inject the asm code which calls our c# function
            var codeCave = Memory.InjectAsm(asmCode, "EventSignalDetour");

            // set the jmp from WoWs code to my injected code
            Memory.InjectAsm((uint)Offsets.Hooks.SignalEvent, "jmp " + codeCave, "EventSignalDetourJmp");
        }