From 37da6af1c8390a8650ecc9407e4320383ddac6e2 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 10 Jul 2023 14:30:06 +0200 Subject: [PATCH] Fixed custom file loading crash. Closes https://github.com/Arctium/WoW-Launcher/issues/32 --- src/ModLoader.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ModLoader.cs b/src/ModLoader.cs index 7731adc..7f2240a 100644 --- a/src/ModLoader.cs +++ b/src/ModLoader.cs @@ -12,11 +12,11 @@ class ModLoader { var asm = new byte[] { - 0x85, 0xD2, 0x0F, 0x88, 0x72, 0xAF, 0xFF, 0xFF, 0x33, 0xC0, - 0x49, 0xB9, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, - 0x8D, 0x0C, 0x40, 0xC1, 0xE1, 0x02, 0x42, 0x39, 0x14, 0x09, - 0x74, 0x0C, 0xFF, 0xC0, 0x3D, 0xEF, 0xBE, 0xAD, 0xDE, 0x72, - 0xEB, 0x33, 0xC0, 0xC3, 0x4A, 0x8B, 0x44, 0x09, 0x04, 0xC3 + 0x85, 0xD2, 0x0F, 0x88, 0x72, 0xAF, 0xFF, 0xFF, 0x33, 0xC0, + 0x49, 0xB9, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, + 0x8D, 0x0C, 0x40, 0xC1, 0xE1, 0x02, 0x42, 0x39, 0x14, 0x09, + 0x74, 0x0C, 0xFF, 0xC0, 0x3D, 0xEF, 0xBE, 0xAD, 0xDE, 0x72, + 0xEB, 0x33, 0xC0, 0xC3, 0x4A, 0x8B, 0x44, 0x09, 0x04, 0xC3 }; var trampolineInjectAddress = NativeWindows.VirtualAllocEx(processHandle, IntPtr.Zero, (uint)asm.Length + 32, 0x00001000, (uint)MemProtection.ExecuteRead); @@ -44,7 +44,7 @@ class ModLoader Buffer.BlockCopy(BitConverter.GetBytes(idAlloc), 0, asm, 12, 8); // Calculate the jump address bytes. - var trampolineJmpAddress = (uint)(trampolineInjectAddress + asm.Length - (memory.BaseAddress + (int)trampolineInjectAddress + 2) - 6); + var trampolineJmpAddress = (uint)(trampolineInjectAddress + asm.Length - (trampolineInjectAddress + 2) - 6); // Copy trampoline bytes. Buffer.BlockCopy(BitConverter.GetBytes(trampolineJmpAddress), 0, asm, 4, 4);