Added missing prototypes for StrRetToBuf(A|W).
[wine] / dlls / advapi32 / security.c
1 /*
2  * dlls/advapi32/security.c
3  *  FIXME: for all functions thunking down to Rtl* functions:  implement SetLastError()
4  */
5 #include <string.h>
6
7 #include "windef.h"
8 #include "winerror.h"
9 #include "heap.h"
10 #include "ntddk.h"
11 #include "ntsecapi.h"
12 #include "debugtools.h"
13
14 DECLARE_DEBUG_CHANNEL(advapi)
15 DECLARE_DEBUG_CHANNEL(security)
16
17 #define CallWin32ToNt(func) \
18         { NTSTATUS ret; \
19           ret = (func); \
20           if (ret !=STATUS_SUCCESS) \
21           { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
22           return TRUE; \
23         }
24
25 /*      ##############################
26         ######  TOKEN FUNCTIONS ######
27         ##############################
28 */
29
30 /******************************************************************************
31  * OpenProcessToken                     [ADVAPI32.109]
32  * Opens the access token associated with a process
33  *
34  * PARAMS
35  *   ProcessHandle [I] Handle to process
36  *   DesiredAccess [I] Desired access to process
37  *   TokenHandle   [O] Pointer to handle of open access token
38  *
39  * RETURNS STD
40  */
41 BOOL WINAPI
42 OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, 
43                   HANDLE *TokenHandle )
44 {
45         CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
46 }
47
48 /******************************************************************************
49  * OpenThreadToken [ADVAPI32.114]
50  *
51  * PARAMS
52  *   thread        []
53  *   desiredaccess []
54  *   openasself    []
55  *   thandle       []
56  */
57 BOOL WINAPI
58 OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, 
59                  BOOL OpenAsSelf, HANDLE *TokenHandle)
60 {
61         CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
62 }
63
64 /******************************************************************************
65  * AdjustTokenPrivileges [ADVAPI32.10]
66  *
67  * PARAMS
68  *   TokenHandle          []
69  *   DisableAllPrivileges []
70  *   NewState             []
71  *   BufferLength         []
72  *   PreviousState        []
73  *   ReturnLength         []
74  */
75 BOOL WINAPI
76 AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
77                        LPVOID NewState, DWORD BufferLength, 
78                        LPVOID PreviousState, LPDWORD ReturnLength )
79 {
80         CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
81 }
82
83 /******************************************************************************
84  * GetTokenInformation [ADVAPI32.66]
85  *
86  * PARAMS
87  *   token           []
88  *   tokeninfoclass  []
89  *   tokeninfo       []
90  *   tokeninfolength []
91  *   retlen          []
92  *
93  */
94 BOOL WINAPI
95 GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass, 
96                      LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
97 {
98         CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
99 }
100
101 /*      ##############################
102         ######  SID FUNCTIONS   ######
103         ##############################
104 */
105
106 /******************************************************************************
107  * AllocateAndInitializeSid [ADVAPI32.11]
108  *
109  * PARAMS
110  *   pIdentifierAuthority []
111  *   nSubAuthorityCount   []
112  *   nSubAuthority0       []
113  *   nSubAuthority1       []
114  *   nSubAuthority2       []
115  *   nSubAuthority3       []
116  *   nSubAuthority4       []
117  *   nSubAuthority5       []
118  *   nSubAuthority6       []
119  *   nSubAuthority7       []
120  *   pSid                 []
121  */
122 BOOL WINAPI
123 AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
124                           BYTE nSubAuthorityCount,
125                           DWORD nSubAuthority0, DWORD nSubAuthority1,
126                           DWORD nSubAuthority2, DWORD nSubAuthority3,
127                           DWORD nSubAuthority4, DWORD nSubAuthority5,
128                           DWORD nSubAuthority6, DWORD nSubAuthority7,
129                           PSID *pSid )
130 {
131     if (!(*pSid = HeapAlloc( GetProcessHeap(), 0,
132                              GetSidLengthRequired(nSubAuthorityCount))))
133         return FALSE;
134     (*pSid)->Revision = SID_REVISION;
135     if (pIdentifierAuthority)
136         memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority,
137                sizeof (SID_IDENTIFIER_AUTHORITY));
138     *GetSidSubAuthorityCount(*pSid) = nSubAuthorityCount;
139
140     if (nSubAuthorityCount > 0)
141         *GetSidSubAuthority(*pSid, 0) = nSubAuthority0;
142     if (nSubAuthorityCount > 1)
143         *GetSidSubAuthority(*pSid, 1) = nSubAuthority1;
144     if (nSubAuthorityCount > 2)
145         *GetSidSubAuthority(*pSid, 2) = nSubAuthority2;
146     if (nSubAuthorityCount > 3)
147         *GetSidSubAuthority(*pSid, 3) = nSubAuthority3;
148     if (nSubAuthorityCount > 4)
149         *GetSidSubAuthority(*pSid, 4) = nSubAuthority4;
150     if (nSubAuthorityCount > 5)
151         *GetSidSubAuthority(*pSid, 5) = nSubAuthority5;
152     if (nSubAuthorityCount > 6)
153         *GetSidSubAuthority(*pSid, 6) = nSubAuthority6;
154     if (nSubAuthorityCount > 7)
155         *GetSidSubAuthority(*pSid, 7) = nSubAuthority7;
156
157     return TRUE;
158 }
159
160 /******************************************************************************
161  * FreeSid [ADVAPI32.42]
162  *
163  * PARAMS
164  *   pSid []
165  */
166 PVOID WINAPI
167 FreeSid( PSID pSid )
168 {
169     HeapFree( GetProcessHeap(), 0, pSid );
170     return NULL;
171 }
172
173 /******************************************************************************
174  * CopySid [ADVAPI32.24]
175  *
176  * PARAMS
177  *   nDestinationSidLength []
178  *   pDestinationSid       []
179  *   pSourceSid            []
180  */
181 BOOL WINAPI
182 CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
183 {
184
185     if (!IsValidSid(pSourceSid))
186         return FALSE;
187
188     if (nDestinationSidLength < GetLengthSid(pSourceSid))
189         return FALSE;
190
191     memcpy(pDestinationSid, pSourceSid, GetLengthSid(pSourceSid));
192
193     return TRUE;
194 }
195
196 /******************************************************************************
197  * IsValidSid [ADVAPI32.80]
198  *
199  * PARAMS
200  *   pSid []
201  */
202 BOOL WINAPI
203 IsValidSid( PSID pSid )
204 {
205     if (IsBadReadPtr(pSid, 4))
206     {
207         WARN_(security)("(%p): invalid pointer!", pSid);
208         return FALSE;
209     }
210
211     if (pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
212         return FALSE;
213
214     if (!pSid || pSid->Revision != SID_REVISION)
215         return FALSE;
216
217     return TRUE;
218 }
219
220 /******************************************************************************
221  * EqualSid [ADVAPI32.40]
222  *
223  * PARAMS
224  *   pSid1 []
225  *   pSid2 []
226  */
227 BOOL WINAPI
228 EqualSid( PSID pSid1, PSID pSid2 )
229 {
230     if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
231         return FALSE;
232
233     if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
234         return FALSE;
235
236     if (memcmp(pSid1, pSid2, GetLengthSid(pSid1)) != 0)
237         return FALSE;
238
239     return TRUE;
240 }
241
242 /******************************************************************************
243  * EqualPrefixSid [ADVAPI32.39]
244  */
245 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2) {
246     if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
247         return FALSE;
248
249     if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
250         return FALSE;
251
252     if (memcmp(pSid1, pSid2, GetSidLengthRequired(pSid1->SubAuthorityCount - 1))
253  != 0)
254         return FALSE;
255
256     return TRUE;
257 }
258
259 /******************************************************************************
260  * GetSidLengthRequired [ADVAPI32.63]
261  *
262  * PARAMS
263  *   nSubAuthorityCount []
264  */
265 DWORD WINAPI
266 GetSidLengthRequired( BYTE nSubAuthorityCount )
267 {
268     return sizeof (SID) + (nSubAuthorityCount - 1) * sizeof (DWORD);
269 }
270
271 /******************************************************************************
272  * InitializeSid [ADVAPI32.74]
273  *
274  * PARAMS
275  *   pIdentifierAuthority []
276  */
277 BOOL WINAPI
278 InitializeSid (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
279                     BYTE nSubAuthorityCount)
280 {
281     int i;
282
283     pSid->Revision = SID_REVISION;
284     if (pIdentifierAuthority)
285         memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority,
286                sizeof (SID_IDENTIFIER_AUTHORITY));
287     *GetSidSubAuthorityCount(pSid) = nSubAuthorityCount;
288
289     for (i = 0; i < nSubAuthorityCount; i++)
290         *GetSidSubAuthority(pSid, i) = 0;
291
292     return TRUE;
293 }
294
295 /******************************************************************************
296  * GetSidIdentifierAuthority [ADVAPI32.62]
297  *
298  * PARAMS
299  *   pSid []
300  */
301 PSID_IDENTIFIER_AUTHORITY WINAPI
302 GetSidIdentifierAuthority( PSID pSid )
303 {
304     return &pSid->IdentifierAuthority;
305 }
306
307 /******************************************************************************
308  * GetSidSubAuthority [ADVAPI32.64]
309  *
310  * PARAMS
311  *   pSid          []
312  *   nSubAuthority []
313  */
314 PDWORD WINAPI
315 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
316 {
317     return &pSid->SubAuthority[nSubAuthority];
318 }
319
320 /******************************************************************************
321  * GetSidSubAuthorityCount [ADVAPI32.65]
322  *
323  * PARAMS
324  *   pSid []
325  */
326 PUCHAR WINAPI
327 GetSidSubAuthorityCount (PSID pSid)
328 {
329     return &pSid->SubAuthorityCount;
330 }
331
332 /******************************************************************************
333  * GetLengthSid [ADVAPI32.48]
334  *
335  * PARAMS
336  *   pSid []
337  */
338 DWORD WINAPI
339 GetLengthSid (PSID pSid)
340 {
341     return GetSidLengthRequired( * GetSidSubAuthorityCount(pSid) );
342 }
343
344 /*      ##############################################
345         ######  SECURITY DESCRIPTOR FUNCTIONS   ######
346         ##############################################
347 */
348         
349 /******************************************************************************
350  * InitializeSecurityDescriptor [ADVAPI32.73]
351  *
352  * PARAMS
353  *   pDescr   []
354  *   revision []
355  */
356 BOOL WINAPI
357 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
358 {
359         CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
360 }
361
362 /******************************************************************************
363  * GetSecurityDescriptorLength [ADVAPI32.55]
364  */
365 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
366 {
367         return (RtlLengthSecurityDescriptor(pDescr));
368 }
369
370 /******************************************************************************
371  * GetSecurityDescriptorOwner [ADVAPI32.56]
372  *
373  * PARAMS
374  *   pOwner            []
375  *   lpbOwnerDefaulted []
376  */
377 BOOL WINAPI
378 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
379                             LPBOOL lpbOwnerDefaulted )
380 {
381         CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
382 }
383
384 /******************************************************************************
385  * SetSecurityDescriptorOwner [ADVAPI32]
386  *
387  * PARAMS
388  */
389 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, 
390                                    PSID pOwner, BOOL bOwnerDefaulted)
391 {
392         CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
393 }
394 /******************************************************************************
395  * GetSecurityDescriptorGroup                   [ADVAPI32.54]
396  */
397 BOOL WINAPI GetSecurityDescriptorGroup(
398         PSECURITY_DESCRIPTOR SecurityDescriptor,
399         PSID *Group,
400         LPBOOL GroupDefaulted)
401 {
402         CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
403 }       
404 /******************************************************************************
405  * SetSecurityDescriptorGroup
406  */
407 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
408                                            PSID Group, BOOL GroupDefaulted)
409 {
410         CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
411 }
412
413 /******************************************************************************
414  * IsValidSecurityDescriptor [ADVAPI32.79]
415  *
416  * PARAMS
417  *   lpsecdesc []
418  */
419 BOOL WINAPI
420 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
421 {
422         CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
423 }
424
425 /******************************************************************************
426  *  GetSecurityDescriptorDacl                   [ADVAPI.91]
427  */
428 BOOL WINAPI GetSecurityDescriptorDacl(
429         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
430         OUT LPBOOL lpbDaclPresent,
431         OUT PACL *pDacl,
432         OUT LPBOOL lpbDaclDefaulted)
433 {
434         CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
435                                                pDacl, (PBOOLEAN)lpbDaclDefaulted));
436 }       
437
438 /******************************************************************************
439  *  SetSecurityDescriptorDacl                   [ADVAPI.224]
440  */
441 BOOL WINAPI 
442 SetSecurityDescriptorDacl (
443         PSECURITY_DESCRIPTOR lpsd,
444         BOOL daclpresent,
445         PACL dacl,
446         BOOL dacldefaulted )
447 {
448         CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
449 }
450 /******************************************************************************
451  *  GetSecurityDescriptorSacl                   [ADVAPI.]
452  */
453 BOOL WINAPI GetSecurityDescriptorSacl(
454         IN PSECURITY_DESCRIPTOR lpsd,
455         OUT LPBOOL lpbSaclPresent,
456         OUT PACL *pSacl,
457         OUT LPBOOL lpbSaclDefaulted)
458 {
459         CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, (PBOOLEAN)lpbSaclPresent,
460                                                pSacl, (PBOOLEAN)lpbSaclDefaulted));
461 }       
462
463 /**************************************************************************
464  * SetSecurityDescriptorSacl                    [NTDLL.488]
465  */
466 BOOL  WINAPI SetSecurityDescriptorSacl (
467         PSECURITY_DESCRIPTOR lpsd,
468         BOOL saclpresent,
469         PACL lpsacl,
470         BOOL sacldefaulted)
471 {
472         CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
473 }
474 /******************************************************************************
475  * MakeSelfRelativeSD [ADVAPI32.95]
476  *
477  * PARAMS
478  *   lpabssecdesc  []
479  *   lpselfsecdesc []
480  *   lpbuflen      []
481  */
482 BOOL WINAPI
483 MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc,
484                     PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen )
485 {
486         FIXME_(advapi)("(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen);
487         return TRUE;
488 }
489
490 /******************************************************************************
491  * GetSecurityDescriptorControl32                       [ADVAPI32]
492  */
493
494 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR  pSecurityDescriptor,
495                  PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
496 {       FIXME_(advapi)("(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
497         return 1;
498 }               
499
500 /*      ##############################
501         ######  MISC FUNCTIONS  ######
502         ##############################
503 */
504
505 /******************************************************************************
506  * LookupPrivilegeValue32W                      [ADVAPI32.93]
507  * Retrieves LUID used on a system to represent the privilege name.
508  *
509  * NOTES
510  *   lpLuid should be PLUID
511  *
512  * PARAMS
513  *   lpSystemName [I] Address of string specifying the system
514  *   lpName       [I] Address of string specifying the privilege
515  *   lpLuid       [I] Address of locally unique identifier
516  *
517  * RETURNS STD
518  */
519 BOOL WINAPI
520 LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
521 {
522     FIXME_(advapi)("(%s,%s,%p): stub\n",debugstr_w(lpSystemName), 
523                   debugstr_w(lpName), lpLuid);
524     return TRUE;
525 }
526
527 /******************************************************************************
528  * LookupPrivilegeValue32A                      [ADVAPI32.92]
529  */
530 BOOL WINAPI
531 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
532 {
533     LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
534     LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
535     BOOL ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
536     HeapFree(GetProcessHeap(), 0, lpNameW);
537     HeapFree(GetProcessHeap(), 0, lpSystemNameW);
538     return ret;
539 }
540
541 /******************************************************************************
542  * GetFileSecurity32A [ADVAPI32.45]
543  *
544  * Obtains Specified information about the security of a file or directory
545  * The information obtained is constrained by the callers access rights and
546  * privileges
547  */
548 BOOL WINAPI
549 GetFileSecurityA( LPCSTR lpFileName, 
550                     SECURITY_INFORMATION RequestedInformation,
551                     PSECURITY_DESCRIPTOR pSecurityDescriptor,
552                     DWORD nLength, LPDWORD lpnLengthNeeded )
553 {
554   FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
555   return TRUE;
556 }
557
558 /******************************************************************************
559  * GetFileSecurity32W [ADVAPI32.46]
560  *
561  * Obtains Specified information about the security of a file or directory
562  * The information obtained is constrained by the callers access rights and
563  * privileges
564  *
565  * PARAMS
566  *   lpFileName           []
567  *   RequestedInformation []
568  *   pSecurityDescriptor  []
569  *   nLength              []
570  *   lpnLengthNeeded      []
571  */
572 BOOL WINAPI
573 GetFileSecurityW( LPCWSTR lpFileName, 
574                     SECURITY_INFORMATION RequestedInformation,
575                     PSECURITY_DESCRIPTOR pSecurityDescriptor,
576                     DWORD nLength, LPDWORD lpnLengthNeeded )
577 {
578   FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) ); 
579   return TRUE;
580 }
581
582
583 /******************************************************************************
584  * LookupAccountSid32A [ADVAPI32.86]
585  */
586 BOOL WINAPI
587 LookupAccountSidA( LPCSTR system, PSID sid, LPCSTR account,
588                      LPDWORD accountSize, LPCSTR domain, LPDWORD domainSize,
589                      PSID_NAME_USE name_use )
590 {
591         FIXME_(security)("(%s,%p,%p,%p,%p,%p,%p): stub\n",
592               system,sid,account,accountSize,domain,domainSize,name_use);
593         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
594         return FALSE;
595 }
596
597 /******************************************************************************
598  * LookupAccountSid32W [ADVAPI32.87]
599  *
600  * PARAMS
601  *   system      []
602  *   sid         []
603  *   account     []
604  *   accountSize []
605  *   domain      []
606  *   domainSize  []
607  *   name_use    []
608  */
609 BOOL WINAPI
610 LookupAccountSidW( LPCWSTR system, PSID sid, LPCWSTR account, 
611                      LPDWORD accountSize, LPCWSTR domain, LPDWORD domainSize,
612                      PSID_NAME_USE name_use )
613 {
614         FIXME_(security)("(%p,%p,%p,%p,%p,%p,%p): stub\n",
615               system,sid,account,accountSize,domain,domainSize,name_use);
616         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
617         return FALSE;
618 }
619
620 /******************************************************************************
621  * SetFileSecurity32A [ADVAPI32.182]
622  * Sets the security of a file or directory
623  */
624 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
625                                 SECURITY_INFORMATION RequestedInformation,
626                                 PSECURITY_DESCRIPTOR pSecurityDescriptor)
627 {
628   FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
629   return TRUE;
630 }
631
632 /******************************************************************************
633  * SetFileSecurity32W [ADVAPI32.183]
634  * Sets the security of a file or directory
635  *
636  * PARAMS
637  *   lpFileName           []
638  *   RequestedInformation []
639  *   pSecurityDescriptor  []
640  */
641 BOOL WINAPI
642 SetFileSecurityW( LPCWSTR lpFileName, 
643                     SECURITY_INFORMATION RequestedInformation,
644                     PSECURITY_DESCRIPTOR pSecurityDescriptor )
645 {
646   FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) ); 
647   return TRUE;
648 }
649
650 /******************************************************************************
651  * QueryWindows31FilesMigration [ADVAPI32.266]
652  *
653  * PARAMS
654  *   x1 []
655  */
656 BOOL WINAPI
657 QueryWindows31FilesMigration( DWORD x1 )
658 {
659         FIXME_(advapi)("(%ld):stub\n",x1);
660         return TRUE;
661 }
662
663 /******************************************************************************
664  * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.265]
665  *
666  * PARAMS
667  *   x1 []
668  *   x2 []
669  *   x3 []
670  *   x4 []
671  */
672 BOOL WINAPI
673 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
674                                                DWORD x4 )
675 {
676         FIXME_(advapi)("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
677         return TRUE;
678 }
679
680 /******************************************************************************
681  * LsaOpenPolicy [ADVAPI32.200]
682  *
683  * PARAMS
684  *   x1 []
685  *   x2 []
686  *   x3 []
687  *   x4 []
688  */
689 NTSTATUS WINAPI
690 LsaOpenPolicy(PLSA_UNICODE_STRING SystemName,
691               PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
692               ACCESS_MASK DesiredAccess,
693               PLSA_HANDLE PolicyHandle)
694 {
695         FIXME_(advapi)("(%p,%p,0x%08lx,%p):stub\n",
696                        SystemName, ObjectAttributes,
697                        DesiredAccess, PolicyHandle);
698         return 0xc0000000; /* generic error */
699 }
700
701 /******************************************************************************
702  * NotifyBootConfigStatus [ADVAPI32.97]
703  *
704  * PARAMS
705  *   x1 []
706  */
707 BOOL WINAPI
708 NotifyBootConfigStatus( DWORD x1 )
709 {
710         FIXME_(advapi)("(0x%08lx):stub\n",x1);
711         return 1;
712 }
713
714 /******************************************************************************
715  * RevertToSelf [ADVAPI32.180]
716  *
717  * PARAMS
718  *   void []
719  */
720 BOOL WINAPI
721 RevertToSelf( void )
722 {
723         FIXME_(advapi)("(), stub\n");
724         return TRUE;
725 }
726
727 /******************************************************************************
728  * ImpersonateSelf [ADVAPI32.71]
729  */
730 BOOL WINAPI
731 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
732 {
733     FIXME_(advapi)("(%08x), stub\n", ImpersonationLevel);
734     return TRUE;
735 }
736
737 /******************************************************************************
738  * AccessCheck32 [ADVAPI32.71]
739  */
740 BOOL WINAPI
741 AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken,
742             DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet,
743             LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus)
744 {
745     FIXME_(advapi)("(%p, %04x, %08lx, %p, %p, %p, %p, %p), stub\n",
746                    pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping, 
747                    PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus);
748     *AccessStatus = TRUE;
749     return TRUE;
750 }
751
752 /*************************************************************************
753  * SetThreadToken [ADVAPI32.231]
754  *
755  * Assigns an "impersonation token" to a thread so it can assume the
756  * security privledges of another thread or process.  Can also remove
757  * a previously assigned token.  Only supported on NT - it's a stub 
758  * exactly like this one on Win9X.
759  *
760  */
761
762 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
763 {
764     FIXME_(advapi)("(%p, %x): stub\n", thread, token);
765
766     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
767
768     return FALSE;
769 }
770
771
772
773