PROJECT: remove keystone
This commit is contained in:
parent
e5f950308a
commit
8da82cf569
2
deps
2
deps
|
@ -1 +1 @@
|
|||
Subproject commit 67f089f8416d806101913ec619cbb557540d2f64
|
||||
Subproject commit de80e8da63c96c7b729c61172f6c4e7f27fd2ac9
|
|
@ -10,100 +10,11 @@
|
|||
#include "value.h"
|
||||
#include "disasm_fast.h"
|
||||
#include "disasm_helper.h"
|
||||
#include "keystone/keystone.h"
|
||||
#include "datainst_helper.h"
|
||||
#include "debugger.h"
|
||||
|
||||
AssemblerEngine assemblerEngine = AssemblerEngine::XEDParse;
|
||||
|
||||
namespace Keystone
|
||||
{
|
||||
static char* stristr(const char* haystack, const char* needle)
|
||||
{
|
||||
// Case insensitive strstr
|
||||
// https://stackoverflow.com/questions/27303062/strstr-function-like-that-ignores-upper-or-lower-case
|
||||
do
|
||||
{
|
||||
const char* h = haystack;
|
||||
const char* n = needle;
|
||||
while(tolower((unsigned char)*h) == tolower((unsigned char)*n) && *n)
|
||||
{
|
||||
h++;
|
||||
n++;
|
||||
}
|
||||
|
||||
if(*n == 0)
|
||||
return (char*)haystack;
|
||||
|
||||
}
|
||||
while(*haystack++);
|
||||
|
||||
// Not found
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool StrDel(char* Source, const char* Needle)
|
||||
{
|
||||
// Find the location in the string first
|
||||
char* loc = stristr(Source, Needle);
|
||||
|
||||
if(!loc)
|
||||
return false;
|
||||
|
||||
// "Delete" the word by shifting it over
|
||||
auto needleLen = strlen(Needle);
|
||||
|
||||
memmove(loc, loc + needleLen, strlen(loc) - needleLen + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static XEDPARSE_STATUS XEDParseAssemble(XEDPARSE* XEDParse)
|
||||
{
|
||||
if(!XEDParse)
|
||||
return XEDPARSE_ERROR;
|
||||
|
||||
auto sep = strstr(XEDParse->instr, ";");
|
||||
if(!sep)
|
||||
sep = strstr(XEDParse->instr, "\n");
|
||||
if(sep)
|
||||
*sep = '\0';
|
||||
bool short_command = StrDel(XEDParse->instr, "short ");
|
||||
|
||||
ks_engine* ks;
|
||||
ks_err err = ks_open(KS_ARCH_X86, XEDParse->x64 ? KS_MODE_64 : KS_MODE_32, &ks);
|
||||
if(err != KS_ERR_OK)
|
||||
{
|
||||
strcpy_s(XEDParse->error, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Failed on ks_open()...")));
|
||||
return XEDPARSE_ERROR;
|
||||
}
|
||||
//ks_option(ks, KS_OPT_SYNTAX, KS_OPT_SYNTAX_INTEL);
|
||||
auto result = XEDPARSE_OK;
|
||||
unsigned char* encode;
|
||||
size_t size;
|
||||
size_t count;
|
||||
if(ks_asm(ks, XEDParse->instr, XEDParse->cip, &encode, &size, &count) != KS_ERR_OK)
|
||||
{
|
||||
sprintf_s(XEDParse->error, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "ks_asm() failed: count = %lu, error = %u")), count, ks_errno(ks));
|
||||
result = XEDPARSE_ERROR;
|
||||
}
|
||||
else if(short_command && size > 2)
|
||||
{
|
||||
sprintf_s(XEDParse->error, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "ks_asm() failed: destination is out of range (size = %lu)")), size);
|
||||
result = XEDPARSE_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
XEDParse->dest_size = (unsigned int)min(size, XEDPARSE_MAXASMSIZE);
|
||||
for(size_t i = 0; i < XEDParse->dest_size; i++)
|
||||
XEDParse->dest[i] = encode[i];
|
||||
}
|
||||
ks_free(encode);
|
||||
ks_close(ks);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
namespace asmjit
|
||||
{
|
||||
static XEDPARSE_STATUS XEDParseAssemble(XEDPARSE* XEDParse)
|
||||
|
@ -146,9 +57,7 @@ bool assemble(duint addr, unsigned char* dest, int destsize, int* size, const ch
|
|||
parse.cip = addr;
|
||||
strcpy_s(parse.instr, instruction);
|
||||
auto DoAssemble = XEDParseAssemble;
|
||||
if(assemblerEngine == AssemblerEngine::Keystone)
|
||||
DoAssemble = Keystone::XEDParseAssemble;
|
||||
else if(assemblerEngine == AssemblerEngine::asmjit)
|
||||
if(assemblerEngine == AssemblerEngine::asmjit || assemblerEngine == AssemblerEngine::Keystone)
|
||||
DoAssemble = asmjit::XEDParseAssemble;
|
||||
if(DoAssemble(&parse) == XEDPARSE_ERROR)
|
||||
{
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_ARM_H
|
||||
#define KEYSTONE_ARM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_arm
|
||||
{
|
||||
KS_ERR_ASM_ARM_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_ARM_MISSINGFEATURE,
|
||||
KS_ERR_ASM_ARM_MNEMONICFAIL,
|
||||
} ks_err_asm_arm;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_ARM64_H
|
||||
#define KEYSTONE_ARM64_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_arm64
|
||||
{
|
||||
KS_ERR_ASM_ARM64_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_ARM64_MISSINGFEATURE,
|
||||
KS_ERR_ASM_ARM64_MNEMONICFAIL,
|
||||
} ks_err_asm_arm64;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_HEXAGON_H
|
||||
#define KEYSTONE_HEXAGON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_hexagon
|
||||
{
|
||||
KS_ERR_ASM_HEXAGON_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_HEXAGON_MISSINGFEATURE,
|
||||
KS_ERR_ASM_HEXAGON_MNEMONICFAIL,
|
||||
} ks_err_asm_hexagon;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,330 +0,0 @@
|
|||
/* Keystone Assembler Engine (www.keystone-engine.org) */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_ENGINE_H
|
||||
#define KEYSTONE_ENGINE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef _MSC_VER // MSVC compiler
|
||||
#pragma warning(disable:4201)
|
||||
#pragma warning(disable:4100)
|
||||
#define KEYSTONE_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define KEYSTONE_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define KEYSTONE_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
struct ks_struct;
|
||||
typedef struct ks_struct ks_engine;
|
||||
|
||||
// Keystone API version
|
||||
#define KS_API_MAJOR 0
|
||||
#define KS_API_MINOR 9
|
||||
|
||||
/*
|
||||
Macro to create combined version which can be compared to
|
||||
result of ks_version() API.
|
||||
*/
|
||||
#define KS_MAKE_VERSION(major, minor) ((major << 8) + minor)
|
||||
|
||||
// Architecture type
|
||||
typedef enum ks_arch
|
||||
{
|
||||
KS_ARCH_ARM = 1, // ARM architecture (including Thumb, Thumb-2)
|
||||
KS_ARCH_ARM64, // ARM-64, also called AArch64
|
||||
KS_ARCH_MIPS, // Mips architecture
|
||||
KS_ARCH_X86, // X86 architecture (including x86 & x86-64)
|
||||
KS_ARCH_PPC, // PowerPC architecture (currently unsupported)
|
||||
KS_ARCH_SPARC, // Sparc architecture
|
||||
KS_ARCH_SYSTEMZ, // SystemZ architecture (S390X)
|
||||
KS_ARCH_HEXAGON, // Hexagon architecture
|
||||
KS_ARCH_MAX,
|
||||
} ks_arch;
|
||||
|
||||
// Mode type
|
||||
typedef enum ks_mode
|
||||
{
|
||||
KS_MODE_LITTLE_ENDIAN = 0, // little-endian mode (default mode)
|
||||
KS_MODE_BIG_ENDIAN = 1 << 30, // big-endian mode
|
||||
// arm / arm64
|
||||
KS_MODE_ARM = 1 << 0, // ARM mode
|
||||
KS_MODE_THUMB = 1 << 4, // THUMB mode (including Thumb-2)
|
||||
KS_MODE_V8 = 1 << 6, // ARMv8 A32 encodings for ARM
|
||||
// mips
|
||||
KS_MODE_MICRO = 1 << 4, // MicroMips mode
|
||||
KS_MODE_MIPS3 = 1 << 5, // Mips III ISA
|
||||
KS_MODE_MIPS32R6 = 1 << 6, // Mips32r6 ISA
|
||||
KS_MODE_MIPS32 = 1 << 2, // Mips32 ISA
|
||||
KS_MODE_MIPS64 = 1 << 3, // Mips64 ISA
|
||||
// x86 / x64
|
||||
KS_MODE_16 = 1 << 1, // 16-bit mode
|
||||
KS_MODE_32 = 1 << 2, // 32-bit mode
|
||||
KS_MODE_64 = 1 << 3, // 64-bit mode
|
||||
// ppc
|
||||
KS_MODE_PPC32 = 1 << 2, // 32-bit mode
|
||||
KS_MODE_PPC64 = 1 << 3, // 64-bit mode
|
||||
KS_MODE_QPX = 1 << 4, // Quad Processing eXtensions mode
|
||||
// sparc
|
||||
KS_MODE_SPARC32 = 1 << 2, // 32-bit mode
|
||||
KS_MODE_SPARC64 = 1 << 3, // 64-bit mode
|
||||
KS_MODE_V9 = 1 << 4, // SparcV9 mode
|
||||
} ks_mode;
|
||||
|
||||
// All generic errors related to input assembly >= KS_ERR_ASM
|
||||
#define KS_ERR_ASM 128
|
||||
|
||||
// All architecture-specific errors related to input assembly >= KS_ERR_ASM_ARCH
|
||||
#define KS_ERR_ASM_ARCH 512
|
||||
|
||||
// All type of errors encountered by Keystone API.
|
||||
typedef enum ks_err
|
||||
{
|
||||
KS_ERR_OK = 0, // No error: everything was fine
|
||||
KS_ERR_NOMEM, // Out-Of-Memory error: ks_open(), ks_emulate()
|
||||
KS_ERR_ARCH, // Unsupported architecture: ks_open()
|
||||
KS_ERR_HANDLE, // Invalid handle
|
||||
KS_ERR_MODE, // Invalid/unsupported mode: ks_open()
|
||||
KS_ERR_VERSION, // Unsupported version (bindings)
|
||||
KS_ERR_OPT_INVALID, // Unsupported option
|
||||
|
||||
// generic input assembly errors - parser specific
|
||||
KS_ERR_ASM_EXPR_TOKEN = KS_ERR_ASM, // unknown token in expression
|
||||
KS_ERR_ASM_DIRECTIVE_VALUE_RANGE, // literal value out of range for directive
|
||||
KS_ERR_ASM_DIRECTIVE_ID, // expected identifier in directive
|
||||
KS_ERR_ASM_DIRECTIVE_TOKEN, // unexpected token in directive
|
||||
KS_ERR_ASM_DIRECTIVE_STR, // expected string in directive
|
||||
KS_ERR_ASM_DIRECTIVE_COMMA, // expected comma in directive
|
||||
KS_ERR_ASM_DIRECTIVE_RELOC_NAME, // expected relocation name in directive
|
||||
KS_ERR_ASM_DIRECTIVE_RELOC_TOKEN, // unexpected token in .reloc directive
|
||||
KS_ERR_ASM_DIRECTIVE_FPOINT, // invalid floating point in directive
|
||||
KS_ERR_ASM_DIRECTIVE_UNKNOWN, // unknown directive
|
||||
KS_ERR_ASM_DIRECTIVE_EQU, // invalid equal directive
|
||||
KS_ERR_ASM_DIRECTIVE_INVALID, // (generic) invalid directive
|
||||
KS_ERR_ASM_VARIANT_INVALID, // invalid variant
|
||||
KS_ERR_ASM_EXPR_BRACKET, // brackets expression not supported on this target
|
||||
KS_ERR_ASM_SYMBOL_MODIFIER, // unexpected symbol modifier following '@'
|
||||
KS_ERR_ASM_SYMBOL_REDEFINED, // invalid symbol redefinition
|
||||
KS_ERR_ASM_SYMBOL_MISSING, // cannot find a symbol
|
||||
KS_ERR_ASM_RPAREN, // expected ')' in parentheses expression
|
||||
KS_ERR_ASM_STAT_TOKEN, // unexpected token at start of statement
|
||||
KS_ERR_ASM_UNSUPPORTED, // unsupported token yet
|
||||
KS_ERR_ASM_MACRO_TOKEN, // unexpected token in macro instantiation
|
||||
KS_ERR_ASM_MACRO_PAREN, // unbalanced parentheses in macro argument
|
||||
KS_ERR_ASM_MACRO_EQU, // expected '=' after formal parameter identifier
|
||||
KS_ERR_ASM_MACRO_ARGS, // too many positional arguments
|
||||
KS_ERR_ASM_MACRO_LEVELS_EXCEED, // macros cannot be nested more than 20 levels deep
|
||||
KS_ERR_ASM_MACRO_STR, // invalid macro string
|
||||
KS_ERR_ASM_MACRO_INVALID, // invalid macro (generic error)
|
||||
KS_ERR_ASM_ESC_BACKSLASH, // unexpected backslash at end of escaped string
|
||||
KS_ERR_ASM_ESC_OCTAL, // invalid octal escape sequence (out of range)
|
||||
KS_ERR_ASM_ESC_SEQUENCE, // invalid escape sequence (unrecognized character)
|
||||
KS_ERR_ASM_ESC_STR, // broken escape string
|
||||
KS_ERR_ASM_TOKEN_INVALID, // invalid token
|
||||
KS_ERR_ASM_INSN_UNSUPPORTED, // this instruction is unsupported in this mode
|
||||
KS_ERR_ASM_FIXUP_INVALID, // invalid fixup
|
||||
KS_ERR_ASM_LABEL_INVALID, // invalid label
|
||||
KS_ERR_ASM_FRAGMENT_INVALID, // invalid fragment
|
||||
|
||||
// generic input assembly errors - architecture specific
|
||||
KS_ERR_ASM_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_MISSINGFEATURE,
|
||||
KS_ERR_ASM_MNEMONICFAIL,
|
||||
} ks_err;
|
||||
|
||||
// Resolver callback to provide value for a missing symbol in @symbol.
|
||||
// To handle a symbol, the resolver must put value of the symbol in @value,
|
||||
// then returns True.
|
||||
// If we do not resolve a missing symbol, this function must return False.
|
||||
// In that case, ks_asm() would eventually return with error KS_ERR_ASM_SYMBOL_MISSING.
|
||||
|
||||
// To register the resolver, pass its function address to ks_option(), using
|
||||
// option KS_OPT_SYM_RESOLVER. For example, see samples/sample.c.
|
||||
typedef bool (*ks_sym_resolver)(const char* symbol, uint64_t* value);
|
||||
|
||||
// Runtime option for the Keystone engine
|
||||
typedef enum ks_opt_type
|
||||
{
|
||||
KS_OPT_SYNTAX = 1, // Choose syntax for input assembly
|
||||
KS_OPT_SYM_RESOLVER, // Set symbol resolver callback
|
||||
} ks_opt_type;
|
||||
|
||||
|
||||
// Runtime option value (associated with ks_opt_type above)
|
||||
typedef enum ks_opt_value
|
||||
{
|
||||
KS_OPT_SYNTAX_INTEL = 1 << 0, // X86 Intel syntax - default on X86 (KS_OPT_SYNTAX).
|
||||
KS_OPT_SYNTAX_ATT = 1 << 1, // X86 ATT asm syntax (KS_OPT_SYNTAX).
|
||||
KS_OPT_SYNTAX_NASM = 1 << 2, // X86 Nasm syntax (KS_OPT_SYNTAX).
|
||||
KS_OPT_SYNTAX_MASM = 1 << 3, // X86 Masm syntax (KS_OPT_SYNTAX) - unsupported yet.
|
||||
KS_OPT_SYNTAX_GAS = 1 << 4, // X86 GNU GAS syntax (KS_OPT_SYNTAX).
|
||||
KS_OPT_SYNTAX_RADIX16 = 1 << 5, // All immediates are in hex format (i.e 12 is 0x12)
|
||||
} ks_opt_value;
|
||||
|
||||
|
||||
#include "arm64.h"
|
||||
#include "arm.h"
|
||||
#include "hexagon.h"
|
||||
#include "mips.h"
|
||||
#include "ppc.h"
|
||||
#include "sparc.h"
|
||||
#include "systemz.h"
|
||||
#include "x86.h"
|
||||
|
||||
/*
|
||||
Return combined API version & major and minor version numbers.
|
||||
|
||||
@major: major number of API version
|
||||
@minor: minor number of API version
|
||||
|
||||
@return hexical number as (major << 8 | minor), which encodes both
|
||||
major & minor versions.
|
||||
NOTE: This returned value can be compared with version number made
|
||||
with macro KS_MAKE_VERSION
|
||||
|
||||
For example, second API version would return 1 in @major, and 1 in @minor
|
||||
The return value would be 0x0101
|
||||
|
||||
NOTE: if you only care about returned value, but not major and minor values,
|
||||
set both @major & @minor arguments to NULL.
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
unsigned int ks_version(unsigned int* major, unsigned int* minor);
|
||||
|
||||
|
||||
/*
|
||||
Determine if the given architecture is supported by this library.
|
||||
|
||||
@arch: architecture type (KS_ARCH_*)
|
||||
|
||||
@return True if this library supports the given arch.
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
bool ks_arch_supported(ks_arch arch);
|
||||
|
||||
|
||||
/*
|
||||
Create new instance of Keystone engine.
|
||||
|
||||
@arch: architecture type (KS_ARCH_*)
|
||||
@mode: hardware mode. This is combined of KS_MODE_*
|
||||
@ks: pointer to ks_engine, which will be updated at return time
|
||||
|
||||
@return KS_ERR_OK on success, or other value on failure (refer to ks_err enum
|
||||
for detailed error).
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
ks_err ks_open(ks_arch arch, int mode, ks_engine** ks);
|
||||
|
||||
|
||||
/*
|
||||
Close KS instance: MUST do to release the handle when it is not used anymore.
|
||||
NOTE: this must be called only when there is no longer usage of Keystone.
|
||||
The reason is the this API releases some cached memory, thus access to any
|
||||
Keystone API after ks_close() might crash your application.
|
||||
After this, @ks is invalid, and nolonger usable.
|
||||
|
||||
@ks: pointer to a handle returned by ks_open()
|
||||
|
||||
@return KS_ERR_OK on success, or other value on failure (refer to ks_err enum
|
||||
for detailed error).
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
ks_err ks_close(ks_engine* ks);
|
||||
|
||||
|
||||
/*
|
||||
Report the last error number when some API function fail.
|
||||
Like glibc's errno, ks_errno might not retain its old error once accessed.
|
||||
|
||||
@ks: handle returned by ks_open()
|
||||
|
||||
@return: error code of ks_err enum type (KS_ERR_*, see above)
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
ks_err ks_errno(ks_engine* ks);
|
||||
|
||||
|
||||
/*
|
||||
Return a string describing given error code.
|
||||
|
||||
@code: error code (see KS_ERR_* above)
|
||||
|
||||
@return: returns a pointer to a string that describes the error code
|
||||
passed in the argument @code
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
const char* ks_strerror(ks_err code);
|
||||
|
||||
|
||||
/*
|
||||
Set option for Keystone engine at runtime
|
||||
|
||||
@ks: handle returned by ks_open()
|
||||
@type: type of option to be set. See ks_opt_type
|
||||
@value: option value corresponding with @type
|
||||
|
||||
@return: KS_ERR_OK on success, or other value on failure.
|
||||
Refer to ks_err enum for detailed error.
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
ks_err ks_option(ks_engine* ks, ks_opt_type type, size_t value);
|
||||
|
||||
|
||||
/*
|
||||
Assemble a string given its the buffer, size, start address and number
|
||||
of instructions to be decoded.
|
||||
This API dynamically allocate memory to contain assembled instruction.
|
||||
Resulted array of bytes containing the machine code is put into @*encoding
|
||||
|
||||
NOTE 1: this API will automatically determine memory needed to contain
|
||||
output bytes in *encoding.
|
||||
|
||||
NOTE 2: caller must free the allocated memory itself to avoid memory leaking.
|
||||
|
||||
@ks: handle returned by ks_open()
|
||||
@str: NULL-terminated assembly string. Use ; or \n to separate statements.
|
||||
@address: address of the first assembly instruction, or 0 to ignore.
|
||||
@encoding: array of bytes containing encoding of input assembly string.
|
||||
NOTE: *encoding will be allocated by this function, and should be freed
|
||||
with ks_free() function.
|
||||
@encoding_size: size of *encoding
|
||||
@stat_count: number of statements successfully processed
|
||||
|
||||
@return: 0 on success, or -1 on failure.
|
||||
|
||||
On failure, call ks_errno() for error code.
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
int ks_asm(ks_engine* ks,
|
||||
const char* string,
|
||||
uint64_t address,
|
||||
unsigned char** encoding, size_t* encoding_size,
|
||||
size_t* stat_count);
|
||||
|
||||
|
||||
/*
|
||||
Free memory allocated by ks_asm()
|
||||
|
||||
@p: memory allocated in @encoding argument of ks_asm()
|
||||
*/
|
||||
KEYSTONE_EXPORT
|
||||
void ks_free(unsigned char* p);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_MIPS_H
|
||||
#define KEYSTONE_MIPS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_mips
|
||||
{
|
||||
KS_ERR_ASM_MIPS_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_MIPS_MISSINGFEATURE,
|
||||
KS_ERR_ASM_MIPS_MNEMONICFAIL,
|
||||
} ks_err_asm_mips;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_PPC_H
|
||||
#define KEYSTONE_PPC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_ppc
|
||||
{
|
||||
KS_ERR_ASM_PPC_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_PPC_MISSINGFEATURE,
|
||||
KS_ERR_ASM_PPC_MNEMONICFAIL,
|
||||
} ks_err_asm_ppc;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_SPARC_H
|
||||
#define KEYSTONE_SPARC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_sparc
|
||||
{
|
||||
KS_ERR_ASM_SPARC_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_SPARC_MISSINGFEATURE,
|
||||
KS_ERR_ASM_SPARC_MNEMONICFAIL,
|
||||
} ks_err_asm_sparc;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_SYSTEMZ_H
|
||||
#define KEYSTONE_SYSTEMZ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_systemz
|
||||
{
|
||||
KS_ERR_ASM_SYSTEMZ_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_SYSTEMZ_MISSINGFEATURE,
|
||||
KS_ERR_ASM_SYSTEMZ_MNEMONICFAIL,
|
||||
} ks_err_asm_systemz;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
/* Keystone Assembler Engine */
|
||||
/* By Nguyen Anh Quynh, 2016 */
|
||||
|
||||
#ifndef KEYSTONE_X86_H
|
||||
#define KEYSTONE_X86_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keystone.h"
|
||||
|
||||
typedef enum ks_err_asm_x86
|
||||
{
|
||||
KS_ERR_ASM_X86_INVALIDOPERAND = KS_ERR_ASM_ARCH,
|
||||
KS_ERR_ASM_X86_MISSINGFEATURE,
|
||||
KS_ERR_ASM_X86_MNEMONICFAIL,
|
||||
} ks_err_asm_x86;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -207,15 +207,6 @@
|
|||
<ClInclude Include="function.h" />
|
||||
<ClInclude Include="historycontext.h" />
|
||||
<ClInclude Include="jit.h" />
|
||||
<ClInclude Include="keystone\arm.h" />
|
||||
<ClInclude Include="keystone\arm64.h" />
|
||||
<ClInclude Include="keystone\hexagon.h" />
|
||||
<ClInclude Include="keystone\keystone.h" />
|
||||
<ClInclude Include="keystone\mips.h" />
|
||||
<ClInclude Include="keystone\ppc.h" />
|
||||
<ClInclude Include="keystone\sparc.h" />
|
||||
<ClInclude Include="keystone\systemz.h" />
|
||||
<ClInclude Include="keystone\x86.h" />
|
||||
<ClInclude Include="handle.h" />
|
||||
<ClInclude Include="jansson\jansson.h" />
|
||||
<ClInclude Include="jansson\jansson_config.h" />
|
||||
|
@ -411,7 +402,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>ntdll\ntdll_x86.lib;keystone\keystone_x86.lib;$(ProjectDir)..\zydis_wrapper\bin\x32\zydis_wrapper.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ntdll\ntdll_x86.lib;$(ProjectDir)..\zydis_wrapper\bin\x32\zydis_wrapper.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -432,7 +423,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>false</EnableCOMDATFolding>
|
||||
<OptimizeReferences>false</OptimizeReferences>
|
||||
<AdditionalDependencies>ntdll\ntdll_x86.lib;keystone\keystone_x86.lib;$(ProjectDir)..\zydis_wrapper\bin\x32d\zydis_wrapper.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32d\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ntdll\ntdll_x86.lib;$(ProjectDir)..\zydis_wrapper\bin\x32d\zydis_wrapper.lib;yara\yara_x86.lib;lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32d\x32bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -459,7 +450,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>$(ProjectDir)..\zydis_wrapper\bin\x64\zydis_wrapper.lib;ntdll\ntdll_x64.lib;keystone\keystone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(ProjectDir)..\zydis_wrapper\bin\x64\zydis_wrapper.lib;ntdll\ntdll_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -483,7 +474,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>false</EnableCOMDATFolding>
|
||||
<OptimizeReferences>false</OptimizeReferences>
|
||||
<AdditionalDependencies>$(ProjectDir)..\zydis_wrapper\bin\x64d\zydis_wrapper.lib;ntdll\ntdll_x64.lib;keystone\keystone_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64d\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(ProjectDir)..\zydis_wrapper\bin\x64d\zydis_wrapper.lib;ntdll\ntdll_x64.lib;yara\yara_x64.lib;lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64d\x64bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;ws2_32.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -81,9 +81,6 @@
|
|||
<Filter Include="Header Files\Interfaces/Exports\_scriptapi">
|
||||
<UniqueIdentifier>{eb7d9981-6079-4b4b-af18-e44e63451d10}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Third Party\keystone">
|
||||
<UniqueIdentifier>{ccc8108c-36f5-4b8d-8152-7208f109d752}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Commands">
|
||||
<UniqueIdentifier>{c753866f-f2d5-4469-b8b0-0c7a6cea607e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -772,33 +769,6 @@
|
|||
<ClInclude Include="encodemap.h">
|
||||
<Filter>Header Files\Information</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\arm.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\arm64.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\hexagon.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\keystone.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\mips.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\ppc.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\sparc.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\systemz.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="keystone\x86.h">
|
||||
<Filter>Header Files\Third Party\keystone</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="datainst_helper.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue