66 {
67 if (createByName && name == null)
68 {
69 throw new ArgumentNullException("name");
70 }
71 if (!createByName &&
handle ==
null)
72 {
73 throw new ArgumentNullException("handle");
74 }
75 RawSecurityDescriptor resultSd;
76 int securityInfo =
Win32.GetSecurityInfo(resourceType, name,
handle, includeSections, out resultSd);
77 if (securityInfo != 0)
78 {
79 Exception ex = null;
80 if (exceptionFromErrorCode != null)
81 {
82 ex = exceptionFromErrorCode(securityInfo, name,
handle, exceptionContext);
83 }
84 if (ex == null)
85 {
86 switch (securityInfo)
87 {
88 case 5:
89 ex = new UnauthorizedAccessException();
90 break;
91 case 1307:
93 break;
94 case 1308:
96 break;
97 case 87:
99 break;
100 case 123:
102 break;
103 case 2:
105 break;
106 case 3:
107 {
109 ex = ex2;
110 break;
111 }
112 case 1350:
114 break;
115 case 233:
117 break;
118 default:
120 break;
121 }
122 }
123 throw ex;
124 }
125 return new CommonSecurityDescriptor(isContainer, isDS: false, resultSd, trusted: true);
126 }
static string AccessControl_UnexpectedError
static string AccessControl_InvalidOwner
static string Format(string resourceFormat, object p1)
static string Argument_InvalidName
static string InvalidOperation_DisconnectedPipe
static string AccessControl_InvalidGroup
static string AccessControl_NoAssociatedSecurity
@ InvalidOperationException