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 * ADVAPI_IsLocalComputer
55 * Checks whether the server name indicates local machine.
57 BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
65 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
69 buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
70 Result = GetComputerNameW(buf, &dwSize);
71 if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
73 Result = Result && !lstrcmpW(ServerName, buf);
74 HeapFree(GetProcessHeap(), 0, buf);
80 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
81 if (!ADVAPI_IsLocalComputer(ServerName)) \
83 FIXME("Action Implemented for local computer only. " \
84 "Requested for server %s\n", debugstr_w(ServerName)); \
88 /* ##############################
89 ###### TOKEN FUNCTIONS ######
90 ##############################
93 /******************************************************************************
94 * OpenProcessToken [ADVAPI32.@]
95 * Opens the access token associated with a process
98 * ProcessHandle [I] Handle to process
99 * DesiredAccess [I] Desired access to process
100 * TokenHandle [O] Pointer to handle of open access token
105 OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
106 HANDLE *TokenHandle )
108 CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
111 /******************************************************************************
112 * OpenThreadToken [ADVAPI32.@]
121 OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
122 BOOL OpenAsSelf, HANDLE *TokenHandle)
124 CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
127 /******************************************************************************
128 * AdjustTokenPrivileges [ADVAPI32.@]
132 * DisableAllPrivileges []
139 AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
140 LPVOID NewState, DWORD BufferLength,
141 LPVOID PreviousState, LPDWORD ReturnLength )
143 CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
146 /******************************************************************************
147 * CheckTokenMembership [ADVAPI32.@]
155 CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
158 FIXME("(0x%08x %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
164 /******************************************************************************
165 * GetTokenInformation [ADVAPI32.@]
171 * tokeninfolength [I]
176 GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
177 LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
179 TRACE("(%x, %s, %p, %ld, %p): \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, retlen);
198 CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
201 /******************************************************************************
202 * SetTokenInformation [ADVAPI32.@]
208 * tokeninfolength [I]
212 SetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
213 LPVOID tokeninfo, DWORD tokeninfolength )
215 FIXME("(%x, %s, %p, %ld): stub\n",
217 (tokeninfoclass == TokenUser) ? "TokenUser" :
218 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
219 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
220 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
221 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
222 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
223 (tokeninfoclass == TokenSource) ? "TokenSource" :
224 (tokeninfoclass == TokenType) ? "TokenType" :
225 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
226 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
227 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
228 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
229 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
230 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
231 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
233 tokeninfo, tokeninfolength);
235 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
240 /*************************************************************************
241 * SetThreadToken [ADVAPI32.@]
243 * Assigns an "impersonation token" to a thread so it can assume the
244 * security privledges of another thread or process. Can also remove
245 * a previously assigned token. Only supported on NT - it's a stub
246 * exactly like this one on Win9X.
250 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
252 FIXME("(%p, %x): stub (NT impl. only)\n", thread, token);
254 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
259 /* ##############################
260 ###### SID FUNCTIONS ######
261 ##############################
264 /******************************************************************************
265 * AllocateAndInitializeSid [ADVAPI32.@]
268 * pIdentifierAuthority []
269 * nSubAuthorityCount []
281 AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
282 BYTE nSubAuthorityCount,
283 DWORD nSubAuthority0, DWORD nSubAuthority1,
284 DWORD nSubAuthority2, DWORD nSubAuthority3,
285 DWORD nSubAuthority4, DWORD nSubAuthority5,
286 DWORD nSubAuthority6, DWORD nSubAuthority7,
289 CallWin32ToNt (RtlAllocateAndInitializeSid(
290 pIdentifierAuthority, nSubAuthorityCount,
291 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
292 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
296 /******************************************************************************
297 * FreeSid [ADVAPI32.@]
306 return NULL; /* is documented like this */
309 /******************************************************************************
310 * CopySid [ADVAPI32.@]
313 * nDestinationSidLength []
318 CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
320 return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
323 /******************************************************************************
324 * IsValidSid [ADVAPI32.@]
330 IsValidSid( PSID pSid )
332 return RtlValidSid( pSid );
335 /******************************************************************************
336 * EqualSid [ADVAPI32.@]
343 EqualSid( PSID pSid1, PSID pSid2 )
345 return RtlEqualSid( pSid1, pSid2 );
348 /******************************************************************************
349 * EqualPrefixSid [ADVAPI32.@]
351 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
353 return RtlEqualPrefixSid(pSid1, pSid2);
356 /******************************************************************************
357 * GetSidLengthRequired [ADVAPI32.@]
360 * nSubAuthorityCount []
363 GetSidLengthRequired( BYTE nSubAuthorityCount )
365 return RtlLengthRequiredSid(nSubAuthorityCount);
368 /******************************************************************************
369 * InitializeSid [ADVAPI32.@]
372 * pIdentifierAuthority []
377 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
378 BYTE nSubAuthorityCount)
380 return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
383 /******************************************************************************
384 * GetSidIdentifierAuthority [ADVAPI32.@]
389 PSID_IDENTIFIER_AUTHORITY WINAPI
390 GetSidIdentifierAuthority( PSID pSid )
392 return RtlIdentifierAuthoritySid(pSid);
395 /******************************************************************************
396 * GetSidSubAuthority [ADVAPI32.@]
403 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
405 return RtlSubAuthoritySid(pSid, nSubAuthority);
408 /******************************************************************************
409 * GetSidSubAuthorityCount [ADVAPI32.@]
415 GetSidSubAuthorityCount (PSID pSid)
417 return RtlSubAuthorityCountSid(pSid);
420 /******************************************************************************
421 * GetLengthSid [ADVAPI32.@]
427 GetLengthSid (PSID pSid)
429 return RtlLengthSid(pSid);
432 /* ##############################################
433 ###### SECURITY DESCRIPTOR FUNCTIONS ######
434 ##############################################
437 /******************************************************************************
438 * InitializeSecurityDescriptor [ADVAPI32.@]
445 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
447 CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
450 /******************************************************************************
451 * GetSecurityDescriptorLength [ADVAPI32.@]
453 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
455 return (RtlLengthSecurityDescriptor(pDescr));
458 /******************************************************************************
459 * GetSecurityDescriptorOwner [ADVAPI32.@]
463 * lpbOwnerDefaulted []
466 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
467 LPBOOL lpbOwnerDefaulted )
469 CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
472 /******************************************************************************
473 * SetSecurityDescriptorOwner [ADVAPI32.@]
477 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
478 PSID pOwner, BOOL bOwnerDefaulted)
480 CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
482 /******************************************************************************
483 * GetSecurityDescriptorGroup [ADVAPI32.@]
485 BOOL WINAPI GetSecurityDescriptorGroup(
486 PSECURITY_DESCRIPTOR SecurityDescriptor,
488 LPBOOL GroupDefaulted)
490 CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
492 /******************************************************************************
493 * SetSecurityDescriptorGroup [ADVAPI32.@]
495 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
496 PSID Group, BOOL GroupDefaulted)
498 CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
501 /******************************************************************************
502 * IsValidSecurityDescriptor [ADVAPI32.@]
508 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
510 CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
513 /******************************************************************************
514 * GetSecurityDescriptorDacl [ADVAPI32.@]
516 BOOL WINAPI GetSecurityDescriptorDacl(
517 IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
518 OUT LPBOOL lpbDaclPresent,
520 OUT LPBOOL lpbDaclDefaulted)
522 CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
523 pDacl, (PBOOLEAN)lpbDaclDefaulted));
526 /******************************************************************************
527 * SetSecurityDescriptorDacl [ADVAPI32.@]
530 SetSecurityDescriptorDacl (
531 PSECURITY_DESCRIPTOR lpsd,
536 CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
538 /******************************************************************************
539 * GetSecurityDescriptorSacl [ADVAPI32.@]
541 BOOL WINAPI GetSecurityDescriptorSacl(
542 IN PSECURITY_DESCRIPTOR lpsd,
543 OUT LPBOOL lpbSaclPresent,
545 OUT LPBOOL lpbSaclDefaulted)
547 CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
548 (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
551 /**************************************************************************
552 * SetSecurityDescriptorSacl [ADVAPI32.@]
554 BOOL WINAPI SetSecurityDescriptorSacl (
555 PSECURITY_DESCRIPTOR lpsd,
560 CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
562 /******************************************************************************
563 * MakeSelfRelativeSD [ADVAPI32.@]
572 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
573 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
574 IN OUT LPDWORD lpdwBufferLength)
576 CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength));
579 /******************************************************************************
580 * GetSecurityDescriptorControl [ADVAPI32.@]
583 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
584 PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
586 CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
589 /* ##############################
590 ###### ACL FUNCTIONS ######
591 ##############################
594 /*************************************************************************
595 * InitializeAcl [ADVAPI32.@]
597 DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
599 CallWin32ToNt (RtlCreateAcl(acl, size, rev));
602 /* ##############################
603 ###### MISC FUNCTIONS ######
604 ##############################
607 /******************************************************************************
608 * LookupPrivilegeValueW [ADVAPI32.@]
609 * Retrieves LUID used on a system to represent the privilege name.
612 * lpLuid should be PLUID
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, LPVOID lpLuid )
624 FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
625 debugstr_w(lpName), lpLuid);
629 /******************************************************************************
630 * LookupPrivilegeValueA [ADVAPI32.@]
633 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
635 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
636 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
639 ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
640 HeapFree(GetProcessHeap(), 0, lpNameW);
641 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
645 /******************************************************************************
646 * GetFileSecurityA [ADVAPI32.@]
648 * Obtains Specified information about the security of a file or directory
649 * The information obtained is constrained by the callers access rights and
653 GetFileSecurityA( LPCSTR lpFileName,
654 SECURITY_INFORMATION RequestedInformation,
655 PSECURITY_DESCRIPTOR pSecurityDescriptor,
656 DWORD nLength, LPDWORD lpnLengthNeeded )
658 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
662 /******************************************************************************
663 * GetFileSecurityW [ADVAPI32.@]
665 * Obtains Specified information about the security of a file or directory
666 * The information obtained is constrained by the callers access rights and
671 * RequestedInformation []
672 * pSecurityDescriptor []
677 GetFileSecurityW( LPCWSTR lpFileName,
678 SECURITY_INFORMATION RequestedInformation,
679 PSECURITY_DESCRIPTOR pSecurityDescriptor,
680 DWORD nLength, LPDWORD lpnLengthNeeded )
682 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
687 /******************************************************************************
688 * LookupAccountSidA [ADVAPI32.@]
695 IN OUT LPDWORD accountSize,
697 IN OUT LPDWORD domainSize,
698 OUT PSID_NAME_USE name_use )
700 static const char ac[] = "Administrator";
701 static const char dm[] = "DOMAIN";
702 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
703 debugstr_a(system),sid,
704 account,accountSize,accountSize?*accountSize:0,
705 domain,domainSize,domainSize?*domainSize:0,
708 if (accountSize) *accountSize = strlen(ac)+1;
709 if (account && (*accountSize > strlen(ac)))
712 if (domainSize) *domainSize = strlen(dm)+1;
713 if (domain && (*domainSize > strlen(dm)))
716 if (name_use) *name_use = SidTypeUser;
720 /******************************************************************************
721 * LookupAccountSidW [ADVAPI32.@]
737 IN OUT LPDWORD accountSize,
739 IN OUT LPDWORD domainSize,
740 OUT PSID_NAME_USE name_use )
742 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
743 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
744 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
745 debugstr_w(system),sid,
746 account,accountSize,accountSize?*accountSize:0,
747 domain,domainSize,domainSize?*domainSize:0,
750 if (accountSize) *accountSize = strlenW(ac)+1;
751 if (account && (*accountSize > strlenW(ac)))
752 strcpyW(account, ac);
754 if (domainSize) *domainSize = strlenW(dm)+1;
755 if (domain && (*domainSize > strlenW(dm)))
758 if (name_use) *name_use = SidTypeUser;
762 /******************************************************************************
763 * SetFileSecurityA [ADVAPI32.@]
764 * Sets the security of a file or directory
766 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
767 SECURITY_INFORMATION RequestedInformation,
768 PSECURITY_DESCRIPTOR pSecurityDescriptor)
770 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
774 /******************************************************************************
775 * SetFileSecurityW [ADVAPI32.@]
776 * Sets the security of a file or directory
780 * RequestedInformation []
781 * pSecurityDescriptor []
784 SetFileSecurityW( LPCWSTR lpFileName,
785 SECURITY_INFORMATION RequestedInformation,
786 PSECURITY_DESCRIPTOR pSecurityDescriptor )
788 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
792 /******************************************************************************
793 * QueryWindows31FilesMigration [ADVAPI32.@]
799 QueryWindows31FilesMigration( DWORD x1 )
801 FIXME("(%ld):stub\n",x1);
805 /******************************************************************************
806 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
815 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
818 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
822 /******************************************************************************
823 * LsaOpenPolicy [ADVAPI32.@]
833 IN PLSA_UNICODE_STRING SystemName,
834 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
835 IN ACCESS_MASK DesiredAccess,
836 IN OUT PLSA_HANDLE PolicyHandle)
838 FIXME("(%s,%p,0x%08lx,%p):stub\n",
839 SystemName?debugstr_w(SystemName->Buffer):"null",
840 ObjectAttributes, DesiredAccess, PolicyHandle);
841 ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
842 STATUS_ACCESS_VIOLATION);
843 dumpLsaAttributes(ObjectAttributes);
844 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
845 return STATUS_SUCCESS;
848 /******************************************************************************
849 * LsaQueryInformationPolicy [ADVAPI32.@]
852 LsaQueryInformationPolicy(
853 IN LSA_HANDLE PolicyHandle,
854 IN POLICY_INFORMATION_CLASS InformationClass,
857 FIXME("(%p,0x%08x,%p):stub\n",
858 PolicyHandle, InformationClass, Buffer);
860 if(!Buffer) return FALSE;
861 switch (InformationClass)
863 case PolicyAuditEventsInformation: /* 2 */
865 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
866 p->AuditingMode = FALSE; /* no auditing */
870 case PolicyPrimaryDomainInformation: /* 3 */
871 case PolicyAccountDomainInformation: /* 5 */
874 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
877 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
879 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
880 RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
881 xdi->ppdi.Sid = &(xdi->sid);
882 xdi->sid.Revision = SID_REVISION;
883 xdi->sid.SubAuthorityCount = 1;
884 xdi->sid.IdentifierAuthority = localSidAuthority;
885 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
889 case PolicyAuditLogInformation:
890 case PolicyPdAccountInformation:
891 case PolicyLsaServerRoleInformation:
892 case PolicyReplicaSourceInformation:
893 case PolicyDefaultQuotaInformation:
894 case PolicyModificationInformation:
895 case PolicyAuditFullSetInformation:
896 case PolicyAuditFullQueryInformation:
897 case PolicyDnsDomainInformation:
899 FIXME("category not implemented\n");
906 /******************************************************************************
907 * LsaLookupSids [ADVAPI32.@]
912 LSA_UNICODE_STRING Name;
914 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
918 LSA_UNICODE_STRING Name;
920 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
925 PLSA_TRUST_INFORMATION Domains;
926 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
930 IN LSA_HANDLE PolicyHandle,
933 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
934 OUT PLSA_TRANSLATED_NAME *Names )
936 FIXME("%p %lu %p %p %p\n",
937 PolicyHandle, Count, Sids, ReferencedDomains, Names);
941 /******************************************************************************
942 * LsaFreeMemory [ADVAPI32.@]
945 LsaFreeMemory(IN PVOID Buffer)
947 TRACE("(%p)\n",Buffer);
948 return HeapFree(GetProcessHeap(), 0, Buffer);
950 /******************************************************************************
951 * LsaClose [ADVAPI32.@]
954 LsaClose(IN LSA_HANDLE ObjectHandle)
956 FIXME("(%p):stub\n",ObjectHandle);
960 /******************************************************************************
961 * LsaNtStatusToWinError [ADVAPI32.@]
967 LsaNtStatusToWinError(NTSTATUS Status)
969 return RtlNtStatusToDosError(Status);
972 /******************************************************************************
973 * NotifyBootConfigStatus [ADVAPI32.@]
979 NotifyBootConfigStatus( DWORD x1 )
981 FIXME("(0x%08lx):stub\n",x1);
985 /******************************************************************************
986 * RevertToSelf [ADVAPI32.@]
998 /******************************************************************************
999 * ImpersonateSelf [ADVAPI32.@]
1002 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1004 return RtlImpersonateSelf(ImpersonationLevel);
1007 /******************************************************************************
1008 * ImpersonateLoggedOnUser [ADVAPI32.@]
1010 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
1012 FIXME("(%08x):stub returning FALSE\n", hToken);
1016 /******************************************************************************
1017 * AccessCheck [ADVAPI32.@]
1019 * FIXME check cast LPBOOL to PBOOLEAN
1023 PSECURITY_DESCRIPTOR SecurityDescriptor,
1025 DWORD DesiredAccess,
1026 PGENERIC_MAPPING GenericMapping,
1027 PPRIVILEGE_SET PrivilegeSet,
1028 LPDWORD PrivilegeSetLength,
1029 LPDWORD GrantedAccess,
1030 LPBOOL AccessStatus)
1032 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
1033 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
1036 /*************************************************************************
1037 * SetKernelObjectSecurity [ADVAPI32.@]
1039 BOOL WINAPI SetKernelObjectSecurity (
1041 IN SECURITY_INFORMATION SecurityInformation,
1042 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1044 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1047 /******************************************************************************
1048 * AddAccessAllowedAce [ADVAPI32.@]
1050 BOOL WINAPI AddAccessAllowedAce(
1052 IN DWORD dwAceRevision,
1053 IN DWORD AccessMask,
1056 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1059 /******************************************************************************
1060 * LookupAccountNameA [ADVAPI32.@]
1068 LPSTR ReferencedDomainName,
1069 IN OUT LPDWORD cbReferencedDomainName,
1070 OUT PSID_NAME_USE name_use )
1072 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1076 /******************************************************************************
1077 * GetAce [ADVAPI32.@]
1079 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1081 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1084 /******************************************************************************
1085 * PrivilegeCheck [ADVAPI32.@]
1087 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1089 FIXME("stub %d %p %p\n", ClientToken, RequiredPrivileges, pfResult);