public void SetInformation <T>(T jobObjectStructureWrapper) where T : IJobObjectSettable
        {
            JobObjectType jobObjectType = jobObjectStructureWrapper.JobType;
            int           length        = Marshal.SizeOf(jobObjectStructureWrapper.GetType());
            IntPtr        structurePtr  = Marshal.AllocHGlobal(length);

            try
            {
                Marshal.StructureToPtr(jobObjectStructureWrapper, structurePtr, false);
                if (!NativeMethods.SetInformationJobObject(this, jobObjectType, structurePtr, (uint)length))
                {
                    ErrorHelper.ThrowCustomWin32Exception();
                }
            }
            finally
            {
                Marshal.FreeHGlobal(structurePtr);
            }
        }
        public void GetInformation <T>(T jobObjectStructureWrapper) where T : IJobObjectQueryable
        {
            JobObjectType jobObjectType = jobObjectStructureWrapper.JobType;
            int           length        = Marshal.SizeOf(typeof(T));
            IntPtr        structurePtr  = Marshal.AllocHGlobal(length);

            try
            {
                if (!NativeMethods.QueryInformationJobObject(this, jobObjectType, structurePtr, (uint)length, IntPtr.Zero))
                {
                    ErrorHelper.ThrowCustomWin32Exception();
                }
                Marshal.PtrToStructure(structurePtr, jobObjectStructureWrapper);
            }
            finally
            {
                Marshal.FreeHGlobal(structurePtr);
            }
        }
 public static extern bool QueryInformationJobObject(JobObjectHandle handle, JobObjectType jobObjectClass, IntPtr jobObjectInfo, uint jobObjectInfoLength, IntPtr returnLength);