/// <summary> /// Disassembles bytes to a collection of assembly instructions. /// </summary> /// <param name="rawStartOffset">The starting offset</param> /// <param name="length">The length. This value is overwritten when the last instruction's bounds are outside of the bounds.</param> /// <returns></returns> public InstructionCollection Disassemble(long rawStartOffset, long length) { image.SetOffset(rawStartOffset); InstructionCollection instructions = new InstructionCollection(); image.reader.BaseStream.Position = rawStartOffset; long offset = rawStartOffset; while (image.stream.Position < rawStartOffset + length) { x86Instruction instruction = DisassembleNextInstruction(); instructions.Add(instruction); offset += rawStartOffset + instruction.Size; image.SetOffset(offset); } // reader.Dispose(); return instructions; }
/// <summary> /// Creates a new instance of the ReadingFinishedEventArgs containing the parsed instructions. /// </summary> /// <param name="instructions">The instructions the assembly has read.</param> public ReadingFinishedEventArgs(InstructionCollection instructions) { instr = instructions; }
private void Form1_Load(object sender, EventArgs e) { InstructionCollection instructions = new InstructionCollection(); }
/// <summary> /// Disassembles bytes to a collection of assembly instructions. /// </summary> /// <param name="rawStartOffset">The starting offset</param> /// <param name="length">The length. This value is overwritten when the last instruction's bounds are outside of the bounds.</param> /// <returns></returns> public InstructionCollection Disassemble(long rawStartOffset, long length) { reader.BaseStream.Position = rawStartOffset; InstructionCollection instructions = new InstructionCollection(); long offset = rawStartOffset; long endOffset = rawStartOffset + length; while (reader.BaseStream.Position < endOffset) { x86Instruction instruction = DisassembleNextInstruction(); instructions.Add(instruction); offset += instruction.Size; reader.BaseStream.Position = offset; } // reader.Dispose(); return instructions; }