コード例 #1
0
        public ProcessWindow(ProcessItem process)
        {
            this.SetPhParent();
            InitializeComponent();
            this.AddEscapeToClose();
            this.SetTopMost();

            _processItem = process;
            _pid = process.Pid;

            if (process.Icon != null)
                this.Icon = process.Icon;
            else
                this.Icon = Program.HackerWindow.Icon;

            textFileDescription.Text = "";
            textFileCompany.Text = "";
            textFileVersion.Text = "";

            Program.PWindows.Add(_pid, this);

            foreach (var d in Program.AppInstance.ProcessWindow.GetTabPages())
                tabControl.TabPages.Add(d(_pid));

            this.FixTabs();

            _dontCalculate = false;
        }
コード例 #2
0
        public ProcessWindow(ProcessItem process)
        {
            InitializeComponent();
            this.AddEscapeToClose();
            this.SetTopMost();

            _processItem = process;
            _pid = process.Pid;

            if (process.Icon != null)
                this.Icon = process.Icon;
            else
                this.Icon = Program.HackerWindow.Icon;

            textFileDescription.Text = string.Empty;
            textFileCompany.Text = string.Empty;
            textFileVersion.Text = string.Empty;

            if (!Program.PWindows.ContainsKey(_pid))
                Program.PWindows.Add(_pid, this);

            this.FixTabs();
          

            _selectThreadRun = new ProcessHacker.Common.Threading.ActionSync(this.SelectThreadInternal, 2);
        }
コード例 #3
0
 public QueueThreadWorker(ProcessItem processItem)
 {
     if (processItem == null)
     {
         throw new ArgumentException("processItem is null");
     }
     this.processItem = processItem;
     queueThread = new Thread(queueWorker);
     queueThread.Priority = ThreadPriority.AboveNormal;
     queueThread.Start();
 }
コード例 #4
0
        public void Add(ProcessItem item)
        {
            ProcessNode itemNode = new ProcessNode(item);

            // Add the process to the list of all processes.
            _processes.Add(item.Pid, itemNode);

            // Find the process' parent and add the process to it if we found it.
            if (item.HasParent && _processes.ContainsKey(item.ParentPid))
            {
                ProcessNode parent = _processes[item.ParentPid];

                parent.Children.Add(itemNode);
                itemNode.Parent = parent;
            }
            else
            {
                // The process doesn't have a parent, so add it to the root nodes.
                _roots.Add(itemNode);
            }

            itemNode.RefreshTreePath();

            // Find this process' children and fix them up.

            // We need to create a copy of the array because we may need 
            // to modify the roots list.
            ProcessNode[] roots = _roots.ToArray();

            foreach (ProcessNode node in roots)
            {
                // Notice that we don't replace a node's parent if it 
                // already has one. This is to break potential cyclic 
                // references.
                if (node.Parent == null && node.ProcessItem.HasParent && node.PPid == item.Pid)
                {
                    // Remove the node from the root list and add it to our 
                    // process' child list.
                    _roots.Remove(node);
                    itemNode.Children.Add(node);
                    node.Parent = itemNode;
                    node.RefreshTreePathRecursive();
                }
            }

            this.StructureChanged(this, new TreePathEventArgs(new TreePath()));
        }
コード例 #5
0
        public DumpProcessWindow(DumpHackerWindow hw, ProcessItem item, MemoryObject processMo)
        {
            InitializeComponent();
            this.AddEscapeToClose();

            _hw = hw;
            _item = item;
            _processMo = processMo;

            if (_item.Pid > 0)
            {
                this.Text = _item.Name + " (PID " + _item.Pid.ToString() + ")";
            }
            else
            {
                this.Text = _item.Name;
            }

            this.Icon = _item.Icon;
        }
コード例 #6
0
        public void Add(ProcessItem item)
        {
            ProcessNode itemNode = new ProcessNode(item);

            _processes.Add(item.Pid, itemNode);

            if (item.HasParent && _processes.ContainsKey(item.ParentPid))
            {
                ProcessNode parent = _processes[item.ParentPid];

                parent.Children.Add(itemNode);
                itemNode.Parent = parent;
            }
            else
            {

                _roots.Add(itemNode);
            }

            itemNode.RefreshTreePath();

            ProcessNode[] roots = _roots.ToArray();

            foreach (ProcessNode node in roots)
            {

                if (node.Parent == null && node.ProcessItem.HasParent && node.PPid == item.Pid)
                {

                    _roots.Remove(node);
                    itemNode.Children.Add(node);
                    node.Parent = itemNode;
                    node.RefreshTreePathRecursive();
                }
            }

            this.StructureChanged(this, new TreePathEventArgs(new TreePath()));
        }
コード例 #7
0
        public ProcessNode(ProcessItem pitem)
        {
            _pitem   = pitem;
            this.Tag = pitem.Pid;

            if (_pitem.Icon == null)
            {
                _wasNoIcon = true;
                _icon      = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
            }
            else
            {
                try
                {
                    _icon = _pitem.Icon.ToBitmap();
                }
                catch
                {
                    _wasNoIcon = true;
                    _icon      = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
                }
            }
        }
コード例 #8
0
ファイル: ProcessNode.cs プロジェクト: andyvand/ProcessHacker
        public ProcessNode(ProcessItem pitem)
        {
            _pitem = pitem;
            this.Tag = pitem.Pid;

            if (_pitem.Icon == null)
            {
                _wasNoIcon = true;
                _icon = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
            }
            else
            {
                try
                {
                    _icon = _pitem.Icon.ToBitmap();
                }
                catch
                {
                    _wasNoIcon = true;
                    _icon = global::ProcessHacker.Properties.Resources.Process_small.ToBitmap();
                }
            }
        }
コード例 #9
0
        public List <ProcessItem> GetFirstProcessList()
        {
            //Return the first list of ProcessItems

            List <ProcessItem> list = new List <ProcessItem>();

            foreach (var item in processListStorage[0].ReturnAllItems())
            {
                ProcessItem firstElement = processListStorage[0].pop();                    //remove the item from the storage and store it here

                list.Add(new ProcessItem(firstElement.getName(), firstElement.getTime())); //add item into list
            }

            processListStorage.RemoveAt(0); //remove item

            //if no more lists left, set flag to 0 indicating no more left to any process that uses that flag
            if (processListStorage.Count < 1)
            {
                flag = 0;
            }

            return(list);
        }
コード例 #10
0
        public Task <IProcessItem> GetProcessItemAsync(string processItemId)
        {
            _eventStreamsLock.EnterReadLock();
            var events = _eventStreams
                         .Where(x => x.ProcessItemId == processItemId)
                         .OrderBy(x => x.MutationTimestampUtc)
                         .ToList();

            _eventStreamsLock.ExitReadLock();
            if (!events.Any())
            {
                return(Task.FromResult <IProcessItem>(null));
            }

            var processItem = new ProcessItem();

            foreach (var e in events)
            {
                processItem.ReplayMutation(new CompletedProcessItemMutation(e.MutationId, e.MutationTimestampUtc, e.Mutation));
            }

            return(Task.FromResult <IProcessItem>(processItem));
        }
コード例 #11
0
        /// <summary>
        /// Calls a delegate to all items in the queue. The queue is locked during the whole call.
        /// The items are processed in order from highest to lowest priority.
        /// </summary>
        /// <param name="processItem">The delegate to call.</param>
        public void ProcessItems(ProcessItem processItem)
        {
            bool stopProcessing = false;

            lock (m_lockObject)
            {
                ThrowIfInProcessItems();
                m_inProcessItems = true;

                try
                {
                    for (int blockIdx = 0; blockIdx < m_itemBlocks.Count && !stopProcessing; ++blockIdx)
                    {
                        ItemBlock itemBlock = m_itemBlocks[blockIdx];
                        itemBlock.ProcessItems(processItem, ref stopProcessing);

                        if (itemBlock.Count == 0)
                        {
                            if (blockIdx > 0)
                            {
                                m_itemBlocks[blockIdx - 1].MinPriority = itemBlock.MinPriority;
                            }
                            else if (m_itemBlocks.Count > 1)
                            {
                                m_itemBlocks[blockIdx + 1].MaxPriority = itemBlock.MaxPriority;
                            }

                            m_itemBlocks.RemoveAt(blockIdx--);
                        }
                    }
                }
                finally
                {
                    m_inProcessItems = false;
                }
            }
        }
コード例 #12
0
        private void provider_DictionaryRemoved(ProcessItem item)
        {
            this.BeginInvoke(new MethodInvoker(delegate
            {
                lock (_listLock)
                {
                    TreeNodeAdv node = this.FindTreeNode(item.Pid);

                    if (node != null)
                    {
                        //if (this.StateHighlighting)
                        //{
                        node.State = TreeNodeAdv.NodeState.Removed;
                        this.PerformDelayed(Settings.Instance.HighlightingDuration,
                                            new MethodInvoker(delegate
                        {
                            try
                            {
                                _treeModel.Remove(item);
                                this.RefreshItems();
                            }
                            catch (Exception ex)
                            {
                                Logging.Log(ex);
                            }
                        }));
                        //}
                        //else
                        //{
                        //    _treeModel.Remove(item);
                        //}

                        treeProcesses.Invalidate();
                    }
                }
            }));
        }
コード例 #13
0
        public void RefreshItems()
        {
            lock (_listLock)
            {
                foreach (TreeNodeAdv node in treeProcesses.AllNodes)
                {
                    try
                    {
                        ProcessNode pNode = this.FindNode(node);
                        IDictionary <int, ProcessItem> processes;

                        if (!_dumpMode)
                        {
                            processes = _provider.Dictionary;
                        }
                        else
                        {
                            processes = DumpProcesses;
                        }

                        // May not be in the dictionary if the process has terminated but
                        // the node is still being highlighted.
                        if (processes.ContainsKey(pNode.Pid))
                        {
                            ProcessItem item = processes[pNode.Pid];

                            node.BackColor = this.GetProcessColor(item);
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.Log(ex);
                    }
                }
            }
        }
コード例 #14
0
        protected override void Execute(ProcessItem <MediaTitle> item)
        {
            string title    = String.Empty;
            string subtitle = String.Empty;

            if (String.IsNullOrWhiteSpace(item.Model.Subtitle) && !String.IsNullOrWhiteSpace(item.Model.Title))
            {
                title = item.Model.Title;
            }
            else if (String.IsNullOrWhiteSpace(item.Model.Title) && !String.IsNullOrWhiteSpace(item.Model.Subtitle))
            {
                subtitle = item.Model.Subtitle;
                item.AddError("title", "Title is missing, has only subtitle");
            }
            else
            {
                title    = item.Model.Title.Trim();
                subtitle = item.Model.Subtitle.Trim();

                item.SimpleProperties.Add((new TypedItem(String.Intern(Constants.Facets.Fulltitle), item.Model.Title + " " + item.Model.Subtitle)));
            }

            if (!String.IsNullOrWhiteSpace(title))
            {
                string token = Tokenize(title);
                item.TokenProperties.Add(new Title()
                {
                    Text  = title,
                    Token = token
                });
            }
            if (!String.IsNullOrWhiteSpace(subtitle))
            {
                item.SimpleProperties.Add((new TypedItem(String.Intern(Constants.Facets.Subtitle), subtitle)));
            }
        }
コード例 #15
0
ファイル: DataNode.cs プロジェクト: 15831944/backsight
 /// <summary>
 /// Queries the specified search extent. If this node is completely
 /// enclosed by the search extent, the <see cref="PassAll"/> method gets
 /// called to process all points with no further spatial checks. For
 /// nodes that partially overlap, each point is checked against the
 /// search extent.
 /// </summary>
 /// <param name="searchExtent">The search extent.</param>
 /// <param name="itemHandler">The method that should be called for each query hit (any
 /// node with an extent that overlaps the query window)</param>
 internal override void Query(Extent searchExtent, ProcessItem itemHandler)
 {
     if (this.Window.IsOverlap(searchExtent))
     {
         if (this.Window.IsEnclosedBy(searchExtent))
         {
             PassAll(itemHandler);
         }
         else
         {
             foreach (IPoint p in m_Items)
             {
                 if (searchExtent.IsOverlap(p.Geometry))
                 {
                     bool keepGoing = itemHandler(p);
                     if (!keepGoing)
                     {
                         return;
                     }
                 }
             }
         }
     }
 }
コード例 #16
0
        /// <summary>
        /// Process items with a covering rectangle that overlaps a query window.
        /// </summary>
        /// <param name="extent">The extent of the query window</param>
        /// <param name="types">The type(s) of object to look for</param>
        /// <param name="itemHandler">The method that should be called for each query hit. A hit
        /// is defined as anything with a covering rectangle that overlaps the query window (this
        /// does not mean the hit actually intersects the window).</param>
        public void QueryWindow(IWindow extent, SpatialType types, ProcessItem itemHandler)
        {
            Extent w = (extent == null || extent.IsEmpty ? new Extent() : new Extent(extent));

            if ((types & SpatialType.Point) != 0)
            {
                m_Points.Query(w, itemHandler);
            }

            if ((types & SpatialType.Line) != 0)
            {
                m_Lines.Query(w, itemHandler);
            }

            if ((types & SpatialType.Text) != 0)
            {
                m_Text.Query(w, itemHandler);
            }

            if ((types & SpatialType.Polygon) != 0)
            {
                m_Polygons.Query(w, itemHandler);
            }
        }
コード例 #17
0
 public void PrcosessMessage(string url, string title = "", bool found = false)
 {
     App.Current.Dispatcher.Invoke(() =>
     {
         title    = string.IsNullOrWhiteSpace(title) ? url : title;
         var item = _parseProcess.FirstOrDefault(_ => _.Url == url);
         if (item != null)
         {
             item.Message = string.Format("Совпадения {0} найдены - {1}",
                                          found ? string.Empty : "не", item.Title);
         }
         else
         {
             item = new ProcessItem
             {
                 Title   = title.SafeSubstring(0, 100),
                 Message = title.SafeSubstring(0, 100),
                 Tick    = DateTime.Now,
                 Url     = url
             };
             _parseProcess.Add(item);
         }
     });
 }
コード例 #18
0
ファイル: PointIndex.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Queries this index
 /// </summary>
 /// <param name="searchExtent">The area to search for</param>
 /// <param name="itemHandler">The method to call for every point that
 /// falls within the search extent</param>
 internal void Query(Extent searchExtent, ProcessItem itemHandler)
 {
     m_Root.Query(searchExtent, itemHandler);
 }
コード例 #19
0
        private void LoadProcess(MemoryObject mo)
        {
            var names = mo.ChildNames;
            ProcessItem pitem;

            if (!names.Contains("General"))
                return;

            IDictionary<string, string> generalDict;

            using (MemoryObject general = mo.GetChild("General"))
                generalDict = Dump.GetDictionary(general);

            pitem = new ProcessItem
            {
                Pid = Dump.ParseInt32(generalDict["ProcessId"]),
                Name = generalDict["Name"],
                ParentPid = Dump.ParseInt32(generalDict["ParentPid"])
            };

            if (generalDict.ContainsKey("HasParent"))
                pitem.HasParent = Dump.ParseBool(generalDict["HasParent"]);
            if (generalDict.ContainsKey("StartTime"))
                pitem.CreateTime = Dump.ParseDateTime(generalDict["StartTime"]);
            if (generalDict.ContainsKey("SessionId"))
                pitem.SessionId = Dump.ParseInt32(generalDict["SessionId"]);

            if (generalDict.ContainsKey("FileName"))
                pitem.FileName = generalDict["FileName"];

            if (generalDict.ContainsKey("FileDescription"))
            {
                pitem.VersionInfo = new ImageVersionInfo
                {
                    FileDescription = generalDict["FileDescription"],
                    CompanyName = generalDict["FileCompanyName"],
                    FileVersion = generalDict["FileVersion"],
                    FileName = pitem.FileName
                };
            }

            if (generalDict.ContainsKey("CommandLine"))
                pitem.CmdLine = generalDict["CommandLine"];
            if (generalDict.ContainsKey("IsPosix"))
                pitem.IsPosix = Dump.ParseBool(generalDict["IsPosix"]);
            if (generalDict.ContainsKey("IsWow64"))
                pitem.IsWow64 = Dump.ParseBool(generalDict["IsWow64"]);
            if (generalDict.ContainsKey("IsBeingDebugged"))
                pitem.IsBeingDebugged = Dump.ParseBool(generalDict["IsBeingDebugged"]);
            if (generalDict.ContainsKey("UserName"))
                pitem.Username = generalDict["UserName"];
            if (generalDict.ContainsKey("ElevationType"))
                pitem.ElevationType = (TokenElevationType)Dump.ParseInt32(generalDict["ElevationType"]);

            if (generalDict.ContainsKey("CpuUsage"))
                pitem.CpuUsage = float.Parse(generalDict["CpuUsage"]);
            if (generalDict.ContainsKey("JobName"))
                pitem.JobName = generalDict["JobName"];
            if (generalDict.ContainsKey("IsInJob"))
                pitem.IsInJob = Dump.ParseBool(generalDict["IsInJob"]);
            if (generalDict.ContainsKey("IsInSignificantJob"))
                pitem.IsInSignificantJob = Dump.ParseBool(generalDict["IsInSignificantJob"]);
            if (generalDict.ContainsKey("Integrity"))
                pitem.Integrity = generalDict["Integrity"];
            if (generalDict.ContainsKey("IntegrityLevel"))
                pitem.IntegrityLevel = Dump.ParseInt32(generalDict["IntegrityLevel"]);
            if (generalDict.ContainsKey("IsDotNet"))
                pitem.IsDotNet = Dump.ParseBool(generalDict["IsDotNet"]);
            if (generalDict.ContainsKey("IsPacked"))
                pitem.IsPacked = Dump.ParseBool(generalDict["IsPacked"]);
            if (generalDict.ContainsKey("VerifyResult"))
                pitem.VerifyResult = (VerifyResult)Dump.ParseInt32(generalDict["VerifyResult"]);
            if (generalDict.ContainsKey("VerifySignerName"))
                pitem.VerifySignerName = generalDict["VerifySignerName"];
            if (generalDict.ContainsKey("ImportFunctions"))
                pitem.ImportFunctions = Dump.ParseInt32(generalDict["ImportFunctions"]);
            if (generalDict.ContainsKey("ImportModules"))
                pitem.ImportModules = Dump.ParseInt32(generalDict["ImportModules"]);

            if (names.Contains("SmallIcon"))
            {
                using (var smallIcon = mo.GetChild("SmallIcon"))
                    pitem.Icon = Dump.GetIcon(smallIcon);
            }

            if (names.Contains("VmCounters"))
            {
                using (var vmCounters = mo.GetChild("VmCounters"))
                    pitem.Process.VirtualMemoryCounters = Dump.GetStruct<VmCountersEx64>(vmCounters).ToVmCountersEx();
            }

            if (names.Contains("IoCounters"))
            {
                using (var ioCounters = mo.GetChild("IoCounters"))
                    pitem.Process.IoCounters = Dump.GetStruct<IoCounters>(ioCounters);
            }

            _processes.Add(pitem.Pid, pitem);
            treeProcesses.AddItem(pitem);
        }
コード例 #20
0
 private Color GetProcessColor(ProcessItem p)
 {
     if (Settings.Instance.UseColorDebuggedProcesses && p.IsBeingDebugged)
     {
         return(Settings.Instance.ColorDebuggedProcesses);
     }
     else if (Settings.Instance.UseColorElevatedProcesses &&
              p.ElevationType == TokenElevationType.Full)
     {
         return(Settings.Instance.ColorElevatedProcesses);
     }
     else if (Settings.Instance.UseColorPosixProcesses &&
              p.IsPosix)
     {
         return(Settings.Instance.ColorPosixProcesses);
     }
     else if (Settings.Instance.UseColorWow64Processes &&
              p.IsWow64)
     {
         return(Settings.Instance.ColorWow64Processes);
     }
     else if (Settings.Instance.UseColorJobProcesses && p.IsInSignificantJob)
     {
         return(Settings.Instance.ColorJobProcesses);
     }
     else if (Settings.Instance.UseColorPackedProcesses &&
              Settings.Instance.VerifySignatures &&
              p.Name != null &&
              Program.ImposterNames.Contains(p.Name.ToLowerInvariant()) &&
              p.VerifyResult != VerifyResult.Trusted &&
              p.VerifyResult != VerifyResult.Unknown &&
              p.FileName != null)
     {
         return(Settings.Instance.ColorPackedProcesses);
     }
     else if (Settings.Instance.UseColorPackedProcesses &&
              Settings.Instance.VerifySignatures &&
              p.VerifyResult != VerifyResult.Trusted &&
              p.VerifyResult != VerifyResult.NoSignature &&
              p.VerifyResult != VerifyResult.Unknown)
     {
         return(Settings.Instance.ColorPackedProcesses);
     }
     else if (Settings.Instance.UseColorDotNetProcesses && p.IsDotNet)
     {
         return(Settings.Instance.ColorDotNetProcesses);
     }
     else if (Settings.Instance.UseColorPackedProcesses && p.IsPacked)
     {
         return(Settings.Instance.ColorPackedProcesses);
     }
     else if (_dumpMode && Settings.Instance.UseColorServiceProcesses &&
              DumpProcessServices.ContainsKey(p.Pid) && DumpProcessServices[p.Pid].Count > 0)
     {
         return(Settings.Instance.ColorServiceProcesses);
     }
     else if (!_dumpMode && Settings.Instance.UseColorServiceProcesses &&
              Program.HackerWindow.ProcessServices.ContainsKey(p.Pid) &&
              Program.HackerWindow.ProcessServices[p.Pid].Count > 0)
     {
         return(Settings.Instance.ColorServiceProcesses);
     }
     else if (Settings.Instance.UseColorSystemProcesses && p.Username == "NT AUTHORITY\\SYSTEM")
     {
         return(Settings.Instance.ColorSystemProcesses);
     }
     else if (_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == DumpUserName)
     {
         return(Settings.Instance.ColorOwnProcesses);
     }
     else if (!_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == Program.CurrentUsername)
     {
         return(Settings.Instance.ColorOwnProcesses);
     }
     else
     {
         return(SystemColors.Window);
     }
 }
コード例 #21
0
ファイル: Runner.cs プロジェクト: toatall/AutoEod3
 private void Cancel(ProcessItem item)
 {
     item.Status     = StatusType.Cancel;
     item.StatusText = "Отменено";
     SQL.cancel      = true;
 }
コード例 #22
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
        private void provider_DictionaryRemoved(ProcessItem item)
        {
            this.BeginInvoke(new MethodInvoker(delegate
            {
                lock (_listLock)
                {
                    TreeNodeAdv node = this.FindTreeNode(item.Pid);

                    if (node != null)
                    {
                        //if (this.StateHighlighting)
                        //{
                            node.State = TreeNodeAdv.NodeState.Removed;
                            this.PerformDelayed(Settings.Instance.HighlightingDuration,
                                new MethodInvoker(delegate
                            {
                                try
                                {
                                    _treeModel.Remove(item);
                                    this.RefreshItems();
                                }
                                catch (Exception ex)
                                {
                                    Logging.Log(ex);
                                }
                            }));
                        //}
                        //else
                        //{
                        //    _treeModel.Remove(item);
                        //}

                        treeProcesses.Invalidate();
                    }
                }
            }));
        }
コード例 #23
0
 public GenericStdParallelProcess(ProcessItem <Tin, Tout> processItem, int count)
     : base(0, 0, count, false, false)
 {
     this.processItem = processItem;
     this.convertFrom = delegate(IValueStructure value) { return((Tin)value); };
 }
コード例 #24
0
        public void UpdateStatistics()
        {
            if (!Program.ProcessProvider.Dictionary.ContainsKey(_pid))
            {
                return;
            }

            ProcessItem item = Program.ProcessProvider.Dictionary[_pid];

            labelCPUPriority.Text   = item.Process.BasePriority.ToString();
            labelCPUKernelTime.Text = Utils.FormatTimeSpan(new TimeSpan(item.Process.KernelTime));
            labelCPUUserTime.Text   = Utils.FormatTimeSpan(new TimeSpan(item.Process.UserTime));
            labelCPUTotalTime.Text  = Utils.FormatTimeSpan(new TimeSpan(item.Process.KernelTime + item.Process.UserTime));

            labelMemoryPB.Text  = Utils.FormatSize(item.Process.VirtualMemoryCounters.PrivatePageCount);
            labelMemoryWS.Text  = Utils.FormatSize(item.Process.VirtualMemoryCounters.WorkingSetSize);
            labelMemoryPWS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakWorkingSetSize);
            labelMemoryVS.Text  = Utils.FormatSize(item.Process.VirtualMemoryCounters.VirtualSize);
            labelMemoryPVS.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakVirtualSize);
            labelMemoryPU.Text  = Utils.FormatSize(item.Process.VirtualMemoryCounters.PagefileUsage);
            labelMemoryPPU.Text = Utils.FormatSize(item.Process.VirtualMemoryCounters.PeakPagefileUsage);
            labelMemoryPF.Text  = ((ulong)item.Process.VirtualMemoryCounters.PageFaultCount).ToString("N0");

            labelIOReads.Text      = item.Process.IoCounters.ReadOperationCount.ToString("N0");
            labelIOReadBytes.Text  = Utils.FormatSize(item.Process.IoCounters.ReadTransferCount);
            labelIOWrites.Text     = item.Process.IoCounters.WriteOperationCount.ToString("N0");
            labelIOWriteBytes.Text = Utils.FormatSize(item.Process.IoCounters.WriteTransferCount);
            labelIOOther.Text      = item.Process.IoCounters.OtherOperationCount.ToString("N0");
            labelIOOtherBytes.Text = Utils.FormatSize(item.Process.IoCounters.OtherTransferCount);

            labelOtherHandles.Text = ((ulong)item.Process.HandleCount).ToString("N0");

            if (_pid > 0)
            {
                try
                {
                    labelOtherGDIHandles.Text  = item.ProcessQueryHandle.GetGuiResources(false).ToString("N0");
                    labelOtherUSERHandles.Text = item.ProcessQueryHandle.GetGuiResources(true).ToString("N0");

                    if (OSVersion.HasCycleTime)
                    {
                        labelCPUCycles.Text = item.ProcessQueryHandle.GetCycleTime().ToString("N0");
                    }
                    else
                    {
                        labelCPUCycles.Text = "N/A";
                    }

                    if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista))
                    {
                        labelMemoryPP.Text   = item.ProcessQueryHandle.PagePriority.ToString();
                        labelIOPriority.Text = item.ProcessQueryHandle.IoPriority.ToString();
                    }
                }
                catch
                { }
            }
            else
            {
                labelOtherGDIHandles.Text  = "0";
                labelOtherUSERHandles.Text = "0";
                labelCPUCycles.Text        = "0";
                labelMemoryPP.Text         = "0";
                labelIOPriority.Text       = "0";
            }
        }
コード例 #25
0
 /// <summary>
 /// Queries the specified search extent.
 /// </summary>
 /// <param name="searchExtent">The search extent.</param>
 /// <param name="itemHandler">The method that should be called for each query hit (any
 /// node with an extent that overlaps the query window)</param>
 internal abstract void Query(Extent searchExtent, ProcessItem itemHandler);
コード例 #26
0
        public static void DumpProcess(
            MemoryObject processMo,
            SystemProcess process,
            ProcessItem item,
            Dictionary <int, SystemProcess> processesDict,
            object handles
            )
        {
            int pid = process.Process.ProcessId;

            using (var general = processMo.CreateChild("General"))
            {
                BinaryWriter bw = new BinaryWriter(general.GetWriteStream());

                if (pid < 0)
                {
                    bw.Write("ProcessId", pid);
                    bw.Write("Name", process.Name);
                    bw.Write("ParentPid", 0);
                    bw.Write("HasParent", true);

                    if (item != null)
                    {
                        bw.Write("CpuUsage", item.CpuUsage.ToString());
                    }

                    bw.Close();

                    return;
                }

                bw.Write("ProcessId", pid);
                bw.Write("Name", pid != 0 ? process.Name : "System Idle Process");
                bw.Write("ParentPid", process.Process.InheritedFromProcessId);
                bw.Write("StartTime", DateTime.FromFileTime(process.Process.CreateTime));
                bw.Write("SessionId", process.Process.SessionId);

                bool hasParent = true;

                if (
                    !processesDict.ContainsKey(process.Process.InheritedFromProcessId) ||
                    process.Process.InheritedFromProcessId == process.Process.ProcessId
                    )
                {
                    hasParent = false;
                }
                else if (processesDict.ContainsKey(process.Process.InheritedFromProcessId))
                {
                    ulong parentStartTime =
                        (ulong)processesDict[process.Process.InheritedFromProcessId].Process.CreateTime;
                    ulong thisStartTime = (ulong)process.Process.CreateTime;

                    if (parentStartTime > thisStartTime)
                    {
                        hasParent = false;
                    }
                }

                bw.Write("HasParent", hasParent);

                try
                {
                    string fileName;

                    if (pid != 4)
                    {
                        using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
                            fileName = FileUtils.GetFileName(phandle.GetImageFileName());
                    }
                    else
                    {
                        fileName = Windows.KernelFileName;
                    }

                    bw.Write("FileName", fileName);

                    var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName);

                    bw.Write("FileDescription", info.FileDescription);
                    bw.Write("FileCompanyName", info.CompanyName);
                    bw.Write("FileVersion", info.FileVersion);

                    try
                    {
                        Icon icon;

                        icon = FileUtils.GetFileIcon(fileName, false);

                        if (icon != null)
                        {
                            using (var smallIcon = processMo.CreateChild("SmallIcon"))
                            {
                                using (var s = smallIcon.GetWriteStream())
                                {
                                    using (var b = icon.ToBitmap())
                                        b.Save(s, System.Drawing.Imaging.ImageFormat.Png);
                                }
                            }

                            Win32.DestroyIcon(icon.Handle);
                        }

                        icon = FileUtils.GetFileIcon(fileName, true);

                        if (icon != null)
                        {
                            using (var largeIcon = processMo.CreateChild("LargeIcon"))
                            {
                                using (var s = largeIcon.GetWriteStream())
                                {
                                    using (var b = icon.ToBitmap())
                                        b.Save(s, System.Drawing.Imaging.ImageFormat.Png);
                                }
                            }

                            Win32.DestroyIcon(icon.Handle);
                        }
                    }
                    catch
                    { }
                }
                catch
                { }

                try
                {
                    using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights | ProcessAccess.VmRead))
                    {
                        bw.Write("CommandLine", phandle.GetCommandLine());
                        bw.Write("CurrentDirectory", phandle.GetPebString(PebOffset.CurrentDirectoryPath));
                        bw.Write("IsPosix", phandle.IsPosix());
                    }
                }
                catch
                { }

                try
                {
                    using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
                    {
                        if (OSVersion.Architecture == OSArch.Amd64)
                        {
                            bw.Write("IsWow64", phandle.IsWow64());
                        }
                    }

                    using (var phandle = new ProcessHandle(pid, ProcessAccess.QueryInformation))
                    {
                        bw.Write("IsBeingDebugged", phandle.IsBeingDebugged());
                        bw.Write("IsCritical", phandle.IsCritical());
                        bw.Write("DepStatus", (int)phandle.GetDepStatus());
                    }
                }
                catch
                { }

                bool userNameWritten = false;

                try
                {
                    using (var phandle = new ProcessHandle(pid, Program.MinProcessQueryRights))
                    {
                        using (var thandle = phandle.GetToken(TokenAccess.Query))
                        {
                            bw.Write("UserName", thandle.GetUser().GetFullName(true));
                            userNameWritten = true;

                            if (OSVersion.HasUac)
                            {
                                bw.Write("ElevationType", (int)thandle.GetElevationType());
                            }
                        }
                    }
                }
                catch
                { }

                if (!userNameWritten && pid <= 4)
                {
                    bw.Write("UserName", "NT AUTHORITY\\SYSTEM");
                }

                if (item != null)
                {
                    bw.Write("CpuUsage", item.CpuUsage.ToString());
                    bw.Write("JobName", item.JobName);
                    bw.Write("IsInJob", item.IsInJob);
                    bw.Write("IsInSignificantJob", item.IsInSignificantJob);
                    bw.Write("Integrity", item.Integrity);
                    bw.Write("IntegrityLevel", item.IntegrityLevel);
                    bw.Write("IsDotNet", item.IsDotNet);
                    bw.Write("IsPacked", item.IsPacked);
                    bw.Write("VerifyResult", (int)item.VerifyResult);
                    bw.Write("VerifySignerName", item.VerifySignerName);
                    bw.Write("ImportFunctions", item.ImportFunctions);
                    bw.Write("ImportModules", item.ImportModules);
                }

                bw.Close();
            }

            using (var vmCounters = processMo.CreateChild("VmCounters"))
                AppendStruct(vmCounters, new VmCountersEx64(process.Process.VirtualMemoryCounters));
            using (var ioCounters = processMo.CreateChild("IoCounters"))
                AppendStruct(ioCounters, process.Process.IoCounters);

            try
            {
                DumpProcessModules(processMo, pid);
            }
            catch
            { }

            try
            {
                DumpProcessToken(processMo, pid);
            }
            catch
            { }

            try
            {
                DumpProcessEnvironment(processMo, pid);
            }
            catch
            { }

            try
            {
                DumpProcessHandles(processMo, pid, handles);
            }
            catch
            { }

            //if (item != null)
            //{
            //    DumpProcessHistory(processMo, item.FloatHistoryManager.GetBuffer(ProcessStats.CpuKernel), "CpuKernel");
            //    DumpProcessHistory(processMo, item.FloatHistoryManager.GetBuffer(ProcessStats.CpuUser), "CpuUser");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.IoRead), "IoRead");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.IoWrite), "IoWrite");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.IoOther), "IoOther");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.IoReadOther), "IoReadOther");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.PrivateMemory), "PrivateMemory");
            //    DumpProcessHistory(processMo, item.LongHistoryManager.GetBuffer(ProcessStats.WorkingSet), "WorkingSet");
            //}
        }
コード例 #27
0
 public TitleIndexBuilder(ProcessItem <MediaTitle> item)
 {
     ProcessItem = item;
 }
コード例 #28
0
        public async Task ProcessActionTask(IEngineTask task)
        {
            var actionTask = task as ActionTask;
            var process    = await _processStore.GetProcessAsync(actionTask.ProcessId);

            var processItem = await _processItemEventStore.GetProcessItemAsync(actionTask.ProcessItemId);

            if (processItem == null)
            {
                var action = process.StartActions[actionTask.ActionId];
                if (action == null)
                {
                    throw new Exception("Start action not found, and process item is null.");
                }

                processItem = new ProcessItem();
                processItem.ApplyMutation(new CreationActionProcessItemMutation()
                {
                    ProcessItemId   = actionTask.ProcessItemId,
                    ActionId        = actionTask.ActionId,
                    TargetStepId    = action.ArrivalStep,
                    PropertyChanges = actionTask.PropertyChanges
                });
                _processItemEventStore.StoreUnsavedMutations((IProcessItemEventContainer)processItem,
                                                             (processItemMutationId, mutationDateTimeUtc) =>
                {
                    processItem.SetProcessItemState(processItemMutationId, mutationDateTimeUtc);
                });
            }
            else
            {
                _taskValidatorFactory(EngineTaskValidatorKinds.CurrentUserCanLockProcessItem).Validate(task, processItem);
                _taskValidatorFactory(EngineTaskValidatorKinds.RequestIsForTheMostRecentState).Validate(task, processItem);

                if (process.Steps.TryGetValue(processItem.CurrentStepId, out var step))
                {
                    if (step.Actions.TryGetValue(actionTask.ActionId, out var action))
                    {
                        processItem.ApplyMutation(new ActionProcessItemMutation()
                        {
                            ActionId        = actionTask.ActionId,
                            TargetStepId    = action.ArrivalStep,
                            PropertyChanges = actionTask.PropertyChanges
                        });
                        _processItemEventStore.StoreUnsavedMutations((IProcessItemEventContainer)processItem,
                                                                     (processItemMutationId, mutationDateTimeUtc) =>
                        {
                            processItem.SetProcessItemState(processItemMutationId, mutationDateTimeUtc);
                        });
                    }
                    else
                    {
                        throw new ActionNotFoundException(actionTask.ProcessItemId, actionTask.ProcessId, actionTask.PrincipalId, processItem.CurrentStepId, actionTask.ActionId);
                    }
                }
                else
                {
                    throw new Exception("Step not found.");
                }
            }
            _eventQueue.PublishEvent(new EventNotification()
            {
                ProcessId        = actionTask.ProcessId,
                ProcessItemId    = actionTask.ProcessItemId,
                ActionId         = actionTask.ActionId,
                NotificationKind = EventNotificationKinds.Action
            });
        }
コード例 #29
0
        protected override void Execute(ProcessItem <MediaTitle> item)
        {
            var keywords = SourceData.Where(text => item.Model.Title.ToLower().StartsWith(text.ToLower()) && item.Model.Title.ToLower().Contains(text.ToLower())).ToList();

            item.SimpleProperties.Add(new TypedItem(String.Intern(Constants.Facets.Keywords), keywords));
        }
コード例 #30
0
 /// <summary>
 /// Processes circles that overlap the specified window.
 /// Used by <c>FindCirclesQuery</c> to execute the query.
 /// </summary>
 /// <param name="extent">The query extent</param>
 /// <param name="itemHandler">Delegate for processing each query hit</param>
 internal void FindCircles(IWindow extent, ProcessItem itemHandler)
 {
     m_ExtraData.QueryWindow(extent, SpatialType.Line, itemHandler);
 }
コード例 #31
0
        public void Sync(string localRootFolder, string remoteFolder, S3StausChangedEventHandler eventHandler)
        {
            var files = GetFiles(localRootFolder, remoteFolder);
            var listRequest = new ListObjectsRequest().WithBucketName(_bucketName).WithPrefix(remoteFolder);
            var list = new Dictionary<string, S3Object>();
            UpdateStatus(eventHandler, files, list);
            bool isTruncated = false;
            bool hadException = false;
            using (var client = CreateAmazonS3Client()) {
                do {
                    try {
                        var listResponse = client.ListObjects(listRequest);
                        isTruncated = listResponse.IsTruncated;
                        var currentList = listResponse.S3Objects.Where(obj => obj.Size != 0).ToList();
                        foreach (var item in currentList) {

                            list.Add(item.Key, item);
                            if (files.ContainsKey(item.Key)) {
                                var file = files[item.Key];
                                if (file.LocalSize != item.Size) {
                                    file.S3Path = item.Key;
                                    file.S3Size = item.Size;
                                    file.Action = (file.LocalSize > file.S3Size) ? ProcessAction.Upload : ProcessAction.Download;
                                } else file.Action = ProcessAction.Match;
                            } else {
                                var file = new ProcessItem {S3Path = item.Key, S3Size = item.Size, Action = ProcessAction.Download};
                                files.Add(item.Key, file);
                            }
                        }
                        UpdateStatus(eventHandler, files, list);
                        listRequest.Marker = listResponse.NextMarker;
                    } catch (Exception) {
                        hadException = true;
                    }
                } while (isTruncated);
            }
            if (hadException) return;
            foreach (var file in files) {
                if (!list.ContainsKey(file.Key)) {
                    file.Value.S3Path = file.Key;
                    file.Value.Action = ProcessAction.Upload;
                }
            }
            UpdateStatus(eventHandler, files, list);
            //Task.Factory.StartNew(() => {
                foreach (var file in files) {
                    if (file.Value.Action == ProcessAction.Upload) {
                        Upload(file.Value);
                        UpdateStatus(eventHandler, files, list);
                    }
                }
            //});
            //Task.Factory.StartNew(() => {
                foreach (var file in files) {
                    if (file.Value.Action == ProcessAction.Download) {
                        Download(localRootFolder, file.Value);
                        UpdateStatus(eventHandler, files, list);
                    }
                }
            //});
        }
コード例 #32
0
ファイル: Program.cs プロジェクト: RoDaniel/featurehouse
 public static ProcessWindow GetProcessWindow(ProcessItem process)
 {
     return GetProcessWindow(process, new PWindowInvokeAction(delegate { }));
 }
コード例 #33
0
 public GenericStdParallelProcess(ProcessItem <Tin, Tout> processItem, int firstInput, int firstOutput, int count, bool inputIsInternal, bool outputIsInternal)
     : base(firstInput, firstOutput, count, inputIsInternal, outputIsInternal)
 {
     this.processItem = processItem;
     this.convertFrom = delegate(IValueStructure value) { return((Tin)value); };
 }
コード例 #34
0
        public async Task <IActionResult> CreateReport([FromBody] CreateReportInput input)
        {
            //选择的床位Id
            var bedIds  = input.Ids.Split(',');
            var records = _machineProcessApp.GetListByDate(input.StartDate, input.EndDate)
                          .Where(t => t.F_OperatePerson != null)
                          .Where(t => bedIds.Contains(t.F_Mid))
                          .Select(t => new
            {
                t.F_DialylisBedNo,
                t.F_GroupName,
                t.F_MachineName,
                t.F_MachineNo,
                t.F_Memo,
                t.F_Mid,
                t.F_OperatePerson,
                t.F_OperateTime,
                t.F_Option1,
                t.F_Option2,
                t.F_Option3,
                t.F_Option4,
                t.F_Option5,
                t.F_Option6,
                t.F_PGender,
                t.F_Pid,
                t.F_PName,
                t.F_ShowOrder,
                t.F_Vid,
                t.F_VisitDate,
                t.F_VisitNo
            })
                          .OrderBy(t => t.F_ShowOrder).ThenBy(t => t.F_VisitDate).ThenBy(t => t.F_VisitNo)
                          .ToList();
            var category = new MachineProcessCategory
            {
            };
            var users = _usersService.GetUserNameDict("").Select(t => new { t.F_Id, t.F_RealName }).ToList();

            foreach (var item in records)
            {
                var findrow = category.ProcessSummeryInfos.FirstOrDefault(t => t.Mid == item.F_Mid);
                if (findrow == null)
                {
                    findrow = new ProcessSummeryInfo
                    {
                        Mid           = item.F_Mid,
                        DialylisBedNo = item.F_DialylisBedNo,
                        GroupName     = item.F_GroupName,
                        MachineName   = item.F_MachineName,
                        MachineNo     = item.F_MachineNo,
                        StartDate     = input.StartDate.ToDateString(),
                        EndDate       = input.EndDate.ToDateString()
                    };
                    category.ProcessSummeryInfos.Add(findrow);
                }
                var element = new ProcessItem
                {
                    OperateTime       = "",
                    DialysisEndTime   = "",
                    DialysisStartTime = "",
                    Memo          = item.F_Memo,
                    OperatePerson = "",
                    PGender       = item.F_PGender,
                    PName         = item.F_PName,
                    VisitDate     = item.F_VisitDate.ToDate().ToDateString(),
                    VisitNo       = item.F_VisitNo.ToInt().ToString()
                };
                element.OperateTime = item.F_OperateTime == null ? "" : item.F_OperateTime.ToDate().ToDateTimeString(true).Substring(11);
                element.Option1     = item.F_Option1 ?? false;
                element.Option2     = item.F_Option2 ?? false;
                element.Option3     = item.F_Option3 ?? false;
                element.Option4     = item.F_Option4 ?? false;
                if (element.Option4 == true)
                {
                    element.Option5 = item.F_Option5 ?? "";
                    element.Option6 = item.F_Option6 ?? "";
                }
                var visitRecord = await _patVisitApp.GetForm(item.F_Vid);

                if (visitRecord != null)
                {
                    element.DialysisStartTime = visitRecord.F_DialysisStartTime == null ? "" : visitRecord.F_DialysisStartTime.ToDate().ToDateTimeString(true).Substring(11);
                    element.DialysisEndTime   = visitRecord.F_DialysisEndTime == null ? "" : visitRecord.F_DialysisEndTime.ToDate().ToDateTimeString(true).Substring(11);
                }
                if (item.F_OperatePerson != null)
                {
                    var finduser = users.FirstOrDefault(t => t.F_Id == item.F_OperatePerson);
                    element.OperatePerson = finduser == null ? "" : finduser.F_RealName;
                }
                findrow.ProcessItems.Add(element);
            }
            return(Content(_machineProcessApp.GetImageReport(category.ProcessSummeryInfos)));
        }
コード例 #35
0
        /// <summary>
        /// WebSocket Process
        /// </summary>
        /// <param name="r"></param>
        /// <param name="i"></param>
        public override void ShowForm(HttpListenerRequest r, int i)
        {
            var  host     = r.UrlReferrer == null ? string.Empty : r.UrlReferrer.Host;
            var  pid      = r.QueryString[KeyContext.QueryKey.ProcessId];
            var  sid      = r.QueryString[KeyContext.QueryKey.SecurityId];
            var  mode     = r.QueryString[KeyContext.QueryKey.Mode];
            var  authcode = r.QueryString[KeyContext.QueryKey.AuthCode]; //AES
            bool isRun    = false;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                //연속호출 체크
                if (CheckOverlapRequest() == false)
                {
                    return;
                }

                this.Cursor = Cursors.WaitCursor;
                string message   = string.Empty;
                string eninsttcd = string.Empty;
                string enuserid  = string.Empty;
                int    sindex    = -1;

                if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(sid) || string.IsNullOrEmpty(mode) || string.IsNullOrEmpty(authcode))
                {
                    ShowBalloonTip("필수 매겨변수가 누락되었습니다.", ToolTipIcon.Error);
                    return;
                }

                //개발모드가 아니면 도메인 체크
                //if (ApplicationConfig.DevMode == false)
                //{
                //    if (string.IsNullOrEmpty(host) ||
                //        host.Equals(ApplicationConfig.ServerHostName, StringComparison.CurrentCultureIgnoreCase) == false)
                //    {
                //        ShowBalloonTip("정상적인 접근이 아닙니다.", ToolTipIcon.Error);
                //        return;
                //    }
                //}

                sindex = GetSecurityIndex(sid);

                if (sindex < 0 || lastSecurityId.Equals(sindex))
                {
                    ShowBalloonTip("정상적인 요청이 아닙니다.", ToolTipIcon.Error);
                    return;
                }

                //복호화
                string[] dec = GetDecryptUserId(sindex, authcode);

                if (string.IsNullOrEmpty(dec[0]) || string.IsNullOrEmpty(dec[1]))
                {
                    ShowBalloonTip("복호화에 실패했습니다 \r\n 다시 호출해 주십시오.", ToolTipIcon.Error);
                    return;
                }

                if (Request == null ||
                    Request.CORR_INSTT_CD.Equals(dec[0], StringComparison.CurrentCultureIgnoreCase) == false ||
                    Request.USR_ID.Equals(dec[1], StringComparison.CurrentCultureIgnoreCase) == false)
                {
                    //사용자 정보 조회
                    isRun = SetUserAuthInfo(dec);
                }
                else
                {
                    //마지막 호출 사용자와 현재 호출 사용자 비교
                    isRun = (Request.CORR_INSTT_CD.Equals(dec[0], StringComparison.CurrentCultureIgnoreCase) &&
                             Request.USR_ID.Equals(dec[1], StringComparison.CurrentCultureIgnoreCase));
                }

                if (isRun == false || Request == null || string.IsNullOrEmpty(Request.USR_ID))
                {
                    ShowBalloonTip("사용자 인증에 실패 하였습니다.", ToolTipIcon.Error);
                    return;
                }
                else
                {
                    launcherService.ClearProcess(pid);
                }

                if (launcherService.Status == LauncherRunStatus.IsRuning)
                {
                    RequestHistoryHelper.GetActiveItem(i).Message = string.Empty;
                    RequestHistoryHelper.GetActiveItem(i).State   = "Complete";

                    ProcessItem item = GetProcessInfo(r.QueryString);

                    string prgName = launcherService.RunAt(item);

                    if (string.IsNullOrEmpty(prgName) == false)
                    {
                        InteropHelper.SwitchToThisWindowApp(prgName);
                    }
                }
                else
                {
                    if (launcherService.Status.Equals(LauncherRunStatus.IsRuning) == false)
                    {
                        ShowBalloonTip("요청을 수행 할 수 없습니다. \r\n 프로그램을 다시 시작해 주십시오.", ToolTipIcon.Error);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                ShowBalloonTip(ex.Message, ToolTipIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
コード例 #36
0
ファイル: IndexNode.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Processes every child node associated with this index node.
 /// This will be called by the <see cref="Query"/> method in a situation
 /// where the node is completely enclosed by a search extent.
 /// </summary>
 /// <param name="itemHandler">The method that should be called for every point</param>
 /// <remarks>This method should really return a <c>bool</c>, by being sensitive to
 /// the return value from the item handler (as it is, we may end up processing more
 /// data than we need to)</remarks>
 internal override void PassAll(ProcessItem itemHandler)
 {
     foreach (Node n in m_Children)
         n.PassAll(itemHandler);
 }
コード例 #37
0
ファイル: ProcessHelper.cs プロジェクト: Hengyin-Group/IntoPC
        public void StartProcess(ProcessItem pItem)
        {
            try
            {
                var processName = System.IO.Path.GetFileName(pItem?.FullPath ?? "").ToLower();
                if (string.IsNullOrEmpty(processName))
                {
                    //指定的程序路径配置无效;
                }
                else
                {
                    Process ps = CheckProcess(pItem);

                    if (ps == null)
                    {
                        ProcessStartInfo psi = new ProcessStartInfo();
                        //打开相应的软件
                        psi.UseShellExecute       = false;
                        psi.FileName              = pItem.FullPath;
                        psi.CreateNoWindow        = true;
                        psi.RedirectStandardError = true;
                        psi.WorkingDirectory      = System.IO.Path.GetDirectoryName(pItem.FullPath);

                        bool tryWithAdmin = false;
                        try
                        {
                            ps = Process.Start(psi);
                        }
                        catch (Exception ex)
                        {
                            //打开失败,尝试用管理员权限打开
                            bool isAdmin = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
                            if (!isAdmin)
                            {
                                tryWithAdmin = true;
                            }
                        }
                        if (tryWithAdmin)
                        {
                            //必须将UseShellExecute设置为true,将Verb设置为"runas"来用管理员权限启动.
                            //UseShellExecute时不能重定向IO流,所以将RedirectStandardError设置为false
                            psi.UseShellExecute       = true;
                            psi.RedirectStandardError = false;
                            psi.Verb = "runas";
                            ps       = Process.Start(psi);
                        }
                    }
                    else
                    {
                        ////将指定ps移至前台
                        //ShowWindow(ps.MainWindowHandle, SW_RESTORE); //将窗口还原,如果不用此方法,缩小的窗口不能激活
                        //bool res = SetForegroundWindow(ps.MainWindowHandle);
                        //if (!res)
                        //{
                        //    //无法切换到;
                        //}

                        MessageBox.Show("程序已打开");
                    }
                }
            }
            catch (Exception ex)
            {
                //启动失败
            }
        }
コード例 #38
0
ファイル: IndexNode.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Queries the specified search extent. For child nodes that are completely
 /// enclosed by the search extent, the <see cref="PassAll"/> method gets
 /// called to process all descendants with no further spatial checks. For
 /// child nodes that partially overlap, this method will be called recursively.
 /// </summary>
 /// <param name="searchExtent">The search extent.</param>
 /// <param name="itemHandler">The method that should be called for each query hit (any
 /// node with an extent that overlaps the query window)</param>
 internal override void Query(Extent searchExtent, ProcessItem itemHandler)
 {
     foreach (Node n in m_Children)
     {
         if (n.Window.IsEnclosedBy(searchExtent))
             n.PassAll(itemHandler);
         else
             n.Query(searchExtent, itemHandler);
     }
 }
コード例 #39
0
ファイル: Runner.cs プロジェクト: toatall/AutoEod3
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="scriptName"></param>
 /// <param name="connectionString"></param>
 /// <param name="indexDb"></param>
 /// <param name="codeIfns"></param>
 /// <param name="dates"></param>
 /// <param name="result"></param>
 public Runner(string scriptName, string connectionString, string indexDb, IResult result, ProcessItem processItem)
 {
     this.scriptName       = scriptName;
     this.connectionString = connectionString;
     this.indexDb          = indexDb;
     this.codeIfns         = processItem.CodeIfns;
     this.result           = result;
     this.processItem      = processItem;
     SetText(string.Format("Создание процесса для выполнения скрипта {0} для испекции {1}", scriptName, processItem.CodeIfns));
 }
コード例 #40
0
 /// <summary>
 /// Queries this index
 /// </summary>
 /// <param name="searchExtent">The area to search for</param>
 /// <param name="itemHandler">The method to call for every point that
 /// falls within the search extent</param>
 internal void Query(Extent searchExtent, ProcessItem itemHandler)
 {
     m_Root.Query(searchExtent, itemHandler);
 }
コード例 #41
0
 public void AddItem(ProcessItem item)
 {
     provider_DictionaryAdded(item);
 }
コード例 #42
0
        public void processP_DictionaryRemoved(ProcessItem item)
        {
            this.QueueMessage("Terminated Process: " + item.Name + " (PID " + item.Pid.ToString() + ")");

            if (processServices.ContainsKey(item.Pid))
                processServices.Remove(item.Pid);

            if (TPMenuItem.Checked)
                this.GetFirstIcon().ShowBalloonTip(2000, "Terminated Process",
                    "The process " + item.Name + " (" + item.Pid.ToString() + ") was terminated.", ToolTipIcon.Info);
        }
コード例 #43
0
 /// <summary>
 /// Creates an instance of the process window on a separate thread.
 /// </summary>
 public static ProcessWindow GetProcessWindow(ProcessItem process)
 {
     return GetProcessWindow(process, delegate { });
 }
コード例 #44
0
        public void ShowProperties(ProcessItem item)
        {
            DumpProcessWindow dpw = new DumpProcessWindow(
                this,
                item,
                _processesMo.GetChild(item.Pid.ToString("x"))
                );

            dpw.Show();
        }
コード例 #45
0
        /// <summary>
        /// Creates an instance of the process window on a separate thread and invokes an action on that thread.
        /// </summary>
        /// <param name="action">The action to be performed.</param>
        public static ProcessWindow GetProcessWindow(ProcessItem process, PWindowInvokeAction action)
        {
            ProcessWindow pw = null;

            if (PWindows.ContainsKey(process.Pid))
            {
                pw = PWindows[process.Pid];

                pw.BeginInvoke(action, pw);

                return pw;
            }

            if (PWindowsThreaded)
            {
                Thread t = new Thread(() =>
                {
                    pw = new ProcessWindow(process);

                    if (!pw.IsDisposed)
                        action(pw);
                    if (!pw.IsDisposed)
                        Application.Run(pw);

                    Program.PThreads.Remove(process.Pid);
                }, Utils.SixteenthStackSize);

                t.SetApartmentState(ApartmentState.STA);
                t.Start();

                Program.PThreads.Add(process.Pid, t);
            }
            else
            {
                pw = new ProcessWindow(process);
                if (!pw.IsDisposed)
                    action(pw);
                if (!pw.IsDisposed)
                    pw.Show();
            }

            return pw;
        }
コード例 #46
0
        public void Modify(ProcessItem oldItem, ProcessItem newItem)
        {
            ProcessNode node = _processes[newItem.Pid];

            node.ProcessItem = newItem;
        }
コード例 #47
0
        public void processP_DictionaryAdded(ProcessItem item)
        {
            ProcessItem parent = null;
            string parentText = "";

            if (item.HasParent && processP.Dictionary.ContainsKey(item.ParentPid))
            {
                try
                {
                    parent = processP.Dictionary[item.ParentPid];

                    parentText += " started by " + parent.Name + " (PID " + parent.Pid.ToString() + ")";
                }
                catch (Exception ex)
                {
                    Logging.Log(ex);
                }
            }

            this.QueueMessage("New Process: " + item.Name + " (PID " + item.Pid.ToString() + ")" + parentText);

            if (NPMenuItem.Checked)
                this.GetFirstIcon().ShowBalloonTip(2000, "New Process",
                    "The process " + item.Name + " (" + item.Pid.ToString() +
                    ") was started" + ((parentText != "") ? " by " +
                    parent.Name + " (" + parent.Pid.ToString() + ")" : "") + ".", ToolTipIcon.Info);
        }
コード例 #48
0
 /// <summary>
 /// Processes circles that overlap the specified window.
 /// Used by <c>FindCirclesQuery</c> to execute the query.
 /// </summary>
 /// <param name="extent">The query extent</param>
 /// <param name="itemHandler">Delegate for processing each query hit</param>
 internal void FindCircles(IWindow extent, ProcessItem itemHandler)
 {
     m_ExtraData.QueryWindow(extent, SpatialType.Line, itemHandler);
 }
コード例 #49
0
ファイル: Node.cs プロジェクト: steve-stanton/backsight
 /// <summary>
 /// Queries the specified search extent.
 /// </summary>
 /// <param name="searchExtent">The search extent.</param>
 /// <param name="itemHandler">The method that should be called for each query hit. A hit
 /// is defined as anything with a covering rectangle that overlaps the query window (this
 /// does not mean the hit actually intersects the window).</param>
 internal virtual void Query(Extent searchExtent, ProcessItem itemHandler)
 {
     if (m_Items!=null)
     {
         foreach (Item i in m_Items)
         {
             if (i.Window.IsOverlap(searchExtent))
             {
                 bool keepGoing = itemHandler(i.SpatialObject);
                 if (!keepGoing)
                     return;
             }
         }
     }
 }
コード例 #50
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
        private Color GetProcessColor(ProcessItem p)
        {
            foreach (var filter in Program.AppInstance.ProcessHighlighting.GetFilters())
            {
                Color color = SystemColors.Window;

                if (filter(p.Pid, ref color))
                    return color;
            }

            if (Properties.Settings.Default.UseColorDebuggedProcesses && p.IsBeingDebugged)
                return Properties.Settings.Default.ColorDebuggedProcesses;
            else if (Properties.Settings.Default.UseColorElevatedProcesses &&
                p.ElevationType == TokenElevationType.Full)
                return Properties.Settings.Default.ColorElevatedProcesses;
            else if (Properties.Settings.Default.UseColorPosixProcesses &&
                p.IsPosix)
                return Properties.Settings.Default.ColorPosixProcesses;
            else if (Properties.Settings.Default.UseColorWow64Processes &&
                p.IsWow64)
                return Properties.Settings.Default.ColorWow64Processes;
            else if (Properties.Settings.Default.UseColorJobProcesses && p.IsInSignificantJob)
                return Properties.Settings.Default.ColorJobProcesses;
            else if (Properties.Settings.Default.UseColorPackedProcesses &&
                Properties.Settings.Default.VerifySignatures &&
                Program.ImposterNames.Contains(p.Name.ToLower()) &&
                p.VerifyResult != VerifyResult.Trusted &&
                p.VerifyResult != VerifyResult.TrustedInstaller &&
                p.VerifyResult != VerifyResult.Unknown &&
                p.FileName != null)
                return Properties.Settings.Default.ColorPackedProcesses;
            else if (Properties.Settings.Default.UseColorPackedProcesses &&
                Properties.Settings.Default.VerifySignatures &&
                p.VerifyResult != VerifyResult.Trusted &&
                p.VerifyResult != VerifyResult.TrustedInstaller &&
                p.VerifyResult != VerifyResult.NoSignature &&
                p.VerifyResult != VerifyResult.Unknown)
                return Properties.Settings.Default.ColorPackedProcesses;
            else if (Properties.Settings.Default.UseColorDotNetProcesses && p.IsDotNet)
                return Properties.Settings.Default.ColorDotNetProcesses;
            else if (Properties.Settings.Default.UseColorPackedProcesses && p.IsPacked)
                return Properties.Settings.Default.ColorPackedProcesses;
            else if (Properties.Settings.Default.UseColorServiceProcesses &&
                Program.HackerWindow.ProcessServices.ContainsKey(p.Pid) &&
                Program.HackerWindow.ProcessServices[p.Pid].Count > 0)
                return Properties.Settings.Default.ColorServiceProcesses;
            else if (Properties.Settings.Default.UseColorSystemProcesses && p.Username == "NT AUTHORITY\\SYSTEM")
                return Properties.Settings.Default.ColorSystemProcesses;
            else if (Properties.Settings.Default.UseColorOwnProcesses && p.Username == Program.CurrentUsername)
                return Properties.Settings.Default.ColorOwnProcesses;
            else
                return SystemColors.Window;
        }
コード例 #51
0
        public void Remove(ProcessItem item)
        {
            ProcessNode itemNode = _processes[item.Pid];
            ProcessNode[] itemChildren = null;

            // Dispose of the process node we're removing.
            itemNode.Dispose();

            itemChildren = itemNode.Children.ToArray();

            // Check if the node has a parent.
            if (itemNode.Parent == null)
            {
                if (_roots.Contains(itemNode))
                {
                    // Remove the process from the roots and make its children root nodes.
                    _roots.Remove(itemNode);
                    this.MoveChildrenToRoot(itemNode);
                }
            }
            else
            {
                if (itemNode.Parent.Children.Contains(itemNode))
                {
                    // Remove the node from its parent and make its children root nodes.
                    itemNode.Parent.Children.Remove(itemNode);
                    this.MoveChildrenToRoot(itemNode);
                }
            }

            // Remove the process from the process dictionary.
            _processes.Remove(item.Pid);
            this.StructureChanged(this, new TreePathEventArgs(new TreePath()));

            // Expand the children because TreeViewAdv collapses them by default.
            if (itemChildren != null)
            {
                foreach (ProcessNode n in itemChildren)
                {
                    try
                    {
                        _tree.FindTreeNode(n).ExpandAll();
                    }
                    catch (Exception ex)
                    {
                        Logging.Log(ex);
                    }
                }
            }

            _tree.Invalidate();
        }
コード例 #52
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
 private Color GetProcessColor(ProcessItem p)
 {
     if (Settings.Instance.UseColorDebuggedProcesses && p.IsBeingDebugged)
         return Settings.Instance.ColorDebuggedProcesses;
     else if (Settings.Instance.UseColorElevatedProcesses &&
         p.ElevationType == TokenElevationType.Full)
         return Settings.Instance.ColorElevatedProcesses;
     else if (Settings.Instance.UseColorPosixProcesses &&
         p.IsPosix)
         return Settings.Instance.ColorPosixProcesses;
     else if (Settings.Instance.UseColorWow64Processes &&
         p.IsWow64)
         return Settings.Instance.ColorWow64Processes;
     else if (Settings.Instance.UseColorJobProcesses && p.IsInSignificantJob)
         return Settings.Instance.ColorJobProcesses;
     else if (Settings.Instance.UseColorPackedProcesses &&
         Settings.Instance.VerifySignatures &&
         p.Name != null &&
         Program.ImposterNames.Contains(p.Name.ToLowerInvariant()) &&
         p.VerifyResult != VerifyResult.Trusted &&
         p.VerifyResult != VerifyResult.Unknown &&
         p.FileName != null)
         return Settings.Instance.ColorPackedProcesses;
     else if (Settings.Instance.UseColorPackedProcesses &&
         Settings.Instance.VerifySignatures &&
         p.VerifyResult != VerifyResult.Trusted &&
         p.VerifyResult != VerifyResult.NoSignature &&
         p.VerifyResult != VerifyResult.Unknown)
         return Settings.Instance.ColorPackedProcesses;
     else if (Settings.Instance.UseColorDotNetProcesses && p.IsDotNet)
         return Settings.Instance.ColorDotNetProcesses;
     else if (Settings.Instance.UseColorPackedProcesses && p.IsPacked)
         return Settings.Instance.ColorPackedProcesses;
     else if (_dumpMode && Settings.Instance.UseColorServiceProcesses &&
         DumpProcessServices.ContainsKey(p.Pid) && DumpProcessServices[p.Pid].Count > 0)
         return Settings.Instance.ColorServiceProcesses;
     else if (!_dumpMode && Settings.Instance.UseColorServiceProcesses &&
         Program.HackerWindow.ProcessServices.ContainsKey(p.Pid) &&
         Program.HackerWindow.ProcessServices[p.Pid].Count > 0)
         return Settings.Instance.ColorServiceProcesses;
     else if (Settings.Instance.UseColorSystemProcesses && p.Username == "NT AUTHORITY\\SYSTEM")
         return Settings.Instance.ColorSystemProcesses;
     else if (_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == DumpUserName)
         return Settings.Instance.ColorOwnProcesses;
     else if (!_dumpMode && Settings.Instance.UseColorOwnProcesses && p.Username == Program.CurrentUsername)
         return Settings.Instance.ColorOwnProcesses;
     else
         return SystemColors.Window;
 }
コード例 #53
0
        public void Modify(ProcessItem oldItem, ProcessItem newItem)
        {
            ProcessNode node = _processes[newItem.Pid];

            node.ProcessItem = newItem;

            //if (node.ProcessItem.HasParent && node.PPID != -1)
            //    this.NodesChanged(this, new TreeModelEventArgs(this.GetPath(
            //        _processes.ContainsKey(node.PPID) ? _processes[node.PPID] : null),
            //        new object[] { node }));
        }
コード例 #54
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
 public void AddItem(ProcessItem item)
 {
     provider_DictionaryAdded(item);
 }
コード例 #55
0
 public GenericStdParallelProcess(ProcessItem <Tin, Tout> processItem, ConvertFrom <Tin> convertFrom, int firstInput, int firstOutput, int count, bool inputIsInternal, bool outputIsInternal)
     : base(firstInput, firstOutput, count, inputIsInternal, outputIsInternal)
 {
     this.processItem = processItem;
     this.convertFrom = convertFrom;
 }
コード例 #56
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
        private void provider_DictionaryAdded(ProcessItem item)
        {
            this.BeginInvoke(new MethodInvoker(delegate
            {
                lock (_listLock)
                {
                    _treeModel.Add(item);

                    TreeNodeAdv node = this.FindTreeNode(item.Pid);

                    if (node != null)
                    {
                        if (item.RunId > 0 && _runCount > 0)
                        {
                            node.State = TreeNodeAdv.NodeState.New;
                            this.PerformDelayed(Settings.Instance.HighlightingDuration,
                                new MethodInvoker(delegate
                            {
                                node.State = TreeNodeAdv.NodeState.Normal;
                                treeProcesses.Invalidate();
                            }));
                        }

                        node.BackColor = this.GetProcessColor(item);
                        node.ExpandAll();
                    }
                }
            }));
        }
コード例 #57
0
 public GenericStdParallelProcess(ProcessItem <Tin, Tout> processItem, ConvertFrom <Tin> convertFrom, int count)
     : base(0, 0, count, false, false)
 {
     this.processItem = processItem;
     this.convertFrom = convertFrom;
 }
コード例 #58
0
ファイル: ProcessTree.cs プロジェクト: andyvand/ProcessHacker
        private void provider_DictionaryModified(ProcessItem oldItem, ProcessItem newItem)
        {
            this.BeginInvoke(new MethodInvoker(delegate
            {
                lock (_listLock)
                {
                    TreeNodeAdv node = this.FindTreeNode(newItem.Pid);

                    if (node != null)
                    {
                        node.BackColor = this.GetProcessColor(newItem);
                    }

                    _treeModel.Nodes[newItem.Pid].ProcessItem = newItem;
                }
            }));
        }
コード例 #59
0
        public void Remove(ProcessItem item)
        {
            ProcessNode itemNode = _processes[item.Pid];
            ProcessNode[] itemChildren = null;

            itemNode.Dispose();

            itemChildren = itemNode.Children.ToArray();

            if (itemNode.Parent == null)
            {
                if (_roots.Contains(itemNode))
                {

                    _roots.Remove(itemNode);
                    this.MoveChildrenToRoot(itemNode);
                }
            }
            else
            {
                if (itemNode.Parent.Children.Contains(itemNode))
                {

                    itemNode.Parent.Children.Remove(itemNode);
                    this.MoveChildrenToRoot(itemNode);
                }
            }

            _processes.Remove(item.Pid);
            this.StructureChanged(this, new TreePathEventArgs(new TreePath()));

            if (itemChildren != null)
            {
                foreach (ProcessNode n in itemChildren)
                {
                    try
                    {
                        _tree.FindTreeNode(n).ExpandAll();
                    }
                    catch (Exception ex)
                    {
                        Logging.Log(ex);
                    }
                }
            }

            _tree.Invalidate();
        }
コード例 #60
0
 /// <summary>
 /// Processes every item related to this node (including any child nodes).
 /// This will be called by the <see cref="Query"/> method in a situation
 /// where the node is completely enclosed by a search extent.
 /// </summary>
 /// <param name="itemHandler">The method that should be called for every point</param>
 /// <remarks>This method should really return a <c>bool</c>, by being sensitive to
 /// the return value from the item handler (as it is, we may end up processing more
 /// data than we need to)</remarks>
 internal abstract void PassAll(ProcessItem itemHandler);