当前位置: 首页>>代码示例>>C#>>正文


C# ProcessHandle.GetJobObject方法代码示例

本文整理汇总了C#中ProcessHandle.GetJobObject方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessHandle.GetJobObject方法的具体用法?C# ProcessHandle.GetJobObject怎么用?C# ProcessHandle.GetJobObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProcessHandle的用法示例。


在下文中一共展示了ProcessHandle.GetJobObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeSubControls

        private void InitializeSubControls()
        {
            var processStats = new ProcessStatistics(_pid);
            processStats.Dock = DockStyle.Fill;
            tabStatistics.Controls.Add(processStats);
            _processStats = processStats;

            // If this is a non-process, we need to clear the statistics first.
            if (_pid <= 0)
                _processStats.ClearStatistics();

            try
            {
                _tokenProps = new TokenProperties(new ProcessHandle(_pid, Program.MinProcessQueryRights));
                _tokenProps.Dock = DockStyle.Fill;
                tabToken.Controls.Add(_tokenProps);
            }
            catch
            { }

            try
            {
                using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                {
                    var jhandle = phandle.GetJobObject(JobObjectAccess.Query);

                    if (jhandle != null)
                    {
                        using (jhandle)
                        {
                            _jobProps = new JobProperties(jhandle);
                            _jobProps.Dock = DockStyle.Fill;
                            tabJob.Controls.Add(_jobProps);
                        }
                    }
                }
            }
            catch
            { }

            if (Program.HackerWindow != null)
            {
                if (Program.HackerWindow.ProcessServices.ContainsKey(_pid))
                {
                    if (Program.HackerWindow.ProcessServices[_pid].Count > 0)
                    {
                        _serviceProps = new ServiceProperties(
                           Program.HackerWindow.ProcessServices.ContainsKey(_pid) ?
                           Program.HackerWindow.ProcessServices[_pid].ToArray() :
                           new string[0]);
                        _serviceProps.Dock = DockStyle.Fill;
                        _serviceProps.PID = _pid;
                        tabServices.Controls.Add(_serviceProps);
                    }
                }
            }

            if (_processItem.IsDotNet)
            {
                try
                {
                    _dotNetCounters = new DotNetCounters(_pid, _processItem.Name);
                    _dotNetCounters.Dock = DockStyle.Fill;
                    tabDotNet.Controls.Add(_dotNetCounters);
                }
                catch
                { }
            }

            listEnvironment.ListViewItemSorter = new SortedListViewComparer(listEnvironment);
            listEnvironment.ContextMenu = listEnvironment.GetCopyMenu();
            ColumnSettings.LoadSettings(Settings.Instance.EnvironmentListViewColumns, listEnvironment);
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:73,代码来源:ProcessWindow.cs

示例2: FixTabs

        private void FixTabs()
        {
            if (_pid <= 0)
            {
                // this "process" is probably Idle, DPCs or Interrupts, so we won't try to load any more information.
                buttonEditDEP.Enabled = false;
                buttonEditProtected.Enabled = false;
                buttonInspectParent.Enabled = false;
                buttonInspectPEB.Enabled = false;

                if (fileCurrentDirectory.Text != string.Empty)
                    fileCurrentDirectory.Enabled = false;

                if (_pid != 4)
                    fileImage.Enabled = false;

                buttonSearch.Enabled = false;
                buttonPermissions.Enabled = false;
                buttonTerminate.Enabled = false;

                // Remove tab controls not relevant to Idle/DPCs/Interrupts.
                tabControl.TabPages.Remove(tabHandles);
                tabControl.TabPages.Remove(tabMemory);
                tabControl.TabPages.Remove(tabModules);
                tabControl.TabPages.Remove(tabServices);
                if (_pid != 0) // Idle has threads
                    tabControl.TabPages.Remove(tabThreads);
                tabControl.TabPages.Remove(tabToken);
                if (tabControl.TabPages.Contains(tabJob))
                    tabControl.TabPages.Remove(tabJob);
                tabControl.TabPages.Remove(tabEnvironment);
                tabControl.TabPages.Remove(tabDotNet);
            }
            else
            {
                try
                {
                    using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {
                        // Check if the process is in a job.
                        if (phandle.GetJobObject(JobObjectAccess.Query) == null)
                            tabControl.TabPages.Remove(tabJob);
                    }
                }
                catch
                {
                    tabControl.TabPages.Remove(tabJob);
                }

                if (Program.HackerWindow != null)
                {
                    if (Program.HackerWindow.ProcessServices.ContainsKey(_pid))
                    {
                        if (Program.HackerWindow.ProcessServices[_pid].Count == 0)
                            tabControl.TabPages.Remove(tabServices);
                    }
                    else
                    {
                        tabControl.TabPages.Remove(tabServices);
                    }
                }

                if (!_processItem.IsDotNet)
                    tabControl.TabPages.Remove(tabDotNet);
            }
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:66,代码来源:ProcessWindow.cs

示例3: InitializeSubControls

        private void InitializeSubControls()
        {
            var processStats = new ProcessStatistics(_pid);
            processStats.Dock = DockStyle.Fill;
            tabStatistics.Controls.Add(processStats);
            _processStats = processStats;

            if (_pid <= 0)
                _processStats.ClearStatistics();

            try
            {
                _tokenProps = new TokenProperties(new ProcessHandle(_pid, Program.MinProcessQueryRights));
                _tokenProps.Dock = DockStyle.Fill;
                tabToken.Controls.Add(_tokenProps);
            }
            catch
            { }

            try
            {
                using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                {
                    var jhandle = phandle.GetJobObject(JobObjectAccess.Query);

                    if (jhandle != null)
                    {
                        using (jhandle)
                        {
                            _jobProps = new JobProperties(jhandle);
                            _jobProps.Dock = DockStyle.Fill;
                            tabJob.Controls.Add(_jobProps);
                        }
                    }
                }
            }
            catch
            { }

            if (Program.HackerWindow != null)
            {
                if (Program.HackerWindow.ProcessServices.ContainsKey(_pid))
                {
                    if (Program.HackerWindow.ProcessServices[_pid].Count > 0)
                    {
                        _serviceProps = new ServiceProperties(
                           Program.HackerWindow.ProcessServices.ContainsKey(_pid) ?
                           Program.HackerWindow.ProcessServices[_pid].ToArray() :
                           new string[0]);
                        _serviceProps.Dock = DockStyle.Fill;
                        _serviceProps.PID = _pid;
                        tabServices.Controls.Add(_serviceProps);
                    }
                }
            }

            listEnvironment.ListViewItemSorter = new SortedListViewComparer(listEnvironment);
            listEnvironment.SetDoubleBuffered(true);
            listEnvironment.SetTheme("explorer");
            listEnvironment.ContextMenu = listEnvironment.GetCopyMenu();
            ColumnSettings.LoadSettings(Properties.Settings.Default.EnvironmentListViewColumns, listEnvironment);
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:62,代码来源:ProcessWindow.cs

示例4: TJ1

        private void TJ1()
        {
            if (KProcessHacker.Instance != null)
            {
                try
                {
                    using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {
                        var jhandle = phandle.GetJobObject(JobObjectAccess.Query | JobObjectAccess.Terminate);

                        if (jhandle != null)
                        {

                            if (jhandle.GetProcessIdList().Length == 1)
                            {
                                jhandle.Terminate();
                                return;
                            }
                        }
                    }
                }
                catch
                { }
            }

            using (var jhandle = JobObjectHandle.Create(JobObjectAccess.AssignProcess | JobObjectAccess.Terminate))
            {
                using (ProcessHandle phandle =
                    new ProcessHandle(_pid, ProcessAccess.SetQuota | ProcessAccess.Terminate))
                {
                    phandle.AssignToJobObject(jhandle);
                }

                jhandle.Terminate();
            }
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:36,代码来源:TerminatorWindow.cs

示例5: FixTabs

        private void FixTabs()
        {
            if (_pid <= 0)
            {

                buttonEditDEP.Enabled = false;
                buttonEditProtected.Enabled = false;
                buttonInspectParent.Enabled = false;
                buttonInspectPEB.Enabled = false;

                if (fileCurrentDirectory.Text != "")
                    fileCurrentDirectory.Enabled = false;

                if (_pid != 4)
                    fileImage.Enabled = false;

                buttonSearch.Enabled = false;
                buttonTerminate.Enabled = false;

                tabControl.TabPages.Remove(tabHandles);
                tabControl.TabPages.Remove(tabMemory);
                tabControl.TabPages.Remove(tabModules);
                tabControl.TabPages.Remove(tabServices);
                tabControl.TabPages.Remove(tabThreads);
                tabControl.TabPages.Remove(tabToken);
                if (tabControl.TabPages.Contains(tabJob))
                    tabControl.TabPages.Remove(tabJob);
                tabControl.TabPages.Remove(tabEnvironment);
            }
            else
            {
                try
                {
                    using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {

                        if (phandle.GetJobObject(JobObjectAccess.Query) == null)
                            tabControl.TabPages.Remove(tabJob);
                    }
                }
                catch
                {
                    tabControl.TabPages.Remove(tabJob);
                }

                if (Program.HackerWindow != null)
                {
                    if (Program.HackerWindow.ProcessServices.ContainsKey(_pid))
                    {
                        if (Program.HackerWindow.ProcessServices[_pid].Count == 0)
                            tabControl.TabPages.Remove(tabServices);
                    }
                    else
                    {
                        tabControl.TabPages.Remove(tabServices);
                    }
                }
            }
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:59,代码来源:ProcessWindow.cs


注:本文中的ProcessHandle.GetJobObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。