Compiler warnings fix.
[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 (!pSid || pSid->Revision != SID_REVISION)
206         return FALSE;
207
208     return TRUE;
209 }
210
211 /******************************************************************************
212  * EqualSid [ADVAPI32.40]
213  *
214  * PARAMS
215  *   pSid1 []
216  *   pSid2 []
217  */
218 BOOL WINAPI
219 EqualSid( PSID pSid1, PSID pSid2 )
220 {
221     if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
222         return FALSE;
223
224     if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
225         return FALSE;
226
227     if (memcmp(pSid1, pSid2, GetLengthSid(pSid1)) != 0)
228         return FALSE;
229
230     return TRUE;
231 }
232
233 /******************************************************************************
234  * EqualPrefixSid [ADVAPI32.39]
235  */
236 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2) {
237     if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
238         return FALSE;
239
240     if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
241         return FALSE;
242
243     if (memcmp(pSid1, pSid2, GetSidLengthRequired(pSid1->SubAuthorityCount - 1))
244  != 0)
245         return FALSE;
246
247     return TRUE;
248 }
249
250 /******************************************************************************
251  * GetSidLengthRequired [ADVAPI32.63]
252  *
253  * PARAMS
254  *   nSubAuthorityCount []
255  */
256 DWORD WINAPI
257 GetSidLengthRequired( BYTE nSubAuthorityCount )
258 {
259     return sizeof (SID) + (nSubAuthorityCount - 1) * sizeof (DWORD);
260 }
261
262 /******************************************************************************
263  * InitializeSid [ADVAPI32.74]
264  *
265  * PARAMS
266  *   pIdentifierAuthority []
267  */
268 BOOL WINAPI
269 InitializeSid (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
270                     BYTE nSubAuthorityCount)
271 {
272     int i;
273
274     pSid->Revision = SID_REVISION;
275     if (pIdentifierAuthority)
276         memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority,
277                sizeof (SID_IDENTIFIER_AUTHORITY));
278     *GetSidSubAuthorityCount(pSid) = nSubAuthorityCount;
279
280     for (i = 0; i < nSubAuthorityCount; i++)
281         *GetSidSubAuthority(pSid, i) = 0;
282
283     return TRUE;
284 }
285
286 /******************************************************************************
287  * GetSidIdentifierAuthority [ADVAPI32.62]
288  *
289  * PARAMS
290  *   pSid []
291  */
292 PSID_IDENTIFIER_AUTHORITY WINAPI
293 GetSidIdentifierAuthority( PSID pSid )
294 {
295     return &pSid->IdentifierAuthority;
296 }
297
298 /******************************************************************************
299  * GetSidSubAuthority [ADVAPI32.64]
300  *
301  * PARAMS
302  *   pSid          []
303  *   nSubAuthority []
304  */
305 PDWORD WINAPI
306 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
307 {
308     return &pSid->SubAuthority[nSubAuthority];
309 }
310
311 /******************************************************************************
312  * GetSidSubAuthorityCount [ADVAPI32.65]
313  *
314  * PARAMS
315  *   pSid []
316  */
317 PUCHAR WINAPI
318 GetSidSubAuthorityCount (PSID pSid)
319 {
320     return &pSid->SubAuthorityCount;
321 }
322
323 /******************************************************************************
324  * GetLengthSid [ADVAPI32.48]
325  *
326  * PARAMS
327  *   pSid []
328  */
329 DWORD WINAPI
330 GetLengthSid (PSID pSid)
331 {
332     return GetSidLengthRequired( * GetSidSubAuthorityCount(pSid) );
333 }
334
335 /*      ##############################################
336         ######  SECURITY DESCRIPTOR FUNCTIONS   ######
337         ##############################################
338 */
339         
340 /******************************************************************************
341  * InitializeSecurityDescriptor [ADVAPI32.73]
342  *
343  * PARAMS
344  *   pDescr   []
345  *   revision []
346  */
347 BOOL WINAPI
348 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
349 {
350         CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
351 }
352
353 /******************************************************************************
354  * GetSecurityDescriptorLength [ADVAPI32.55]
355  */
356 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
357 {
358         return (RtlLengthSecurityDescriptor(pDescr));
359 }
360
361 /******************************************************************************
362  * GetSecurityDescriptorOwner [ADVAPI32.56]
363  *
364  * PARAMS
365  *   pOwner            []
366  *   lpbOwnerDefaulted []
367  */
368 BOOL WINAPI
369 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
370                             LPBOOL lpbOwnerDefaulted )
371 {
372         CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
373 }
374
375 /******************************************************************************
376  * SetSecurityDescriptorOwner [ADVAPI32]
377  *
378  * PARAMS
379  */
380 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, 
381                                    PSID pOwner, BOOL bOwnerDefaulted)
382 {
383         CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
384 }
385 /******************************************************************************
386  * GetSecurityDescriptorGroup                   [ADVAPI32.54]
387  */
388 BOOL WINAPI GetSecurityDescriptorGroup(
389         PSECURITY_DESCRIPTOR SecurityDescriptor,
390         PSID *Group,
391         LPBOOL GroupDefaulted)
392 {
393         CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
394 }       
395 /******************************************************************************
396  * SetSecurityDescriptorGroup
397  */
398 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
399                                            PSID Group, BOOL GroupDefaulted)
400 {
401         CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
402 }
403
404 /******************************************************************************
405  * IsValidSecurityDescriptor [ADVAPI32.79]
406  *
407  * PARAMS
408  *   lpsecdesc []
409  */
410 BOOL WINAPI
411 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
412 {
413         CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
414 }
415
416 /******************************************************************************
417  *  GetSecurityDescriptorDacl                   [ADVAPI.91]
418  */
419 BOOL WINAPI GetSecurityDescriptorDacl(
420         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
421         OUT LPBOOL lpbDaclPresent,
422         OUT PACL *pDacl,
423         OUT LPBOOL lpbDaclDefaulted)
424 {
425         CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
426                                                pDacl, (PBOOLEAN)lpbDaclDefaulted));
427 }       
428
429 /******************************************************************************
430  *  SetSecurityDescriptorDacl                   [ADVAPI.224]
431  */
432 BOOL WINAPI 
433 SetSecurityDescriptorDacl (
434         PSECURITY_DESCRIPTOR lpsd,
435         BOOL daclpresent,
436         PACL dacl,
437         BOOL dacldefaulted )
438 {
439         CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
440 }
441 /******************************************************************************
442  *  GetSecurityDescriptorSacl                   [ADVAPI.]
443  */
444 BOOL WINAPI GetSecurityDescriptorSacl(
445         IN PSECURITY_DESCRIPTOR lpsd,
446         OUT LPBOOL lpbSaclPresent,
447         OUT PACL *pSacl,
448         OUT LPBOOL lpbSaclDefaulted)
449 {
450         CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, (PBOOLEAN)lpbSaclPresent,
451                                                pSacl, (PBOOLEAN)lpbSaclDefaulted));
452 }       
453
454 /**************************************************************************
455  * SetSecurityDescriptorSacl                    [NTDLL.488]
456  */
457 BOOL  WINAPI SetSecurityDescriptorSacl (
458         PSECURITY_DESCRIPTOR lpsd,
459         BOOL saclpresent,
460         PACL lpsacl,
461         BOOL sacldefaulted)
462 {
463         CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
464 }
465 /******************************************************************************
466  * MakeSelfRelativeSD [ADVAPI32.95]
467  *
468  * PARAMS
469  *   lpabssecdesc  []
470  *   lpselfsecdesc []
471  *   lpbuflen      []
472  */
473 BOOL WINAPI
474 MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc,
475                     PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen )
476 {
477         FIXME_(advapi)("(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen);
478         return TRUE;
479 }
480
481 /******************************************************************************
482  * GetSecurityDescriptorControl32                       [ADVAPI32]
483  */
484
485 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR  pSecurityDescriptor,
486                  PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
487 {       FIXME_(advapi)("(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
488         return 1;
489 }               
490
491 /*      ##############################
492         ######  MISC FUNCTIONS  ######
493         ##############################
494 */
495
496 /******************************************************************************
497  * LookupPrivilegeValue32W                      [ADVAPI32.93]
498  * Retrieves LUID used on a system to represent the privilege name.
499  *
500  * NOTES
501  *   lpLuid should be PLUID
502  *
503  * PARAMS
504  *   lpSystemName [I] Address of string specifying the system
505  *   lpName       [I] Address of string specifying the privilege
506  *   lpLuid       [I] Address of locally unique identifier
507  *
508  * RETURNS STD
509  */
510 BOOL WINAPI
511 LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
512 {
513     FIXME_(advapi)("(%s,%s,%p): stub\n",debugstr_w(lpSystemName), 
514                   debugstr_w(lpName), lpLuid);
515     return TRUE;
516 }
517
518 /******************************************************************************
519  * LookupPrivilegeValue32A                      [ADVAPI32.92]
520  */
521 BOOL WINAPI
522 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
523 {
524     LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
525     LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
526     BOOL ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
527     HeapFree(GetProcessHeap(), 0, lpNameW);
528     HeapFree(GetProcessHeap(), 0, lpSystemNameW);
529     return ret;
530 }
531
532 /******************************************************************************
533  * GetFileSecurity32A [ADVAPI32.45]
534  *
535  * Obtains Specified information about the security of a file or directory
536  * The information obtained is constrained by the callers access rights and
537  * privileges
538  */
539 BOOL WINAPI
540 GetFileSecurityA( LPCSTR lpFileName, 
541                     SECURITY_INFORMATION RequestedInformation,
542                     PSECURITY_DESCRIPTOR pSecurityDescriptor,
543                     DWORD nLength, LPDWORD lpnLengthNeeded )
544 {
545   FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
546   return TRUE;
547 }
548
549 /******************************************************************************
550  * GetFileSecurity32W [ADVAPI32.46]
551  *
552  * Obtains Specified information about the security of a file or directory
553  * The information obtained is constrained by the callers access rights and
554  * privileges
555  *
556  * PARAMS
557  *   lpFileName           []
558  *   RequestedInformation []
559  *   pSecurityDescriptor  []
560  *   nLength              []
561  *   lpnLengthNeeded      []
562  */
563 BOOL WINAPI
564 GetFileSecurityW( LPCWSTR lpFileName, 
565                     SECURITY_INFORMATION RequestedInformation,
566                     PSECURITY_DESCRIPTOR pSecurityDescriptor,
567                     DWORD nLength, LPDWORD lpnLengthNeeded )
568 {
569   FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) ); 
570   return TRUE;
571 }
572
573
574 /******************************************************************************
575  * LookupAccountSid32A [ADVAPI32.86]
576  */
577 BOOL WINAPI
578 LookupAccountSidA( LPCSTR system, PSID sid, LPCSTR account,
579                      LPDWORD accountSize, LPCSTR domain, LPDWORD domainSize,
580                      PSID_NAME_USE name_use )
581 {
582         FIXME_(security)("(%s,%p,%p,%p,%p,%p,%p): stub\n",
583               system,sid,account,accountSize,domain,domainSize,name_use);
584         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
585         return FALSE;
586 }
587
588 /******************************************************************************
589  * LookupAccountSid32W [ADVAPI32.87]
590  *
591  * PARAMS
592  *   system      []
593  *   sid         []
594  *   account     []
595  *   accountSize []
596  *   domain      []
597  *   domainSize  []
598  *   name_use    []
599  */
600 BOOL WINAPI
601 LookupAccountSidW( LPCWSTR system, PSID sid, LPCWSTR account, 
602                      LPDWORD accountSize, LPCWSTR domain, LPDWORD domainSize,
603                      PSID_NAME_USE name_use )
604 {
605         FIXME_(security)("(%p,%p,%p,%p,%p,%p,%p): stub\n",
606               system,sid,account,accountSize,domain,domainSize,name_use);
607         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
608         return FALSE;
609 }
610
611 /******************************************************************************
612  * SetFileSecurity32A [ADVAPI32.182]
613  * Sets the security of a file or directory
614  */
615 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
616                                 SECURITY_INFORMATION RequestedInformation,
617                                 PSECURITY_DESCRIPTOR pSecurityDescriptor)
618 {
619   FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
620   return TRUE;
621 }
622
623 /******************************************************************************
624  * SetFileSecurity32W [ADVAPI32.183]
625  * Sets the security of a file or directory
626  *
627  * PARAMS
628  *   lpFileName           []
629  *   RequestedInformation []
630  *   pSecurityDescriptor  []
631  */
632 BOOL WINAPI
633 SetFileSecurityW( LPCWSTR lpFileName, 
634                     SECURITY_INFORMATION RequestedInformation,
635                     PSECURITY_DESCRIPTOR pSecurityDescriptor )
636 {
637   FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) ); 
638   return TRUE;
639 }
640
641 /******************************************************************************
642  * QueryWindows31FilesMigration [ADVAPI32.266]
643  *
644  * PARAMS
645  *   x1 []
646  */
647 BOOL WINAPI
648 QueryWindows31FilesMigration( DWORD x1 )
649 {
650         FIXME_(advapi)("(%ld):stub\n",x1);
651         return TRUE;
652 }
653
654 /******************************************************************************
655  * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.265]
656  *
657  * PARAMS
658  *   x1 []
659  *   x2 []
660  *   x3 []
661  *   x4 []
662  */
663 BOOL WINAPI
664 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
665                                                DWORD x4 )
666 {
667         FIXME_(advapi)("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
668         return TRUE;
669 }
670
671 /******************************************************************************
672  * LsaOpenPolicy [ADVAPI32.200]
673  *
674  * PARAMS
675  *   x1 []
676  *   x2 []
677  *   x3 []
678  *   x4 []
679  */
680 NTSTATUS WINAPI
681 LsaOpenPolicy(PLSA_UNICODE_STRING SystemName,
682               PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
683               ACCESS_MASK DesiredAccess,
684               PLSA_HANDLE PolicyHandle)
685 {
686         FIXME_(advapi)("(%p,%p,0x%08lx,%p):stub\n",
687                        SystemName, ObjectAttributes,
688                        DesiredAccess, PolicyHandle);
689         return 0xc0000000; /* generic error */
690 }
691
692 /******************************************************************************
693  * NotifyBootConfigStatus [ADVAPI32.97]
694  *
695  * PARAMS
696  *   x1 []
697  */
698 BOOL WINAPI
699 NotifyBootConfigStatus( DWORD x1 )
700 {
701         FIXME_(advapi)("(0x%08lx):stub\n",x1);
702         return 1;
703 }
704
705 /******************************************************************************
706  * RevertToSelf [ADVAPI32.180]
707  *
708  * PARAMS
709  *   void []
710  */
711 BOOL WINAPI
712 RevertToSelf( void )
713 {
714         FIXME_(advapi)("(), stub\n");
715         return TRUE;
716 }
717
718 /******************************************************************************
719  * ImpersonateSelf [ADVAPI32.71]
720  */
721 BOOL WINAPI
722 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
723 {
724     FIXME_(advapi)("(%08x), stub\n", ImpersonationLevel);
725     return TRUE;
726 }
727
728 /******************************************************************************
729  * AccessCheck32 [ADVAPI32.71]
730  */
731 BOOL WINAPI
732 AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken,
733             DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet,
734             LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus)
735 {
736     FIXME_(advapi)("(%p, %04x, %08lx, %p, %p, %p, %p, %p), stub\n",
737                    pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping, 
738                    PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus);
739     *AccessStatus = TRUE;
740     return TRUE;
741 }
742
743 /*************************************************************************
744  * SetThreadToken [ADVAPI32.231]
745  *
746  * Assigns an "impersonation token" to a thread so it can assume the
747  * security privledges of another thread or process.  Can also remove
748  * a previously assigned token.  Only supported on NT - it's a stub 
749  * exactly like this one on Win9X.
750  *
751  */
752
753 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
754 {
755     FIXME_(advapi)("(%p, %x): stub\n", thread, token);
756
757     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
758
759     return FALSE;
760 }
761
762
763
764