source: trunk/src/NTDLL/sec.cpp@ 2134

Last change on this file since 2134 was 2134, checked in by sandervl, 26 years ago

Forward SID apis to NTDLL & move some sid apis from advapi32 to ntdll

File size: 20.8 KB
Line 
1/* $Id: sec.cpp,v 1.5 1999-12-19 12:25:55 sandervl Exp $ */
2
3/*
4 * Project Odin Software License can be found in LICENSE.TXT
5 * Win32 NT Runtime / NTDLL for OS/2
6 *
7 * Copyright 1998 original WINE Author
8 * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
9 *
10 * Security functions
11 *
12 * Copyright 1996-1998 Marcus Meissner
13 */
14
15#include <stdlib.h>
16#include <string.h>
17#include <time.h>
18#include <ctype.h>
19#include <math.h>
20
21#include <os2win.h>
22#include "ntdll.h"
23
24/*
25 * SID FUNCTIONS
26 */
27
28/******************************************************************************
29 * RtlAllocateAndInitializeSid [NTDLL.265]
30 *
31 */
32BOOLEAN WINAPI RtlAllocateAndInitializeSid ( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
33 BYTE nSubAuthorityCount,
34 DWORD nSubAuthority0,
35 DWORD nSubAuthority1,
36 DWORD nSubAuthority2,
37 DWORD nSubAuthority3,
38 DWORD nSubAuthority4,
39 DWORD nSubAuthority5,
40 DWORD nSubAuthority6,
41 DWORD nSubAuthority7,
42 PSID *pSid)
43{
44 dprintf(("NTDLL: RtlAllocateAndInitializeSid(%08xh,%08xh,%08xh,"
45 "%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
46 pIdentifierAuthority,
47 nSubAuthorityCount,
48 nSubAuthority0,
49 nSubAuthority1,
50 nSubAuthority2,
51 nSubAuthority3,
52 nSubAuthority4,
53 nSubAuthority5,
54 nSubAuthority6,
55 nSubAuthority7,
56 pSid));
57
58 *pSid = (PSID)Heap_Alloc(sizeof(SID)+nSubAuthorityCount*sizeof(DWORD));
59 if(*pSid == NULL) {
60 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
61 return FALSE;
62 }
63 (*pSid)->Revision = SID_REVISION;
64 (*pSid)->SubAuthorityCount = nSubAuthorityCount;
65
66 if (nSubAuthorityCount > 0)
67 (*pSid)->SubAuthority[0] = nSubAuthority0;
68 if (nSubAuthorityCount > 1)
69 (*pSid)->SubAuthority[1] = nSubAuthority1;
70 if (nSubAuthorityCount > 2)
71 (*pSid)->SubAuthority[2] = nSubAuthority2;
72 if (nSubAuthorityCount > 3)
73 (*pSid)->SubAuthority[3] = nSubAuthority3;
74 if (nSubAuthorityCount > 4)
75 (*pSid)->SubAuthority[4] = nSubAuthority4;
76 if (nSubAuthorityCount > 5)
77 (*pSid)->SubAuthority[5] = nSubAuthority5;
78 if (nSubAuthorityCount > 6)
79 (*pSid)->SubAuthority[6] = nSubAuthority6;
80 if (nSubAuthorityCount > 7)
81 (*pSid)->SubAuthority[7] = nSubAuthority7;
82
83 if(pIdentifierAuthority)
84 memcpy((PVOID)&(*pSid)->IdentifierAuthority, (PVOID)pIdentifierAuthority, sizeof(SID_IDENTIFIER_AUTHORITY));
85 return TRUE;
86}
87
88
89/******************************************************************************
90 * RtlEqualSid [NTDLL.352]
91 *
92 */
93BOOL WINAPI RtlEqualSid(PSID pSid1, PSID pSid2)
94{
95 dprintf(("NTDLL: RtlEqualSid(%08x, %08x)",
96 pSid1,
97 pSid2));
98
99 if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
100 return FALSE;
101
102 if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
103 return FALSE;
104
105 if (memcmp(pSid1, pSid2, RtlLengthSid(pSid1)) != 0)
106 return FALSE;
107
108 return TRUE;
109}
110
111
112/******************************************************************************
113 * RtlEqualPrefixSid [NTDLL.351]
114 */
115BOOL WINAPI RtlEqualPrefixSid (PSID pSid1, PSID pSid2)
116{
117 if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
118 return FALSE;
119
120 if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
121 return FALSE;
122
123 if (memcmp(pSid1, pSid2, RtlLengthRequiredSid(pSid1->SubAuthorityCount - 1)) != 0)
124 return FALSE;
125
126 return TRUE;
127}
128
129/******************************************************************************
130 * RtlFreeSid [NTDLL.376]
131 */
132VOID* WINAPI RtlFreeSid(PSID pSid)
133{
134 dprintf(("NTDLL: RtlFreeSid(%08xh)", pSid));
135
136 Heap_Free(pSid);
137 return NULL;
138}
139
140
141/**************************************************************************
142 * RtlLengthRequiredSid [NTDLL.427]
143 */
144DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths)
145{
146 dprintf (("NTDLL: RtlLengthRequiredSid(%08xh)\n",
147 nrofsubauths));
148
149 return sizeof(DWORD)*nrofsubauths+sizeof(SID);
150}
151
152
153/**************************************************************************
154 * RtlLengthSid [NTDLL.429]
155 */
156DWORD WINAPI RtlLengthSid(PSID sid)
157{
158 dprintf(("NTDLL: RtlLengthSid(%08xh)\n",
159 sid));
160
161 if (!sid)
162 return FALSE;
163
164 return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
165}
166
167
168/**************************************************************************
169 * RtlInitializeSid [NTDLL.410]
170 */
171DWORD WINAPI RtlInitializeSid(PSID psid,
172 PSID_IDENTIFIER_AUTHORITY psidauth,
173 DWORD c)
174{
175 BYTE a = c & 0xff;
176
177 dprintf(("NTDLL: RtlInitializeSid(%08xh,%08xh,%08xh)\n",
178 psid,
179 psidauth,
180 c));
181
182 if (a>=SID_MAX_SUB_AUTHORITIES)
183 return a;
184
185 psid->SubAuthorityCount = a;
186 psid->Revision = SID_REVISION;
187 memcpy(&(psid->IdentifierAuthority),
188 psidauth,
189 sizeof(SID_IDENTIFIER_AUTHORITY));
190
191 return STATUS_SUCCESS;
192}
193
194
195/******************************************************************************
196 * RtlIdentifierAuthoritySid [NTDLL.395]
197 *
198 * PARAMS
199 * pSid []
200 */
201PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid( PSID pSid )
202{
203 return &pSid->IdentifierAuthority;
204}
205
206/**************************************************************************
207 * RtlSubAuthoritySid [NTDLL.497]
208 */
209LPDWORD WINAPI RtlSubAuthoritySid(PSID psid,
210 DWORD nr)
211{
212 dprintf(("NTDLL: RtlSubAuthoritySid(%08xh,%08xh)\n",
213 psid,
214 nr));
215
216 return &(psid->SubAuthority[nr]);
217}
218
219
220/**************************************************************************
221 * RtlSubAuthorityCountSid [NTDLL.496]
222 */
223
224LPBYTE WINAPI RtlSubAuthorityCountSid(PSID psid)
225{
226 dprintf2(("NTDLL: RtlSubAUthorityCountSid(%08xh)\n",
227 psid));
228
229 return ((LPBYTE)psid)+1;
230}
231
232
233/**************************************************************************
234 * RtlCopySid [NTDLL.302]
235 */
236DWORD WINAPI RtlCopySid(DWORD nDestinationSidLength,
237 PSID pDestinationSid,
238 PSID pSourceSid)
239{
240 dprintf(("NTDLL: RtlCopySid(%08xh,%08xh,%08xh)\n",
241 nDestinationSidLength,
242 pDestinationSid,
243 pSourceSid));
244
245 if (!RtlValidSid(pSourceSid))
246 return STATUS_INVALID_PARAMETER;
247
248 if (nDestinationSidLength < RtlLengthSid(pSourceSid))
249 return STATUS_BUFFER_TOO_SMALL;
250
251 memcpy(pDestinationSid, pSourceSid, RtlLengthSid(pSourceSid));
252
253 return STATUS_SUCCESS;
254}
255
256
257/******************************************************************************
258 * RtlValidSid [NTDLL.523]
259 *
260 * PARAMS
261 * pSid []
262 */
263BOOL WINAPI RtlValidSid( PSID pSid )
264{
265 if (IsBadReadPtr(pSid, 4))
266 {
267 return FALSE;
268 }
269
270 if (pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
271 return FALSE;
272
273 if (!pSid || pSid->Revision != SID_REVISION)
274 return FALSE;
275
276 return TRUE;
277}
278
279/*
280 * security descriptor functions
281 */
282
283/**************************************************************************
284 * RtlCreateSecurityDescriptor [NTDLL.313]
285 *
286 * RETURNS:
287 * 0 success,
288 * STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE,
289 * STATUS_NO_MEMORY
290 */
291NTSTATUS WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
292 DWORD rev)
293{
294 dprintf(("NTDLL: RtlCreateSecurityDescriptor(%08xh,%08xh)\n",
295 lpsd,
296 rev));
297
298 if (rev!=SECURITY_DESCRIPTOR_REVISION)
299 return STATUS_UNKNOWN_REVISION;
300
301 memset(lpsd,
302 '\0',
303 sizeof(*lpsd));
304
305 lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
306
307 return STATUS_SUCCESS;
308}
309
310
311/**************************************************************************
312 * RtlValidSecurityDescriptor [NTDLL.313]
313 *
314 */
315NTSTATUS WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
316{
317 dprintf(("NTDLL: RtlValidSecurityDescriptor(%08xh)\n",
318 SecurityDescriptor));
319
320 if ( ! SecurityDescriptor )
321 return STATUS_INVALID_SECURITY_DESCR;
322
323 if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
324 return STATUS_UNKNOWN_REVISION;
325
326 return STATUS_SUCCESS;
327}
328
329
330/**************************************************************************
331 * RtlLengthSecurityDescriptor [NTDLL]
332 */
333ULONG WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor)
334{
335 ULONG Size;
336
337 dprintf(("NTDLL: RtlLengthSecurityDescriptor(%08xh)\n",
338 SecurityDescriptor));
339
340 Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
341 if ( SecurityDescriptor == NULL )
342 return 0;
343
344 if ( SecurityDescriptor->Owner != NULL )
345 Size += SecurityDescriptor->Owner->SubAuthorityCount;
346 if ( SecurityDescriptor->Group != NULL )
347 Size += SecurityDescriptor->Group->SubAuthorityCount;
348
349
350 if ( SecurityDescriptor->Sacl != NULL )
351 Size += SecurityDescriptor->Sacl->AclSize;
352 if ( SecurityDescriptor->Dacl != NULL )
353 Size += SecurityDescriptor->Dacl->AclSize;
354
355 return Size;
356}
357
358/******************************************************************************
359 * RtlGetDaclSecurityDescriptor [NTDLL]
360 *
361 */
362NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,
363 PBOOLEAN lpbDaclPresent,
364 PACL *pDacl,
365 PBOOLEAN lpbDaclDefaulted)
366{
367 dprintf(("NTDLL: RtlGetDaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
368 pSecurityDescriptor,
369 lpbDaclPresent,
370 pDacl,
371 lpbDaclDefaulted));
372
373 if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
374 return STATUS_UNKNOWN_REVISION ;
375
376 *lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control);
377 if (*lpbDaclPresent ? 1 : 0)
378 {
379 if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
380 {
381 *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
382 }
383 else
384 {
385 *pDacl = pSecurityDescriptor->Dacl;
386 }
387 }
388
389 *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
390
391 return STATUS_SUCCESS;
392}
393
394
395/**************************************************************************
396 * RtlSetDaclSecurityDescriptor [NTDLL.483]
397 */
398NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
399 BOOLEAN daclpresent,
400 PACL dacl,
401 BOOLEAN dacldefaulted)
402{
403 dprintf(("NTDLL: RtlSetDaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
404 lpsd,
405 daclpresent,
406 dacl,
407 dacldefaulted));
408
409 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
410 return STATUS_UNKNOWN_REVISION;
411 if (lpsd->Control & SE_SELF_RELATIVE)
412 return STATUS_INVALID_SECURITY_DESCR;
413
414 if (!daclpresent)
415 {
416 lpsd->Control &= ~SE_DACL_PRESENT;
417 return TRUE;
418 }
419
420 lpsd->Control |= SE_DACL_PRESENT;
421 lpsd->Dacl = dacl;
422
423 if (dacldefaulted)
424 lpsd->Control |= SE_DACL_DEFAULTED;
425 else
426 lpsd->Control &= ~SE_DACL_DEFAULTED;
427
428 return STATUS_SUCCESS;
429}
430
431
432/******************************************************************************
433 * RtlGetSaclSecurityDescriptor [NTDLL]
434 *
435 */
436NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,
437 PBOOLEAN lpbSaclPresent,
438 PACL *pSacl,
439 PBOOLEAN lpbSaclDefaulted)
440{
441 dprintf(("NTDLL: RtlGetSaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
442 pSecurityDescriptor,
443 lpbSaclPresent,
444 pSacl,
445 lpbSaclDefaulted));
446
447 if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
448 return STATUS_UNKNOWN_REVISION ;
449
450 *lpbSaclPresent = (SE_SACL_PRESENT & pSecurityDescriptor->Control);
451 if (*lpbSaclPresent ? 1 : 0)
452 {
453 if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
454 {
455 *pSacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Sacl);
456 }
457 else
458 {
459 *pSacl = pSecurityDescriptor->Sacl;
460 }
461 }
462
463 *lpbSaclDefaulted = (( SE_SACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
464
465 return STATUS_SUCCESS;
466}
467
468
469/**************************************************************************
470 * RtlSetSaclSecurityDescriptor [NTDLL.488]
471 */
472NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
473 BOOLEAN saclpresent,
474 PACL sacl,
475 BOOLEAN sacldefaulted)
476{
477 dprintf(("NTDLL: RtlSetSaclSecurityDescriptor(%08xh,%08xh,%08xh,%08xh)\n",
478 lpsd,
479 saclpresent,
480 sacl,
481 sacldefaulted));
482
483 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
484 return STATUS_UNKNOWN_REVISION;
485
486 if (lpsd->Control & SE_SELF_RELATIVE)
487 return STATUS_INVALID_SECURITY_DESCR;
488
489 if (!saclpresent)
490 {
491 lpsd->Control &= ~SE_SACL_PRESENT;
492 return 0;
493 }
494
495 lpsd->Control |= SE_SACL_PRESENT;
496 lpsd->Sacl = sacl;
497
498 if (sacldefaulted)
499 lpsd->Control |= SE_SACL_DEFAULTED;
500 else
501 lpsd->Control &= ~SE_SACL_DEFAULTED;
502
503 return STATUS_SUCCESS;
504}
505
506
507/**************************************************************************
508 * RtlGetOwnerSecurityDescriptor [NTDLL.488]
509 */
510NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
511 PSID *Owner,
512 PBOOLEAN OwnerDefaulted)
513{
514 dprintf(("NTDLL: RtlGetOwnerSecurityDescriptor(%08xh,%08xh,%08xh)\n",
515 SecurityDescriptor,
516 Owner,
517 OwnerDefaulted));
518
519 if ( !SecurityDescriptor || !Owner || !OwnerDefaulted )
520 return STATUS_INVALID_PARAMETER;
521
522 *Owner = SecurityDescriptor->Owner;
523 if ( *Owner != NULL )
524 {
525 if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
526 *OwnerDefaulted = TRUE;
527 else
528 *OwnerDefaulted = FALSE;
529 }
530
531 return STATUS_SUCCESS;
532}
533
534
535/**************************************************************************
536 * RtlSetOwnerSecurityDescriptor [NTDLL.487]
537 */
538NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR lpsd,
539 PSID owner,
540 BOOLEAN ownerdefaulted)
541{
542 dprintf(("NTDLL: RtlSetOwnerSecurityDescriptor(%08x,%08xh,%08xh)\n",
543 lpsd,
544 owner,
545 ownerdefaulted));
546
547 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
548 return STATUS_UNKNOWN_REVISION;
549 if (lpsd->Control & SE_SELF_RELATIVE)
550 return STATUS_INVALID_SECURITY_DESCR;
551
552 lpsd->Owner = owner;
553 if (ownerdefaulted)
554 lpsd->Control |= SE_OWNER_DEFAULTED;
555 else
556 lpsd->Control &= ~SE_OWNER_DEFAULTED;
557
558 return STATUS_SUCCESS;
559}
560
561
562/**************************************************************************
563 * RtlSetGroupSecurityDescriptor [NTDLL.485]
564 */
565NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR lpsd,
566 PSID group,
567 BOOLEAN groupdefaulted)
568{
569 dprintf(("NTDLL: RtlSetGroupSecurityDescriptor(%08xh,%08xh,%08xh)\n",
570 lpsd,
571 group,
572 groupdefaulted));
573
574 if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
575 return STATUS_UNKNOWN_REVISION;
576 if (lpsd->Control & SE_SELF_RELATIVE)
577 return STATUS_INVALID_SECURITY_DESCR;
578
579 lpsd->Group = group;
580 if (groupdefaulted)
581 lpsd->Control |= SE_GROUP_DEFAULTED;
582 else
583 lpsd->Control &= ~SE_GROUP_DEFAULTED;
584
585 return STATUS_SUCCESS;
586}
587
588
589/**************************************************************************
590 * RtlGetGroupSecurityDescriptor [NTDLL]
591 */
592NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
593 PSID *Group,
594 PBOOLEAN GroupDefaulted)
595{
596 dprintf(("NTDLL: RtlGetGroupSecurityDescriptor(%08xh,%08xh,%08xh)\n",
597 SecurityDescriptor,
598 Group,
599 GroupDefaulted));
600
601 if ( !SecurityDescriptor || !Group || !GroupDefaulted )
602 return STATUS_INVALID_PARAMETER;
603
604 *Group = SecurityDescriptor->Group;
605 if ( *Group != NULL )
606 {
607 if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
608 *GroupDefaulted = TRUE;
609 else
610 *GroupDefaulted = FALSE;
611 }
612
613 return STATUS_SUCCESS;
614}
615
616
617/*
618 * access control list's
619 */
620
621/**************************************************************************
622 * RtlCreateAcl [NTDLL.306]
623 *
624 * NOTES
625 * This should return NTSTATUS
626 */
627DWORD WINAPI RtlCreateAcl(PACL acl,
628 DWORD size,
629 DWORD rev)
630{
631 dprintf(("NTDLL: RtlCreateAcl(%08xh,%08xh,%08xh)\n",
632 acl,
633 size,
634 rev));
635
636 if (rev!=ACL_REVISION)
637 return STATUS_INVALID_PARAMETER;
638 if (size<sizeof(ACL))
639 return STATUS_BUFFER_TOO_SMALL;
640 if (size>0xFFFF)
641 return STATUS_INVALID_PARAMETER;
642
643 memset(acl,'\0',sizeof(ACL));
644 acl->AclRevision = rev;
645 acl->AclSize = size;
646 acl->AceCount = 0;
647
648 return 0;
649}
650
651
652/**************************************************************************
653 * RtlFirstFreeAce [NTDLL.370]
654 * looks for the AceCount+1 ACE, and if it is still within the alloced
655 * ACL, return a pointer to it
656 */
657BOOLEAN WINAPI RtlFirstFreeAce(PACL acl,
658 PACE_HEADER *x)
659{
660 PACE_HEADER ace;
661 int i;
662
663 dprintf(("NTDLL: RtlFirstFreeAct(%08xh,%08xh)\n",
664 acl,
665 x));
666
667 *x = 0;
668 ace = (PACE_HEADER)(acl+1);
669 for (i=0;
670 i<acl->AceCount;
671 i++)
672 {
673 if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
674 return 0;
675
676 ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
677 }
678
679 if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
680 return 0;
681
682 *x = ace;
683 return 1;
684}
685
686
687/**************************************************************************
688 * RtlAddAce [NTDLL.260]
689 */
690NTSTATUS WINAPI RtlAddAce(PACL acl,
691 DWORD rev,
692 DWORD xnrofaces,
693 PACE_HEADER acestart,
694 DWORD acelen)
695{
696 PACE_HEADER ace,targetace;
697 int nrofaces;
698
699 dprintf(("NTDLL: RtlAddAce(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
700 acl,
701 rev,
702 xnrofaces,
703 acestart,
704 acelen));
705
706 if (acl->AclRevision != ACL_REVISION)
707 return STATUS_INVALID_PARAMETER;
708
709 if (!RtlFirstFreeAce(acl,&targetace))
710 return STATUS_INVALID_PARAMETER;
711
712 nrofaces=0;
713 ace=acestart;
714
715 while (((DWORD)ace-(DWORD)acestart)<acelen)
716 {
717 nrofaces++;
718 ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
719 }
720
721 if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
722 return STATUS_INVALID_PARAMETER;
723
724 memcpy((LPBYTE)targetace,acestart,acelen);
725 acl->AceCount+=nrofaces;
726
727 return STATUS_SUCCESS;
728}
729
730
731/******************************************************************************
732 * RtlAddAccessAllowedAce [NTDLL]
733 */
734DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,
735 DWORD x2,
736 DWORD x3,
737 DWORD x4)
738{
739 dprintf(("NTDLL: RtlAddAccessAllowedAce(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
740 x1,
741 x2,
742 x3,
743 x4));
744
745 return 0;
746}
747
748
749/******************************************************************************
750 * RtlGetAce [NTDLL]
751 */
752DWORD WINAPI RtlGetAce(PACL pAcl,
753 DWORD dwAceIndex,
754 LPVOID *pAce )
755{
756 dprintf(("NTDLL: RtlGetAce(%08x,%08x,%08x) not implemented.\n",
757 pAcl,
758 dwAceIndex,
759 pAce));
760
761 return 0;
762}
763
764
765/*
766 * misc
767 */
768
769/******************************************************************************
770 * RtlAdjustPrivilege [NTDLL]
771 */
772DWORD WINAPI RtlAdjustPrivilege(DWORD x1,
773 DWORD x2,
774 DWORD x3,
775 DWORD x4)
776{
777 dprintf(("NTDLL: RtlAdjustPrivilege(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
778 x1,
779 x2,
780 x3,
781 x4));
782
783 return 0;
784}
785
Note: See TracBrowser for help on using the repository browser.