From 31c69b6ca1b91e7fd9fd8e14082fd2584c5f538c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 24 May 2020 16:48:22 +0200 Subject: first public release Signed-off-by: Toni Uhlig --- source/disasm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 source/disasm.c (limited to 'source/disasm.c') diff --git a/source/disasm.c b/source/disasm.c new file mode 100644 index 0000000..b36abae --- /dev/null +++ b/source/disasm.c @@ -0,0 +1,24 @@ +#include "compat.h" +#include "disasm.h" +#include "distorm/distorm.h" + + +_DecodeResult disasm(_OffsetType codeOffset, const unsigned char* code, int codeLen, _DecodeType dt, _DInst instructions[], unsigned int maxInstructions, unsigned int* usedInstructionsCount) +{ + _DecodeResult res; + _CodeInfo ci; + unsigned int instsCount = 0; + + ci.codeOffset = codeOffset; + ci.code = code; + ci.codeLen = codeLen; + ci.dt = dt; + ci.features = DF_NONE; + + if (dt == Decode16Bits) ci.features = DF_MAXIMUM_ADDR16; + else if (dt == Decode32Bits) ci.features = DF_MAXIMUM_ADDR32; + + res = distorm_decompose(&ci, instructions, maxInstructions, &instsCount); + *usedInstructionsCount = instsCount; + return res; +} -- cgit v1.2.3