Buffer containing raw binary code to be disassembled
Address of the first instruction in given raw code buffer
Number of instructions to be disassembled, or 0 to get all of them
The successfully disassembled instructions
1 auto CODE = cast(ubyte[])"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x00\x91\x92"; 2 auto cs = new CapstoneX86(ModeFlags(Mode.bit32)); // Initialise x86 32bit engine 3 auto res = cs.disasm(CODE, 0x1000); // Disassemble, offsetting addresses by 0x1000 4 assert("%s %s".format(res[0].mnemonic, res[0].opStr) == "lea ecx, dword ptr [edx + esi + 8]"); 5 assert("%s %s".format(res[1].mnemonic, res[1].opStr) == "add eax, ebx"); 6 assert("%s %s".format(res[2].mnemonic, res[2].opStr) == "add esi, 0x1234");
Disassemble binary code, given the code buffer, start address and number of instructions to be decoded