public void FunctionProlog_ParserWithFunctionPrologAtFirstInstruction_ReturnsNonNull()
        {
            //arrange
            DummyInstruction instruction1 = new DummyInstruction(SharpDisasm.Udis86.ud_mnemonic_code.UD_Ipush);
            DummyInstruction instruction2 = new DummyInstruction(SharpDisasm.Udis86.ud_mnemonic_code.UD_Imov);
            DummyInstruction instruction3 = new DummyInstruction(SharpDisasm.Udis86.ud_mnemonic_code.UD_Iadc);

            //set instruction 1
            instruction1.NextInstruction = instruction2;
            instruction1.Offset          = 0;
            ud_operand ud_operand1 = new ud_operand();

            ud_operand1.@base = ud_type.UD_R_EBP;
            var operand1 = new Operand(ud_operand1);

            instruction1.Operands = new Operand[] { operand1 };

            //set instruction 2
            instruction2.NextInstruction = instruction3;
            ud_operand ud_operand2_1 = new ud_operand();

            ud_operand2_1.@base = SharpDisasm.Udis86.ud_type.UD_R_EBP;
            var operand2_1 = new Operand(ud_operand2_1);

            ud_operand ud_operand2_2 = new ud_operand();

            ud_operand2_2.@base = SharpDisasm.Udis86.ud_type.UD_R_ESP;
            var operand2_2 = new Operand(ud_operand2_2);

            instruction2.Operands = new Operand[] { operand2_1, operand2_2 };

            instruction3.Offset = 2;

            //act
            var parser             = new FunctionPrologParser();
            var lastPrologAssembly = parser.Parse(instruction1, 2);

            //assert
            Assert.IsNotNull(lastPrologAssembly, "last Prolog assembly should not  be null");
        }
Exemple #2
0
 internal Operand(ud_operand operand)
 {
     UdOperand = operand;
 }