Esempio n. 1
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (_pinnedCodeArray != null)
     {
         _pinnedCodeArray.Dispose();
         _pinnedCodeArray = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Prepares a new disassembler instance for the code provided. The instructions can then be disassembled with a call to <see cref="Disassemble"/>. The base address used to resolve relative addresses should be provided in <paramref name="address"/>.
        /// </summary>
        /// <param name="code">The code to be disassembled</param>
        /// <param name="architecture">The target x86 instruction set architecture of the code (e.g. 64-bit, 32-bit or 16-bit).</param>
        /// <param name="address">The address of the first byte of code. This value is used to resolve relative addresses into absolute addresses while disassembling.</param>
        /// <param name="copyBinaryToInstruction">Keeps a copy of the binary code for the instruction. This will increase the memory usage for each instruction. This is necessary if planning on using the <see cref="Translators.Translator.IncludeBinary"/> option.</param>
        /// <param name="vendor">What vendor instructions to support during disassembly, default is Any. Other options are AMD or Intel.</param>
        public Disassembler(byte[] code, ArchitectureMode architecture, ulong address = 0x0, bool copyBinaryToInstruction = false, Vendor vendor = Vendor.Any)
        {
            this.Code = code;
            if (code != null)
            {
                _pinnedCodeArray = new AutoPinner(Code);
                this.CodePtr     = _pinnedCodeArray;
                this.CodeLength  = Code.Length;
            }
            this.Architecture            = architecture;
            this.Address                 = address;
            this.CopyBinaryToInstruction = copyBinaryToInstruction;
            this.Vendor = vendor;

            InitUdis86();
        }
Esempio n. 3
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (_pinnedCodeArray != null)
     {
         _pinnedCodeArray.Dispose();
         _pinnedCodeArray = null;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Prepares a new disassembler instance for the code provided. The instructions can then be disassembled with a call to <see cref="Disassemble"/>. The base address used to resolve relative addresses should be provided in <paramref name="address"/>.
        /// </summary>
        /// <param name="code">The code to be disassembled</param>
        /// <param name="architecture">The target x86 instruction set architecture of the code (e.g. 64-bit, 32-bit or 16-bit).</param>
        /// <param name="address">The address of the first byte of code. This value is used to resolve relative addresses into absolute addresses while disassembling.</param>
        /// <param name="copyBinaryToInstruction">Keeps a copy of the binary code for the instruction. This will increase the memory usage for each instruction. This is necessary if planning on using the <see cref="Translators.Translator.IncludeBinary"/> option.</param>
        /// <param name="vendor">What vendor instructions to support during disassembly, default is Any. Other options are AMD or Intel.</param>
        public Disassembler(byte[] code, ArchitectureMode architecture, ulong address = 0x0, bool copyBinaryToInstruction = false, Vendor vendor = Vendor.Any)
        {
            this.Code = code;
            if (code != null)
            {
                _pinnedCodeArray = new AutoPinner(Code);
                this.CodePtr = _pinnedCodeArray;
                this.CodeLength = Code.Length;
            }
            this.Architecture = architecture;
            this.Address = address;
            this.CopyBinaryToInstruction = copyBinaryToInstruction;
            this.Vendor = vendor;

            InitUdis86();
        }