public bool FindLoop(out asmInstruction found) { asmInstruction backup = m_Current; long addr; found = null; while (m_Current != null) { if ((m_Current.Instruction.type == x86_insn_type.insn_jmp) || (m_Current.Instruction.type == x86_insn_type.insn_jcc)) { addr = m_Current.ReadAddressOperand(); if ((addr < m_Current.Address) && (addr >= backup.Address)) { while ((m_Current != null) && (m_Current.Address != addr))//move to start of the loop { m_Current = Previous; } if (m_Current != null) { found = m_Current; return(true); } else { return(false); } } } m_Current = Next; } m_Current = backup; return(false); }
public bool FindByOperandType(x86_op_type x86_op_type, bool backwards, out asmInstruction found) { asmInstruction backup = m_Current; found = null; while (m_Current != null) { foreach (asmOperand op in m_Current.Operands) { if (op.Type == x86_op_type) { found = m_Current; return(true); } } if (backwards) { m_Current = Previous; } else { m_Current = Next; } } m_Current = backup; return(false); }
public bool FindByOperandValue(asmDataHandler value, bool backwards, out asmInstruction found) { asmInstruction backup = m_Current; found = null; while (m_Current != null) { foreach (asmOperand op in m_Current.Operands) { if (op.Data == value) { found = m_Current; return(true); } } if (backwards) { m_Current = Previous; } else { m_Current = Next; } } m_Current = backup; return(false); }
public bool FindMultiple(x86_insn_type[] types, bool backwards, out asmInstruction found) { bool _found = true; asmInstruction backup, fullbackup; fullbackup = m_Current; found = null; while (m_Current != null) { backup = m_Current; _found = true; for (uint i = 0; i < types.Length; i++) { if (m_Current.Instruction.type != types[i]) { _found = false; break; } /*if (backwards) * m_Current = Previous; * else*///always next otherwise the instruction list has to be passed reversed m_Current = Next; if (m_Current == null) { _found = false; break; } } m_Current = backup; if (_found) { found = m_Current; return(true); } if (backwards) { m_Current = Previous; } else { m_Current = Next; } } m_Current = fullbackup; return(false); }
public bool FindSized(x86_insn_type type, byte required_size, bool backwards, out asmInstruction found) { asmInstruction backup = m_Current; found = null; while (m_Current != null) { if ((m_Current.Instruction.type == type) && (m_Current.Instruction.size == required_size)) { found = m_Current; return(true); } if (backwards) { m_Current = Previous; } else { m_Current = Next; } } m_Current = backup; return(false); }
public bool FindByType(x86_insn_type type, bool backwards, out asmInstruction found) { asmInstruction backup = m_Current; found = null; while (m_Current != null) { if (m_Current.Instruction.type == type) { found = m_Current; return(true); } if (backwards) { m_Current = Previous; } else { m_Current = Next; } } m_Current = backup; return(false); }
public asmInstruction ToEnd() { return(m_Current = m_Instructions.rightmost().value); }
public asmInstruction ToStart() { return(m_Current = m_Instructions.leftmost().value); }
public asmChunk(long position, BinaryTree <long, asmInstruction> instructions) { m_Instructions = instructions; m_Addr = position; m_Current = m_Instructions[position]; }