예제 #1
0
 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);
        }
예제 #4
0
        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);
예제 #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);