Creates a security descriptor for the DHCP pipe service.
59 {
66
68 1,
70 0, 0, 0, 0, 0, 0, 0,
71 &AuthenticatedUsersSid))
72 {
73 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to create Authenticated Users SID (error code %d)\n",
GetLastError());
75 }
76
78 2,
81 0, 0, 0, 0, 0, 0,
82 &NetworkOpsSid))
83 {
84 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to create Network Ops SID (error code %d)\n",
GetLastError());
86 goto Quit;
87 }
88
90 2,
93 0, 0, 0, 0, 0, 0,
94 &AdminsSid))
95 {
96 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to create Admins SID (error code %d)\n",
GetLastError());
98 goto Quit;
99 }
100
102 1,
104 0, 0, 0, 0, 0, 0, 0,
105 &SystemSid))
106 {
107 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to create Local System SID (error code %d)\n",
GetLastError());
109 goto Quit;
110 }
111
113 if (!AbsSD)
114 {
115 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to allocate absolute security descriptor!\n");
117 goto Quit;
118 }
119
121 {
122 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to initialize absolute security descriptor (error code %d)\n",
GetLastError());
124 goto Quit;
125 }
126
132
135 {
136 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to allocate DACL!\n");
138 goto Quit;
139 }
140
142 {
143 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to initialize DACL (error code %d)\n",
GetLastError());
145 goto Quit;
146 }
147
151 AuthenticatedUsersSid))
152 {
153 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up ACE for Authenticated Users SID (error code %d)\n",
GetLastError());
155 goto Quit;
156 }
157
161 NetworkOpsSid))
162 {
163 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up ACE for Network Ops SID (error code %d)\n",
GetLastError());
165 goto Quit;
166 }
167
171 AdminsSid))
172 {
173 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up ACE for Admins SID (error code %d)\n",
GetLastError());
175 goto Quit;
176 }
177
181 SystemSid))
182 {
183 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up ACE for Local System SID (error code %d)\n",
GetLastError());
185 goto Quit;
186 }
187
189 {
190 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up DACL to absolute security descriptor (error code %d)\n",
GetLastError());
192 goto Quit;
193 }
194
196 {
197 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up owner to absolute security descriptor (error code %d)\n",
GetLastError());
199 goto Quit;
200 }
201
203 {
204 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to set up group to absolute security descriptor (error code %d)\n",
GetLastError());
206 goto Quit;
207 }
208
210 {
211 DPRINT1(
"CreateDhcpPipeSecurity(): Unexpected error code (error code %d -- must be ERROR_INSUFFICIENT_BUFFER)\n",
GetLastError());
213 goto Quit;
214 }
215
218 {
219 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to allocate relative SD!\n");
221 goto Quit;
222 }
223
225 {
226 DPRINT1(
"CreateDhcpPipeSecurity(): Failed to allocate relative SD, buffer too smal (expected size %lu)\n", RelSDSize);
228 goto Quit;
229 }
230
233
234Quit:
236 {
237 if (RelSD)
238 {
240 }
241 }
242
243 if (AuthenticatedUsersSid)
244 {
245 FreeSid(AuthenticatedUsersSid);
246 }
247
248 if (NetworkOpsSid)
249 {
251 }
252
253 if (AdminsSid)
254 {
256 }
257
258 if (SystemSid)
259 {
261 }
262
264 {
266 }
267
268 if (AbsSD)
269 {
271 }
272
273 return ErrCode;
274}
static SID_IDENTIFIER_AUTHORITY NtAuthority
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
DWORD WINAPI GetLengthSid(PSID pSid)
PVOID WINAPI FreeSid(PSID pSid)
#define HeapFree(x, y, z)
struct _ACCESS_ALLOWED_ACE ACCESS_ALLOWED_ACE
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG DaclSize
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
BOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted)
BOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength)
BOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted)
DWORD WINAPI GetLastError(void)
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS
#define SECURITY_BUILTIN_DOMAIN_RID
#define SECURITY_LOCAL_SYSTEM_RID
#define SECURITY_AUTHENTICATED_USER_RID
#define SECURITY_NT_AUTHORITY
#define SECURITY_DESCRIPTOR_REVISION
#define DOMAIN_ALIAS_RID_ADMINS