Moved debugger to libwine to make it available to WineLib apps.
[wine] / dlls / ntdll / sec.c
1 /*
2  *      Security functions
3  *
4  *      Copyright 1996-1998 Marcus Meissner
5  */
6
7 #include <stdlib.h>
8 #include <string.h>
9 #include <time.h>
10 #include <ctype.h>
11 #include <math.h>
12 #include "windef.h"
13 #include "winbase.h"
14 #include "winuser.h"
15 #include "wine/winestring.h"
16 #include "file.h"
17 #include "heap.h"
18 #include "winnls.h"
19 #include "debugtools.h"
20 #include "winerror.h"
21 #include "stackframe.h"
22
23 #include "ntddk.h"
24 #include "winreg.h"
25
26 DEFAULT_DEBUG_CHANNEL(ntdll);
27
28 #define NT_SUCCESS(status) (status == STATUS_SUCCESS)
29
30 /*
31  *      SID FUNCTIONS
32  */
33
34 /******************************************************************************
35  *  RtlAllocateAndInitializeSid         [NTDLL.265] 
36  *
37  */
38 BOOLEAN WINAPI RtlAllocateAndInitializeSid (
39         PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
40         BYTE nSubAuthorityCount,
41         DWORD nSubAuthority0, DWORD nSubAuthority1,
42         DWORD nSubAuthority2, DWORD nSubAuthority3,
43         DWORD nSubAuthority4, DWORD nSubAuthority5,
44         DWORD nSubAuthority6, DWORD nSubAuthority7,
45         PSID *pSid )
46 {
47         TRACE("(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)\n",
48                 pIdentifierAuthority,nSubAuthorityCount,
49                 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
50                 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid);
51
52         if (!(*pSid = HeapAlloc( GetProcessHeap(), 0, RtlLengthRequiredSid(nSubAuthorityCount))))
53           return FALSE;
54
55         (*pSid)->Revision = SID_REVISION;
56
57         if (pIdentifierAuthority)
58           memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
59         *GetSidSubAuthorityCount(*pSid) = nSubAuthorityCount;
60
61         if (nSubAuthorityCount > 0)
62           *GetSidSubAuthority(*pSid, 0) = nSubAuthority0;
63         if (nSubAuthorityCount > 1)
64           *GetSidSubAuthority(*pSid, 1) = nSubAuthority1;
65         if (nSubAuthorityCount > 2)
66           *GetSidSubAuthority(*pSid, 2) = nSubAuthority2;
67         if (nSubAuthorityCount > 3)
68           *GetSidSubAuthority(*pSid, 3) = nSubAuthority3;
69         if (nSubAuthorityCount > 4)
70           *GetSidSubAuthority(*pSid, 4) = nSubAuthority4;
71         if (nSubAuthorityCount > 5)
72           *GetSidSubAuthority(*pSid, 5) = nSubAuthority5;
73         if (nSubAuthorityCount > 6)
74           *GetSidSubAuthority(*pSid, 6) = nSubAuthority6;
75         if (nSubAuthorityCount > 7)
76           *GetSidSubAuthority(*pSid, 7) = nSubAuthority7;
77
78         return STATUS_SUCCESS;
79 }
80 /******************************************************************************
81  *  RtlEqualSid         [NTDLL.352] 
82  *
83  */
84 BOOL WINAPI RtlEqualSid( PSID pSid1, PSID pSid2 )
85 {
86     if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
87         return FALSE;
88
89     if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
90         return FALSE;
91
92     if (memcmp(pSid1, pSid2, GetLengthSid(pSid1)) != 0)
93         return FALSE;
94
95     return TRUE;
96 }
97
98 /******************************************************************************
99  * RtlEqualPrefixSid    [ntdll.]
100  */
101 BOOL WINAPI RtlEqualPrefixSid (PSID pSid1, PSID pSid2) 
102 {
103     if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
104         return FALSE;
105
106     if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
107         return FALSE;
108
109     if (memcmp(pSid1, pSid2, RtlLengthRequiredSid(pSid1->SubAuthorityCount - 1)) != 0)
110         return FALSE;
111
112     return TRUE;
113 }
114
115
116 /******************************************************************************
117  *  RtlFreeSid          [NTDLL.376] 
118  */
119 DWORD WINAPI RtlFreeSid(PSID pSid) 
120 {
121         TRACE("(%p)\n", pSid);
122         HeapFree( GetProcessHeap(), 0, pSid );
123         return STATUS_SUCCESS;
124 }
125
126 /**************************************************************************
127  * RtlLengthRequiredSid [NTDLL.427]
128  *
129  * PARAMS
130  *   nSubAuthorityCount []
131  */
132 DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths)
133 {
134         return (nrofsubauths-1)*sizeof(DWORD) + sizeof(SID);
135 }
136
137 /**************************************************************************
138  *                 RtlLengthSid                         [NTDLL.429]
139  */
140 DWORD WINAPI RtlLengthSid(PSID pSid)
141 {
142         TRACE("sid=%p\n",pSid);
143         if (!pSid) return 0; 
144         return RtlLengthRequiredSid(*RtlSubAuthorityCountSid(pSid));
145 }
146
147 /**************************************************************************
148  *                 RtlInitializeSid                     [NTDLL.410]
149  */
150 BOOL WINAPI RtlInitializeSid(
151         PSID pSid,
152         PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
153         BYTE nSubAuthorityCount)
154 {
155         int i;
156         if (nSubAuthorityCount >= SID_MAX_SUB_AUTHORITIES)
157           return FALSE;
158
159         pSid->Revision = SID_REVISION;
160         pSid->SubAuthorityCount = nSubAuthorityCount;
161         if (pIdentifierAuthority)
162           memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
163
164         for (i = 0; i < nSubAuthorityCount; i++)
165           *GetSidSubAuthority(pSid, i) = 0;
166
167         return TRUE;
168 }
169
170 /**************************************************************************
171  *                 RtlSubAuthoritySid                   [NTDLL.497]
172  *
173  * PARAMS
174  *   pSid          []
175  *   nSubAuthority []
176  */
177 LPDWORD WINAPI RtlSubAuthoritySid( PSID pSid, DWORD nSubAuthority )
178 {
179         return &(pSid->SubAuthority[nSubAuthority]);
180 }
181
182 /**************************************************************************
183  * RtlIdentifierAuthoritySid    [NTDLL.395]
184  *
185  * PARAMS
186  *   pSid []
187  */
188 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid( PSID pSid )
189 {
190         return &(pSid->IdentifierAuthority);
191 }
192
193 /**************************************************************************
194  *                 RtlSubAuthorityCountSid              [NTDLL.496]
195  *
196  * PARAMS
197  *   pSid          []
198  *   nSubAuthority []
199  */
200 LPBYTE WINAPI RtlSubAuthorityCountSid(PSID pSid)
201 {
202         return &(pSid->SubAuthorityCount);
203 }
204
205 /**************************************************************************
206  *                 RtlCopySid                           [NTDLL.302]
207  */
208 DWORD WINAPI RtlCopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
209 {
210         if (!pSourceSid || !RtlValidSid(pSourceSid) ||
211             (nDestinationSidLength < RtlLengthSid(pSourceSid)))
212           return FALSE;
213
214         if (nDestinationSidLength < (pSourceSid->SubAuthorityCount*4+8))
215           return FALSE;
216
217         memmove(pDestinationSid, pSourceSid, pSourceSid->SubAuthorityCount*4+8);
218         return TRUE;
219 }
220 /******************************************************************************
221  * RtlValidSid [NTDLL.532]
222  *
223  * PARAMS
224  *   pSid []
225  */
226 BOOL WINAPI
227 RtlValidSid( PSID pSid )
228 {
229     if (IsBadReadPtr(pSid, 4))
230     {
231         WARN("(%p): invalid pointer!\n", pSid);
232         return FALSE;
233     }
234
235     if (pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
236         return FALSE;
237
238     if (!pSid || pSid->Revision != SID_REVISION)
239         return FALSE;
240
241     return TRUE;
242 }
243
244
245 /*
246  *      security descriptor functions
247  */
248
249 /**************************************************************************
250  * RtlCreateSecurityDescriptor                  [NTDLL.313]
251  *
252  * RETURNS:
253  *  0 success, 
254  *  STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE,
255  *  STATUS_NO_MEMORY 
256  */
257 NTSTATUS WINAPI RtlCreateSecurityDescriptor(
258         PSECURITY_DESCRIPTOR lpsd,
259         DWORD rev)
260 {
261         if (rev!=SECURITY_DESCRIPTOR_REVISION)
262                 return STATUS_UNKNOWN_REVISION;
263         memset(lpsd,'\0',sizeof(*lpsd));
264         lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
265         return STATUS_SUCCESS;
266 }
267 /**************************************************************************
268  * RtlValidSecurityDescriptor                   [NTDLL.313]
269  *
270  */
271 NTSTATUS WINAPI RtlValidSecurityDescriptor(
272         PSECURITY_DESCRIPTOR SecurityDescriptor)
273 {
274         if ( ! SecurityDescriptor )
275                 return STATUS_INVALID_SECURITY_DESCR;
276         if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
277                 return STATUS_UNKNOWN_REVISION;
278
279         return STATUS_SUCCESS;
280 }
281
282 /**************************************************************************
283  *  RtlLengthSecurityDescriptor                 [NTDLL]
284  */
285 ULONG WINAPI RtlLengthSecurityDescriptor(
286         PSECURITY_DESCRIPTOR SecurityDescriptor)
287 {
288         ULONG Size;
289         Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
290         if ( SecurityDescriptor == NULL )
291                 return 0;
292
293         if ( SecurityDescriptor->Owner != NULL )
294                 Size += SecurityDescriptor->Owner->SubAuthorityCount;
295         if ( SecurityDescriptor->Group != NULL )
296                 Size += SecurityDescriptor->Group->SubAuthorityCount;
297
298
299         if ( SecurityDescriptor->Sacl != NULL )
300                 Size += SecurityDescriptor->Sacl->AclSize;
301         if ( SecurityDescriptor->Dacl != NULL )
302                 Size += SecurityDescriptor->Dacl->AclSize;
303
304         return Size;
305 }
306
307 /******************************************************************************
308  *  RtlGetDaclSecurityDescriptor                [NTDLL] 
309  *
310  */
311 NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
312         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
313         OUT PBOOLEAN lpbDaclPresent,
314         OUT PACL *pDacl,
315         OUT PBOOLEAN lpbDaclDefaulted)
316 {
317         TRACE("(%p,%p,%p,%p)\n",
318         pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted);
319
320         if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
321           return STATUS_UNKNOWN_REVISION ;
322
323         if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
324         {
325           if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
326           { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
327           }
328           else
329           { *pDacl = pSecurityDescriptor->Dacl;
330           }
331         }
332
333         *lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
334         
335         return STATUS_SUCCESS;
336 }
337
338 /**************************************************************************
339  *  RtlSetDaclSecurityDescriptor                [NTDLL.483]
340  */
341 NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
342         PSECURITY_DESCRIPTOR lpsd,
343         BOOLEAN daclpresent,
344         PACL dacl,
345         BOOLEAN dacldefaulted )
346 {
347         if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
348                 return STATUS_UNKNOWN_REVISION;
349         if (lpsd->Control & SE_SELF_RELATIVE)
350                 return STATUS_INVALID_SECURITY_DESCR;
351
352         if (!daclpresent) 
353         {       lpsd->Control &= ~SE_DACL_PRESENT;
354                 return TRUE;
355         }
356
357         lpsd->Control |= SE_DACL_PRESENT;
358         lpsd->Dacl = dacl;
359
360         if (dacldefaulted)
361                 lpsd->Control |= SE_DACL_DEFAULTED;
362         else
363                 lpsd->Control &= ~SE_DACL_DEFAULTED;
364
365         return STATUS_SUCCESS;
366 }
367
368 /******************************************************************************
369  *  RtlGetSaclSecurityDescriptor                [NTDLL] 
370  *
371  */
372 NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
373         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
374         OUT PBOOLEAN lpbSaclPresent,
375         OUT PACL *pSacl,
376         OUT PBOOLEAN lpbSaclDefaulted)
377 {
378         TRACE("(%p,%p,%p,%p)\n",
379         pSecurityDescriptor, lpbSaclPresent, *pSacl, lpbSaclDefaulted);
380
381         if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
382           return STATUS_UNKNOWN_REVISION ;
383
384         if ( (*lpbSaclPresent = (SE_SACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
385         {
386           if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
387           { *pSacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Sacl);
388           }
389           else
390           { *pSacl = pSecurityDescriptor->Sacl;
391           }
392         }
393
394         *lpbSaclDefaulted = (( SE_SACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
395         
396         return STATUS_SUCCESS;
397 }
398
399 /**************************************************************************
400  * RtlSetSaclSecurityDescriptor                 [NTDLL.488]
401  */
402 NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
403         PSECURITY_DESCRIPTOR lpsd,
404         BOOLEAN saclpresent,
405         PACL sacl,
406         BOOLEAN sacldefaulted)
407 {
408         if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
409                 return STATUS_UNKNOWN_REVISION;
410         if (lpsd->Control & SE_SELF_RELATIVE)
411                 return STATUS_INVALID_SECURITY_DESCR;
412         if (!saclpresent) {
413                 lpsd->Control &= ~SE_SACL_PRESENT;
414                 return 0;
415         }
416         lpsd->Control |= SE_SACL_PRESENT;
417         lpsd->Sacl = sacl;
418         if (sacldefaulted)
419                 lpsd->Control |= SE_SACL_DEFAULTED;
420         else
421                 lpsd->Control &= ~SE_SACL_DEFAULTED;
422         return STATUS_SUCCESS;
423 }
424
425 /**************************************************************************
426  * RtlGetOwnerSecurityDescriptor                [NTDLL.488]
427  */
428 NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
429         PSECURITY_DESCRIPTOR SecurityDescriptor,
430         PSID *Owner,
431         PBOOLEAN OwnerDefaulted)
432 {
433         if ( !SecurityDescriptor  || !Owner || !OwnerDefaulted )
434                 return STATUS_INVALID_PARAMETER;
435
436         *Owner = SecurityDescriptor->Owner;
437         if ( *Owner != NULL )  {
438                 if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
439                         *OwnerDefaulted = TRUE;
440                 else
441                         *OwnerDefaulted = FALSE;
442         }
443         return STATUS_SUCCESS;
444 }
445
446 /**************************************************************************
447  *                 RtlSetOwnerSecurityDescriptor                [NTDLL.487]
448  */
449 NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
450         PSECURITY_DESCRIPTOR lpsd,
451         PSID owner,
452         BOOLEAN ownerdefaulted)
453 {
454         if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
455                 return STATUS_UNKNOWN_REVISION;
456         if (lpsd->Control & SE_SELF_RELATIVE)
457                 return STATUS_INVALID_SECURITY_DESCR;
458
459         lpsd->Owner = owner;
460         if (ownerdefaulted)
461                 lpsd->Control |= SE_OWNER_DEFAULTED;
462         else
463                 lpsd->Control &= ~SE_OWNER_DEFAULTED;
464         return STATUS_SUCCESS;
465 }
466
467 /**************************************************************************
468  *                 RtlSetGroupSecurityDescriptor                [NTDLL.485]
469  */
470 NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
471         PSECURITY_DESCRIPTOR lpsd,
472         PSID group,
473         BOOLEAN groupdefaulted)
474 {
475         if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
476                 return STATUS_UNKNOWN_REVISION;
477         if (lpsd->Control & SE_SELF_RELATIVE)
478                 return STATUS_INVALID_SECURITY_DESCR;
479
480         lpsd->Group = group;
481         if (groupdefaulted)
482                 lpsd->Control |= SE_GROUP_DEFAULTED;
483         else
484                 lpsd->Control &= ~SE_GROUP_DEFAULTED;
485         return STATUS_SUCCESS;
486 }
487 /**************************************************************************
488  *                 RtlGetGroupSecurityDescriptor                [NTDLL]
489  */
490 NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
491         PSECURITY_DESCRIPTOR SecurityDescriptor,
492         PSID *Group,
493         PBOOLEAN GroupDefaulted)
494 {
495         if ( !SecurityDescriptor || !Group || !GroupDefaulted )
496                 return STATUS_INVALID_PARAMETER;
497
498         *Group = SecurityDescriptor->Group;
499         if ( *Group != NULL )  {
500                 if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
501                         *GroupDefaulted = TRUE;
502                 else
503                         *GroupDefaulted = FALSE;
504         }
505         return STATUS_SUCCESS;
506
507
508 /**************************************************************************
509  *                 RtlMakeSelfRelativeSD                [NTDLL]
510  */
511 NTSTATUS WINAPI RtlMakeSelfRelativeSD(
512         IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
513         IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
514         IN OUT LPDWORD lpdwBufferLength)
515 {
516         FIXME("(%p,%p,%p(%lu))\n", pAbsoluteSecurityDescriptor,
517         pSelfRelativeSecurityDescriptor, lpdwBufferLength,*lpdwBufferLength);
518         return STATUS_SUCCESS;
519 }
520
521 /*
522  *      access control list's
523  */
524
525 /**************************************************************************
526  *                 RtlCreateAcl                         [NTDLL.306]
527  *
528  * NOTES
529  *    This should return NTSTATUS
530  */
531 NTSTATUS WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev)
532 {
533         TRACE("%p 0x%08lx 0x%08lx\n", acl, size, rev);
534
535         if (rev!=ACL_REVISION)
536                 return STATUS_INVALID_PARAMETER;
537         if (size<sizeof(ACL))
538                 return STATUS_BUFFER_TOO_SMALL;
539         if (size>0xFFFF)
540                 return STATUS_INVALID_PARAMETER;
541
542         memset(acl,'\0',sizeof(ACL));
543         acl->AclRevision        = rev;
544         acl->AclSize            = size;
545         acl->AceCount           = 0;
546         return 0;
547 }
548
549 /**************************************************************************
550  *                 RtlFirstFreeAce                      [NTDLL.370]
551  * looks for the AceCount+1 ACE, and if it is still within the alloced
552  * ACL, return a pointer to it
553  */
554 BOOLEAN WINAPI RtlFirstFreeAce(
555         PACL acl,
556         PACE_HEADER *x)
557 {
558         PACE_HEADER     ace;
559         int             i;
560
561         *x = 0;
562         ace = (PACE_HEADER)(acl+1);
563         for (i=0;i<acl->AceCount;i++) {
564                 if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
565                         return 0;
566                 ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
567         }
568         if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
569                 return 0;
570         *x = ace;
571         return 1;
572 }
573
574 /**************************************************************************
575  *                 RtlAddAce                            [NTDLL.260]
576  */
577 NTSTATUS WINAPI RtlAddAce(
578         PACL acl,
579         DWORD rev,
580         DWORD xnrofaces,
581         PACE_HEADER acestart,
582         DWORD acelen)
583 {
584         PACE_HEADER     ace,targetace;
585         int             nrofaces;
586
587         if (acl->AclRevision != ACL_REVISION)
588                 return STATUS_INVALID_PARAMETER;
589         if (!RtlFirstFreeAce(acl,&targetace))
590                 return STATUS_INVALID_PARAMETER;
591         nrofaces=0;ace=acestart;
592         while (((DWORD)ace-(DWORD)acestart)<acelen) {
593                 nrofaces++;
594                 ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
595         }
596         if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
597                 return STATUS_INVALID_PARAMETER;
598         memcpy((LPBYTE)targetace,acestart,acelen);
599         acl->AceCount+=nrofaces;
600         return STATUS_SUCCESS;
601 }
602
603 /******************************************************************************
604  *  RtlAddAccessAllowedAce              [NTDLL] 
605  */
606 BOOL WINAPI RtlAddAccessAllowedAce(
607         IN OUT PACL pAcl,
608         IN DWORD dwAceRevision,
609         IN DWORD AccessMask,
610         IN PSID pSid)
611 {
612         FIXME("(%p,0x%08lx,0x%08lx,%p),stub!\n",
613         pAcl, dwAceRevision, AccessMask, pSid);
614         return 0;
615 }
616
617 /******************************************************************************
618  *  RtlGetAce           [NTDLL] 
619  */
620 DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) 
621 {
622         FIXME("(%p,%ld,%p),stub!\n",pAcl,dwAceIndex,pAce);
623         return 0;
624 }
625
626 /*
627  *      misc
628  */
629
630 /******************************************************************************
631  *  RtlAdjustPrivilege          [NTDLL] 
632  */
633 DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4) 
634 {
635         FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
636         return 0;
637 }
638
639 /******************************************************************************
640  *  RtlImpersonateSelf          [NTDLL] 
641  */
642 BOOL WINAPI
643 RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
644 {
645         FIXME("(%08x), stub\n", ImpersonationLevel);
646         return TRUE;
647 }
648
649 NTSTATUS WINAPI 
650 NtAccessCheck(
651         IN PSECURITY_DESCRIPTOR SecurityDescriptor,
652         IN HANDLE ClientToken,
653         IN ACCESS_MASK DesiredAccess,
654         IN PGENERIC_MAPPING GenericMapping,
655         OUT PPRIVILEGE_SET PrivilegeSet,
656         OUT PULONG ReturnLength,
657         OUT PULONG GrantedAccess,
658         OUT PBOOLEAN AccessStatus)
659 {
660         FIXME("(%p, %04x, %08lx, %p, %p, %p, %p, %p), stub\n",
661           SecurityDescriptor, ClientToken, DesiredAccess, GenericMapping, 
662           PrivilegeSet, ReturnLength, GrantedAccess, AccessStatus);
663         *AccessStatus = TRUE;
664         return STATUS_SUCCESS;
665 }
666
667 NTSTATUS WINAPI
668 NtSetSecurityObject(
669         IN HANDLE Handle,
670         IN SECURITY_INFORMATION SecurityInformation,
671         IN PSECURITY_DESCRIPTOR SecurityDescriptor) 
672 {
673         FIXME("0x%08x 0x%08lx %p\n", Handle, SecurityInformation, SecurityDescriptor);
674         return STATUS_SUCCESS;
675 }
676
677 /******************************************************************************
678  * RtlGetControlSecurityDescriptor
679  */
680
681 NTSTATUS WINAPI RtlGetControlSecurityDescriptor(
682         PSECURITY_DESCRIPTOR  pSecurityDescriptor,
683         PSECURITY_DESCRIPTOR_CONTROL pControl,
684         LPDWORD lpdwRevision)
685 {
686         FIXME("(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
687         return STATUS_SUCCESS;
688 }