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