예제 #1
0
        internal static IntPtr InjectAsm(string[] parInstructions, string parPatchName)
        {
            if (Asm == null)
            {
                Asm = new FasmNet();
            }
            Asm.Clear();
            Asm.AddLine("use32");
            foreach (var x in parInstructions)
            {
                Asm.AddLine(x);
            }

            var byteCode = new byte[0];

            try
            {
                byteCode = Asm.Assemble();
            }
            catch (FasmAssemblerException ex)
            {
                MessageBox.Show(
                    $"Error definition: {ex.ErrorCode}; Error code: {(int) ex.ErrorCode}; Error line: {ex.ErrorLine}; Error offset: {ex.ErrorOffset}; Mnemonics: {ex.Mnemonics}");
            }

            var start = Reader.Alloc(byteCode.Length);

            Asm.Clear();
            Asm.AddLine("use32");
            foreach (var x in parInstructions)
            {
                Asm.AddLine(x);
            }
            byteCode = Asm.Assemble(start);

            HookWardenMemScan.RemoveHack(start);
            HookWardenMemScan.RemoveHack(parPatchName);
            var originalBytes = Reader.ReadBytes(start, byteCode.Length);

            if (parPatchName != "")
            {
                var parHack = new Hack(start,
                                       byteCode,
                                       originalBytes, parPatchName);
                HookWardenMemScan.AddHack(parHack);
                parHack.Apply();
            }
            else
            {
                Reader.WriteBytes(start, byteCode);
            }
            return(start);
        }
예제 #2
0
        internal static void InjectAsm(uint parPtr, string parInstructions, string parPatchName)
        {
            Asm.Clear();
            Asm.AddLine("use32");
            Asm.AddLine(parInstructions);
            var start = new IntPtr(parPtr);

            byte[] byteCode;
            try
            {
                byteCode = Asm.Assemble(start);
            }
            catch (FasmAssemblerException ex)
            {
                MessageBox.Show(
                    $"Error definition: {ex.ErrorCode}; Error code: {(int) ex.ErrorCode}; Error line: {ex.ErrorLine}; Error offset: {ex.ErrorOffset}; Mnemonics: {ex.Mnemonics}");
                return;
            }

            HookWardenMemScan.RemoveHack(start);
            HookWardenMemScan.RemoveHack(parPatchName);
            var originalBytes = Reader.ReadBytes(start, byteCode.Length);

            if (parPatchName != "")
            {
                var parHack = new Hack(start,
                                       byteCode,
                                       originalBytes, parPatchName);
                HookWardenMemScan.AddHack(parHack);
                parHack.Apply();
            }
            else
            {
                Reader.WriteBytes(start, byteCode);
            }
        }
예제 #3
0
        internal static void Init()
        {
            if (Applied)
            {
                return;
            }
            //$"Initialising singletons".Log(LogFiles.InjectedLog, true);
            //App.Singleton.Initialise();

            //$"Hiding patches from warden".Log(LogFiles.InjectedLog, true);

            /*var DisableCollision1 = new Hack(Offsets.Hacks.DisableCollision1,
             *  new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 },
             *  "DisableCollision1");
             * HookWardenMemScan.AddHack(DisableCollision1);*/
            //DisableCollision1.Apply();
            // Ctm Patch
            var CtmPatch = new Hack(Offsets.Hacks.CtmPatch,
                                    new byte[] { 0x00, 0x00, 0x00, 0x00 }, "Ctm");

            HookWardenMemScan.AddHack(CtmPatch);
            //CtmPatch.Apply();
            // wallclimb hack yay :)
            //float wc = 0.5f;
            //Hack Wallclimb = new Hack(Hacks.Wallclimb, BitConverter.GetBytes(wc), "Wallclimb");
            //HookWardenMemScan.AddHack(Wallclimb);
            //Wallclimb.Apply();

            /*var DisableCollision3 = new Hack(Offsets.Hacks.DisableCollision3, new byte[] { 0xEB, 0x69 }, "DisableCollision3"); // new byte[] { 0xEB, 0x69 }
             * HookWardenMemScan.AddHack(DisableCollision3);
             * DisableCollision3.Apply();*/

            // Loot patch
            var LootPatch = new Hack(Offsets.Hacks.LootPatch, new byte[] { 0xEB }, "LootPatch");

            HookWardenMemScan.AddHack(LootPatch);
            LootPatch.Apply();

            var LootPatch2 = new Hack(Offsets.Hacks.LootPatch2, new byte[] { 0xEB }, "LootPatch2");

            HookWardenMemScan.AddHack(LootPatch2);
            LootPatch2.Apply();

            // Ctm Hide
            var CtmHide = new Hack(Offsets.Player.CtmState, new byte[] { 0x0, 0x0, 0x0, 0x0 },
                                   new byte[] { 0x0C, 0x00, 0x00, 0x00 },
                                   "CtmHideHack")
            {
                DynamicHide = true
            };

            HookWardenMemScan.AddHack(CtmHide);

            var CtmHideX = new Hack(Offsets.Player.CtmX, new byte[] { 0x0, 0x0, 0x0, 0x0 },
                                    new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackX")
            {
                DynamicHide = true
            };

            HookWardenMemScan.AddHack(CtmHideX);

            var CtmHideY = new Hack(Offsets.Player.CtmY, new byte[] { 0x0, 0x0, 0x0, 0x0 },
                                    new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackY")
            {
                DynamicHide = true
            };

            HookWardenMemScan.AddHack(CtmHideY);

            var CtmHideZ = new Hack(Offsets.Player.CtmZ, new byte[] { 0x0, 0x0, 0x0, 0x0 },
                                    new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackZ")
            {
                DynamicHide = true
            };

            HookWardenMemScan.AddHack(CtmHideZ);


            // Lua Unlock
            var LuaUnlock = new Hack(Offsets.Hacks.LuaUnlock, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 },
                                     "LuaUnlock");

            HookWardenMemScan.AddHack(LuaUnlock);
            LuaUnlock.Apply();

            //ErasePeHeader("Loader.dll");
            //UnlinkFromPeb("Loader.dll");

            SetupHideModules((IntPtr)Process.GetCurrentProcess().Id);

            Hacks.Instance.AntiCtmStutter = true;
            Applied = true;
        }