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 UNICODE_STRING lpSystemNameW;
638 UNICODE_STRING lpNameW;
641 RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
642 RtlCreateUnicodeStringFromAsciiz(&lpNameW,lpName);
643 ret = LookupPrivilegeValueW(lpSystemNameW.Buffer, lpNameW.Buffer, lpLuid);
644 RtlFreeUnicodeString(&lpNameW);
645 RtlFreeUnicodeString(&lpSystemNameW);
649 /******************************************************************************
650 * GetFileSecurityA [ADVAPI32.@]
652 * Obtains Specified information about the security of a file or directory
653 * The information obtained is constrained by the callers access rights and
657 GetFileSecurityA( LPCSTR lpFileName,
658 SECURITY_INFORMATION RequestedInformation,
659 PSECURITY_DESCRIPTOR pSecurityDescriptor,
660 DWORD nLength, LPDWORD lpnLengthNeeded )
662 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
666 /******************************************************************************
667 * GetFileSecurityW [ADVAPI32.@]
669 * Obtains Specified information about the security of a file or directory
670 * The information obtained is constrained by the callers access rights and
675 * RequestedInformation []
676 * pSecurityDescriptor []
681 GetFileSecurityW( LPCWSTR lpFileName,
682 SECURITY_INFORMATION RequestedInformation,
683 PSECURITY_DESCRIPTOR pSecurityDescriptor,
684 DWORD nLength, LPDWORD lpnLengthNeeded )
686 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
691 /******************************************************************************
692 * LookupAccountSidA [ADVAPI32.@]
699 IN OUT LPDWORD accountSize,
701 IN OUT LPDWORD domainSize,
702 OUT PSID_NAME_USE name_use )
704 static const char ac[] = "Administrator";
705 static const char dm[] = "DOMAIN";
706 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
707 debugstr_a(system),sid,
708 account,accountSize,accountSize?*accountSize:0,
709 domain,domainSize,domainSize?*domainSize:0,
712 if (accountSize) *accountSize = strlen(ac)+1;
713 if (account && (*accountSize > strlen(ac)))
716 if (domainSize) *domainSize = strlen(dm)+1;
717 if (domain && (*domainSize > strlen(dm)))
720 if (name_use) *name_use = SidTypeUser;
724 /******************************************************************************
725 * LookupAccountSidW [ADVAPI32.@]
741 IN OUT LPDWORD accountSize,
743 IN OUT LPDWORD domainSize,
744 OUT PSID_NAME_USE name_use )
746 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
747 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
748 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
749 debugstr_w(system),sid,
750 account,accountSize,accountSize?*accountSize:0,
751 domain,domainSize,domainSize?*domainSize:0,
754 if (accountSize) *accountSize = strlenW(ac)+1;
755 if (account && (*accountSize > strlenW(ac)))
756 strcpyW(account, ac);
758 if (domainSize) *domainSize = strlenW(dm)+1;
759 if (domain && (*domainSize > strlenW(dm)))
762 if (name_use) *name_use = SidTypeUser;
766 /******************************************************************************
767 * SetFileSecurityA [ADVAPI32.@]
768 * Sets the security of a file or directory
770 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
771 SECURITY_INFORMATION RequestedInformation,
772 PSECURITY_DESCRIPTOR pSecurityDescriptor)
774 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
778 /******************************************************************************
779 * SetFileSecurityW [ADVAPI32.@]
780 * Sets the security of a file or directory
784 * RequestedInformation []
785 * pSecurityDescriptor []
788 SetFileSecurityW( LPCWSTR lpFileName,
789 SECURITY_INFORMATION RequestedInformation,
790 PSECURITY_DESCRIPTOR pSecurityDescriptor )
792 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
796 /******************************************************************************
797 * QueryWindows31FilesMigration [ADVAPI32.@]
803 QueryWindows31FilesMigration( DWORD x1 )
805 FIXME("(%ld):stub\n",x1);
809 /******************************************************************************
810 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
819 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
822 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
826 /******************************************************************************
827 * LsaOpenPolicy [ADVAPI32.@]
837 IN PLSA_UNICODE_STRING SystemName,
838 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
839 IN ACCESS_MASK DesiredAccess,
840 IN OUT PLSA_HANDLE PolicyHandle)
842 FIXME("(%s,%p,0x%08lx,%p):stub\n",
843 SystemName?debugstr_w(SystemName->Buffer):"null",
844 ObjectAttributes, DesiredAccess, PolicyHandle);
845 ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
846 STATUS_ACCESS_VIOLATION);
847 dumpLsaAttributes(ObjectAttributes);
848 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
849 return STATUS_SUCCESS;
852 /******************************************************************************
853 * LsaQueryInformationPolicy [ADVAPI32.@]
856 LsaQueryInformationPolicy(
857 IN LSA_HANDLE PolicyHandle,
858 IN POLICY_INFORMATION_CLASS InformationClass,
861 FIXME("(%p,0x%08x,%p):stub\n",
862 PolicyHandle, InformationClass, Buffer);
864 if(!Buffer) return FALSE;
865 switch (InformationClass)
867 case PolicyAuditEventsInformation: /* 2 */
869 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
870 p->AuditingMode = FALSE; /* no auditing */
874 case PolicyPrimaryDomainInformation: /* 3 */
875 case PolicyAccountDomainInformation: /* 5 */
878 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
881 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
883 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
884 RtlCreateUnicodeStringFromAsciiz(&(xdi->ppdi.Name), "DOMAIN");
885 xdi->ppdi.Sid = &(xdi->sid);
886 xdi->sid.Revision = SID_REVISION;
887 xdi->sid.SubAuthorityCount = 1;
888 xdi->sid.IdentifierAuthority = localSidAuthority;
889 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
893 case PolicyAuditLogInformation:
894 case PolicyPdAccountInformation:
895 case PolicyLsaServerRoleInformation:
896 case PolicyReplicaSourceInformation:
897 case PolicyDefaultQuotaInformation:
898 case PolicyModificationInformation:
899 case PolicyAuditFullSetInformation:
900 case PolicyAuditFullQueryInformation:
901 case PolicyDnsDomainInformation:
903 FIXME("category not implemented\n");
910 /******************************************************************************
911 * LsaLookupSids [ADVAPI32.@]
916 LSA_UNICODE_STRING Name;
918 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
922 LSA_UNICODE_STRING Name;
924 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
929 PLSA_TRUST_INFORMATION Domains;
930 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
934 IN LSA_HANDLE PolicyHandle,
937 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
938 OUT PLSA_TRANSLATED_NAME *Names )
940 FIXME("%p %lu %p %p %p\n",
941 PolicyHandle, Count, Sids, ReferencedDomains, Names);
945 /******************************************************************************
946 * LsaFreeMemory [ADVAPI32.@]
949 LsaFreeMemory(IN PVOID Buffer)
951 TRACE("(%p)\n",Buffer);
952 return HeapFree(GetProcessHeap(), 0, Buffer);
954 /******************************************************************************
955 * LsaClose [ADVAPI32.@]
958 LsaClose(IN LSA_HANDLE ObjectHandle)
960 FIXME("(%p):stub\n",ObjectHandle);
964 /******************************************************************************
965 * LsaNtStatusToWinError [ADVAPI32.@]
971 LsaNtStatusToWinError(NTSTATUS Status)
973 return RtlNtStatusToDosError(Status);
976 /******************************************************************************
977 * NotifyBootConfigStatus [ADVAPI32.@]
983 NotifyBootConfigStatus( DWORD x1 )
985 FIXME("(0x%08lx):stub\n",x1);
989 /******************************************************************************
990 * RevertToSelf [ADVAPI32.@]
1002 /******************************************************************************
1003 * ImpersonateSelf [ADVAPI32.@]
1006 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1008 return RtlImpersonateSelf(ImpersonationLevel);
1011 /******************************************************************************
1012 * ImpersonateLoggedOnUser [ADVAPI32.@]
1014 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
1016 FIXME("(%p):stub returning FALSE\n", hToken);
1020 /******************************************************************************
1021 * AccessCheck [ADVAPI32.@]
1023 * FIXME check cast LPBOOL to PBOOLEAN
1027 PSECURITY_DESCRIPTOR SecurityDescriptor,
1029 DWORD DesiredAccess,
1030 PGENERIC_MAPPING GenericMapping,
1031 PPRIVILEGE_SET PrivilegeSet,
1032 LPDWORD PrivilegeSetLength,
1033 LPDWORD GrantedAccess,
1034 LPBOOL AccessStatus)
1036 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
1037 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
1040 /*************************************************************************
1041 * SetKernelObjectSecurity [ADVAPI32.@]
1043 BOOL WINAPI SetKernelObjectSecurity (
1045 IN SECURITY_INFORMATION SecurityInformation,
1046 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1048 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1051 /******************************************************************************
1052 * AddAccessAllowedAce [ADVAPI32.@]
1054 BOOL WINAPI AddAccessAllowedAce(
1056 IN DWORD dwAceRevision,
1057 IN DWORD AccessMask,
1060 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1063 /******************************************************************************
1064 * LookupAccountNameA [ADVAPI32.@]
1072 LPSTR ReferencedDomainName,
1073 IN OUT LPDWORD cbReferencedDomainName,
1074 OUT PSID_NAME_USE name_use )
1076 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1080 /******************************************************************************
1081 * GetAce [ADVAPI32.@]
1083 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1085 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1088 /******************************************************************************
1089 * PrivilegeCheck [ADVAPI32.@]
1091 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1093 FIXME("stub %p %p %p\n", ClientToken, RequiredPrivileges, pfResult);
1099 /******************************************************************************
1100 * GetSecurityInfoExW [ADVAPI32.@]
1102 DWORD WINAPI GetSecurityInfoExW(
1103 HANDLE hObject, SE_OBJECT_TYPE ObjectType,
1104 SECURITY_INFORMATION SecurityInfo, LPCWSTR lpProvider,
1105 LPCWSTR lpProperty, PACTRL_ACCESSW *ppAccessList,
1106 PACTRL_AUDITW *ppAuditList, LPWSTR *lppOwner, LPWSTR *lppGroup
1110 return ERROR_BAD_PROVIDER;