3 immutable(ubyte)[] CODE
= cast(immutable(ubyte)[])"\x55\x48\x8b\x05\xb8\x13\x00\x00";
10 if (cs_open(CS_ARCH_X86
, CS_MODE_32
, &handle
) != CS_ERR_OK
) assert(0, "can't initialize capstone");
11 scope(exit
) cs_close(&handle
);
13 count
= cs_disasm(handle
, CODE
.ptr
, CODE
.length
-1, 0x1000, 0, &insn
);
15 foreach (immutable j
; 0..count
) {
16 import core
.stdc
.stdio
: printf
;
17 printf("0x%08x: %-8s %s\n", cast(uint)insn
[j
].address
, insn
[j
].mnemonic
.ptr
, insn
[j
].op_str
.ptr
);
21 import core
.stdc
.stdio
: printf
;
22 printf("ERROR: Failed to disassemble given code!\n");