public static IntPtr FollowRelJmp(IntPtr ptr) { while (true) { var dec = new InstructionDecoder(ptr); var e = dec.GetEnumerator(); e.MoveNext(); if (e.Current.Opcode != 0xE9) { break; } Debug.Assert(e.Current.Data != 0); ptr = ptr.Plus((int)e.Current.Data + 5); } return(ptr); }
public static IntPtr FindNearestOp(IntPtr ptr, int minOffset) { int len = 0; var dec = new InstructionDecoder(ptr); var e = dec.GetEnumerator(); while (len < minOffset) { e.MoveNext(); len += e.Current.Length; ptr = ptr.Plus(e.Current.Length); if (IsRelJmp(e.Current.Opcode)) { throw new NotImplementedException(); } } return(ptr); }