Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Commit

Permalink
Adding random overhead to SizeOfCode + little cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxuser committed Jul 21, 2014
1 parent 37db810 commit d60f3f3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions OZMTool/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,22 +705,24 @@ UINT8 injectDSDTintoAmiboardInfo(QByteArray amiboardbuf, QByteArray dsdtbuf, QBy

printf(" * Patching addresses in code\n");

UINT32 noIdeaWhyOverheadNeeded = 0x80; // <--- WHAT IT SAYS ?!?
const static UINT32 MAX_INSTRUCTIONS = 1000;
_DInst decomposed[MAX_INSTRUCTIONS];
_DecodedInst disassembled[MAX_INSTRUCTIONS];
_DecodeResult res, res2;
_CodeInfo ci = {0};
unsigned int decomposedInstructionsCount = 0;
unsigned int decodedInstructionsCount = 0;
ci.code = (const unsigned char*)amiboardbuf.constData();
ci.codeOffset = HeaderNT->OptionalHeader.BaseOfCode;
ci.codeLen = HeaderNT->OptionalHeader.SizeOfCode;
ci.codeLen = HeaderNT->OptionalHeader.SizeOfCode+noIdeaWhyOverheadNeeded;
ci.dt = Decode64Bits;

UINT32 decomposedInstructionsCount = 0;
UINT32 decodedInstructionsCount = 0;

/* Actual disassembly */
res = distorm_decode(HeaderNT->OptionalHeader.BaseOfCode,
(const unsigned char*)amiboardbuf.constData(),
HeaderNT->OptionalHeader.SizeOfCode,
res = distorm_decode(ci.codeOffset,
ci.code,
ci.codeLen,
Decode64Bits,
disassembled,
MAX_INSTRUCTIONS,
Expand Down

0 comments on commit d60f3f3

Please sign in to comment.