public JobObject(JobObjectHandle handle) { if (handle.IsInvalid || handle.IsClosed) { throw new ArgumentException("Invalid handle", "handle"); } _handle = handle; }
public static JobObjectHandle Open(string name, bool inheritHandle = false, JobObjectAccessRights desiredAccess = JobObjectAccessRights.AllAccess) { JobObjectHandle jobObjectHandle = NativeMethods.OpenJobObject(desiredAccess, inheritHandle, name); if (jobObjectHandle.IsInvalid) { ErrorHelper.ThrowCustomWin32Exception(); } return(jobObjectHandle); }
public static JobObjectHandle Create(string name = null) { JobObjectHandle jobObjectHandle = NativeMethods.CreateJobObject(null, name); if (jobObjectHandle.IsInvalid) { ErrorHelper.ThrowCustomWin32Exception(); } return(jobObjectHandle); }
public bool IsProcessInJob(JobObjectHandle jobHandle) { bool result; if (!NativeMethods.IsProcessInJob(this, jobHandle, out result)) { ErrorHelper.ThrowCustomWin32Exception(); } return(result); }
public static JobObjectHandle Create(JobObjectSecurity security, string name = null) { using (var securityAttributes = new SecurityAttributes(security)) { JobObjectHandle jobObjectHandle = NativeMethods.CreateJobObject(securityAttributes, name); if (jobObjectHandle.IsInvalid) { ErrorHelper.ThrowCustomWin32Exception(); } return(jobObjectHandle); } }
public static extern bool TerminateJobObject(JobObjectHandle handle, uint exitCode);
public static extern bool QueryInformationJobObject(JobObjectHandle handle, JobObjectType jobObjectClass, IntPtr jobObjectInfo, uint jobObjectInfoLength, IntPtr returnLength);
public static extern bool AssignProcessToJobObject(JobObjectHandle handle, ProcessHandle processHandle);
public bool IsProcessInJob(JobObjectHandle jobObject) { return(_handle.IsProcessInJob(jobObject)); }
public JobObjectSecurity(JobObjectHandle handle, AccessControlSections includeSections, bool isContainer = false) : base(isContainer, ResourceType.KernelObject, handle, includeSections) { }
public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);