private void reload()
        {
            // this.dkmEvalResult.InspectionContext;
            txtOutput.Text = "";
            ulong address = this.dkmEvalResult.Address.Value;

            DkmProcess process = this.dkmEvalResult.InspectionContext.Thread.Process;

            byte[] buffer = new byte[1024];
            process.ReadMemory(
                address,
                DkmReadMemoryFlags.None,
                buffer
                );

            using (BSONIterator it = new BSONIterator(buffer))
            {
                while (it.Next() != BSONType.EOO)
                {
                    BSONValue value = it.FetchCurrentValue();
                    String    s     = value.ToString();

                    txtOutput.Text += s;
                    txtOutput.Text += "\n";
                    continue;
                }
            }

            return;
        }
Exemple #2
0
        public void TestIterate1()
        {
            var doc = new BSONDocument();

            doc["a"]  = "av";
            doc["bb"] = 24;
            //doc["ccc"] = BSONDocument.ValueOf(new{na1 = 1, nb = "2"});
            //doc["d"] = new BSONOid("51b9f3af98195c4600000000");

            //17-00-00-00                       +4
            //02-61-00-03-00-00-00-61-76-00		+10
            //10-62-62-00-18-00-00-00			+8
            //00								+1
            Assert.AreEqual("17-00-00-00-02-61-00-03-00-00-00-61-76-00-10-62-62-00-18-00-00-00-00",
                            doc.ToDebugDataString());
            BSONIterator it = new BSONIterator(doc);

            Assert.AreEqual(doc.ToByteArray().Length, it.DocumentLength);
            var c = "";

            while (it.Next() != BSONType.EOO)
            {
                c += it.CurrentKey;
            }
            Assert.AreEqual("abb", c);
            it.Dispose();

            it = new BSONIterator(doc);
            var cnt = 0;

            while (it.Next() != BSONType.EOO)
            {
                BSONValue bv = it.FetchCurrentValue();
                Assert.IsNotNull(bv);
                if (cnt == 0)
                {
                    Assert.IsTrue(bv.BSONType == BSONType.STRING);
                    Assert.IsTrue(bv.Key == "a");
                    Assert.AreEqual("av", bv.Value);
                }
                if (cnt == 1)
                {
                    Assert.IsTrue(bv.BSONType == BSONType.INT);
                    Assert.IsTrue(bv.Key == "bb");
                    Assert.AreEqual(24, bv.Value);
                }
                cnt++;
            }
        }
Exemple #3
0
        public void TestIterate1()
        {
            var doc = new BSONDocument();
            doc["a"] = "av";
            doc["bb"] = 24;
            //doc["ccc"] = BSONDocument.ValueOf(new{na1 = 1, nb = "2"});
            //doc["d"] = new BSONOid("51b9f3af98195c4600000000");

            //17-00-00-00 						+4
            //02-61-00-03-00-00-00-61-76-00		+10
            //10-62-62-00-18-00-00-00			+8
            //00								+1
            Assert.AreEqual("17-00-00-00-02-61-00-03-00-00-00-61-76-00-10-62-62-00-18-00-00-00-00",
                            doc.ToDebugDataString());
            BSONIterator it = new BSONIterator(doc);
            Assert.AreEqual(doc.ToByteArray().Length, it.DocumentLength);
            var c = "";
            while (it.Next() != BSONType.EOO) {
                c += it.CurrentKey;
            }
            Assert.AreEqual("abb", c);
            it.Dispose();

            it = new BSONIterator(doc);
            var cnt = 0;
            while (it.Next() != BSONType.EOO) {
                BSONValue bv = it.FetchCurrentValue();
                Assert.IsNotNull(bv);
                if (cnt == 0) {
                    Assert.IsTrue(bv.BSONType == BSONType.STRING);
                    Assert.IsTrue(bv.Key == "a");
                    Assert.AreEqual("av", bv.Value);
                }
                if (cnt == 1) {
                    Assert.IsTrue(bv.BSONType == BSONType.INT);
                    Assert.IsTrue(bv.Key == "bb");
                    Assert.AreEqual(24, bv.Value);
                }
                cnt++;
            }
        }