fork(2) download
  1. #include <capstone.h>
  2. #include <iostream>
  3.  
  4. #define g_DisasmCode "\x55\x48\x8b\x05\xb8\x13\x00\x00"
  5.  
  6. int main(int, char**)
  7. {
  8. csh handle;
  9. cs_insn *insn;
  10. size_t count;
  11.  
  12. // Ignore the architecture and mode, they are correct i just changed
  13. // the names
  14. if(cs_open(ArchX86, Mode32, &handle) != CS_ERR_OK)
  15. return -1;
  16. count = cs_disasm(handle, (uint8_t*)g_DisasmCode, sizeof(g_DisasmCode) - 1, 0x1000, 0, &insn);
  17. if(count > 0)
  18. {
  19. size_t j;
  20. for(j = 0; j < count; j++)
  21. {
  22. printf("%i:\t%s\t\t%s\n", insn[j].size, insn[j].mnemonic,
  23. insn[j].op_str);
  24.  
  25. }
  26.  
  27. cs_free(insn, count);
  28.  
  29. }
  30. else
  31. printf("ERROR: Failed to disassemble given code!\n");
  32.  
  33. cs_close(&handle);
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:22: fatal error: capstone.h: No such file or directory
compilation terminated.
stdout
Standard output is empty