static void DoMagic(IntPtr handle, PacketTracer version) { // replace the instruction at version.Target with a jmp rel32 instruction // the goal is to skip all of the checks and warnings related to user profile changes unchecked { // calculate how far we need to jump // -5 because the jmp rel32 instruction is 5 bytes long uint dist = (uint)version.EndpointPtr.ToInt32() - (uint)version.TargetPtr.ToInt32() - 5u; WriteMemory(handle, version.TargetPtr, new byte[] { 0xE9, (byte)dist, (byte)(dist >> 8), (byte)(dist >> 16), (byte)(dist >> 24) } ); } }
static void DoMagic(IntPtr handle, PacketTracer version) { //replace the instruction at version.Target with a jmp rel32 instruction //the goal is to skip all of the checks and warnings related to user profile changes unchecked { //calculate how far we need to jump //-5 because the jmp rel32 instruction is 5 bytes long uint dist = (uint)version.EndpointPtr.ToInt32() - (uint)version.TargetPtr.ToInt32() - 5u; WriteMemory(handle, version.TargetPtr, new byte[] { 0xE9, (byte)dist, (byte)(dist >> 8), (byte)(dist >> 16), (byte)(dist >> 24) } ); } }