コード例 #1
0
        /// <summary>
        /// Disassembles the given code
        /// </summary>
        /// <param name="generatedCode">The generated code</param>
        public static string Disassemble(IList<byte> generatedCode)
        {
            var strBuffer = new StringBuilder();
            var buffer = new UnmanagedBuffer(generatedCode.ToArray());

            var disasm = new Disasm();
            disasm.Archi = 64;

            int offset = 0;
            while (offset < generatedCode.Count)
            {
                disasm.EIP = new IntPtr(buffer.Ptr.ToInt64() + offset);
                int result = BeaEngine64.Disasm(disasm);

                if (result == (int)BeaConstants.SpecialInfo.UNKNOWN_OPCODE)
                {
                    break;
                }

                //strBuffer.AppendLine("0x" + offset.ToString("X") + " " + disasm.CompleteInstr);
                strBuffer.AppendLine(disasm.CompleteInstr);
                offset += result;
            }

            return strBuffer.ToString();
        }
コード例 #2
0
        /// <summary>
        /// Creates a new disassembler
        /// </summary>
        /// <param name="compilationData">The compilation data</param>
        public Disassembler(AbstractCompilationData compilationData)
        {
            this.compilationData = compilationData;

            this.codeBuffer = new UnmanagedBuffer(compilationData.Function.GeneratedCode.ToArray());
            this.disassembler = new Disasm();
            this.disassembler.Archi = 64;
            this.disassembler.EIP = new IntPtr(this.codeBuffer.Ptr.ToInt64());
        }
コード例 #3
0
ファイル: BeaEngine.cs プロジェクト: sergey-raevskiy/unwind
 public static int Disassemble(Disasm disasm)
 {
     return s_x64 ? BeaEngine64.Disasm(disasm) : BeaEngine32.Disasm(disasm);
 }