capstone
capstone copied to clipboard
cs_open problem
cs_open not initial success every times .
Could you please provide a minimal example to run. With the output you expect and what the actual behavior is.
error code 4,but i'm32gb dram .memory enough correct platform
#include <stdio.h>
#include <inttypes.h>
#include<capstone.h>
#pragma comment(lib,"capstone.lib")
int main(int argc, char* argv[])
{
auto buffer = "\x55\x8b\xec\x81\xec\x24\x03\x00\x00\x6a\x17\x90\x90\x90";
csh handle;
cs_insn* insn;
size_t count;
int size = 14;
printf("By: LyShark \n\n");
if (cs_open(CS_ARCH_X86, CS_MODE_32, &handle) != CS_ERR_OK)
{
return 0;
}
// https://www.cnblogs.com/lyshark
count = cs_disasm(handle, (unsigned char*)buffer, size, 0x1000, 0, &insn);
if (count > 0)
{
size_t index;
for (index = 0; index < count; index++)
{
for (int x = 0; x < insn[index].size; x++)
{
printf("machine code: %d -> %02X \n", x, insn[index].bytes[x]);
}
printf("ADDR: 0x%llx| length: %d ASM: %s %s \n", insn[index].address, insn[index].size, insn[index].mnemonic, insn[index].op_str);
}
cs_free(insn, count);
}
else
{
printf("disasm failed! \n");
}
cs_close(&handle);
getchar();
return 0;
}
@12UE Works fine on g++. Can you try this in MSVC to see if it works?
msvc not working