DisassembleNextInstruction() 공개 메소드

Disassembles the next instruction at the current offset.
public DisassembleNextInstruction ( ) : x86Instruction
리턴 x86Instruction
예제 #1
0
        /// <summary>
        /// Calculates and returns the size in bytes needed when replacing an instruction
        /// </summary>
        /// <param name="targetInstruction">The instruction to be replaced.</param>
        /// <param name="newSize">The new instruction's size.</param>
        /// <returns></returns>
        public int CalculateSpaceNeeded(x86Instruction targetInstruction, int newSize)
        {
            if (newSize <= targetInstruction.Size)
            {
                return(targetInstruction.Size);
            }

            int sizeNeeded = 0;

            uint currentOffset = targetInstruction.Offset.FileOffset;

            while (sizeNeeded < newSize)
            {
                disassembler.CurrentOffset = currentOffset;
                x86Instruction currentInstruction = disassembler.DisassembleNextInstruction();
                sizeNeeded    += currentInstruction.Size;
                currentOffset += (uint)currentInstruction.Size;
            }
            return(sizeNeeded);
        }