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)); } } }
private void WaitChainWindow_Load(object sender, EventArgs e) { using (WaitChainTraversal wct = new WaitChainTraversal()) { ShowProcessWaitChains(wct, false); } }