private void ShowProcessWaitChains(WaitChainTraversal wct, bool showAllData)
        {
            var threads = Windows.GetProcessThreads(processPid);

            if (threads == null)
            {
                PhUtils.ShowWarning(string.Format("The process ID {0} does not exist", processPid));
                this.Close();
            }

            textDescription.AppendText(string.Format("Process: {0}, PID: {1}", processName, processPid));

            threadTree.Nodes.Add(string.Format("Process: {0}, PID: {1}", processName, processPid));

            foreach (var thread in threads)
            {
                //Get the wait chains for this thread.
                int currThreadId = thread.Key;

                WaitData data = wct.GetThreadWaitChain(currThreadId);

                if (data != null)
                {
                    DisplayThreadData(data, showAllData);
                }
                else //This happens when running without admin rights.
                {
                    threadTree.Nodes.Add(string.Format("TID:{0} Unable to retrieve wait chains for this thread without Admin rights", currThreadId));
                }
            }
        }
示例#2
0
        private void LoadSystemInformation()
        {
            MemoryObject sysInfoMo;

            sysInfoMo = _mfs.RootObject.GetChild("SystemInformation");

            if (sysInfoMo == null)
            {
                PhUtils.ShowWarning("The dump file does not contain system information. This most likely " +
                                    "means the file is corrupt.");
                return;
            }

            var dict = Dump.GetDictionary(sysInfoMo);

            sysInfoMo.Dispose();

            _phVersion    = dict["ProcessHackerVersion"];
            _osVersion    = dict["OSVersion"];
            _architecture = (OSArch)Dump.ParseInt32(dict["Architecture"]);
            _userName     = dict["UserName"];

            treeProcesses.DumpUserName = _userName;

            this.Text = "Process Hacker " + _phVersion +
                        " [" + _userName + "] (" + _osVersion + ", " +
                        (_architecture == OSArch.I386 ? "32-bit" : "64-bit") +
                        ")";
        }
示例#3
0
        public static void Update(Form form, bool interactive)
        {
            if (PhUtils.IsInternetConnected)
            {
                XmlDocument xDoc = new XmlDocument();

                try
                {
                    xDoc.Load(Properties.Settings.Default.AppUpdateUrl);
                }
                catch (Exception ex)
                {
                    if (interactive)
                    {
                        PhUtils.ShowException("Unable to download update information", ex);
                    }
                    else
                    {
                        Program.HackerWindow.QueueMessage("Unable to download update information: " + ex.Message);
                    }

                    return;
                }

                UpdateItem currentVersion = new UpdateItem();
                UpdateItem bestUpdate     = currentVersion;

                XmlNodeList nodes = xDoc.SelectNodes("//update");
                foreach (XmlNode node in nodes)
                {
                    try
                    {
                        UpdateItem update = new UpdateItem(node);

                        // Check if this update is better than the one we already have.
                        if (update.IsBetterThan(bestUpdate, (AppUpdateLevel)Properties.Settings.Default.AppUpdateLevel))
                        {
                            bestUpdate = update;
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.Log(ex);
                    }
                }

                PromptWithUpdate(form, bestUpdate, currentVersion, interactive);
            }
            else if (interactive)
            {
                PhUtils.ShowWarning("An Internet session could not be established. Please verify connectivity.");
            }
        }
        private void LoadProcesses()
        {
            MemoryObject processesMo = this._mfs.RootObject.GetChild("Processes");

            _processesMo = processesMo;

            if (processesMo == null)
            {
                PhUtils.ShowWarning("The dump file does not contain process information. This most likely means the file is corrupt.");
                return;
            }

            processesMo.EnumChildren(childMo =>
            {
                using (childMo)
                    this.LoadProcess(childMo);

                return(true);
            });
        }
示例#5
0
        private void LoadServices()
        {
            MemoryObject servicesMo;

            servicesMo  = _mfs.RootObject.GetChild("Services");
            _servicesMo = servicesMo;

            if (servicesMo == null)
            {
                PhUtils.ShowWarning("The dump file does not contain service information. This most likely " +
                                    "means the file is corrupt.");
                return;
            }

            servicesMo.EnumChildren((childMo) =>
            {
                using (childMo)
                    this.LoadService(childMo);

                return(true);
            });
        }