예제 #1
0
        public void DataScanner_Readstring()
        {
            var addrBase = Address.Ptr32(0x00123000);
            var mem      = new MemoryArea(addrBase, new byte[0x1000]);
            var segmap   = new SegmentMap(addrBase,
                                          new ImageSegment("code", mem, AccessMode.ReadWrite));

            Given_Architecture();
            var program = new Program(
                segmap,
                arch.Object,
                new Mock <IPlatform>().Object);
            var sr   = new ScanResults();
            var addr = Address.Ptr32(0x00123400);

            Given_String(mem, addr, "Hello");

            var dsc = new DataScanner(program, sr, new FakeDecompilerEventListener());

            dsc.EnqueueUserGlobalData(addr, StringType.NullTerminated(PrimitiveType.Char), "sHello");
            dsc.ProcessQueue();

            var item = program.ImageMap.Items[addr];

            Assert.AreEqual(6, item.Size);
        }