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()
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
36 #define CallWin32ToNt(func) \
39 if (ret !=STATUS_SUCCESS) \
40 { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
44 static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa )
48 TRACE("\n\tlength=%lu, rootdir=%p, objectname=%s\n\tattr=0x%08lx, sid=%p qos=%p\n",
49 oa->Length, oa->RootDirectory,
50 oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
51 oa->Attributes, oa->SecurityDescriptor, oa->SecurityQualityOfService);
55 /************************************************************
56 * ADVAPI_IsLocalComputer
58 * Checks whether the server name indicates local machine.
60 BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
68 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
72 buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
73 Result = GetComputerNameW(buf, &dwSize);
74 if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
76 Result = Result && !lstrcmpW(ServerName, buf);
77 HeapFree(GetProcessHeap(), 0, buf);
83 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
84 if (!ADVAPI_IsLocalComputer(ServerName)) \
86 FIXME("Action Implemented for local computer only. " \
87 "Requested for server %s\n", debugstr_w(ServerName)); \
91 /* ##############################
92 ###### TOKEN FUNCTIONS ######
93 ##############################
96 /******************************************************************************
97 * OpenProcessToken [ADVAPI32.@]
98 * Opens the access token associated with a process
101 * ProcessHandle [I] Handle to process
102 * DesiredAccess [I] Desired access to process
103 * TokenHandle [O] Pointer to handle of open access token
108 OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
109 HANDLE *TokenHandle )
111 CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
114 /******************************************************************************
115 * OpenThreadToken [ADVAPI32.@]
124 OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
125 BOOL OpenAsSelf, HANDLE *TokenHandle)
127 CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
130 /******************************************************************************
131 * AdjustTokenPrivileges [ADVAPI32.@]
135 * DisableAllPrivileges []
142 AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
143 LPVOID NewState, DWORD BufferLength,
144 LPVOID PreviousState, LPDWORD ReturnLength )
146 CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
149 /******************************************************************************
150 * CheckTokenMembership [ADVAPI32.@]
158 CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
161 FIXME("(%p %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
167 /******************************************************************************
168 * GetTokenInformation [ADVAPI32.@]
174 * tokeninfolength [I]
179 GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
180 LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
182 TRACE("(%p, %s, %p, %ld, %p): \n",
184 (tokeninfoclass == TokenUser) ? "TokenUser" :
185 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
186 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
187 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
188 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
189 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
190 (tokeninfoclass == TokenSource) ? "TokenSource" :
191 (tokeninfoclass == TokenType) ? "TokenType" :
192 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
193 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
194 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
195 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
196 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
197 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
198 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
200 tokeninfo, tokeninfolength, retlen);
201 CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
204 /******************************************************************************
205 * SetTokenInformation [ADVAPI32.@]
211 * tokeninfolength [I]
215 SetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
216 LPVOID tokeninfo, DWORD tokeninfolength )
218 FIXME("(%p, %s, %p, %ld): stub\n",
220 (tokeninfoclass == TokenUser) ? "TokenUser" :
221 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
222 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
223 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
224 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
225 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
226 (tokeninfoclass == TokenSource) ? "TokenSource" :
227 (tokeninfoclass == TokenType) ? "TokenType" :
228 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
229 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
230 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
231 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
232 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
233 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
234 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
236 tokeninfo, tokeninfolength);
238 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
243 /*************************************************************************
244 * SetThreadToken [ADVAPI32.@]
246 * Assigns an "impersonation token" to a thread so it can assume the
247 * security privledges of another thread or process. Can also remove
248 * a previously assigned token. Only supported on NT - it's a stub
249 * exactly like this one on Win9X.
253 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
255 FIXME("(%p, %p): stub (NT impl. only)\n", thread, token);
257 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
262 /* ##############################
263 ###### SID FUNCTIONS ######
264 ##############################
267 /******************************************************************************
268 * AllocateAndInitializeSid [ADVAPI32.@]
271 * pIdentifierAuthority []
272 * nSubAuthorityCount []
284 AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
285 BYTE nSubAuthorityCount,
286 DWORD nSubAuthority0, DWORD nSubAuthority1,
287 DWORD nSubAuthority2, DWORD nSubAuthority3,
288 DWORD nSubAuthority4, DWORD nSubAuthority5,
289 DWORD nSubAuthority6, DWORD nSubAuthority7,
292 CallWin32ToNt (RtlAllocateAndInitializeSid(
293 pIdentifierAuthority, nSubAuthorityCount,
294 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
295 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
299 /******************************************************************************
300 * FreeSid [ADVAPI32.@]
309 return NULL; /* is documented like this */
312 /******************************************************************************
313 * CopySid [ADVAPI32.@]
316 * nDestinationSidLength []
321 CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
323 return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
326 /******************************************************************************
327 * IsValidSid [ADVAPI32.@]
333 IsValidSid( PSID pSid )
335 return RtlValidSid( pSid );
338 /******************************************************************************
339 * EqualSid [ADVAPI32.@]
346 EqualSid( PSID pSid1, PSID pSid2 )
348 return RtlEqualSid( pSid1, pSid2 );
351 /******************************************************************************
352 * EqualPrefixSid [ADVAPI32.@]
354 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
356 return RtlEqualPrefixSid(pSid1, pSid2);
359 /******************************************************************************
360 * GetSidLengthRequired [ADVAPI32.@]
363 * nSubAuthorityCount []
366 GetSidLengthRequired( BYTE nSubAuthorityCount )
368 return RtlLengthRequiredSid(nSubAuthorityCount);
371 /******************************************************************************
372 * InitializeSid [ADVAPI32.@]
375 * pIdentifierAuthority []
380 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
381 BYTE nSubAuthorityCount)
383 return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
386 /******************************************************************************
387 * GetSidIdentifierAuthority [ADVAPI32.@]
392 PSID_IDENTIFIER_AUTHORITY WINAPI
393 GetSidIdentifierAuthority( PSID pSid )
395 return RtlIdentifierAuthoritySid(pSid);
398 /******************************************************************************
399 * GetSidSubAuthority [ADVAPI32.@]
406 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
408 return RtlSubAuthoritySid(pSid, nSubAuthority);
411 /******************************************************************************
412 * GetSidSubAuthorityCount [ADVAPI32.@]
418 GetSidSubAuthorityCount (PSID pSid)
420 return RtlSubAuthorityCountSid(pSid);
423 /******************************************************************************
424 * GetLengthSid [ADVAPI32.@]
430 GetLengthSid (PSID pSid)
432 return RtlLengthSid(pSid);
435 /* ##############################################
436 ###### SECURITY DESCRIPTOR FUNCTIONS ######
437 ##############################################
440 /******************************************************************************
441 * InitializeSecurityDescriptor [ADVAPI32.@]
448 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
450 CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
453 /******************************************************************************
454 * GetSecurityDescriptorLength [ADVAPI32.@]
456 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
458 return (RtlLengthSecurityDescriptor(pDescr));
461 /******************************************************************************
462 * GetSecurityDescriptorOwner [ADVAPI32.@]
466 * lpbOwnerDefaulted []
469 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
470 LPBOOL lpbOwnerDefaulted )
472 CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
475 /******************************************************************************
476 * SetSecurityDescriptorOwner [ADVAPI32.@]
480 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
481 PSID pOwner, BOOL bOwnerDefaulted)
483 CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
485 /******************************************************************************
486 * GetSecurityDescriptorGroup [ADVAPI32.@]
488 BOOL WINAPI GetSecurityDescriptorGroup(
489 PSECURITY_DESCRIPTOR SecurityDescriptor,
491 LPBOOL GroupDefaulted)
493 CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
495 /******************************************************************************
496 * SetSecurityDescriptorGroup [ADVAPI32.@]
498 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
499 PSID Group, BOOL GroupDefaulted)
501 CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
504 /******************************************************************************
505 * IsValidSecurityDescriptor [ADVAPI32.@]
511 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
513 CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
516 /******************************************************************************
517 * GetSecurityDescriptorDacl [ADVAPI32.@]
519 BOOL WINAPI GetSecurityDescriptorDacl(
520 IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
521 OUT LPBOOL lpbDaclPresent,
523 OUT LPBOOL lpbDaclDefaulted)
525 CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
526 pDacl, (PBOOLEAN)lpbDaclDefaulted));
529 /******************************************************************************
530 * SetSecurityDescriptorDacl [ADVAPI32.@]
533 SetSecurityDescriptorDacl (
534 PSECURITY_DESCRIPTOR lpsd,
539 CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
541 /******************************************************************************
542 * GetSecurityDescriptorSacl [ADVAPI32.@]
544 BOOL WINAPI GetSecurityDescriptorSacl(
545 IN PSECURITY_DESCRIPTOR lpsd,
546 OUT LPBOOL lpbSaclPresent,
548 OUT LPBOOL lpbSaclDefaulted)
550 CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
551 (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
554 /**************************************************************************
555 * SetSecurityDescriptorSacl [ADVAPI32.@]
557 BOOL WINAPI SetSecurityDescriptorSacl (
558 PSECURITY_DESCRIPTOR lpsd,
563 CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
565 /******************************************************************************
566 * MakeSelfRelativeSD [ADVAPI32.@]
575 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
576 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
577 IN OUT LPDWORD lpdwBufferLength)
579 CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength));
582 /******************************************************************************
583 * GetSecurityDescriptorControl [ADVAPI32.@]
586 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
587 PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
589 CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
592 /* ##############################
593 ###### ACL FUNCTIONS ######
594 ##############################
597 /*************************************************************************
598 * InitializeAcl [ADVAPI32.@]
600 DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
602 CallWin32ToNt (RtlCreateAcl(acl, size, rev));
605 /* ##############################
606 ###### MISC FUNCTIONS ######
607 ##############################
610 /******************************************************************************
611 * LookupPrivilegeValueW [ADVAPI32.@]
612 * Retrieves LUID used on a system to represent the privilege name.
615 * lpSystemName [I] Address of string specifying the system
616 * lpName [I] Address of string specifying the privilege
617 * lpLuid [I] Address of locally unique identifier
622 LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid )
624 FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
625 debugstr_w(lpName), lpLuid);
626 lpLuid->LowPart = 0x12345678;
627 lpLuid->HighPart = 0x87654321;
631 /******************************************************************************
632 * LookupPrivilegeValueA [ADVAPI32.@]
635 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid )
637 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
638 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
641 ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
642 HeapFree(GetProcessHeap(), 0, lpNameW);
643 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
647 /******************************************************************************
648 * GetFileSecurityA [ADVAPI32.@]
650 * Obtains Specified information about the security of a file or directory
651 * The information obtained is constrained by the callers access rights and
655 GetFileSecurityA( LPCSTR lpFileName,
656 SECURITY_INFORMATION RequestedInformation,
657 PSECURITY_DESCRIPTOR pSecurityDescriptor,
658 DWORD nLength, LPDWORD lpnLengthNeeded )
660 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
664 /******************************************************************************
665 * GetFileSecurityW [ADVAPI32.@]
667 * Obtains Specified information about the security of a file or directory
668 * The information obtained is constrained by the callers access rights and
673 * RequestedInformation []
674 * pSecurityDescriptor []
679 GetFileSecurityW( LPCWSTR lpFileName,
680 SECURITY_INFORMATION RequestedInformation,
681 PSECURITY_DESCRIPTOR pSecurityDescriptor,
682 DWORD nLength, LPDWORD lpnLengthNeeded )
684 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
689 /******************************************************************************
690 * LookupAccountSidA [ADVAPI32.@]
697 IN OUT LPDWORD accountSize,
699 IN OUT LPDWORD domainSize,
700 OUT PSID_NAME_USE name_use )
702 static const char ac[] = "Administrator";
703 static const char dm[] = "DOMAIN";
704 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
705 debugstr_a(system),sid,
706 account,accountSize,accountSize?*accountSize:0,
707 domain,domainSize,domainSize?*domainSize:0,
710 if (accountSize) *accountSize = strlen(ac)+1;
711 if (account && (*accountSize > strlen(ac)))
714 if (domainSize) *domainSize = strlen(dm)+1;
715 if (domain && (*domainSize > strlen(dm)))
718 if (name_use) *name_use = SidTypeUser;
722 /******************************************************************************
723 * LookupAccountSidW [ADVAPI32.@]
739 IN OUT LPDWORD accountSize,
741 IN OUT LPDWORD domainSize,
742 OUT PSID_NAME_USE name_use )
744 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
745 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
746 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
747 debugstr_w(system),sid,
748 account,accountSize,accountSize?*accountSize:0,
749 domain,domainSize,domainSize?*domainSize:0,
752 if (accountSize) *accountSize = strlenW(ac)+1;
753 if (account && (*accountSize > strlenW(ac)))
754 strcpyW(account, ac);
756 if (domainSize) *domainSize = strlenW(dm)+1;
757 if (domain && (*domainSize > strlenW(dm)))
760 if (name_use) *name_use = SidTypeUser;
764 /******************************************************************************
765 * SetFileSecurityA [ADVAPI32.@]
766 * Sets the security of a file or directory
768 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
769 SECURITY_INFORMATION RequestedInformation,
770 PSECURITY_DESCRIPTOR pSecurityDescriptor)
772 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
776 /******************************************************************************
777 * SetFileSecurityW [ADVAPI32.@]
778 * Sets the security of a file or directory
782 * RequestedInformation []
783 * pSecurityDescriptor []
786 SetFileSecurityW( LPCWSTR lpFileName,
787 SECURITY_INFORMATION RequestedInformation,
788 PSECURITY_DESCRIPTOR pSecurityDescriptor )
790 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
794 /******************************************************************************
795 * QueryWindows31FilesMigration [ADVAPI32.@]
801 QueryWindows31FilesMigration( DWORD x1 )
803 FIXME("(%ld):stub\n",x1);
807 /******************************************************************************
808 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
817 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
820 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
824 /******************************************************************************
825 * LsaOpenPolicy [ADVAPI32.@]
835 IN PLSA_UNICODE_STRING SystemName,
836 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
837 IN ACCESS_MASK DesiredAccess,
838 IN OUT PLSA_HANDLE PolicyHandle)
840 FIXME("(%s,%p,0x%08lx,%p):stub\n",
841 SystemName?debugstr_w(SystemName->Buffer):"null",
842 ObjectAttributes, DesiredAccess, PolicyHandle);
843 ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
844 STATUS_ACCESS_VIOLATION);
845 dumpLsaAttributes(ObjectAttributes);
846 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
847 return STATUS_SUCCESS;
850 /******************************************************************************
851 * LsaQueryInformationPolicy [ADVAPI32.@]
854 LsaQueryInformationPolicy(
855 IN LSA_HANDLE PolicyHandle,
856 IN POLICY_INFORMATION_CLASS InformationClass,
859 FIXME("(%p,0x%08x,%p):stub\n",
860 PolicyHandle, InformationClass, Buffer);
862 if(!Buffer) return FALSE;
863 switch (InformationClass)
865 case PolicyAuditEventsInformation: /* 2 */
867 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
868 p->AuditingMode = FALSE; /* no auditing */
872 case PolicyPrimaryDomainInformation: /* 3 */
873 case PolicyAccountDomainInformation: /* 5 */
876 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
879 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
881 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
882 RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
883 xdi->ppdi.Sid = &(xdi->sid);
884 xdi->sid.Revision = SID_REVISION;
885 xdi->sid.SubAuthorityCount = 1;
886 xdi->sid.IdentifierAuthority = localSidAuthority;
887 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
891 case PolicyAuditLogInformation:
892 case PolicyPdAccountInformation:
893 case PolicyLsaServerRoleInformation:
894 case PolicyReplicaSourceInformation:
895 case PolicyDefaultQuotaInformation:
896 case PolicyModificationInformation:
897 case PolicyAuditFullSetInformation:
898 case PolicyAuditFullQueryInformation:
899 case PolicyDnsDomainInformation:
901 FIXME("category not implemented\n");
908 /******************************************************************************
909 * LsaLookupSids [ADVAPI32.@]
914 LSA_UNICODE_STRING Name;
916 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
920 LSA_UNICODE_STRING Name;
922 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
927 PLSA_TRUST_INFORMATION Domains;
928 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
932 IN LSA_HANDLE PolicyHandle,
935 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
936 OUT PLSA_TRANSLATED_NAME *Names )
938 FIXME("%p %lu %p %p %p\n",
939 PolicyHandle, Count, Sids, ReferencedDomains, Names);
943 /******************************************************************************
944 * LsaFreeMemory [ADVAPI32.@]
947 LsaFreeMemory(IN PVOID Buffer)
949 TRACE("(%p)\n",Buffer);
950 return HeapFree(GetProcessHeap(), 0, Buffer);
952 /******************************************************************************
953 * LsaClose [ADVAPI32.@]
956 LsaClose(IN LSA_HANDLE ObjectHandle)
958 FIXME("(%p):stub\n",ObjectHandle);
962 /******************************************************************************
963 * LsaNtStatusToWinError [ADVAPI32.@]
969 LsaNtStatusToWinError(NTSTATUS Status)
971 return RtlNtStatusToDosError(Status);
974 /******************************************************************************
975 * NotifyBootConfigStatus [ADVAPI32.@]
981 NotifyBootConfigStatus( DWORD x1 )
983 FIXME("(0x%08lx):stub\n",x1);
987 /******************************************************************************
988 * RevertToSelf [ADVAPI32.@]
1000 /******************************************************************************
1001 * ImpersonateSelf [ADVAPI32.@]
1004 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1006 return RtlImpersonateSelf(ImpersonationLevel);
1009 /******************************************************************************
1010 * ImpersonateLoggedOnUser [ADVAPI32.@]
1012 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
1014 FIXME("(%p):stub returning FALSE\n", hToken);
1018 /******************************************************************************
1019 * AccessCheck [ADVAPI32.@]
1021 * FIXME check cast LPBOOL to PBOOLEAN
1025 PSECURITY_DESCRIPTOR SecurityDescriptor,
1027 DWORD DesiredAccess,
1028 PGENERIC_MAPPING GenericMapping,
1029 PPRIVILEGE_SET PrivilegeSet,
1030 LPDWORD PrivilegeSetLength,
1031 LPDWORD GrantedAccess,
1032 LPBOOL AccessStatus)
1034 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
1035 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
1038 /*************************************************************************
1039 * SetKernelObjectSecurity [ADVAPI32.@]
1041 BOOL WINAPI SetKernelObjectSecurity (
1043 IN SECURITY_INFORMATION SecurityInformation,
1044 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1046 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1049 /******************************************************************************
1050 * AddAccessAllowedAce [ADVAPI32.@]
1052 BOOL WINAPI AddAccessAllowedAce(
1054 IN DWORD dwAceRevision,
1055 IN DWORD AccessMask,
1058 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1061 /******************************************************************************
1062 * LookupAccountNameA [ADVAPI32.@]
1070 LPSTR ReferencedDomainName,
1071 IN OUT LPDWORD cbReferencedDomainName,
1072 OUT PSID_NAME_USE name_use )
1074 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1078 /******************************************************************************
1079 * GetAce [ADVAPI32.@]
1081 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1083 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1086 /******************************************************************************
1087 * PrivilegeCheck [ADVAPI32.@]
1089 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1091 FIXME("stub %p %p %p\n", ClientToken, RequiredPrivileges, pfResult);
1097 /******************************************************************************
1098 * GetSecurityInfoExW [ADVAPI32.@]
1100 DWORD WINAPI GetSecurityInfoExW(
1101 HANDLE hObject, SE_OBJECT_TYPE ObjectType,
1102 SECURITY_INFORMATION SecurityInfo, LPCWSTR lpProvider,
1103 LPCWSTR lpProperty, PACTRL_ACCESSW *ppAccessList,
1104 PACTRL_AUDITW *ppAuditList, LPWSTR *lppOwner, LPWSTR *lppGroup
1108 return ERROR_BAD_PROVIDER;