コード例 #1
0
ファイル: Disassembler.cs プロジェクト: RajKumarPandey/Squalr
 /// <summary>
 /// Dispose managed objects.
 /// </summary>
 public void Dispose()
 {
     if (this.pinnedCodeArray != null)
     {
         this.pinnedCodeArray.Dispose();
         this.pinnedCodeArray = null;
     }
 }
コード例 #2
0
ファイル: Disassembler.cs プロジェクト: RajKumarPandey/Squalr
        /// <summary>
        /// Initializes a new instance of the <see cref="Disassembler" /> class. 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 = true, Vendor vendor = Vendor.Any)
        {
            this.code                    = code;
            this.Architecture            = architecture;
            this.Address                 = address;
            this.CopyBinaryToInstruction = copyBinaryToInstruction;
            this.Vendor                  = vendor;

            if (code != null)
            {
                this.pinnedCodeArray = new AutoPinner(this.code);
                this.codePtr         = this.pinnedCodeArray;
                this.codeLength      = this.code.Length;
            }

            Translator = new IntelTranslator();
            this.InitUdis86();
        }