Exemplo n.º 1
0
        public void X86St_SetBp()
        {
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.bp, Constant.Word16(0x1234));
            Assert.IsFalse(state.IsValid(Registers.ebp));
            Assert.IsTrue(state.IsValid(Registers.bp));
        }
Exemplo n.º 2
0
        public void X86St_SetBp()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.bp, Constant.Word16(0x1234));
            Assert.IsFalse(state.IsValid(Registers.ebp));
            Assert.IsTrue(state.IsValid(Registers.bp));
        }
Exemplo n.º 3
0
        public void X86St_SetAhRegisterFileValue()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.ah, Constant.Byte(0x3A));
            Assert.IsFalse(state.IsValid(Registers.ax));
            Assert.IsTrue(state.IsValid(Registers.ah));
        }
Exemplo n.º 4
0
        public void X86St_SetAhRegisterFileValue()
        {
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.ah, Constant.Byte(0x3A));
            Assert.IsFalse(state.IsValid(Registers.ax));
            Assert.IsTrue(state.IsValid(Registers.ah));
        }
Exemplo n.º 5
0
        public void X86St_SetAhThenAl()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.ah, Constant.Byte(0x12));
            state.SetRegister(Registers.al, Constant.Byte(0x34));
            Assert.IsTrue(state.IsValid(Registers.ax));
            Assert.IsTrue(state.IsValid(Registers.al));
            Assert.IsTrue(state.IsValid(Registers.ah));
        }
Exemplo n.º 6
0
        public void X86St_SetCx()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.cx, Constant.Word16(0x1234));
            Assert.AreEqual(0x1234, (int)state.GetRegister(Registers.cx).ToUInt16());
            Assert.AreEqual(0x34, (int)state.GetRegister(Registers.cl).ToByte());
            Assert.AreEqual(0x12, (int)state.GetRegister(Registers.ch).ToByte());
            Assert.IsTrue(state.IsValid(Registers.cx));
            Assert.IsTrue(state.IsValid(Registers.cl));
            Assert.IsTrue(state.IsValid(Registers.ch));
        }
Exemplo n.º 7
0
        public void X86St_SetCx()
        {
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.cx, Constant.Word16(0x1234));
            Assert.AreEqual(0x1234, (int)state.GetRegister(Registers.cx).ToUInt16());
            Assert.AreEqual(0x34, (int)state.GetRegister(Registers.cl).ToByte());
            Assert.AreEqual(0x12, (int)state.GetRegister(Registers.ch).ToByte());
            Assert.IsTrue(state.IsValid(Registers.cx));
            Assert.IsTrue(state.IsValid(Registers.cl));
            Assert.IsTrue(state.IsValid(Registers.ch));
        }
Exemplo n.º 8
0
        public void X86St_SetDhSymbolic_Invalid()
        {
            var ctx = new Dictionary <Storage, Expression> {
                { Registers.dl, Constant.Byte(3) }
            };
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.dh, Constant.Invalid);
            Assert.IsFalse(state.IsValid(Registers.dh));
            Assert.IsFalse(state.IsValid(Registers.dx));
            Assert.IsFalse(state.IsValid(Registers.edx));
            Assert.AreEqual("0x03", ctx[Registers.dl].ToString());
        }
Exemplo n.º 9
0
        public void X86St_SetCxSymbolic_Invalid()
        {
            var ctx = new Dictionary <Storage, Expression> {
                { Registers.cl, Constant.Byte(0) }
            };
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.cx, Constant.Invalid);
            Assert.IsFalse(state.IsValid(Registers.cx));
            Assert.IsFalse(state.IsValid(Registers.cl));
            Assert.IsFalse(state.IsValid(Registers.ch));
            Assert.IsFalse(state.IsValid(Registers.ecx));
        }
Exemplo n.º 10
0
        public void X86St_SetDhSymbolic_Invalid()
        {
            var ctx = new Dictionary <Storage, Expression> {
                { Registers.dl, Constant.Byte(3) }
            };
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.dh, InvalidConstant.Create(Registers.dh.DataType));
            Assert.IsFalse(state.IsValid(Registers.dh));
            Assert.IsFalse(state.IsValid(Registers.dx));
            Assert.IsFalse(state.IsValid(Registers.edx));
            Assert.AreEqual("3<8>", ctx[Registers.dl].ToString());
        }
Exemplo n.º 11
0
        public void X86St_SetCxSymbolic_Invalid()
        {
            var ctx = new Dictionary <Storage, Expression> {
                { Registers.cl, Constant.Byte(0) }
            };
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.cx, InvalidConstant.Create(Registers.cx.DataType));
            Assert.IsFalse(state.IsValid(Registers.cx));
            Assert.IsFalse(state.IsValid(Registers.cl));
            Assert.IsFalse(state.IsValid(Registers.ch));
            Assert.IsFalse(state.IsValid(Registers.ecx));
        }