2 * Copyright 1999, 2000 Juergen Schmied <juergen.schmied@debitel.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * FIXME: for all functions thunking down to Rtl* functions: implement SetLastError()
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
33 #define CallWin32ToNt(func) \
36 if (ret !=STATUS_SUCCESS) \
37 { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
41 static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa )
45 TRACE("\n\tlength=%lu, rootdir=0x%08x, objectname=%s\n\tattr=0x%08lx, sid=%p qos=%p\n",
46 oa->Length, oa->RootDirectory,
47 oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
48 oa->Attributes, oa->SecurityDescriptor, oa->SecurityQualityOfService);
52 /* ##############################
53 ###### TOKEN FUNCTIONS ######
54 ##############################
57 /******************************************************************************
58 * OpenProcessToken [ADVAPI32.@]
59 * Opens the access token associated with a process
62 * ProcessHandle [I] Handle to process
63 * DesiredAccess [I] Desired access to process
64 * TokenHandle [O] Pointer to handle of open access token
69 OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
72 CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
75 /******************************************************************************
76 * OpenThreadToken [ADVAPI32.@]
85 OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
86 BOOL OpenAsSelf, HANDLE *TokenHandle)
88 CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
91 /******************************************************************************
92 * AdjustTokenPrivileges [ADVAPI32.@]
96 * DisableAllPrivileges []
103 AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
104 LPVOID NewState, DWORD BufferLength,
105 LPVOID PreviousState, LPDWORD ReturnLength )
107 CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
110 /******************************************************************************
111 * CheckTokenMembership [ADVAPI32.@]
119 CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
122 FIXME("(0x%08x %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
128 /******************************************************************************
129 * GetTokenInformation [ADVAPI32.@]
135 * tokeninfolength [I]
140 GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
141 LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
143 TRACE("(%x, %s, %p, %ld, %p): \n",
145 (tokeninfoclass == TokenUser) ? "TokenUser" :
146 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
147 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
148 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
149 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
150 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
151 (tokeninfoclass == TokenSource) ? "TokenSource" :
152 (tokeninfoclass == TokenType) ? "TokenType" :
153 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
154 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
155 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
156 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
157 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
158 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
159 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
161 tokeninfo, tokeninfolength, retlen);
162 CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
165 /******************************************************************************
166 * SetTokenInformation [ADVAPI32.@]
172 * tokeninfolength [I]
176 SetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
177 LPVOID tokeninfo, DWORD tokeninfolength )
179 FIXME("(%x, %s, %p, %ld): stub\n",
181 (tokeninfoclass == TokenUser) ? "TokenUser" :
182 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
183 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
184 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
185 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
186 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
187 (tokeninfoclass == TokenSource) ? "TokenSource" :
188 (tokeninfoclass == TokenType) ? "TokenType" :
189 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
190 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
191 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
192 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
193 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
194 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
195 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
197 tokeninfo, tokeninfolength);
199 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
204 /*************************************************************************
205 * SetThreadToken [ADVAPI32.@]
207 * Assigns an "impersonation token" to a thread so it can assume the
208 * security privledges of another thread or process. Can also remove
209 * a previously assigned token. Only supported on NT - it's a stub
210 * exactly like this one on Win9X.
214 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
216 FIXME("(%p, %x): stub (NT impl. only)\n", thread, token);
218 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
223 /* ##############################
224 ###### SID FUNCTIONS ######
225 ##############################
228 /******************************************************************************
229 * AllocateAndInitializeSid [ADVAPI32.@]
232 * pIdentifierAuthority []
233 * nSubAuthorityCount []
245 AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
246 BYTE nSubAuthorityCount,
247 DWORD nSubAuthority0, DWORD nSubAuthority1,
248 DWORD nSubAuthority2, DWORD nSubAuthority3,
249 DWORD nSubAuthority4, DWORD nSubAuthority5,
250 DWORD nSubAuthority6, DWORD nSubAuthority7,
253 CallWin32ToNt (RtlAllocateAndInitializeSid(
254 pIdentifierAuthority, nSubAuthorityCount,
255 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
256 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
260 /******************************************************************************
261 * FreeSid [ADVAPI32.@]
270 return NULL; /* is documented like this */
273 /******************************************************************************
274 * CopySid [ADVAPI32.@]
277 * nDestinationSidLength []
282 CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
284 return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
287 /******************************************************************************
288 * IsValidSid [ADVAPI32.@]
294 IsValidSid( PSID pSid )
296 return RtlValidSid( pSid );
299 /******************************************************************************
300 * EqualSid [ADVAPI32.@]
307 EqualSid( PSID pSid1, PSID pSid2 )
309 return RtlEqualSid( pSid1, pSid2 );
312 /******************************************************************************
313 * EqualPrefixSid [ADVAPI32.@]
315 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
317 return RtlEqualPrefixSid(pSid1, pSid2);
320 /******************************************************************************
321 * GetSidLengthRequired [ADVAPI32.@]
324 * nSubAuthorityCount []
327 GetSidLengthRequired( BYTE nSubAuthorityCount )
329 return RtlLengthRequiredSid(nSubAuthorityCount);
332 /******************************************************************************
333 * InitializeSid [ADVAPI32.@]
336 * pIdentifierAuthority []
341 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
342 BYTE nSubAuthorityCount)
344 return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
347 /******************************************************************************
348 * GetSidIdentifierAuthority [ADVAPI32.@]
353 PSID_IDENTIFIER_AUTHORITY WINAPI
354 GetSidIdentifierAuthority( PSID pSid )
356 return RtlIdentifierAuthoritySid(pSid);
359 /******************************************************************************
360 * GetSidSubAuthority [ADVAPI32.@]
367 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
369 return RtlSubAuthoritySid(pSid, nSubAuthority);
372 /******************************************************************************
373 * GetSidSubAuthorityCount [ADVAPI32.@]
379 GetSidSubAuthorityCount (PSID pSid)
381 return RtlSubAuthorityCountSid(pSid);
384 /******************************************************************************
385 * GetLengthSid [ADVAPI32.@]
391 GetLengthSid (PSID pSid)
393 return RtlLengthSid(pSid);
396 /* ##############################################
397 ###### SECURITY DESCRIPTOR FUNCTIONS ######
398 ##############################################
401 /******************************************************************************
402 * InitializeSecurityDescriptor [ADVAPI32.@]
409 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
411 CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
414 /******************************************************************************
415 * GetSecurityDescriptorLength [ADVAPI32.@]
417 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
419 return (RtlLengthSecurityDescriptor(pDescr));
422 /******************************************************************************
423 * GetSecurityDescriptorOwner [ADVAPI32.@]
427 * lpbOwnerDefaulted []
430 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
431 LPBOOL lpbOwnerDefaulted )
433 CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
436 /******************************************************************************
437 * SetSecurityDescriptorOwner [ADVAPI32.@]
441 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
442 PSID pOwner, BOOL bOwnerDefaulted)
444 CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
446 /******************************************************************************
447 * GetSecurityDescriptorGroup [ADVAPI32.@]
449 BOOL WINAPI GetSecurityDescriptorGroup(
450 PSECURITY_DESCRIPTOR SecurityDescriptor,
452 LPBOOL GroupDefaulted)
454 CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
456 /******************************************************************************
457 * SetSecurityDescriptorGroup [ADVAPI32.@]
459 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
460 PSID Group, BOOL GroupDefaulted)
462 CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
465 /******************************************************************************
466 * IsValidSecurityDescriptor [ADVAPI32.@]
472 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
474 CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
477 /******************************************************************************
478 * GetSecurityDescriptorDacl [ADVAPI32.@]
480 BOOL WINAPI GetSecurityDescriptorDacl(
481 IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
482 OUT LPBOOL lpbDaclPresent,
484 OUT LPBOOL lpbDaclDefaulted)
486 CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
487 pDacl, (PBOOLEAN)lpbDaclDefaulted));
490 /******************************************************************************
491 * SetSecurityDescriptorDacl [ADVAPI32.@]
494 SetSecurityDescriptorDacl (
495 PSECURITY_DESCRIPTOR lpsd,
500 CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
502 /******************************************************************************
503 * GetSecurityDescriptorSacl [ADVAPI32.@]
505 BOOL WINAPI GetSecurityDescriptorSacl(
506 IN PSECURITY_DESCRIPTOR lpsd,
507 OUT LPBOOL lpbSaclPresent,
509 OUT LPBOOL lpbSaclDefaulted)
511 CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
512 (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
515 /**************************************************************************
516 * SetSecurityDescriptorSacl [ADVAPI32.@]
518 BOOL WINAPI SetSecurityDescriptorSacl (
519 PSECURITY_DESCRIPTOR lpsd,
524 CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
526 /******************************************************************************
527 * MakeSelfRelativeSD [ADVAPI32.@]
536 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
537 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
538 IN OUT LPDWORD lpdwBufferLength)
540 CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength));
543 /******************************************************************************
544 * GetSecurityDescriptorControl [ADVAPI32.@]
547 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
548 PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
550 CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
553 /* ##############################
554 ###### ACL FUNCTIONS ######
555 ##############################
558 /*************************************************************************
559 * InitializeAcl [ADVAPI32.@]
561 DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
563 CallWin32ToNt (RtlCreateAcl(acl, size, rev));
566 /* ##############################
567 ###### MISC FUNCTIONS ######
568 ##############################
571 /******************************************************************************
572 * LookupPrivilegeValueW [ADVAPI32.@]
573 * Retrieves LUID used on a system to represent the privilege name.
576 * lpLuid should be PLUID
579 * lpSystemName [I] Address of string specifying the system
580 * lpName [I] Address of string specifying the privilege
581 * lpLuid [I] Address of locally unique identifier
586 LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
588 FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
589 debugstr_w(lpName), lpLuid);
593 /******************************************************************************
594 * LookupPrivilegeValueA [ADVAPI32.@]
597 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
599 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
600 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
603 ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
604 HeapFree(GetProcessHeap(), 0, lpNameW);
605 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
609 /******************************************************************************
610 * GetFileSecurityA [ADVAPI32.@]
612 * Obtains Specified information about the security of a file or directory
613 * The information obtained is constrained by the callers access rights and
617 GetFileSecurityA( LPCSTR lpFileName,
618 SECURITY_INFORMATION RequestedInformation,
619 PSECURITY_DESCRIPTOR pSecurityDescriptor,
620 DWORD nLength, LPDWORD lpnLengthNeeded )
622 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
626 /******************************************************************************
627 * GetFileSecurityW [ADVAPI32.@]
629 * Obtains Specified information about the security of a file or directory
630 * The information obtained is constrained by the callers access rights and
635 * RequestedInformation []
636 * pSecurityDescriptor []
641 GetFileSecurityW( LPCWSTR lpFileName,
642 SECURITY_INFORMATION RequestedInformation,
643 PSECURITY_DESCRIPTOR pSecurityDescriptor,
644 DWORD nLength, LPDWORD lpnLengthNeeded )
646 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
651 /******************************************************************************
652 * LookupAccountSidA [ADVAPI32.@]
659 IN OUT LPDWORD accountSize,
661 IN OUT LPDWORD domainSize,
662 OUT PSID_NAME_USE name_use )
664 static const char ac[] = "Administrator";
665 static const char dm[] = "DOMAIN";
666 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
667 debugstr_a(system),sid,
668 account,accountSize,accountSize?*accountSize:0,
669 domain,domainSize,domainSize?*domainSize:0,
672 if (accountSize) *accountSize = strlen(ac)+1;
673 if (account && (*accountSize > strlen(ac)))
676 if (domainSize) *domainSize = strlen(dm)+1;
677 if (domain && (*domainSize > strlen(dm)))
680 if (name_use) *name_use = SidTypeUser;
684 /******************************************************************************
685 * LookupAccountSidW [ADVAPI32.@]
701 IN OUT LPDWORD accountSize,
703 IN OUT LPDWORD domainSize,
704 OUT PSID_NAME_USE name_use )
706 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
707 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
708 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
709 debugstr_w(system),sid,
710 account,accountSize,accountSize?*accountSize:0,
711 domain,domainSize,domainSize?*domainSize:0,
714 if (accountSize) *accountSize = strlenW(ac)+1;
715 if (account && (*accountSize > strlenW(ac)))
716 strcpyW(account, ac);
718 if (domainSize) *domainSize = strlenW(dm)+1;
719 if (domain && (*domainSize > strlenW(dm)))
722 if (name_use) *name_use = SidTypeUser;
726 /******************************************************************************
727 * SetFileSecurityA [ADVAPI32.@]
728 * Sets the security of a file or directory
730 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
731 SECURITY_INFORMATION RequestedInformation,
732 PSECURITY_DESCRIPTOR pSecurityDescriptor)
734 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
738 /******************************************************************************
739 * SetFileSecurityW [ADVAPI32.@]
740 * Sets the security of a file or directory
744 * RequestedInformation []
745 * pSecurityDescriptor []
748 SetFileSecurityW( LPCWSTR lpFileName,
749 SECURITY_INFORMATION RequestedInformation,
750 PSECURITY_DESCRIPTOR pSecurityDescriptor )
752 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
756 /******************************************************************************
757 * QueryWindows31FilesMigration [ADVAPI32.@]
763 QueryWindows31FilesMigration( DWORD x1 )
765 FIXME("(%ld):stub\n",x1);
769 /******************************************************************************
770 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
779 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
782 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
786 /******************************************************************************
787 * LsaOpenPolicy [ADVAPI32.@]
797 IN PLSA_UNICODE_STRING SystemName,
798 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
799 IN ACCESS_MASK DesiredAccess,
800 IN OUT PLSA_HANDLE PolicyHandle)
802 FIXME("(%s,%p,0x%08lx,%p):stub\n",
803 SystemName?debugstr_w(SystemName->Buffer):"null",
804 ObjectAttributes, DesiredAccess, PolicyHandle);
805 dumpLsaAttributes(ObjectAttributes);
806 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
810 /******************************************************************************
811 * LsaQueryInformationPolicy [ADVAPI32.@]
814 LsaQueryInformationPolicy(
815 IN LSA_HANDLE PolicyHandle,
816 IN POLICY_INFORMATION_CLASS InformationClass,
819 FIXME("(%p,0x%08x,%p):stub\n",
820 PolicyHandle, InformationClass, Buffer);
822 if(!Buffer) return FALSE;
823 switch (InformationClass)
825 case PolicyAuditEventsInformation: /* 2 */
827 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
828 p->AuditingMode = FALSE; /* no auditing */
832 case PolicyPrimaryDomainInformation: /* 3 */
833 case PolicyAccountDomainInformation: /* 5 */
836 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
839 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
841 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
842 RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
843 xdi->ppdi.Sid = &(xdi->sid);
844 xdi->sid.Revision = SID_REVISION;
845 xdi->sid.SubAuthorityCount = 1;
846 xdi->sid.IdentifierAuthority = localSidAuthority;
847 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
851 case PolicyAuditLogInformation:
852 case PolicyPdAccountInformation:
853 case PolicyLsaServerRoleInformation:
854 case PolicyReplicaSourceInformation:
855 case PolicyDefaultQuotaInformation:
856 case PolicyModificationInformation:
857 case PolicyAuditFullSetInformation:
858 case PolicyAuditFullQueryInformation:
859 case PolicyDnsDomainInformation:
861 FIXME("category not implemented\n");
868 /******************************************************************************
869 * LsaLookupSids [ADVAPI32.@]
874 LSA_UNICODE_STRING Name;
876 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
880 LSA_UNICODE_STRING Name;
882 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
887 PLSA_TRUST_INFORMATION Domains;
888 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
892 IN LSA_HANDLE PolicyHandle,
895 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
896 OUT PLSA_TRANSLATED_NAME *Names )
898 FIXME("%p %lu %p %p %p\n",
899 PolicyHandle, Count, Sids, ReferencedDomains, Names);
903 /******************************************************************************
904 * LsaFreeMemory [ADVAPI32.@]
907 LsaFreeMemory(IN PVOID Buffer)
909 TRACE("(%p)\n",Buffer);
910 return HeapFree(GetProcessHeap(), 0, Buffer);
912 /******************************************************************************
913 * LsaClose [ADVAPI32.@]
916 LsaClose(IN LSA_HANDLE ObjectHandle)
918 FIXME("(%p):stub\n",ObjectHandle);
922 /******************************************************************************
923 * LsaNtStatusToWinError [ADVAPI32.@]
929 LsaNtStatusToWinError(NTSTATUS Status)
931 return RtlNtStatusToDosError(Status);
934 /******************************************************************************
935 * NotifyBootConfigStatus [ADVAPI32.@]
941 NotifyBootConfigStatus( DWORD x1 )
943 FIXME("(0x%08lx):stub\n",x1);
947 /******************************************************************************
948 * RevertToSelf [ADVAPI32.@]
960 /******************************************************************************
961 * ImpersonateSelf [ADVAPI32.@]
964 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
966 return RtlImpersonateSelf(ImpersonationLevel);
969 /******************************************************************************
970 * ImpersonateLoggedOnUser [ADVAPI32.@]
972 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
974 FIXME("(%08x):stub returning FALSE\n", hToken);
978 /******************************************************************************
979 * AccessCheck [ADVAPI32.@]
981 * FIXME check cast LPBOOL to PBOOLEAN
985 PSECURITY_DESCRIPTOR SecurityDescriptor,
988 PGENERIC_MAPPING GenericMapping,
989 PPRIVILEGE_SET PrivilegeSet,
990 LPDWORD PrivilegeSetLength,
991 LPDWORD GrantedAccess,
994 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
995 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
998 /*************************************************************************
999 * SetKernelObjectSecurity [ADVAPI32.@]
1001 BOOL WINAPI SetKernelObjectSecurity (
1003 IN SECURITY_INFORMATION SecurityInformation,
1004 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1006 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1009 /******************************************************************************
1010 * AddAccessAllowedAce [ADVAPI32.@]
1012 BOOL WINAPI AddAccessAllowedAce(
1014 IN DWORD dwAceRevision,
1015 IN DWORD AccessMask,
1018 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1021 /******************************************************************************
1022 * LookupAccountNameA [ADVAPI32.@]
1030 LPSTR ReferencedDomainName,
1031 IN OUT LPDWORD cbReferencedDomainName,
1032 OUT PSID_NAME_USE name_use )
1034 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1038 /******************************************************************************
1039 * GetAce [ADVAPI32.@]
1041 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1043 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1046 /******************************************************************************
1047 * PrivilegeCheck [ADVAPI32.@]
1049 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1051 FIXME("stub %d %p %p\n", ClientToken, RequiredPrivileges, pfResult);