diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt
index 883e22eba..8d95db663 100644
--- a/trunk/CHANGELOG.txt
+++ b/trunk/CHANGELOG.txt
@@ -7,6 +7,7 @@ Process Hacker
* Thread wait analysis - right-click a thread and choose
Analyze > Wait to see what a thread is hanging on
* Added ability to create dump files for processes
+ * Added ability to detach processes from debuggers
* More detailed handle properties
* Event objects can now be modified - set, clear, pulse, reset
* Event pair objects can now be modified - set high, set low
diff --git a/trunk/KProcessHacker/i386/kprocesshacker.sys b/trunk/KProcessHacker/i386/kprocesshacker.sys
index 5f2bb6ece..9ecc1cd8c 100644
Binary files a/trunk/KProcessHacker/i386/kprocesshacker.sys and b/trunk/KProcessHacker/i386/kprocesshacker.sys differ
diff --git a/trunk/KProcessHacker/kprocesshacker.c b/trunk/KProcessHacker/kprocesshacker.c
index c8a810682..a2d5d060b 100644
--- a/trunk/KProcessHacker/kprocesshacker.c
+++ b/trunk/KProcessHacker/kprocesshacker.c
@@ -1030,7 +1030,7 @@ NTSTATUS KphDispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/* KphOpenProcessJob
*
* Opens the job object that the process is assigned to. If the process is
- * not assigned to any job object, the call will fail with STATUS_NO_SUCH_FILE.
+ * not assigned to any job object, the call will fail with STATUS_PROCESS_NOT_IN_JOB.
*/
case KPH_OPENPROCESSJOB:
{
diff --git a/trunk/KProcessHacker/ps.c b/trunk/KProcessHacker/ps.c
index b3901402a..6ca0e2063 100644
--- a/trunk/KProcessHacker/ps.c
+++ b/trunk/KProcessHacker/ps.c
@@ -236,7 +236,7 @@ NTSTATUS KphOpenProcess(
return status;
}
- /* let's hope our client isn't a virus... */
+ /* Let's hope our client isn't a virus... */
if (accessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
accessState.PreviouslyGrantedAccess |= ProcessAllAccess;
else
@@ -308,7 +308,7 @@ NTSTATUS KphOpenProcess(
*
* Opens the specified process' job object. If the process has
* not been assigned to a job object, the function returns
- * STATUS_NO_SUCH_FILE.
+ * STATUS_PROCESS_NOT_IN_JOB.
*/
NTSTATUS KphOpenProcessJob(
HANDLE ProcessHandle,
@@ -351,6 +351,7 @@ NTSTATUS KphOpenProcessJob(
return status;
}
+ /* If we have PsGetProcessJob, use it. Otherwise, read the EPROCESS structure. */
if (PsGetProcessJob)
{
jobObject = PsGetProcessJob(processObject);
@@ -364,8 +365,10 @@ NTSTATUS KphOpenProcessJob(
if (jobObject == NULL)
{
+ /* No such job. Output a NULL handle and exit. */
SeDeleteAccessState(&accessState);
- return STATUS_NO_SUCH_FILE;
+ *JobHandle = NULL;
+ return STATUS_PROCESS_NOT_IN_JOB;
}
ObReferenceObject(jobObject);
diff --git a/trunk/ProcessHacker.Native/Api/NativeFunctions.cs b/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
index 16d5dc632..80e200605 100644
--- a/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
+++ b/trunk/ProcessHacker.Native/Api/NativeFunctions.cs
@@ -769,6 +769,15 @@ namespace ProcessHacker.Native.Api
[Out] [Optional] out int ReturnLength
);
+ [DllImport("ntdll.dll")]
+ public static extern NtStatus NtQueryInformationProcess(
+ [In] IntPtr ProcessHandle,
+ [In] ProcessInformationClass ProcessInformationClass,
+ [Out] out IntPtr ProcessInformation,
+ [In] int ProcessInformationLength,
+ [Out] [Optional] out int ReturnLength
+ );
+
[DllImport("ntdll.dll")]
public static extern NtStatus NtQueryInformationProcess(
[In] IntPtr ProcessHandle,
diff --git a/trunk/ProcessHacker.Native/Api/NtStatus.cs b/trunk/ProcessHacker.Native/Api/NtStatus.cs
index eab6ca4bd..53ce102f5 100644
--- a/trunk/ProcessHacker.Native/Api/NtStatus.cs
+++ b/trunk/ProcessHacker.Native/Api/NtStatus.cs
@@ -127,5 +127,7 @@ namespace ProcessHacker.Native.Api
InvalidParameter10 = 0xc00000f8,
InvalidParameter11 = 0xc00000f9,
InvalidParameter12 = 0xc00000fa,
+ PortNotSet = 0xc0000353,
+ DebuggerInactive = 0xc0000354
}
}
diff --git a/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs b/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
index d3c2e5795..cd0a520a0 100644
--- a/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
+++ b/trunk/ProcessHacker.Native/Objects/DebugObjectHandle.cs
@@ -64,10 +64,24 @@ namespace ProcessHacker.Native.Objects
return new DebugObjectHandle(handle, true);
}
- private DebugObjectHandle(IntPtr handle, bool owned)
+ public DebugObjectHandle FromHandle(IntPtr handle)
+ {
+ return new DebugObjectHandle(handle, false);
+ }
+
+ internal DebugObjectHandle(IntPtr handle, bool owned)
: base(handle, owned)
{ }
+ public DebugObjectHandle(ProcessHandle processHandle)
+ {
+ this.Handle = processHandle.GetDebugObjectHandle();
+
+ // Check if we got a handle. If we didn't the process is not being debugged.
+ if (this.Handle == IntPtr.Zero)
+ throw new WindowsException(NtStatus.DebuggerInactive);
+ }
+
public void Continue(ClientId cid, NtStatus continueStatus)
{
NtStatus status;
diff --git a/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs b/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
index afa4a4556..185938223 100644
--- a/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
+++ b/trunk/ProcessHacker.Native/Objects/JobObjectHandle.cs
@@ -109,7 +109,7 @@ namespace ProcessHacker.Native.Objects
{ }
///
- /// Opens the job associated with the specified process.
+ /// Opens the job object associated with the specified process.
///
/// The process.
/// The desired access to the job object.
@@ -124,11 +124,13 @@ namespace ProcessHacker.Native.Objects
// Use KPH to set the handle's granted access.
this.Handle = new IntPtr(KProcessHacker.Instance.KphOpenProcessJob(processHandle,
(JobObjectAccess)StandardRights.Synchronize));
- KProcessHacker.Instance.KphSetHandleGrantedAccess(this.Handle, (int)access);
+ if (this.Handle != IntPtr.Zero)
+ KProcessHacker.Instance.KphSetHandleGrantedAccess(this.Handle, (int)access);
}
+ // If we don't have a handle assume the process isn't in a job.
if (this.Handle == IntPtr.Zero)
- Win32.ThrowLastError();
+ Win32.ThrowLastError(NtStatus.ProcessNotInJob);
}
private T QueryStruct(JobObjectInformationClass informationClass)
diff --git a/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs b/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
index 0b6c4ffb5..7afea00c1 100644
--- a/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
+++ b/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs
@@ -642,6 +642,28 @@ namespace ProcessHacker.Native.Objects
return cycles;
}
+ ///
+ /// Opens the debug object associated with the process.
+ ///
+ /// A debug object handle.
+ public DebugObjectHandle GetDebugObject()
+ {
+ IntPtr handle;
+
+ handle = this.GetDebugObjectHandle();
+
+ // Check if we got a handle. If we didn't the process is not being debugged.
+ if (handle == IntPtr.Zero)
+ return null;
+
+ return new DebugObjectHandle(handle, true);
+ }
+
+ internal IntPtr GetDebugObjectHandle()
+ {
+ return this.GetInformationIntPtr(ProcessInformationClass.ProcessDebugObjectHandle);
+ }
+
///
/// Gets the process' DEP policy.
///
@@ -848,6 +870,24 @@ namespace ProcessHacker.Native.Objects
return value;
}
+ ///
+ /// Gets information about the process in an IntPtr.
+ ///
+ /// The class of information to retrieve.
+ /// An IntPtr.
+ private IntPtr GetInformationIntPtr(ProcessInformationClass infoClass)
+ {
+ NtStatus status;
+ IntPtr value;
+ int retLength;
+
+ if ((status = Win32.NtQueryInformationProcess(
+ this, infoClass, out value, IntPtr.Size, out retLength)) >= NtStatus.Error)
+ Win32.ThrowLastError(status);
+
+ return value;
+ }
+
///
/// Gets the process' I/O priority, ranging from 0-7.
///
@@ -858,12 +898,22 @@ namespace ProcessHacker.Native.Objects
}
///
- /// Opens the job associated with the process.
+ /// Opens the job object associated with the process.
///
- /// A job handle.
- public JobObjectHandle GetJob(JobObjectAccess access)
+ /// A job object handle.
+ public JobObjectHandle GetJobObject(JobObjectAccess access)
{
- return new JobObjectHandle(this, access);
+ try
+ {
+ return new JobObjectHandle(this, access);
+ }
+ catch (WindowsException ex)
+ {
+ if (ex.Status == NtStatus.ProcessNotInJob)
+ return null;
+ else
+ throw ex;
+ }
}
///
@@ -1544,7 +1594,7 @@ namespace ProcessHacker.Native.Objects
/// A handle to the process' token.
public TokenHandle GetToken()
{
- return GetToken(TokenAccess.All);
+ return this.GetToken(TokenAccess.All);
}
///
diff --git a/trunk/ProcessHacker.Native/WindowsException.cs b/trunk/ProcessHacker.Native/WindowsException.cs
index 0d9d2ce03..639f3cb38 100644
--- a/trunk/ProcessHacker.Native/WindowsException.cs
+++ b/trunk/ProcessHacker.Native/WindowsException.cs
@@ -21,8 +21,6 @@
*/
using System;
-using System.Collections.Generic;
-using System.Text;
using ProcessHacker.Native.Api;
namespace ProcessHacker.Native
diff --git a/trunk/ProcessHacker/Common/PhUtils.cs b/trunk/ProcessHacker/Common/PhUtils.cs
index 3d2d183ac..5d9cb433e 100644
--- a/trunk/ProcessHacker/Common/PhUtils.cs
+++ b/trunk/ProcessHacker/Common/PhUtils.cs
@@ -130,5 +130,10 @@ namespace ProcessHacker.Common
{
Win32.SetWindowTheme(control.Handle, theme, null);
}
+
+ public static void ShowMessage(Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
}
}
diff --git a/trunk/ProcessHacker/Components/EventPairProperties.cs b/trunk/ProcessHacker/Components/EventPairProperties.cs
index bc48f5e6d..aaf5b31cc 100644
--- a/trunk/ProcessHacker/Components/EventPairProperties.cs
+++ b/trunk/ProcessHacker/Components/EventPairProperties.cs
@@ -1,12 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
using System.Windows.Forms;
-using ProcessHacker.Native.Objects;
-using ProcessHacker.Native.Security;
+using ProcessHacker.Common;
+using ProcessHacker.Native.Objects;
namespace ProcessHacker.Components
{
@@ -29,7 +24,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -41,7 +36,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Components/EventProperties.cs b/trunk/ProcessHacker/Components/EventProperties.cs
index 84e63cec7..00841337d 100644
--- a/trunk/ProcessHacker/Components/EventProperties.cs
+++ b/trunk/ProcessHacker/Components/EventProperties.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -39,7 +35,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Components/FileNameBox.cs b/trunk/ProcessHacker/Components/FileNameBox.cs
index 81edcaeb1..440edd1df 100644
--- a/trunk/ProcessHacker/Components/FileNameBox.cs
+++ b/trunk/ProcessHacker/Components/FileNameBox.cs
@@ -67,7 +67,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Components/HandleList.cs b/trunk/ProcessHacker/Components/HandleList.cs
index ea50db6f4..1dbd50cce 100644
--- a/trunk/ProcessHacker/Components/HandleList.cs
+++ b/trunk/ProcessHacker/Components/HandleList.cs
@@ -405,7 +405,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
};
@@ -467,7 +467,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -527,7 +527,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -548,7 +548,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -565,7 +565,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Components/JobProperties.cs b/trunk/ProcessHacker/Components/JobProperties.cs
index 0a63e6b4b..697232a54 100644
--- a/trunk/ProcessHacker/Components/JobProperties.cs
+++ b/trunk/ProcessHacker/Components/JobProperties.cs
@@ -226,7 +226,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Components/ModuleList.cs b/trunk/ProcessHacker/Components/ModuleList.cs
index 384469621..11a046139 100644
--- a/trunk/ProcessHacker/Components/ModuleList.cs
+++ b/trunk/ProcessHacker/Components/ModuleList.cs
@@ -317,7 +317,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -451,7 +451,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
else
@@ -487,7 +487,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Components/SemaphoreProperties.cs b/trunk/ProcessHacker/Components/SemaphoreProperties.cs
index 04d253229..dfd4fdf8a 100644
--- a/trunk/ProcessHacker/Components/SemaphoreProperties.cs
+++ b/trunk/ProcessHacker/Components/SemaphoreProperties.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
+using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -44,7 +40,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -59,7 +55,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Components/ServiceProperties.cs b/trunk/ProcessHacker/Components/ServiceProperties.cs
index 3dd06b9a2..9245d199b 100644
--- a/trunk/ProcessHacker/Components/ServiceProperties.cs
+++ b/trunk/ProcessHacker/Components/ServiceProperties.cs
@@ -440,7 +440,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -463,7 +463,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Components/StructViewer.cs b/trunk/ProcessHacker/Components/StructViewer.cs
index 3805e57a6..de230d898 100644
--- a/trunk/ProcessHacker/Components/StructViewer.cs
+++ b/trunk/ProcessHacker/Components/StructViewer.cs
@@ -21,13 +21,9 @@
*/
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
using System.Windows.Forms;
using Aga.Controls.Tree;
+using ProcessHacker.Common;
using ProcessHacker.Structs;
using ProcessHacker.UI;
@@ -71,7 +67,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
this.Error = true;
}
}
diff --git a/trunk/ProcessHacker/Components/ThreadList.cs b/trunk/ProcessHacker/Components/ThreadList.cs
index 4a421311e..fdbf39e12 100644
--- a/trunk/ProcessHacker/Components/ThreadList.cs
+++ b/trunk/ProcessHacker/Components/ThreadList.cs
@@ -805,7 +805,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -1097,7 +1097,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Components/TimerProperties.cs b/trunk/ProcessHacker/Components/TimerProperties.cs
index cc99d05ef..43a8fbad9 100644
--- a/trunk/ProcessHacker/Components/TimerProperties.cs
+++ b/trunk/ProcessHacker/Components/TimerProperties.cs
@@ -1,11 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
-using ProcessHacker.Native.Api;
+using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -50,7 +45,7 @@ namespace ProcessHacker.Components
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/AboutWindow.cs b/trunk/ProcessHacker/Forms/AboutWindow.cs
index 8a0d25321..2d14623a6 100644
--- a/trunk/ProcessHacker/Forms/AboutWindow.cs
+++ b/trunk/ProcessHacker/Forms/AboutWindow.cs
@@ -21,10 +21,8 @@
*/
using System;
-using System.Diagnostics;
-using System.Text;
using System.Windows.Forms;
-using ProcessHacker.Native;
+using ProcessHacker.Common;
namespace ProcessHacker
{
@@ -57,7 +55,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/EditDEPWindow.cs b/trunk/ProcessHacker/Forms/EditDEPWindow.cs
index 5d2fa30c5..541c71c11 100644
--- a/trunk/ProcessHacker/Forms/EditDEPWindow.cs
+++ b/trunk/ProcessHacker/Forms/EditDEPWindow.cs
@@ -22,10 +22,10 @@
using System;
using System.Windows.Forms;
+using ProcessHacker.Common;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
-using System.Runtime.InteropServices;
namespace ProcessHacker
{
@@ -118,7 +118,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
index 3da154082..739e0711f 100644
--- a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
+++ b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs
@@ -40,6 +40,7 @@
this.virtualizationProcessMenuItem = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.affinityProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.createDumpFileProcessMenuItem = new System.Windows.Forms.MenuItem();
this.injectDllProcessMenuItem = new System.Windows.Forms.MenuItem();
this.protectionProcessMenuItem = new System.Windows.Forms.MenuItem();
this.setTokenProcessMenuItem = new System.Windows.Forms.MenuItem();
@@ -163,7 +164,8 @@
this.menuNetwork = new System.Windows.Forms.ContextMenu();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.selectAllNetworkMenuItem = new System.Windows.Forms.MenuItem();
- this.createDumpFileProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.miscellaneousProcessMenuItem = new System.Windows.Forms.MenuItem();
+ this.detachFromDebuggerProcessMenuItem = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.statusGeneral)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusCPU)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusMemory)).BeginInit();
@@ -191,10 +193,8 @@
this.menuItem5,
this.affinityProcessMenuItem,
this.createDumpFileProcessMenuItem,
- this.injectDllProcessMenuItem,
- this.protectionProcessMenuItem,
- this.setTokenProcessMenuItem,
this.terminatorProcessMenuItem,
+ this.miscellaneousProcessMenuItem,
this.priorityMenuItem,
this.runAsProcessMenuItem,
this.propertiesProcessMenuItem,
@@ -262,34 +262,40 @@
this.affinityProcessMenuItem.Text = "Affinity...";
this.affinityProcessMenuItem.Click += new System.EventHandler(this.affinityProcessMenuItem_Click);
//
+ // createDumpFileProcessMenuItem
+ //
+ this.createDumpFileProcessMenuItem.Index = 9;
+ this.createDumpFileProcessMenuItem.Text = "Create Dump File...";
+ this.createDumpFileProcessMenuItem.Click += new System.EventHandler(this.createDumpFileProcessMenuItem_Click);
+ //
// injectDllProcessMenuItem
//
- this.injectDllProcessMenuItem.Index = 10;
+ this.injectDllProcessMenuItem.Index = 1;
this.injectDllProcessMenuItem.Text = "Inject DLL...";
this.injectDllProcessMenuItem.Click += new System.EventHandler(this.injectDllProcessMenuItem_Click);
//
// protectionProcessMenuItem
//
- this.protectionProcessMenuItem.Index = 11;
+ this.protectionProcessMenuItem.Index = 2;
this.protectionProcessMenuItem.Text = "Protection...";
this.protectionProcessMenuItem.Click += new System.EventHandler(this.protectionProcessMenuItem_Click);
//
// setTokenProcessMenuItem
//
- this.setTokenProcessMenuItem.Index = 12;
+ this.setTokenProcessMenuItem.Index = 3;
this.setTokenProcessMenuItem.Text = "Set Token...";
this.setTokenProcessMenuItem.Click += new System.EventHandler(this.setTokenProcessMenuItem_Click);
//
// terminatorProcessMenuItem
//
- this.terminatorProcessMenuItem.Index = 13;
+ this.terminatorProcessMenuItem.Index = 10;
this.terminatorProcessMenuItem.Text = "Terminator...";
this.terminatorProcessMenuItem.Click += new System.EventHandler(this.terminatorProcessMenuItem_Click);
//
// priorityMenuItem
//
this.vistaMenu.SetImage(this.priorityMenuItem, global::ProcessHacker.Properties.Resources.control_equalizer_blue);
- this.priorityMenuItem.Index = 14;
+ this.priorityMenuItem.Index = 12;
this.priorityMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.realTimeMenuItem,
this.highMenuItem,
@@ -343,7 +349,7 @@
//
// runAsProcessMenuItem
//
- this.runAsProcessMenuItem.Index = 15;
+ this.runAsProcessMenuItem.Index = 13;
this.runAsProcessMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.launchAsUserProcessMenuItem,
this.launchAsThisUserProcessMenuItem});
@@ -365,37 +371,37 @@
//
this.propertiesProcessMenuItem.DefaultItem = true;
this.vistaMenu.SetImage(this.propertiesProcessMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify);
- this.propertiesProcessMenuItem.Index = 16;
+ this.propertiesProcessMenuItem.Index = 14;
this.propertiesProcessMenuItem.Text = "&Properties...";
this.propertiesProcessMenuItem.Click += new System.EventHandler(this.propertiesProcessMenuItem_Click);
//
// menuItem7
//
- this.menuItem7.Index = 17;
+ this.menuItem7.Index = 15;
this.menuItem7.Text = "-";
//
// searchProcessMenuItem
//
- this.searchProcessMenuItem.Index = 18;
+ this.searchProcessMenuItem.Index = 16;
this.searchProcessMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlM;
this.searchProcessMenuItem.Text = "&Search Online...";
this.searchProcessMenuItem.Click += new System.EventHandler(this.searchProcessMenuItem_Click);
//
// reanalyzeProcessMenuItem
//
- this.reanalyzeProcessMenuItem.Index = 19;
+ this.reanalyzeProcessMenuItem.Index = 17;
this.reanalyzeProcessMenuItem.Text = "Re-analyze";
this.reanalyzeProcessMenuItem.Click += new System.EventHandler(this.reanalyzeProcessMenuItem_Click);
//
// copyProcessMenuItem
//
this.vistaMenu.SetImage(this.copyProcessMenuItem, global::ProcessHacker.Properties.Resources.page_copy);
- this.copyProcessMenuItem.Index = 20;
+ this.copyProcessMenuItem.Index = 18;
this.copyProcessMenuItem.Text = "&Copy";
//
// selectAllProcessMenuItem
//
- this.selectAllProcessMenuItem.Index = 21;
+ this.selectAllProcessMenuItem.Index = 19;
this.selectAllProcessMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
this.selectAllProcessMenuItem.Text = "Select &All";
this.selectAllProcessMenuItem.Click += new System.EventHandler(this.selectAllProcessMenuItem_Click);
@@ -1183,11 +1189,21 @@
this.selectAllNetworkMenuItem.Text = "Select &All";
this.selectAllNetworkMenuItem.Click += new System.EventHandler(this.selectAllNetworkMenuItem_Click);
//
- // createDumpFileProcessMenuItem
+ // miscellaneousProcessMenuItem
//
- this.createDumpFileProcessMenuItem.Index = 9;
- this.createDumpFileProcessMenuItem.Text = "Create Dump File...";
- this.createDumpFileProcessMenuItem.Click += new System.EventHandler(this.createDumpFileProcessMenuItem_Click);
+ this.miscellaneousProcessMenuItem.Index = 11;
+ this.miscellaneousProcessMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.detachFromDebuggerProcessMenuItem,
+ this.injectDllProcessMenuItem,
+ this.protectionProcessMenuItem,
+ this.setTokenProcessMenuItem});
+ this.miscellaneousProcessMenuItem.Text = "Miscellaneous";
+ //
+ // detachFromDebuggerProcessMenuItem
+ //
+ this.detachFromDebuggerProcessMenuItem.Index = 0;
+ this.detachFromDebuggerProcessMenuItem.Text = "Detach from Debugger";
+ this.detachFromDebuggerProcessMenuItem.Click += new System.EventHandler(this.detachFromDebuggerProcessMenuItem_Click);
//
// HackerWindow
//
@@ -1361,6 +1377,8 @@
private System.Windows.Forms.MenuItem closeNetworkMenuItem;
private System.Windows.Forms.MenuItem protectionProcessMenuItem;
private System.Windows.Forms.MenuItem createDumpFileProcessMenuItem;
+ private System.Windows.Forms.MenuItem miscellaneousProcessMenuItem;
+ private System.Windows.Forms.MenuItem detachFromDebuggerProcessMenuItem;
}
}
diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs
index f48b27943..d01c05266 100644
--- a/trunk/ProcessHacker/Forms/HackerWindow.cs
+++ b/trunk/ProcessHacker/Forms/HackerWindow.cs
@@ -30,13 +30,13 @@ using System.Threading;
using System.Windows.Forms;
using Aga.Controls.Tree;
using ProcessHacker.Common;
+using ProcessHacker.Components;
using ProcessHacker.Native;
using ProcessHacker.Native.Api;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
using ProcessHacker.UI;
using ProcessHacker.UI.Actions;
-using ProcessHacker.Components;
namespace ProcessHacker
{
@@ -267,7 +267,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -1107,7 +1107,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
@@ -1228,7 +1228,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
finally
{
@@ -1237,53 +1237,6 @@ namespace ProcessHacker
}
}
- private void injectDllProcessMenuItem_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
-
- ofd.Filter = "DLL Files (*.dll)|*.dll|All Files (*.*)|*.*";
-
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- try
- {
- using (var phandle = new ProcessHandle(processSelectedPID,
- ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
- {
- phandle.InjectDll(ofd.FileName, 5000);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
-
- private void protectionProcessMenuItem_Click(object sender, EventArgs e)
- {
- (new ProtectProcessWindow(processSelectedPID)).ShowDialog();
- }
-
- private void setTokenProcessMenuItem_Click(object sender, EventArgs e)
- {
- ProcessPickerWindow picker = new ProcessPickerWindow();
-
- picker.Label = "Select the source of the token:";
-
- if (picker.ShowDialog() == DialogResult.OK)
- {
- try
- {
- KProcessHacker.Instance.SetProcessToken(picker.SelectedPid, processSelectedPID);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
-
private void terminatorProcessMenuItem_Click(object sender, EventArgs e)
{
TerminatorWindow w = new TerminatorWindow(processSelectedPID);
@@ -1331,6 +1284,76 @@ namespace ProcessHacker
#endregion
+ #region Miscellaneous
+
+ private void detachFromDebuggerProcessMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ using (var phandle = new ProcessHandle(processSelectedPID, ProcessAccess.QueryInformation | ProcessAccess.SuspendResume))
+ {
+ using (var dhandle = phandle.GetDebugObject())
+ phandle.RemoveDebug(dhandle);
+ }
+ }
+ catch (WindowsException ex)
+ {
+ if (ex.Status == NtStatus.PortNotSet)
+ MessageBox.Show("The process is not being debugged.", "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else
+ PhUtils.ShowMessage(ex);
+ }
+ }
+
+ private void injectDllProcessMenuItem_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog ofd = new OpenFileDialog();
+
+ ofd.Filter = "DLL Files (*.dll)|*.dll|All Files (*.*)|*.*";
+
+ if (ofd.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ using (var phandle = new ProcessHandle(processSelectedPID,
+ ProcessAccess.CreateThread | ProcessAccess.VmOperation | ProcessAccess.VmWrite))
+ {
+ phandle.InjectDll(ofd.FileName, 5000);
+ }
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowMessage(ex);
+ }
+ }
+ }
+
+ private void protectionProcessMenuItem_Click(object sender, EventArgs e)
+ {
+ (new ProtectProcessWindow(processSelectedPID)).ShowDialog();
+ }
+
+ private void setTokenProcessMenuItem_Click(object sender, EventArgs e)
+ {
+ ProcessPickerWindow picker = new ProcessPickerWindow();
+
+ picker.Label = "Select the source of the token:";
+
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ KProcessHacker.Instance.SetProcessToken(picker.SelectedPid, processSelectedPID);
+ }
+ catch (Exception ex)
+ {
+ PhUtils.ShowMessage(ex);
+ }
+ }
+ }
+
+ #endregion
+
#region Injector
private void startProcessProcessMenuItem_Click(object sender, EventArgs e)
@@ -1460,7 +1483,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/HackerWindow.resx b/trunk/ProcessHacker/Forms/HackerWindow.resx
index 4c8ba6adc..43aeb9ae6 100644
--- a/trunk/ProcessHacker/Forms/HackerWindow.resx
+++ b/trunk/ProcessHacker/Forms/HackerWindow.resx
@@ -123,12 +123,27 @@
141, 17
-
- 113
+
+ 249, 17
+
+
+ 359, 17
719, 17
+
+ 492, 17
+
+
+ 613, 17
+
+
+ 141, 17
+
+
+ 113
+
@@ -182,18 +197,6 @@
rEEAAaxBAAGsQQABrEEAAKxBAACsQQAArEHAAKxB8ACsQfB/rEH//6xB
-
- 249, 17
-
-
- 359, 17
-
-
- 492, 17
-
-
- 613, 17
-
817, 17
diff --git a/trunk/ProcessHacker/Forms/HandleFilterWindow.cs b/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
index aa84a7910..029216187 100644
--- a/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
+++ b/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
@@ -243,7 +243,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs b/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
index c0eedcd52..79a08aabc 100644
--- a/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
+++ b/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
@@ -236,7 +236,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Forms/LogWindow.cs b/trunk/ProcessHacker/Forms/LogWindow.cs
index 8ecb859d9..4c0560113 100644
--- a/trunk/ProcessHacker/Forms/LogWindow.cs
+++ b/trunk/ProcessHacker/Forms/LogWindow.cs
@@ -132,7 +132,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Forms/ProcessAffinity.cs b/trunk/ProcessHacker/Forms/ProcessAffinity.cs
index 8746777e3..6fa01b6b0 100644
--- a/trunk/ProcessHacker/Forms/ProcessAffinity.cs
+++ b/trunk/ProcessHacker/Forms/ProcessAffinity.cs
@@ -22,7 +22,7 @@
using System;
using System.Windows.Forms;
-using ProcessHacker.Native.Api;
+using ProcessHacker.Common;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
@@ -66,7 +66,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
this.Close();
return;
@@ -98,7 +98,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs
index 2e9be4cc9..1992dc64e 100644
--- a/trunk/ProcessHacker/Forms/ProcessWindow.cs
+++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs
@@ -197,7 +197,11 @@ namespace ProcessHacker
try
{
using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
- phandle.GetJob(JobObjectAccess.Query);
+ {
+ // Check if the process is in a job.
+ if (phandle.GetJobObject(JobObjectAccess.Query) == null)
+ tabControl.TabPages.Remove(tabJob);
+ }
}
catch
{
@@ -567,11 +571,14 @@ namespace ProcessHacker
{
using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
{
- var jhandle = phandle.GetJob(JobObjectAccess.Query);
+ var jhandle = phandle.GetJobObject(JobObjectAccess.Query);
- _jobProps = new JobProperties(jhandle);
- _jobProps.Dock = DockStyle.Fill;
- tabJob.Controls.Add(_jobProps);
+ if (jhandle != null)
+ {
+ _jobProps = new JobProperties(jhandle);
+ _jobProps.Dock = DockStyle.Fill;
+ tabJob.Controls.Add(_jobProps);
+ }
}
}
catch
@@ -898,7 +905,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
diff --git a/trunk/ProcessHacker/Forms/RunWindow.cs b/trunk/ProcessHacker/Forms/RunWindow.cs
index 83c5a6e24..1f218f947 100644
--- a/trunk/ProcessHacker/Forms/RunWindow.cs
+++ b/trunk/ProcessHacker/Forms/RunWindow.cs
@@ -216,7 +216,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
this.Cursor = Cursors.Default;
diff --git a/trunk/ProcessHacker/Forms/TerminatorWindow.cs b/trunk/ProcessHacker/Forms/TerminatorWindow.cs
index 9255fd058..85093534f 100644
--- a/trunk/ProcessHacker/Forms/TerminatorWindow.cs
+++ b/trunk/ProcessHacker/Forms/TerminatorWindow.cs
@@ -209,7 +209,9 @@ namespace ProcessHacker
{
using (var phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
{
- using (var jhandle = phandle.GetJob(JobObjectAccess.Query | JobObjectAccess.Terminate))
+ var jhandle = phandle.GetJobObject(JobObjectAccess.Query | JobObjectAccess.Terminate);
+
+ if (jhandle != null)
{
// Make sure we're not terminating more than one process
if (jhandle.GetProcessIdList().Length == 1)
diff --git a/trunk/ProcessHacker/Forms/ThreadWindow.cs b/trunk/ProcessHacker/Forms/ThreadWindow.cs
index cf037d2a2..134e730e0 100644
--- a/trunk/ProcessHacker/Forms/ThreadWindow.cs
+++ b/trunk/ProcessHacker/Forms/ThreadWindow.cs
@@ -336,7 +336,7 @@ namespace ProcessHacker
catch (Exception ex)
{
if (!ex.Message.StartsWith("Cannot access a disposed object"))
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Program/Program.cs b/trunk/ProcessHacker/Program/Program.cs
index 6eb30f07d..d4eff2bc9 100644
--- a/trunk/ProcessHacker/Program/Program.cs
+++ b/trunk/ProcessHacker/Program/Program.cs
@@ -413,7 +413,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
return true;
@@ -469,7 +469,7 @@ namespace ProcessHacker
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
return true;
diff --git a/trunk/ProcessHacker/Program/Save.cs b/trunk/ProcessHacker/Program/Save.cs
index a4d545ef8..af2a09a41 100644
--- a/trunk/ProcessHacker/Program/Save.cs
+++ b/trunk/ProcessHacker/Program/Save.cs
@@ -20,13 +20,13 @@
* along with Process Hacker. If not, see .
*/
-using System;
using System.Collections.Generic;
+using System.IO;
using System.Text;
using System.Windows.Forms;
-using System.IO;
using Aga.Controls.Tree;
using Aga.Controls.Tree.NodeControls;
+using ProcessHacker.Common;
namespace ProcessHacker
{
@@ -69,7 +69,7 @@ namespace ProcessHacker
}
catch (IOException ex)
{
- MessageBox.Show(ex.Message, "Process Hacker", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ PhUtils.ShowMessage(ex);
}
}
}
diff --git a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs
index 9ac94a554..eeb19a8c9 100644
--- a/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs
+++ b/trunk/ProcessHacker/Providers/ProcessSystemProvider.cs
@@ -910,16 +910,21 @@ namespace ProcessHacker
{
try
{
- using (var jhandle = queryLimitedHandle.GetJob(JobObjectAccess.Query))
+ var jhandle = queryLimitedHandle.GetJobObject(JobObjectAccess.Query);
+
+ if (jhandle != null)
{
- var limits = jhandle.GetBasicLimitInformation();
-
- item.IsInJob = true;
- item.JobName = jhandle.GetObjectName();
-
- if (limits.LimitFlags != JobObjectLimitFlags.SilentBreakawayOk)
+ using (jhandle)
{
- item.IsInSignificantJob = true;
+ var limits = jhandle.GetBasicLimitInformation();
+
+ item.IsInJob = true;
+ item.JobName = jhandle.GetObjectName();
+
+ if (limits.LimitFlags != JobObjectLimitFlags.SilentBreakawayOk)
+ {
+ item.IsInSignificantJob = true;
+ }
}
}
}