Rizin
unix-like reverse engineering framework and cli tools
vbCapstone.cpp File Reference
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <capstone.h>

Go to the source code of this file.

Macros

#define EXPORT   comment(linker, "/EXPORT:"__FUNCTION__"="__FUNCDNAME__)
 

Functions

unsigned int __stdcall bs_version (int *major, int *minor)
 
bool __stdcall bs_support (int query)
 
cs_err __stdcall bs_open (cs_arch arch, cs_mode mode, csh *handle)
 
cs_err __stdcall bs_close (csh *handle)
 
cs_err __stdcall bs_option (csh handle, cs_opt_type type, size_t value)
 
cs_err __stdcall bs_errno (csh handle)
 
const char *__stdcall bs_strerror (cs_err code)
 
size_t __stdcall bs_disasm (csh handle, const uint8_t *code, size_t code_size, uint64_t address, size_t count, cs_insn **insn)
 
void __stdcall getInstruction (cs_insn *insn, uint32_t index, void *curInst, uint32_t bufSize)
 
const char *__stdcall bs_reg_name (csh handle, unsigned int reg_id)
 
void __stdcall bs_free (cs_insn *insn, size_t count)
 
cs_insn *__stdcall bs_malloc (csh handle)
 
int __stdcall bs_op_index (csh handle, const cs_insn *insn, unsigned int op_type, unsigned int position)
 
int __stdcall bs_op_count (csh handle, const cs_insn *insn, unsigned int op_type)
 
bool __stdcall bs_reg_write (csh handle, const cs_insn *insn, unsigned int reg_id)
 
bool __stdcall bs_reg_read (csh handle, const cs_insn *insn, unsigned int reg_id)
 
bool __stdcall bs_insn_group (csh handle, const cs_insn *insn, unsigned int group_id)
 
const char *__stdcall bcs_group_name (csh handle, unsigned int group_id)
 
const char *__stdcall bs_insn_name (csh handle, unsigned int insn_id)
 
bool __stdcall bs_disasm_iter (csh handle, const uint8_t **code, size_t *size, uint64_t *address, cs_insn *insn)
 

Macro Definition Documentation

◆ EXPORT

#define EXPORT   comment(linker, "/EXPORT:"__FUNCTION__"="__FUNCDNAME__)

Definition at line 18 of file vbCapstone.cpp.

Function Documentation

◆ bcs_group_name()

const char* __stdcall bcs_group_name ( csh  handle,
unsigned int  group_id 
)

Definition at line 106 of file vbCapstone.cpp.

106  {
107 #pragma EXPORT
108  return cs_group_name(handle,group_id);
109 }
static mcore_handle handle
Definition: asm_mcore.c:8
CAPSTONE_EXPORT const char *CAPSTONE_API cs_group_name(csh ud, unsigned int group)
Definition: cs.c:1178

References cs_group_name(), and handle.

◆ bs_close()

cs_err __stdcall bs_close ( csh handle)

Definition at line 35 of file vbCapstone.cpp.

35  {
36 #pragma EXPORT
37  return cs_close(handle);
38 }
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
Definition: cs.c:501

References cs_close(), and handle.

◆ bs_disasm()

size_t __stdcall bs_disasm ( csh  handle,
const uint8_t code,
size_t  code_size,
uint64_t  address,
size_t  count,
cs_insn **  insn 
)

Definition at line 55 of file vbCapstone.cpp.

55  {
56 #pragma EXPORT
57  return cs_disasm(handle, code, code_size, address, count, insn);
58 }
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
Definition: cs.c:798
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
Definition: inftree9.h:24

References count, cs_disasm(), and handle.

◆ bs_disasm_iter()

bool __stdcall bs_disasm_iter ( csh  handle,
const uint8_t **  code,
size_t size,
uint64_t address,
cs_insn *  insn 
)

Definition at line 116 of file vbCapstone.cpp.

116  {
117 #pragma EXPORT
118  return cs_disasm_iter(handle, code, size, address, insn);
119 }
CAPSTONE_EXPORT bool CAPSTONE_API cs_disasm_iter(csh ud, const uint8_t **code, size_t *size, uint64_t *address, cs_insn *insn)
Definition: cs.c:1058
voidpf void uLong size
Definition: ioapi.h:138

References cs_disasm_iter(), and handle.

◆ bs_errno()

cs_err __stdcall bs_errno ( csh  handle)

Definition at line 45 of file vbCapstone.cpp.

45  {
46 #pragma EXPORT
47  return cs_errno(handle);
48 }
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_errno(csh handle)
Definition: cs.c:402

References cs_errno(), and handle.

◆ bs_free()

void __stdcall bs_free ( cs_insn *  insn,
size_t  count 
)

Definition at line 70 of file vbCapstone.cpp.

70  {
71 #pragma EXPORT
72  return cs_free(insn, count);
73 }
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
Definition: cs.c:1017

References count, and cs_free().

◆ bs_insn_group()

bool __stdcall bs_insn_group ( csh  handle,
const cs_insn *  insn,
unsigned int  group_id 
)

Definition at line 101 of file vbCapstone.cpp.

101  {
102 #pragma EXPORT
103  return cs_insn_group(handle,insn,group_id);
104 }
CAPSTONE_EXPORT bool CAPSTONE_API cs_insn_group(csh ud, const cs_insn *insn, unsigned int group_id)
Definition: cs.c:1190

References cs_insn_group(), and handle.

◆ bs_insn_name()

const char* __stdcall bs_insn_name ( csh  handle,
unsigned int  insn_id 
)

Definition at line 111 of file vbCapstone.cpp.

111  {
112 #pragma EXPORT
113  return cs_insn_name(handle,insn_id);
114 }
CAPSTONE_EXPORT const char *CAPSTONE_API cs_insn_name(csh ud, unsigned int insn)
Definition: cs.c:1166

References cs_insn_name(), and handle.

◆ bs_malloc()

cs_insn* __stdcall bs_malloc ( csh  handle)

Definition at line 75 of file vbCapstone.cpp.

75  {
76 #pragma EXPORT
77  return cs_malloc(handle);
78 }
CAPSTONE_EXPORT cs_insn *CAPSTONE_API cs_malloc(csh ud)
Definition: cs.c:1030

References cs_malloc(), and handle.

◆ bs_op_count()

int __stdcall bs_op_count ( csh  handle,
const cs_insn *  insn,
unsigned int  op_type 
)

Definition at line 86 of file vbCapstone.cpp.

86  {
87 #pragma EXPORT
88  return cs_op_count(handle,insn,op_type);
89 }
CAPSTONE_EXPORT int CAPSTONE_API cs_op_count(csh ud, const cs_insn *insn, unsigned int op_type)
Definition: cs.c:1271

References cs_op_count(), and handle.

◆ bs_op_index()

int __stdcall bs_op_index ( csh  handle,
const cs_insn *  insn,
unsigned int  op_type,
unsigned int  position 
)

Definition at line 81 of file vbCapstone.cpp.

81  {
82 #pragma EXPORT
83  return cs_op_index(handle,insn,op_type,position);
84 }
CAPSTONE_EXPORT int CAPSTONE_API cs_op_index(csh ud, const cs_insn *insn, unsigned int op_type, unsigned int post)
Definition: cs.c:1369

References cs_op_index(), and handle.

◆ bs_open()

cs_err __stdcall bs_open ( cs_arch  arch,
cs_mode  mode,
csh handle 
)

Definition at line 30 of file vbCapstone.cpp.

30  {
31 #pragma EXPORT
32  return cs_open(arch, mode, handle);
33 }
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
Definition: cs.c:453
cs_arch arch
Definition: cstool.c:13
const char int mode
Definition: ioapi.h:137

References arch, cs_open(), and handle.

◆ bs_option()

cs_err __stdcall bs_option ( csh  handle,
cs_opt_type  type,
size_t  value 
)

Definition at line 40 of file vbCapstone.cpp.

40  {
41 #pragma EXPORT
42  return cs_option(handle, type, value);
43 }
static int value
Definition: cmd_api.c:93
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
Definition: cs.c:646
int type
Definition: mipsasm.c:17

References cs_option(), handle, type, and value.

◆ bs_reg_name()

const char* __stdcall bs_reg_name ( csh  handle,
unsigned int  reg_id 
)

Definition at line 65 of file vbCapstone.cpp.

65  {
66 #pragma EXPORT
67  return cs_reg_name(handle, reg_id);
68 }
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1154

References cs_reg_name(), and handle.

◆ bs_reg_read()

bool __stdcall bs_reg_read ( csh  handle,
const cs_insn *  insn,
unsigned int  reg_id 
)

Definition at line 96 of file vbCapstone.cpp.

96  {
97 #pragma EXPORT
98  return cs_reg_read(handle,insn,reg_id);
99 }
CAPSTONE_EXPORT bool CAPSTONE_API cs_reg_read(csh ud, const cs_insn *insn, unsigned int reg_id)
Definition: cs.c:1217

References cs_reg_read(), and handle.

◆ bs_reg_write()

bool __stdcall bs_reg_write ( csh  handle,
const cs_insn *  insn,
unsigned int  reg_id 
)

Definition at line 91 of file vbCapstone.cpp.

91  {
92 #pragma EXPORT
93  return cs_reg_write(handle,insn,reg_id);
94 }
CAPSTONE_EXPORT bool CAPSTONE_API cs_reg_write(csh ud, const cs_insn *insn, unsigned int reg_id)
Definition: cs.c:1244

References cs_reg_write(), and handle.

◆ bs_strerror()

const char* __stdcall bs_strerror ( cs_err  code)

Definition at line 50 of file vbCapstone.cpp.

50  {
51 #pragma EXPORT
52  return cs_strerror(code);
53 }
CAPSTONE_EXPORT const char *CAPSTONE_API cs_strerror(cs_err code)
Definition: cs.c:414

References cs_strerror().

◆ bs_support()

bool __stdcall bs_support ( int  query)

Definition at line 25 of file vbCapstone.cpp.

25  {
26 #pragma EXPORT
27  return cs_support(query);
28 }
CAPSTONE_EXPORT bool CAPSTONE_API cs_support(int query)
Definition: cs.c:368

References cs_support().

◆ bs_version()

unsigned int __stdcall bs_version ( int major,
int minor 
)

Definition at line 20 of file vbCapstone.cpp.

20  {
21 #pragma EXPORT
22  return cs_version(major,minor);
23 }
CAPSTONE_EXPORT unsigned int CAPSTONE_API cs_version(int *major, int *minor)
Definition: cs.c:357
#define minor(dev)
Definition: fsmagic.c:57
#define major(dev)
Definition: fsmagic.c:56

References cs_version(), major, and minor.

◆ getInstruction()

void __stdcall getInstruction ( cs_insn *  insn,
uint32_t  index,
void *  curInst,
uint32_t  bufSize 
)

Definition at line 60 of file vbCapstone.cpp.

60  {
61 #pragma EXPORT
62  memcpy(curInst, (void*)&insn[index], bufSize); //size lets us get a partial version of whatever we have implemented in the vbstruct...
63 }
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))

References memcpy().