Пример #1
0
        /// <summary>
        /// 设置扩展限制信息
        /// </summary>
        /// <param name="limit">扩展限制信息</param>
        public void SetInformation(extendedLimitInformation limit)
        {
            int    length          = Marshal.SizeOf(typeof(extendedLimitInformation));
            IntPtr extendedInfoPtr = Marshal.AllocHGlobal(length);

            Marshal.StructureToPtr(limit, extendedInfoPtr, false);
            if (!kernel32.SetInformationJobObject(handle, informationType.JobObjectExtendedLimitInformation, extendedInfoPtr, (uint)length))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
        }
Пример #2
0
 /// <summary>
 /// 设置扩展限制信息
 /// </summary>
 /// <param name="limit">扩展限制信息</param>
 public void SetInformation(extendedLimitInformation limit)
 {
     int length = Marshal.SizeOf(typeof(extendedLimitInformation));
     IntPtr extendedInfoPtr = Marshal.AllocHGlobal(length);
     Marshal.StructureToPtr(limit, extendedInfoPtr, false);
     if (!kernel32.SetInformationJobObject(handle, informationType.JobObjectExtendedLimitInformation, extendedInfoPtr, (uint)length))
     {
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
 }