本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
}