Пример #1
0
        public void ParseXml(StringBuilder Win32AppOutput)
        {
            try
            {
                stream = new StringReader(Win32AppOutput.ToString());
                reader = new XmlTextReader(stream);

                reader.MoveToContent();
                while (reader.ReadState == ReadState.Interactive && reader.ReadToFollowing("item"))
                {
                    MemoryRegion region = new MemoryRegion();
                    XmlReader SubReader = reader.ReadSubtree();
                    ParseRegion(ref region, ref SubReader);
                    MemoryData.Add(region);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Cannot parse memory data XML.", ex);
            }
        }
Пример #2
0
 private void ParseRegion(ref MemoryRegion region, ref XmlReader reader)
 {
     reader.ReadToDescendant("m_region_base_addr");
     region.RegionAddress = (UInt64)reader.ReadElementContentAs(typeof(UInt64), null);
     reader.ReadToNextSibling("m_region_protection");
     region.RegionProtection = (UInt32)reader.ReadElementContentAs(typeof(UInt32), null);
     reader.ReadToNextSibling("region_size");
     region.RegionSize = (UInt64)reader.ReadElementContentAs(typeof(UInt64), null);
     reader.ReadToNextSibling("m_storage_type");
     region.RegionStorageType = (UInt32)reader.ReadElementContentAs(typeof(UInt32), null);
     reader.ReadToNextSibling("m_region_blocks");
     region.NumberOfBlocks = (UInt32)reader.ReadElementContentAs(typeof(UInt32), null);
     reader.ReadToNextSibling("m_guard_blocks");
     region.NumberOfGuardBlocks = (UInt32)reader.ReadElementContentAs(typeof(UInt32), null);
     reader.ReadToNextSibling("m_is_stack");
     region.IsAStack = (Boolean)reader.ReadElementContentAs(typeof(Boolean), null);
     reader.ReadToFollowing("m_blocks");
     XmlReader SubReader = reader.ReadSubtree();
     ParseBlocks(ref region.MemoryBlocks, ref SubReader);
 }