本文整理汇总了C++中Disassembler::ErrorString方法的典型用法代码示例。如果您正苦于以下问题:C++ Disassembler::ErrorString方法的具体用法?C++ Disassembler::ErrorString怎么用?C++ Disassembler::ErrorString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Disassembler
的用法示例。
在下文中一共展示了Disassembler::ErrorString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostInit
//.........这里部分代码省略.........
};
void *call_target = AddrManager::GetAddr("CTFPlayer::IsPlayerClass");
if (call_target == nullptr) return false;
Disassembler<true> disasm;
auto result = disasm.Disassemble(func_base, s_DisasmLimit);
auto it_arg4 = result.end();
auto it_call = result.end();
auto it_test = result.end();
auto it_jcc = result.end();
for (auto i = result.begin(); i != result.end(); ++i) {
// auto insn = *i;
// uintptr_t off = insn.Addr() - func_base;
// if (off >= 0x5e2 && off < 0x600) {
// DevMsg("\n+0x%03x: %s %s\n", off, insn.MnemonicStr(), insn.OperandStr());
//
// DevMsg("Bytes:");
// for (auto byte : insn.Bytes()) {
// DevMsg(" %02X", byte);
// }
// DevMsg("\n");
// }
/* find the call to CTFPlayer::IsPlayerClass */
if (l_is_call_to_addr(*i, call_target)) {
it_call = i;
DevMsg("Found call @ +0x%03x\n", (*it_call).Addr() - func_base);
for (auto j = i - 1; j >= i - 4 && j != result.begin(); --j) {
if (it_arg4 == result.end() && l_is_push_imm32_arg(*j, 0x4, TF_CLASS_ENGINEER)) {
it_arg4 = j;
DevMsg("Found arg4 @ +0x%03x\n", (*it_arg4).Addr() - func_base);
}
}
for (auto j = i + 1; j <= i + 1 && j != result.end(); ++j) {
if (it_test == result.end() && l_is_test_al(*j)) {
it_test = j;
DevMsg("Found test @ +0x%03x\n", (*it_test).Addr() - func_base);
}
}
for (auto j = i + 2; j <= i + 2 && j != result.end(); ++j) {
if (it_jcc == result.end() && l_is_jcc_imm(*j)) {
it_jcc = j;
DevMsg("Found jcc @ +0x%03x\n", (*it_jcc).Addr() - func_base);
}
}
}
}
#if 0
bool result = disasm.IterateRange(this->GetFuncAddr(), s_DisasmLimit, [=](const InstructionDetailed& insn){
uint32_t off = insn.Addr() - (uintptr_t)this->GetFuncAddr();
if (off >= 0x5e2 && off < 0x600) {
DevMsg("\n+0x%03x: %s %s\n", off, insn.MnemonicStr(), insn.OperandStr());
DevMsg("Bytes:");
for (auto byte : insn.Bytes()) {
DevMsg(" %02X", byte);
}
DevMsg("\n");
}
/*
DevMsg("Insn @ %s+0x%03x: mnemonic '%s' opcode '%s'\n",
this->GetFuncName(), (insn.Addr() - (uintptr_t)this->GetFuncAddr()),
insn.MnemonicStr(), insn.OperandStr());
if (insn.ID() != X86_INS_CALL) return true;
DevMsg("Call @ %s+0x%03x: mnemonic '%s' opcode '%s'\n",
this->GetFuncName(), (insn.Addr() - (uintptr_t)this->GetFuncAddr()),
insn.MnemonicStr(), insn.OperandStr());
DevMsg("Bytes:");
for (auto byte : insn.Bytes()) {
DevMsg(" %02X", byte);
}
DevMsg("\n");*/
return true;
// TODO: return false if we find what we're looking for
// also set m_bFound
// also set m_FuncOff
// also set up m_Buf and m_Mask
});
DevMsg("PostInit: result is %d, error is '%s'\n", result, disasm.ErrorString());
#endif
// TODO: return false upon failure
return true;
}