protected ObjectSecurity(bool isContainer, ResourceType resourceType, string name, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) : base(isContainer, resourceType, name, includeSections, exceptionFromErrorCode, exceptionContext) { }
protected NativeObjectSecurity(bool isContainer, ResourceType resourceType, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext);
protected NativeObjectSecurity(bool isContainer, ResourceType resourceType, SafeHandle handle, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext);
internal NativeObjectSecurity(ResourceType resourceType, CommonSecurityDescriptor securityDescriptor, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode) : base(securityDescriptor) { this._resourceType = resourceType; this._exceptionFromErrorCode = exceptionFromErrorCode; }
protected NativeObjectSecurity(bool isContainer, ResourceType resourceType, SafeHandle handle, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) : this(resourceType, NativeObjectSecurity.CreateInternal(resourceType, isContainer, (string)null, handle, includeSections, false, exceptionFromErrorCode, exceptionContext), exceptionFromErrorCode) { }
/// <summary>使用指定的值初始化 <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> 类的一个新实例。</summary> /// <param name="isContainer">如果新的 <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> 对象是一个容器对象,则为 true。</param> /// <param name="resourceType"> /// <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> 对象与其相关联的可保护对象类型。</param> /// <param name="exceptionFromErrorCode">由提供自定义异常的集成器实现的委托。</param> /// <param name="exceptionContext">包含有关异常的源或目标的上下文信息的对象。</param> protected NativeObjectSecurity(bool isContainer, ResourceType resourceType, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) : this(isContainer, resourceType) { this._exceptionContext = exceptionContext; this._exceptionFromErrorCode = exceptionFromErrorCode; }
private static CommonSecurityDescriptor CreateInternal(ResourceType resourceType, bool isContainer, string name, SafeHandle handle, AccessControlSections includeSections, bool createByName, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) { if (createByName && name == null) { throw new ArgumentNullException("name"); } if (!createByName && handle == null) { throw new ArgumentNullException("handle"); } RawSecurityDescriptor resultSd; int securityInfo = Win32.GetSecurityInfo(resourceType, name, handle, includeSections, out resultSd); if (securityInfo != 0) { Exception exception = (Exception)null; if (exceptionFromErrorCode != null) { exception = exceptionFromErrorCode(securityInfo, name, handle, exceptionContext); } if (exception == null) { if (securityInfo == 5) { exception = (Exception) new UnauthorizedAccessException(); } else if (securityInfo == 1307) { exception = (Exception) new InvalidOperationException(Environment.GetResourceString("AccessControl_InvalidOwner")); } else if (securityInfo == 1308) { exception = (Exception) new InvalidOperationException(Environment.GetResourceString("AccessControl_InvalidGroup")); } else if (securityInfo == 87) { exception = (Exception) new InvalidOperationException(Environment.GetResourceString("AccessControl_UnexpectedError", (object)securityInfo)); } else if (securityInfo == 123) { exception = (Exception) new ArgumentException(Environment.GetResourceString("Argument_InvalidName"), "name"); } else if (securityInfo == 2) { exception = name == null ? (Exception) new FileNotFoundException() : (Exception) new FileNotFoundException(name); } else if (securityInfo == 1350) { exception = (Exception) new NotSupportedException(Environment.GetResourceString("AccessControl_NoAssociatedSecurity")); } else { exception = (Exception) new InvalidOperationException(Environment.GetResourceString("AccessControl_UnexpectedError", (object)securityInfo)); } } throw exception; } return(new CommonSecurityDescriptor(isContainer, false, resultSd, true)); }
protected ObjectSecurity(bool isContainer, ResourceType resourceType, System.Runtime.InteropServices.SafeHandle safeHandle, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext) : base(default(bool), default(ResourceType)) { Contract.Ensures(false); }
protected ObjectSecurity(bool isContainer, ResourceType resourceType, string name, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext) : base(default(bool), default(ResourceType)) { Contract.Ensures(false); }
protected NativeObjectSecurity(bool isContainer, ResourceType resourceType, string name, AccessControlSections includeSections, NativeObjectSecurity.ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) : this(resourceType, NativeObjectSecurity.CreateInternal(resourceType, isContainer, name, null, includeSections, true, exceptionFromErrorCode, exceptionContext), exceptionFromErrorCode) { }