Ejemplo n.º 1
0
 private void ReorderDataDirectories(DataDirectory[] directories)
 {
     // Definitely need work :D
     for (int i = 0; i < directories.Length; i++)
     {
         if (directories[i].TargetOffset.FileOffset != 0)
         {
             DataDirectory overlap = GetOverlappingDirectory(directories, directories[i]);
             while (overlap != null)
             {
                 directories[i].TargetOffset = Offset.FromFileOffset(overlap.TargetOffset.FileOffset + overlap.Size, Writer.OriginalAssembly);
                 overlap = GetOverlappingDirectory(directories, directories[i]);
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Disassembles the next instruction at the current offset.
        /// </summary>
        /// <returns></returns>
        public x86Instruction DisassembleNextInstruction()
        {
            x86Instruction newInstruction = new x86Instruction();

            newInstruction.Offset = Offset.FromFileOffset((uint)reader.BaseStream.Position, assembly);

            newInstruction.OpCode = RetrieveNextOpCode();
            ProcessVariableByteIndex(ref newInstruction.code);

            ProcessRegisterOperands(ref newInstruction);
            byte[] rawOperand = ReadRawOperand(newInstruction.OpCode);
            newInstruction.operandbytes = ASMGlobals.MergeBytes(newInstruction.operandbytes, rawOperand);
            ProcessOperandBytes(ref newInstruction);

            ProcessOverrideOperand(ref newInstruction);

            return(newInstruction);
        }
Ejemplo n.º 3
0
 private Operand CreateTargetOffset(uint offset, OperandType offsetType = OperandType.Normal)
 {
     return(new Operand(Offset.FromFileOffset(offset, assembly)));
 }