예제 #1
0
        public void Ose_FindReplace()
        {
            Given_Engine();
            Given_Image(0x001000, new byte[] { 0x2a, 0x2a, 0x2a, 0x21, 0x23, 0x21, 0x23 });
            host.Expect(h => h.WriteMemory(
                            Arg <ulong> .Is.Anything,
                            Arg <int> .Is.Equal(3),
                            Arg <byte[]> .Is.NotNull)).Do(new Func <ulong, int, byte[], bool>((a, l, b) =>
            {
                LoadedImage.WriteBytes(b, a - image.BaseAddress.ToLinear(), l, image.Bytes);
                return(true);
            }));

            Given_Script(
                "find 001000, #21??21#\r\n" +
                "test $RESULT,$RESULT\r\n" +
                "jz done\r\n" +
                "fill $RESULT,3,2d\r\n" +
                "done:\r\n"
                );
            mr.ReplayAll();

            engine.Run();

            Assert.AreEqual("***---#", Encoding.ASCII.GetString(image.Bytes));
        }