Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 13m15s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 13m1s
sm-rpc / build (Release, host.gcc) (push) Failing after 13m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 13m35s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 13m56s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 14m22s
sm-rpc / build (Debug, host.gcc) (push) Failing after 14m49s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 15m13s
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
// diStorm64 library sample
|
|
// http://ragestorm.net/distorm/
|
|
// Arkon, Stefan, 2005
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#pragma comment(lib, "../../distorm.lib")
|
|
|
|
#include "../../include/distorm.h"
|
|
|
|
// The number of the array of instructions the decoder function will use to return the disassembled instructions.
|
|
// Play with this value for performance...
|
|
#define MAX_INSTRUCTIONS (1000)
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
_DecodeResult res;
|
|
_DInst decodedInstructions[1000];
|
|
_DecodedInst di;
|
|
unsigned int decodedInstructionsCount = 0, i = 0;
|
|
_OffsetType offset = 0;
|
|
unsigned int dver = distorm_version();
|
|
printf("diStorm version: %d.%d.%d\n", (dver >> 16), ((dver) >> 8) & 0xff, dver & 0xff);
|
|
|
|
unsigned char rawData[] = {
|
|
0x0f, 0x01, 0xcb
|
|
};
|
|
|
|
_CodeInfo ci = { 0 };
|
|
ci.codeLen = sizeof(rawData);
|
|
ci.code = rawData;
|
|
ci.dt = Decode32Bits;
|
|
ci.features = 0;
|
|
distorm_decompose(&ci, decodedInstructions, 1000, &decodedInstructionsCount);
|
|
//distorm_decode(0, rawData, sizeof(rawData), Decode32Bits, &di, 1, &decodedInstructionsCount);
|
|
for (int i = 0; i < decodedInstructionsCount; i++) {
|
|
distorm_format(&ci, &decodedInstructions[i], &di);
|
|
printf("%08I64x (%02d) %-24s %s%s%s\r\n", di.offset, di.size, (char*)di.instructionHex.p, (char*)di.mnemonic.p, di.operands.length != 0 ? " " : "", (char*)di.operands.p);
|
|
}
|
|
|
|
return 0;
|
|
}
|