Ejemplo n.º 1
0
        public SummaryView(MiniDumpFile miniDumpFile)
            : this()
        {
            _miniDumpFile = miniDumpFile;

            #region Header data

            MiniDumpHeader header = _miniDumpFile.ReadHeader();

            if (header == null)
            {
                return;
            }

            txtDateTime.Text = header.TimeDateStamp.ToString();
            txtFlags.Text    = header.Flags.ToString();
            lblAvailableStreamsHeading.Text = $"Available Streams ({header.DirectoryEntries.Count} items)";

            foreach (MiniDumpDirectory directoryEntry in header.DirectoryEntries.OrderBy(entry => entry.StreamType.ToString()))
            {
                ListViewItem newItem = new ListViewItem(directoryEntry.StreamType.ToString());
                newItem.Tag = directoryEntry;
                newItem.SubItems.Add(Formatters.FormatAsMemoryAddress(directoryEntry.Location.Rva));
                newItem.SubItems.Add(directoryEntry.Location.DataSizePretty);

                listView1.Items.Add(newItem);
            }
            #endregion

            #region Module stream
            MiniDumpModule[] modules = _miniDumpFile.ReadModuleList();

            if (modules.Length > 1)
            {
                this.txtMainModule.Text = modules[0].PathAndFileName;
            }
            #endregion

            #region SystemInfo stream
            MiniDumpSystemInfoStream systemInfoStream = _miniDumpFile.ReadSystemInfo();

            if (systemInfoStream != null)
            {
                this.txtOperatingSystem.Text = systemInfoStream.OperatingSystemDescription;

                if (!string.IsNullOrEmpty(systemInfoStream.CSDVersion))
                {
                    this.txtOperatingSystem.Text += $" ({systemInfoStream.CSDVersion})";
                }
            }
            #endregion
        }
Ejemplo n.º 2
0
        private void CmdDisplayStream(string streamName)
        {
            UserControl viewToDisplay = null;
            int         numberOfItems = 0;
            string      nodeText      = String.Empty; // Quick fix for duplicated item counts in node text

            switch (streamName)
            {
            case "Summary":
                nodeText      = string.Empty;
                viewToDisplay = new SummaryView(_miniDumpFile);
                break;

            case "Handles":
                nodeText = "Handles";
                MiniDumpHandleDescriptor[] handleData = this._miniDumpFile.ReadHandleData();
                numberOfItems = handleData.Length;
                viewToDisplay = new HandleDataView(handleData);
                break;

            case "Modules":
                nodeText = "Modules";
                MiniDumpModule[] moduleData = this._miniDumpFile.ReadModuleList();
                numberOfItems = moduleData.Length;
                viewToDisplay = new ModulesView(moduleData);
                break;

            case "Threads":
                nodeText = "Threads";
                MiniDumpThread[] threadData = this._miniDumpFile.ReadThreadList();
                numberOfItems = threadData.Length;
                viewToDisplay = new ThreadListView(threadData);
                break;

            case "ThreadInfo":
                nodeText = "ThreadInfo";
                MiniDumpThreadInfo[] threadInfoData = this._miniDumpFile.ReadThreadInfoList();
                numberOfItems = threadInfoData.Length;
                viewToDisplay = new ThreadInfoListView(threadInfoData);
                break;

            case "ThreadNames":
                nodeText = "ThreadNames";
                MiniDumpThreadNamesStream threadNamesStream = this._miniDumpFile.ReadThreadNamesStream();
                numberOfItems = threadNamesStream.Entries.Count;
                viewToDisplay = new ThreadNamesView(threadNamesStream);
                break;

            case "Memory":
                nodeText = "Memory";
                MiniDumpMemoryDescriptor[] memoryData = this._miniDumpFile.ReadMemoryList();
                numberOfItems = memoryData.Length;
                viewToDisplay = new MemoryListView(memoryData);
                break;

            case "Memory64":
                nodeText = "Memory64";
                MiniDumpMemory64Stream memory64Data = this._miniDumpFile.ReadMemory64List();
                numberOfItems = memory64Data.MemoryRanges.Length;
                viewToDisplay = new MemoryList64View(memory64Data.MemoryRanges);
                break;

            case "MemoryInfo":
                nodeText = "MemoryInfo";
                MiniDumpMemoryInfoStream memoryInfo = this._miniDumpFile.ReadMemoryInfoList();
                numberOfItems = memoryInfo.Entries.Length;
                viewToDisplay = new MemoryInfoView(memoryInfo, _miniDumpFile);
                break;

            case "MiscInfo":
                nodeText = "MiscInfo";
                MiniDumpMiscInfo miscInfo = this._miniDumpFile.ReadMiscInfo();
                numberOfItems = 1;
                viewToDisplay = new MiscInfoView(miscInfo);
                break;

            case "SystemInfo":
                nodeText = "SystemInfo";
                MiniDumpSystemInfoStream systemInfo = this._miniDumpFile.ReadSystemInfo();
                numberOfItems = 1;
                viewToDisplay = new SystemInfoView(systemInfo);
                break;

            case "Exception":
                nodeText = "Exception";
                MiniDumpExceptionStream exceptionStream = this._miniDumpFile.ReadExceptionStream();

                numberOfItems = (exceptionStream == null) ? 0 : 1;

                viewToDisplay = new ExceptionStreamView(exceptionStream);
                break;

            case "UnloadedModules":
                nodeText = "UnloadedModules";
                MiniDumpUnloadedModulesStream unloadedModulesStream = this._miniDumpFile.ReadUnloadedModuleList();
                numberOfItems = (int)unloadedModulesStream.NumberOfEntries;
                viewToDisplay = new UnloadedModulesView(unloadedModulesStream);
                break;

            case "SystemMemoryInfo":
                nodeText = "SystemMemoryInfo";
                MiniDumpSystemMemoryInfo systemMemoryInfo = this._miniDumpFile.ReadSystemMemoryInfo();
                numberOfItems = 1;
                viewToDisplay = new SystemMemoryInfoView(systemMemoryInfo);
                break;

            case "CommentW":
                nodeText = "CommentW";
                MiniDumpCommentStreamW commentWStream = this._miniDumpFile.ReadCommentStreamW();
                numberOfItems = string.IsNullOrEmpty(commentWStream.Comment) ? 0 : 1;
                viewToDisplay = new CommentStreamWView(commentWStream);
                break;
            }

            if (viewToDisplay != null)
            {
                if (nodeText != string.Empty)
                {
                    treeView1.SelectedNode.Text = nodeText + " (" + numberOfItems + (numberOfItems == 1 ? " item" : " items") + ")";
                }

                if (this.splitContainer1.Panel2.Controls.Count > 0)
                {
                    this.splitContainer1.Panel2.Controls.RemoveAt(0);
                }

                viewToDisplay.Dock = DockStyle.Fill;

                this.splitContainer1.Panel2.Controls.Add(viewToDisplay);
            }
        }
Ejemplo n.º 3
0
        public SystemInfoView(MiniDumpSystemInfoStream systemInfo)
            : this()
        {
            _systemInfo = systemInfo;

            AddGroupedNode("ProcessorArchitecture", systemInfo.ProcessorArchitecture.ToString(), LVG_SYSTEM_INFO);

            if (systemInfo.ProcessorArchitecture == MiniDumpProcessorArchitecture.PROCESSOR_ARCHITECTURE_INTEL)
            {
                switch (systemInfo.ProcessorLevel)
                {
                case 3: AddGroupedNode("ProcessorLevel", "Intel 80386", LVG_SYSTEM_INFO); break;

                case 4: AddGroupedNode("ProcessorLevel", "Intel 80486", LVG_SYSTEM_INFO); break;

                case 5: AddGroupedNode("ProcessorLevel", "Intel Pentium", LVG_SYSTEM_INFO); break;

                case 6: AddGroupedNode("ProcessorLevel", "Intel Pentium Pro or Pentium II", LVG_SYSTEM_INFO); break;

                default: AddGroupedNode("ProcessorLevel", systemInfo.ProcessorLevel.ToString(), LVG_SYSTEM_INFO); break;
                }
            }
            else
            {
                AddGroupedNode("ProcessorLevel", systemInfo.ProcessorLevel.ToString(), LVG_SYSTEM_INFO);
            }

            AddGroupedNode("ProcessorRevision", String.Format("0x{0:x8}", systemInfo.ProcessorRevision), LVG_SYSTEM_INFO);
            AddGroupedNode("NumberOfProcessors", systemInfo.NumberOfProcessors.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("Operating System", systemInfo.OperatingSystemDescription, LVG_SYSTEM_INFO);
            AddGroupedNode("ProductType", systemInfo.ProductType.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("MajorVersion", systemInfo.MajorVersion.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("MinorVersion", systemInfo.MinorVersion.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("BuildNumber", systemInfo.BuildNumber.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("PlatformId", systemInfo.PlatformId.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("CSDVersion", systemInfo.CSDVersion, LVG_SYSTEM_INFO);

            AddGroupedNode("SuiteMask", systemInfo.SuiteMask.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteBackOffice", systemInfo.HasSuiteBackOffice.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteBlade", systemInfo.HasSuiteBlade.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteComputeServer", systemInfo.HasSuiteComputeServer.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteDataCenter", systemInfo.HasSuiteDataCenter.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteEnterprise", systemInfo.HasSuiteEnterprise.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteEmbeddedNt", systemInfo.HasSuiteEmbeddedNt.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuitePersonal", systemInfo.HasSuitePersonal.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteSingleUserTerminalServices", systemInfo.HasSuiteSingleUserTerminalServices.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteSmallBusiness", systemInfo.HasSuiteSmallBusiness.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteSmallBusinessRestricted", systemInfo.HasSuiteSmallBusinessRestricted.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteStorageServer", systemInfo.HasSuiteStorageServer.ToString(), LVG_SYSTEM_INFO);
            AddGroupedNode("HasSuiteTerminal", systemInfo.HasSuiteTerminal.ToString(), LVG_SYSTEM_INFO);

            if (systemInfo.ProcessorArchitecture == MiniDumpProcessorArchitecture.PROCESSOR_ARCHITECTURE_INTEL)
            {
                AddGroupedNode("VendorId", systemInfo.CpuInfoX86.VendorId, LVG_CPU_INFO);
                AddGroupedNode("VersionInformation", String.Format("0x{0:x8}", systemInfo.CpuInfoX86.VersionInformation), LVG_CPU_INFO);
                AddGroupedNode("FeatureInformation",
                               String.Format("0x{0:x8} ({1})", systemInfo.CpuInfoX86.FeatureInformation, Convert.ToString(systemInfo.CpuInfoX86.FeatureInformation, 2)),
                               LVG_CPU_INFO);

                if (systemInfo.CpuInfoX86.VendorId == "AuthenticAMD")
                {
                    AddGroupedNode("AMDExtendedCpuFeatures ", String.Format("0x{0:x8}", systemInfo.CpuInfoX86.AMDExtendedCpuFeatures), LVG_CPU_INFO);
                }
            }
            else
            {
                AddGroupedNode("ProcessorFeatures ",
                               String.Format("0x{0:x8}", systemInfo.CpuInfoOther.ProcessorFeatures[0]) +
                               " " +
                               String.Format("0x{0:x8}", systemInfo.CpuInfoOther.ProcessorFeatures[1]), LVG_CPU_INFO);
            }
        }