Exemple #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);
        }
Exemple #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);
Exemple #9
0
 public bool IsProcessInJob(JobObjectHandle jobObject)
 {
     return(_handle.IsProcessInJob(jobObject));
 }
Exemple #10
0
 public JobObjectSecurity(JobObjectHandle handle, AccessControlSections includeSections, bool isContainer = false)
     : base(isContainer, ResourceType.KernelObject, handle, includeSections)
 {
 }
Exemple #11
0
 public static extern bool IsProcessInJob(ProcessHandle processHandle, JobObjectHandle jobHandle, out bool result);