コード例 #1
0
 public JobObject(JobObjectHandle handle)
 {
     if (handle.IsInvalid || handle.IsClosed)
     {
         throw new ArgumentException("Invalid handle", "handle");
     }
     _handle = handle;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        public static JobObjectHandle Create(string name = null)
        {
            JobObjectHandle jobObjectHandle = NativeMethods.CreateJobObject(null, name);

            if (jobObjectHandle.IsInvalid)
            {
                ErrorHelper.ThrowCustomWin32Exception();
            }
            return(jobObjectHandle);
        }
コード例 #4
0
        public bool IsProcessInJob(JobObjectHandle jobHandle)
        {
            bool result;

            if (!NativeMethods.IsProcessInJob(this, jobHandle, out result))
            {
                ErrorHelper.ThrowCustomWin32Exception();
            }
            return(result);
        }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 public static extern bool TerminateJobObject(JobObjectHandle handle, uint exitCode);
コード例 #7
0
 public static extern bool QueryInformationJobObject(JobObjectHandle handle, JobObjectType jobObjectClass, IntPtr jobObjectInfo, uint jobObjectInfoLength, IntPtr returnLength);
コード例 #8
0
 public static extern bool AssignProcessToJobObject(JobObjectHandle handle, ProcessHandle processHandle);
コード例 #9
0
 public bool IsProcessInJob(JobObjectHandle jobObject)
 {
     return(_handle.IsProcessInJob(jobObject));
 }
コード例 #10
0
 public JobObjectSecurity(JobObjectHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
コード例 #11
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);