source: trunk/src/advapi32/security.c@ 8706

Last change on this file since 8706 was 8387, checked in by sandervl, 23 years ago

AllocateAndInitializeSid bugfix (return value)

File size: 25.7 KB
Line 
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#ifdef __WIN32OS2__
15#include <heapstring.h>
16#endif
17
18DEFAULT_DEBUG_CHANNEL(advapi);
19
20#define CallWin32ToNt(func) \
21 { NTSTATUS ret; \
22 ret = (func); \
23 if (ret !=STATUS_SUCCESS) \
24 { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
25 return TRUE; \
26 }
27
28static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa )
29{
30 if (oa)
31 {
32 TRACE("\n\tlength=%lu, rootdir=0x%08x, objectname=%s\n\tattr=0x%08lx, sid=%p qos=%p\n",
33 oa->Length, oa->RootDirectory,
34 oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
35 oa->Attributes, oa->SecurityDescriptor, oa->SecurityQualityOfService);
36 }
37}
38
39/* ##############################
40 ###### TOKEN FUNCTIONS ######
41 ##############################
42*/
43
44/******************************************************************************
45 * OpenProcessToken [ADVAPI32.@]
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 */
55BOOL WINAPI
56OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
57 HANDLE *TokenHandle )
58{
59 CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
60}
61
62/******************************************************************************
63 * OpenThreadToken [ADVAPI32.@]
64 *
65 * PARAMS
66 * thread []
67 * desiredaccess []
68 * openasself []
69 * thandle []
70 */
71BOOL WINAPI
72OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
73 BOOL OpenAsSelf, HANDLE *TokenHandle)
74{
75 CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
76}
77
78/******************************************************************************
79 * AdjustTokenPrivileges [ADVAPI32.@]
80 *
81 * PARAMS
82 * TokenHandle []
83 * DisableAllPrivileges []
84 * NewState []
85 * BufferLength []
86 * PreviousState []
87 * ReturnLength []
88 */
89BOOL WINAPI
90AdjustTokenPrivileges( 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 * CheckTokenMembership [ADVAPI32.@]
99 *
100 * PARAMS
101 * TokenHandle []
102 * SidToCheck []
103 * IsMember []
104 */
105BOOL WINAPI
106CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
107 PBOOL IsMember )
108{
109 FIXME("(0x%08x %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
110
111 *IsMember = TRUE;
112 return(TRUE);
113}
114
115/******************************************************************************
116 * GetTokenInformation [ADVAPI32.@]
117 *
118 * PARAMS
119 * token []
120 * tokeninfoclass []
121 * tokeninfo []
122 * tokeninfolength []
123 * retlen []
124 *
125 */
126BOOL WINAPI
127GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
128 LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
129{
130 CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
131}
132
133/*************************************************************************
134 * SetThreadToken [ADVAPI32.@]
135 *
136 * Assigns an "impersonation token" to a thread so it can assume the
137 * security privledges of another thread or process. Can also remove
138 * a previously assigned token. Only supported on NT - it's a stub
139 * exactly like this one on Win9X.
140 *
141 */
142
143BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
144{
145#ifdef __WIN32OS2__
146
147 dprintf(("SetThreadToken %x %x NOT IMPLEMENTED (FAKED)", thread, token));
148 return TRUE; //pretend it succeeded
149#else
150 FIXME("(%p, %x): stub (NT impl. only)\n", thread, token);
151
152 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
153
154 return FALSE;
155#endif
156}
157
158/* ##############################
159 ###### SID FUNCTIONS ######
160 ##############################
161*/
162
163/******************************************************************************
164 * AllocateAndInitializeSid [ADVAPI32.@]
165 *
166 * PARAMS
167 * pIdentifierAuthority []
168 * nSubAuthorityCount []
169 * nSubAuthority0 []
170 * nSubAuthority1 []
171 * nSubAuthority2 []
172 * nSubAuthority3 []
173 * nSubAuthority4 []
174 * nSubAuthority5 []
175 * nSubAuthority6 []
176 * nSubAuthority7 []
177 * pSid []
178 */
179BOOL WINAPI
180AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
181 BYTE nSubAuthorityCount,
182 DWORD nSubAuthority0, DWORD nSubAuthority1,
183 DWORD nSubAuthority2, DWORD nSubAuthority3,
184 DWORD nSubAuthority4, DWORD nSubAuthority5,
185 DWORD nSubAuthority6, DWORD nSubAuthority7,
186 PSID *pSid )
187{
188 return RtlAllocateAndInitializeSid(
189 pIdentifierAuthority, nSubAuthorityCount,
190 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
191 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
192 pSid );
193}
194
195/******************************************************************************
196 * FreeSid [ADVAPI32.@]
197 *
198 * PARAMS
199 * pSid []
200 */
201PVOID WINAPI
202FreeSid( PSID pSid )
203{
204 RtlFreeSid(pSid);
205 return NULL; /* is documented like this */
206}
207
208/******************************************************************************
209 * CopySid [ADVAPI32.@]
210 *
211 * PARAMS
212 * nDestinationSidLength []
213 * pDestinationSid []
214 * pSourceSid []
215 */
216BOOL WINAPI
217CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
218{
219 return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
220}
221
222/******************************************************************************
223 * IsValidSid [ADVAPI32.@]
224 *
225 * PARAMS
226 * pSid []
227 */
228BOOL WINAPI
229IsValidSid( PSID pSid )
230{
231 return RtlValidSid( pSid );
232}
233
234/******************************************************************************
235 * EqualSid [ADVAPI32.@]
236 *
237 * PARAMS
238 * pSid1 []
239 * pSid2 []
240 */
241BOOL WINAPI
242EqualSid( PSID pSid1, PSID pSid2 )
243{
244 return RtlEqualSid( pSid1, pSid2 );
245}
246
247/******************************************************************************
248 * EqualPrefixSid [ADVAPI32.@]
249 */
250BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
251{
252 return RtlEqualPrefixSid(pSid1, pSid2);
253}
254
255/******************************************************************************
256 * GetSidLengthRequired [ADVAPI32.@]
257 *
258 * PARAMS
259 * nSubAuthorityCount []
260 */
261DWORD WINAPI
262GetSidLengthRequired( BYTE nSubAuthorityCount )
263{
264 return RtlLengthRequiredSid(nSubAuthorityCount);
265}
266
267/******************************************************************************
268 * InitializeSid [ADVAPI32.@]
269 *
270 * PARAMS
271 * pIdentifierAuthority []
272 */
273BOOL WINAPI
274InitializeSid (
275 PSID pSid,
276 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
277 BYTE nSubAuthorityCount)
278{
279 return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
280}
281
282/******************************************************************************
283 * GetSidIdentifierAuthority [ADVAPI32.@]
284 *
285 * PARAMS
286 * pSid []
287 */
288PSID_IDENTIFIER_AUTHORITY WINAPI
289GetSidIdentifierAuthority( PSID pSid )
290{
291 return RtlIdentifierAuthoritySid(pSid);
292}
293
294/******************************************************************************
295 * GetSidSubAuthority [ADVAPI32.@]
296 *
297 * PARAMS
298 * pSid []
299 * nSubAuthority []
300 */
301PDWORD WINAPI
302GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
303{
304 return RtlSubAuthoritySid(pSid, nSubAuthority);
305}
306
307/******************************************************************************
308 * GetSidSubAuthorityCount [ADVAPI32.@]
309 *
310 * PARAMS
311 * pSid []
312 */
313PUCHAR WINAPI
314GetSidSubAuthorityCount (PSID pSid)
315{
316 return RtlSubAuthorityCountSid(pSid);
317}
318
319/******************************************************************************
320 * GetLengthSid [ADVAPI32.@]
321 *
322 * PARAMS
323 * pSid []
324 */
325DWORD WINAPI
326GetLengthSid (PSID pSid)
327{
328 return RtlLengthSid(pSid);
329}
330
331/* ##############################################
332 ###### SECURITY DESCRIPTOR FUNCTIONS ######
333 ##############################################
334*/
335
336/******************************************************************************
337 * InitializeSecurityDescriptor [ADVAPI32.@]
338 *
339 * PARAMS
340 * pDescr []
341 * revision []
342 */
343BOOL WINAPI
344InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
345{
346 CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
347}
348
349/******************************************************************************
350 * GetSecurityDescriptorLength [ADVAPI32.@]
351 */
352DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
353{
354 return (RtlLengthSecurityDescriptor(pDescr));
355}
356
357/******************************************************************************
358 * GetSecurityDescriptorOwner [ADVAPI32.@]
359 *
360 * PARAMS
361 * pOwner []
362 * lpbOwnerDefaulted []
363 */
364BOOL WINAPI
365GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
366 LPBOOL lpbOwnerDefaulted )
367{
368 CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
369}
370
371/******************************************************************************
372 * SetSecurityDescriptorOwner [ADVAPI32.@]
373 *
374 * PARAMS
375 */
376BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
377 PSID pOwner, BOOL bOwnerDefaulted)
378{
379 CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
380}
381/******************************************************************************
382 * GetSecurityDescriptorGroup [ADVAPI32.@]
383 */
384BOOL WINAPI GetSecurityDescriptorGroup(
385 PSECURITY_DESCRIPTOR SecurityDescriptor,
386 PSID *Group,
387 LPBOOL GroupDefaulted)
388{
389 CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
390}
391/******************************************************************************
392 * SetSecurityDescriptorGroup [ADVAPI32.@]
393 */
394BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
395 PSID Group, BOOL GroupDefaulted)
396{
397 CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
398}
399
400/******************************************************************************
401 * IsValidSecurityDescriptor [ADVAPI32.@]
402 *
403 * PARAMS
404 * lpsecdesc []
405 */
406BOOL WINAPI
407IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
408{
409 CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
410}
411
412/******************************************************************************
413 * GetSecurityDescriptorDacl [ADVAPI32.@]
414 */
415BOOL WINAPI GetSecurityDescriptorDacl(
416 IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
417 OUT LPBOOL lpbDaclPresent,
418 OUT PACL *pDacl,
419 OUT LPBOOL lpbDaclDefaulted)
420{
421 CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
422 pDacl, (PBOOLEAN)lpbDaclDefaulted));
423}
424
425/******************************************************************************
426 * SetSecurityDescriptorDacl [ADVAPI32.@]
427 */
428BOOL WINAPI
429SetSecurityDescriptorDacl (
430 PSECURITY_DESCRIPTOR lpsd,
431 BOOL daclpresent,
432 PACL dacl,
433 BOOL dacldefaulted )
434{
435 CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
436}
437/******************************************************************************
438 * GetSecurityDescriptorSacl [ADVAPI32.@]
439 */
440BOOL WINAPI GetSecurityDescriptorSacl(
441 IN PSECURITY_DESCRIPTOR lpsd,
442 OUT LPBOOL lpbSaclPresent,
443 OUT PACL *pSacl,
444 OUT LPBOOL lpbSaclDefaulted)
445{
446 CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
447 (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
448}
449
450/**************************************************************************
451 * SetSecurityDescriptorSacl [ADVAPI32.@]
452 */
453BOOL WINAPI SetSecurityDescriptorSacl (
454 PSECURITY_DESCRIPTOR lpsd,
455 BOOL saclpresent,
456 PACL lpsacl,
457 BOOL sacldefaulted)
458{
459 CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
460}
461/******************************************************************************
462 * MakeSelfRelativeSD [ADVAPI32.@]
463 *
464 * PARAMS
465 * lpabssecdesc []
466 * lpselfsecdesc []
467 * lpbuflen []
468 */
469BOOL WINAPI
470MakeSelfRelativeSD(
471 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
472 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
473 IN OUT LPDWORD lpdwBufferLength)
474{
475 CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength));
476}
477
478/******************************************************************************
479 * GetSecurityDescriptorControl [ADVAPI32.@]
480 */
481
482BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
483 PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
484{
485 CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
486}
487
488/* ##############################
489 ###### ACL FUNCTIONS ######
490 ##############################
491*/
492
493/*************************************************************************
494 * InitializeAcl [ADVAPI32.@]
495 */
496DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
497{
498 CallWin32ToNt (RtlCreateAcl(acl, size, rev));
499}
500
501/* ##############################
502 ###### MISC FUNCTIONS ######
503 ##############################
504*/
505
506/******************************************************************************
507 * LookupPrivilegeValueW [ADVAPI32.@]
508 * Retrieves LUID used on a system to represent the privilege name.
509 *
510 * NOTES
511 * lpLuid should be PLUID
512 *
513 * PARAMS
514 * lpSystemName [I] Address of string specifying the system
515 * lpName [I] Address of string specifying the privilege
516 * lpLuid [I] Address of locally unique identifier
517 *
518 * RETURNS STD
519 */
520BOOL WINAPI
521LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
522{
523 FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
524 debugstr_w(lpName), lpLuid);
525 return TRUE;
526}
527
528/******************************************************************************
529 * LookupPrivilegeValueA [ADVAPI32.@]
530 */
531BOOL WINAPI
532LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
533{
534 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
535 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
536 BOOL ret;
537
538 ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
539 HeapFree(GetProcessHeap(), 0, lpNameW);
540 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
541 return ret;
542}
543
544/******************************************************************************
545 * GetFileSecurityA [ADVAPI32.@]
546 *
547 * Obtains Specified information about the security of a file or directory
548 * The information obtained is constrained by the callers access rights and
549 * privileges
550 */
551BOOL WINAPI
552GetFileSecurityA( LPCSTR lpFileName,
553 SECURITY_INFORMATION RequestedInformation,
554 PSECURITY_DESCRIPTOR pSecurityDescriptor,
555 DWORD nLength, LPDWORD lpnLengthNeeded )
556{
557 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
558 return TRUE;
559}
560
561/******************************************************************************
562 * GetFileSecurityW [ADVAPI32.@]
563 *
564 * Obtains Specified information about the security of a file or directory
565 * The information obtained is constrained by the callers access rights and
566 * privileges
567 *
568 * PARAMS
569 * lpFileName []
570 * RequestedInformation []
571 * pSecurityDescriptor []
572 * nLength []
573 * lpnLengthNeeded []
574 */
575BOOL WINAPI
576GetFileSecurityW( LPCWSTR lpFileName,
577 SECURITY_INFORMATION RequestedInformation,
578 PSECURITY_DESCRIPTOR pSecurityDescriptor,
579 DWORD nLength, LPDWORD lpnLengthNeeded )
580{
581 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
582 return TRUE;
583}
584
585
586/******************************************************************************
587 * LookupAccountSidA [ADVAPI32.@]
588 */
589BOOL WINAPI
590LookupAccountSidA(
591 IN LPCSTR system,
592 IN PSID sid,
593 OUT LPSTR account,
594 IN OUT LPDWORD accountSize,
595 OUT LPSTR domain,
596 IN OUT LPDWORD domainSize,
597 OUT PSID_NAME_USE name_use )
598{
599 static const char ac[] = "Administrator";
600 static const char dm[] = "DOMAIN";
601 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
602 debugstr_a(system),sid,
603 account,accountSize,accountSize?*accountSize:0,
604 domain,domainSize,domainSize?*domainSize:0,
605 name_use);
606
607 if (accountSize) *accountSize = strlen(ac)+1;
608 if (account && (*accountSize > strlen(ac)))
609 strcpy(account, ac);
610
611 if (domainSize) *domainSize = strlen(dm)+1;
612 if (domain && (*domainSize > strlen(dm)))
613 strcpy(domain,dm);
614
615 if (name_use) *name_use = SidTypeUser;
616 return TRUE;
617}
618
619/******************************************************************************
620 * LookupAccountSidW [ADVAPI32.@]
621 *
622 * PARAMS
623 * system []
624 * sid []
625 * account []
626 * accountSize []
627 * domain []
628 * domainSize []
629 * name_use []
630 */
631BOOL WINAPI
632LookupAccountSidW(
633 IN LPCWSTR system,
634 IN PSID sid,
635 OUT LPWSTR account,
636 IN OUT LPDWORD accountSize,
637 OUT LPWSTR domain,
638 IN OUT LPDWORD domainSize,
639 OUT PSID_NAME_USE name_use )
640{
641 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
642 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
643 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
644 debugstr_w(system),sid,
645 account,accountSize,accountSize?*accountSize:0,
646 domain,domainSize,domainSize?*domainSize:0,
647 name_use);
648
649 if (accountSize) *accountSize = strlenW(ac)+1;
650 if (account && (*accountSize > strlenW(ac)))
651 strcpyW(account, ac);
652
653 if (domainSize) *domainSize = strlenW(dm)+1;
654 if (domain && (*domainSize > strlenW(dm)))
655 strcpyW(domain,dm);
656
657 if (name_use) *name_use = SidTypeUser;
658 return TRUE;
659}
660
661/******************************************************************************
662 * SetFileSecurityA [ADVAPI32.@]
663 * Sets the security of a file or directory
664 */
665BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
666 SECURITY_INFORMATION RequestedInformation,
667 PSECURITY_DESCRIPTOR pSecurityDescriptor)
668{
669 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
670 return TRUE;
671}
672
673/******************************************************************************
674 * SetFileSecurityW [ADVAPI32.@]
675 * Sets the security of a file or directory
676 *
677 * PARAMS
678 * lpFileName []
679 * RequestedInformation []
680 * pSecurityDescriptor []
681 */
682BOOL WINAPI
683SetFileSecurityW( LPCWSTR lpFileName,
684 SECURITY_INFORMATION RequestedInformation,
685 PSECURITY_DESCRIPTOR pSecurityDescriptor )
686{
687 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
688 return TRUE;
689}
690
691/******************************************************************************
692 * QueryWindows31FilesMigration [ADVAPI32.@]
693 *
694 * PARAMS
695 * x1 []
696 */
697BOOL WINAPI
698QueryWindows31FilesMigration( DWORD x1 )
699{
700 FIXME("(%ld):stub\n",x1);
701 return TRUE;
702}
703
704/******************************************************************************
705 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
706 *
707 * PARAMS
708 * x1 []
709 * x2 []
710 * x3 []
711 * x4 []
712 */
713BOOL WINAPI
714SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
715 DWORD x4 )
716{
717 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
718 return TRUE;
719}
720
721/******************************************************************************
722 * LsaOpenPolicy [ADVAPI32.@]
723 *
724 * PARAMS
725 * x1 []
726 * x2 []
727 * x3 []
728 * x4 []
729 */
730NTSTATUS WINAPI
731LsaOpenPolicy(
732 IN PLSA_UNICODE_STRING SystemName,
733 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
734 IN ACCESS_MASK DesiredAccess,
735 IN OUT PLSA_HANDLE PolicyHandle)
736{
737 FIXME("(%s,%p,0x%08lx,%p):stub\n",
738 SystemName?debugstr_w(SystemName->Buffer):"null",
739 ObjectAttributes, DesiredAccess, PolicyHandle);
740 dumpLsaAttributes(ObjectAttributes);
741 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
742 return TRUE;
743}
744
745/******************************************************************************
746 * LsaQueryInformationPolicy [ADVAPI32.@]
747 */
748NTSTATUS WINAPI
749LsaQueryInformationPolicy(
750 IN LSA_HANDLE PolicyHandle,
751 IN POLICY_INFORMATION_CLASS InformationClass,
752 OUT PVOID *Buffer)
753{
754 FIXME("(%p,0x%08x,%p):stub\n",
755 PolicyHandle, InformationClass, Buffer);
756
757 if(!Buffer) return FALSE;
758 switch (InformationClass)
759 {
760 case PolicyAuditEventsInformation: /* 2 */
761 {
762 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
763 p->AuditingMode = FALSE; /* no auditing */
764 *Buffer = p;
765 }
766 break;
767 case PolicyPrimaryDomainInformation: /* 3 */
768 case PolicyAccountDomainInformation: /* 5 */
769 {
770 struct di
771 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
772 SID sid;
773 };
774 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
775
776 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
777 RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
778 xdi->ppdi.Sid = &(xdi->sid);
779 xdi->sid.Revision = SID_REVISION;
780 xdi->sid.SubAuthorityCount = 1;
781 xdi->sid.IdentifierAuthority = localSidAuthority;
782 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
783 *Buffer = xdi;
784 }
785 break;
786 case PolicyAuditLogInformation:
787 case PolicyPdAccountInformation:
788 case PolicyLsaServerRoleInformation:
789 case PolicyReplicaSourceInformation:
790 case PolicyDefaultQuotaInformation:
791 case PolicyModificationInformation:
792 case PolicyAuditFullSetInformation:
793 case PolicyAuditFullQueryInformation:
794 case PolicyDnsDomainInformation:
795 {
796 FIXME("category not implemented\n");
797 return FALSE;
798 }
799 }
800 return TRUE;
801}
802
803/******************************************************************************
804 * LsaLookupSids [ADVAPI32.@]
805 */
806typedef struct
807{
808 SID_NAME_USE Use;
809 LSA_UNICODE_STRING Name;
810 LONG DomainIndex;
811} LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
812
813typedef struct
814{
815 LSA_UNICODE_STRING Name;
816 PSID Sid;
817} LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
818
819typedef struct
820{
821 ULONG Entries;
822 PLSA_TRUST_INFORMATION Domains;
823} LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
824
825NTSTATUS WINAPI
826LsaLookupSids(
827 IN LSA_HANDLE PolicyHandle,
828 IN ULONG Count,
829 IN PSID *Sids,
830 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
831 OUT PLSA_TRANSLATED_NAME *Names )
832{
833 FIXME("%p %lu %p %p %p\n",
834 PolicyHandle, Count, Sids, ReferencedDomains, Names);
835 return FALSE;
836}
837
838/******************************************************************************
839 * LsaFreeMemory [ADVAPI32.@]
840 */
841NTSTATUS WINAPI
842LsaFreeMemory(IN PVOID Buffer)
843{
844 TRACE("(%p)\n",Buffer);
845 return HeapFree(GetProcessHeap(), 0, Buffer);
846}
847/******************************************************************************
848 * LsaClose [ADVAPI32.@]
849 */
850NTSTATUS WINAPI
851LsaClose(IN LSA_HANDLE ObjectHandle)
852{
853 FIXME("(%p):stub\n",ObjectHandle);
854 return 0xc0000000;
855}
856/******************************************************************************
857 * NotifyBootConfigStatus [ADVAPI32.@]
858 *
859 * PARAMS
860 * x1 []
861 */
862BOOL WINAPI
863NotifyBootConfigStatus( DWORD x1 )
864{
865 FIXME("(0x%08lx):stub\n",x1);
866 return 1;
867}
868
869/******************************************************************************
870 * RevertToSelf [ADVAPI32.@]
871 *
872 * PARAMS
873 * void []
874 */
875BOOL WINAPI
876RevertToSelf( void )
877{
878 FIXME("(), stub\n");
879 return TRUE;
880}
881
882/******************************************************************************
883 * ImpersonateSelf [ADVAPI32.@]
884 */
885BOOL WINAPI
886ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
887{
888 return RtlImpersonateSelf(ImpersonationLevel);
889}
890
891/******************************************************************************
892 * AccessCheck [ADVAPI32.@]
893 *
894 * FIXME check cast LPBOOL to PBOOLEAN
895 */
896BOOL WINAPI
897AccessCheck(
898 PSECURITY_DESCRIPTOR SecurityDescriptor,
899 HANDLE ClientToken,
900 DWORD DesiredAccess,
901 PGENERIC_MAPPING GenericMapping,
902 PPRIVILEGE_SET PrivilegeSet,
903 LPDWORD PrivilegeSetLength,
904 LPDWORD GrantedAccess,
905 LPBOOL AccessStatus)
906{
907 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
908 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
909}
910
911/*************************************************************************
912 * SetKernelObjectSecurity [ADVAPI32.@]
913 */
914BOOL WINAPI SetKernelObjectSecurity (
915 IN HANDLE Handle,
916 IN SECURITY_INFORMATION SecurityInformation,
917 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
918{
919 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
920}
921
922/******************************************************************************
923 * AddAccessAllowedAce [ADVAPI32.@]
924 */
925BOOL WINAPI AddAccessAllowedAce(
926 IN OUT PACL pAcl,
927 IN DWORD dwAceRevision,
928 IN DWORD AccessMask,
929 IN PSID pSid)
930{
931 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
932}
933
934/******************************************************************************
935 * LookupAccountNameA [ADVAPI32.@]
936 */
937BOOL WINAPI
938LookupAccountNameA(
939 IN LPCSTR system,
940 IN LPCSTR account,
941 OUT PSID sid,
942 OUT LPDWORD cbSid,
943 LPSTR ReferencedDomainName,
944 IN OUT LPDWORD cbReferencedDomainName,
945 OUT PSID_NAME_USE name_use )
946{
947 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
948 return FALSE;
949}
950
951/******************************************************************************
952 * GetAce [ADVAPI32.@]
953 */
954BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
955{
956 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
957}
Note: See TracBrowser for help on using the repository browser.