mirror of
https://github.com/x64dbg/x64dbg.git
synced 2024-11-27 06:40:24 +00:00
Refactor zydis wrapper
This commit is contained in:
parent
f518e507c2
commit
bc9f7105fc
@ -101,8 +101,6 @@ bool Zydis::Disassemble(uint64_t addr, const unsigned char* data, size_t size)
|
||||
nullptr)))
|
||||
return false;
|
||||
|
||||
// Count explicit operands.
|
||||
mVisibleOpCount = 0;
|
||||
for(ZyanU8 i = 0; i < mInstr.info.operand_count; ++i)
|
||||
{
|
||||
auto & op = mInstr.operands[i];
|
||||
@ -125,10 +123,6 @@ bool Zydis::Disassemble(uint64_t addr, const unsigned char* data, size_t size)
|
||||
ZydisCalcAbsoluteAddress(&mInstr.info, &op, mAddr, (uint64_t*)&op.mem.disp.value);
|
||||
}
|
||||
|
||||
if(op.visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
|
||||
break;
|
||||
|
||||
++mVisibleOpCount;
|
||||
}
|
||||
|
||||
mSuccess = true;
|
||||
@ -369,11 +363,19 @@ std::string Zydis::InstructionText(bool replaceRipRelative) const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
uint8_t Zydis::VisibleOpCount() const
|
||||
{
|
||||
if(!Success())
|
||||
return 0;
|
||||
return mInstr.info.operand_count_visible;
|
||||
}
|
||||
|
||||
uint8_t Zydis::OpCount() const
|
||||
{
|
||||
if(!Success())
|
||||
return 0;
|
||||
return mVisibleOpCount;
|
||||
return mInstr.info.operand_count;
|
||||
}
|
||||
|
||||
const ZydisDecodedOperand & Zydis::operator[](uint8_t index) const
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
ZydisMnemonic GetId() const;
|
||||
std::string InstructionText(bool replaceRipRelative = true) const;
|
||||
uint8_t OpCount() const;
|
||||
uint8_t VisibleOpCount() const;
|
||||
const ZydisDecodedOperand & operator[](uint8_t index) const;
|
||||
std::string Mnemonic() const;
|
||||
const char* MemSizeName(size_t size) const;
|
||||
@ -125,5 +126,4 @@ private:
|
||||
ZydisDisassembledInstruction mInstr;
|
||||
char mInstrText[200];
|
||||
bool mSuccess = false;
|
||||
uint8_t mVisibleOpCount = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user