public void LongRelativeJump() { using var assembler = new Assembler.Assembler(); const int expectedResult = 42069; string[] customFunction = new string[] { $"{_use32}", $"mov {_eax}, {expectedResult}", $"ret" }; // Make target and source. var target = _highMemoryAllocator.Write(assembler.Assemble(customFunction)); var src = _lowAlloc.Allocate(100); // for our jump instruction // Assert original works. var tgtMethod = ReloadedHooks.Instance.CreateFunction <GetValueFunction>(target.ToSigned()); Assert.Equal(expectedResult, tgtMethod.GetWrapper()()); CurrentProcess.WriteRaw(src, Utilities.AssembleRelativeJump(src, target, Environment.Is64BitProcess)); // Call the code. var srcMethod = ReloadedHooks.Instance.CreateFunction <GetValueFunction>(src.ToSigned()); Assert.Equal(expectedResult, srcMethod.GetWrapper()()); }