Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateInternal()

static CommonSecurityDescriptor System.Security.AccessControl.NativeObjectSecurity.CreateInternal ( ResourceType resourceType,
bool isContainer,
string name,
SafeHandle handle,
AccessControlSections includeSections,
bool createByName,
ExceptionFromErrorCode exceptionFromErrorCode,
object exceptionContext )
inlinestaticprivate

Definition at line 65 of file NativeObjectSecurity.cs.

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:
104 ex = new FileNotFoundException(name);
105 break;
106 case 3:
107 {
108 Exception ex2 = (isContainer ? ((IOException)new DirectoryNotFoundException(name)) : ((IOException)new FileNotFoundException(name)));
109 ex = ex2;
110 break;
111 }
112 case 1350:
113 ex = new NotSupportedException(System.SR.AccessControl_NoAssociatedSecurity);
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
Definition SR.cs:42
static string AccessControl_InvalidOwner
Definition SR.cs:20
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Argument_InvalidName
Definition SR.cs:20
static string InvalidOperation_DisconnectedPipe
Definition SR.cs:96
static string AccessControl_InvalidGroup
Definition SR.cs:22
static string AccessControl_NoAssociatedSecurity
Definition SR.cs:40
Definition SR.cs:7

References System.SR.AccessControl_InvalidGroup, System.SR.AccessControl_InvalidOwner, System.SR.AccessControl_NoAssociatedSecurity, System.SR.AccessControl_UnexpectedError, System.SR.Argument_InvalidName, System.SR.Format(), System.Security.AccessControl.Win32.GetSecurityInfo(), System.handle, and System.SR.InvalidOperation_DisconnectedPipe.