ultimatepp/uppsrc/plugin/ndisasm/ndisupp.cpp
cxl 1945f22301 plugin/ndisasm: updated to 2.12.02 (thanks coolman)
git-svn-id: svn://ultimatepp.org/upp/trunk@14932 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2020-08-29 18:37:06 +00:00

38 lines
729 B
C++

#include <Core/Core.h>
#include "ndisasm.h"
extern "C" {
#undef INT64_MIN
#undef INT64_MAX
#undef UINT64_MAX
#include "lib/compiler.h"
#include "lib/disasm.h"
}
namespace Upp {
int NDisassemble(char *output, const byte *data, uint64 offset, bool x64)// returns instruction length
{
int len = disasm(const_cast<unsigned char *>(data), output, 256, x64 ? 64 : 32, offset, false, 0);
if(len <= 0) {
eatbyte(const_cast<unsigned char *>(data), output, 256, x64 ? 64 : 32);
len = 1;
}
return len;
}
#ifdef flagMAIN
CONSOLE_APP_MAIN
{
long start = 0x4012f8, end = start + 256;
while(start < end) {
char line[NDISASM_OUTBUF_SIZE];
start += NDisassemble(line, (const byte *)start, start);
puts(line);
}
}
#endif
}