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()
30 #include "wine/debug.h"
31 #include "wine/unicode.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
35 #define CallWin32ToNt(func) \
38 if (ret !=STATUS_SUCCESS) \
39 { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
43 static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa )
47 TRACE("\n\tlength=%lu, rootdir=%p, objectname=%s\n\tattr=0x%08lx, sid=%p qos=%p\n",
48 oa->Length, oa->RootDirectory,
49 oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
50 oa->Attributes, oa->SecurityDescriptor, oa->SecurityQualityOfService);
54 /************************************************************
55 * ADVAPI_IsLocalComputer
57 * Checks whether the server name indicates local machine.
59 BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
67 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
71 buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
72 Result = GetComputerNameW(buf, &dwSize);
73 if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
75 Result = Result && !lstrcmpW(ServerName, buf);
76 HeapFree(GetProcessHeap(), 0, buf);
82 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
83 if (!ADVAPI_IsLocalComputer(ServerName)) \
85 FIXME("Action Implemented for local computer only. " \
86 "Requested for server %s\n", debugstr_w(ServerName)); \
90 /* ##############################
91 ###### TOKEN FUNCTIONS ######
92 ##############################
95 /******************************************************************************
96 * OpenProcessToken [ADVAPI32.@]
97 * Opens the access token associated with a process
100 * ProcessHandle [I] Handle to process
101 * DesiredAccess [I] Desired access to process
102 * TokenHandle [O] Pointer to handle of open access token
107 OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
108 HANDLE *TokenHandle )
110 CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
113 /******************************************************************************
114 * OpenThreadToken [ADVAPI32.@]
123 OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
124 BOOL OpenAsSelf, HANDLE *TokenHandle)
126 CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
129 /******************************************************************************
130 * AdjustTokenPrivileges [ADVAPI32.@]
134 * DisableAllPrivileges []
141 AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
142 LPVOID NewState, DWORD BufferLength,
143 LPVOID PreviousState, LPDWORD ReturnLength )
145 CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
148 /******************************************************************************
149 * CheckTokenMembership [ADVAPI32.@]
157 CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck,
160 FIXME("(%p %p %p) stub!\n", TokenHandle, SidToCheck, IsMember);
166 /******************************************************************************
167 * GetTokenInformation [ADVAPI32.@]
173 * tokeninfolength [I]
178 GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
179 LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
181 TRACE("(%p, %s, %p, %ld, %p): \n",
183 (tokeninfoclass == TokenUser) ? "TokenUser" :
184 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
185 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
186 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
187 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
188 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
189 (tokeninfoclass == TokenSource) ? "TokenSource" :
190 (tokeninfoclass == TokenType) ? "TokenType" :
191 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
192 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
193 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
194 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
195 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
196 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
197 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
199 tokeninfo, tokeninfolength, retlen);
200 CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
203 /******************************************************************************
204 * SetTokenInformation [ADVAPI32.@]
210 * tokeninfolength [I]
214 SetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
215 LPVOID tokeninfo, DWORD tokeninfolength )
217 FIXME("(%p, %s, %p, %ld): stub\n",
219 (tokeninfoclass == TokenUser) ? "TokenUser" :
220 (tokeninfoclass == TokenGroups) ? "TokenGroups" :
221 (tokeninfoclass == TokenPrivileges) ? "TokenPrivileges" :
222 (tokeninfoclass == TokenOwner) ? "TokenOwner" :
223 (tokeninfoclass == TokenPrimaryGroup) ? "TokenPrimaryGroup" :
224 (tokeninfoclass == TokenDefaultDacl) ? "TokenDefaultDacl" :
225 (tokeninfoclass == TokenSource) ? "TokenSource" :
226 (tokeninfoclass == TokenType) ? "TokenType" :
227 (tokeninfoclass == TokenImpersonationLevel) ? "TokenImpersonationLevel" :
228 (tokeninfoclass == TokenStatistics) ? "TokenStatistics" :
229 (tokeninfoclass == TokenRestrictedSids) ? "TokenRestrictedSids" :
230 (tokeninfoclass == TokenSessionId) ? "TokenSessionId" :
231 (tokeninfoclass == TokenGroupsAndPrivileges) ? "TokenGroupsAndPrivileges" :
232 (tokeninfoclass == TokenSessionReference) ? "TokenSessionReference" :
233 (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" :
235 tokeninfo, tokeninfolength);
237 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
242 /*************************************************************************
243 * SetThreadToken [ADVAPI32.@]
245 * Assigns an "impersonation token" to a thread so it can assume the
246 * security privledges of another thread or process. Can also remove
247 * a previously assigned token. Only supported on NT - it's a stub
248 * exactly like this one on Win9X.
252 BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token)
254 FIXME("(%p, %p): stub (NT impl. only)\n", thread, token);
256 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
261 /* ##############################
262 ###### SID FUNCTIONS ######
263 ##############################
266 /******************************************************************************
267 * AllocateAndInitializeSid [ADVAPI32.@]
270 * pIdentifierAuthority []
271 * nSubAuthorityCount []
283 AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
284 BYTE nSubAuthorityCount,
285 DWORD nSubAuthority0, DWORD nSubAuthority1,
286 DWORD nSubAuthority2, DWORD nSubAuthority3,
287 DWORD nSubAuthority4, DWORD nSubAuthority5,
288 DWORD nSubAuthority6, DWORD nSubAuthority7,
291 CallWin32ToNt (RtlAllocateAndInitializeSid(
292 pIdentifierAuthority, nSubAuthorityCount,
293 nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
294 nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
298 /******************************************************************************
299 * FreeSid [ADVAPI32.@]
308 return NULL; /* is documented like this */
311 /******************************************************************************
312 * CopySid [ADVAPI32.@]
315 * nDestinationSidLength []
320 CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
322 return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid);
325 /******************************************************************************
326 * IsValidSid [ADVAPI32.@]
332 IsValidSid( PSID pSid )
334 return RtlValidSid( pSid );
337 /******************************************************************************
338 * EqualSid [ADVAPI32.@]
345 EqualSid( PSID pSid1, PSID pSid2 )
347 return RtlEqualSid( pSid1, pSid2 );
350 /******************************************************************************
351 * EqualPrefixSid [ADVAPI32.@]
353 BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
355 return RtlEqualPrefixSid(pSid1, pSid2);
358 /******************************************************************************
359 * GetSidLengthRequired [ADVAPI32.@]
362 * nSubAuthorityCount []
365 GetSidLengthRequired( BYTE nSubAuthorityCount )
367 return RtlLengthRequiredSid(nSubAuthorityCount);
370 /******************************************************************************
371 * InitializeSid [ADVAPI32.@]
374 * pIdentifierAuthority []
379 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
380 BYTE nSubAuthorityCount)
382 return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount);
385 /******************************************************************************
386 * GetSidIdentifierAuthority [ADVAPI32.@]
391 PSID_IDENTIFIER_AUTHORITY WINAPI
392 GetSidIdentifierAuthority( PSID pSid )
394 return RtlIdentifierAuthoritySid(pSid);
397 /******************************************************************************
398 * GetSidSubAuthority [ADVAPI32.@]
405 GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
407 return RtlSubAuthoritySid(pSid, nSubAuthority);
410 /******************************************************************************
411 * GetSidSubAuthorityCount [ADVAPI32.@]
417 GetSidSubAuthorityCount (PSID pSid)
419 return RtlSubAuthorityCountSid(pSid);
422 /******************************************************************************
423 * GetLengthSid [ADVAPI32.@]
429 GetLengthSid (PSID pSid)
431 return RtlLengthSid(pSid);
434 /* ##############################################
435 ###### SECURITY DESCRIPTOR FUNCTIONS ######
436 ##############################################
439 /******************************************************************************
440 * InitializeSecurityDescriptor [ADVAPI32.@]
447 InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
449 CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
452 /******************************************************************************
453 * GetSecurityDescriptorLength [ADVAPI32.@]
455 DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
457 return (RtlLengthSecurityDescriptor(pDescr));
460 /******************************************************************************
461 * GetSecurityDescriptorOwner [ADVAPI32.@]
465 * lpbOwnerDefaulted []
468 GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
469 LPBOOL lpbOwnerDefaulted )
471 CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
474 /******************************************************************************
475 * SetSecurityDescriptorOwner [ADVAPI32.@]
479 BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
480 PSID pOwner, BOOL bOwnerDefaulted)
482 CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
484 /******************************************************************************
485 * GetSecurityDescriptorGroup [ADVAPI32.@]
487 BOOL WINAPI GetSecurityDescriptorGroup(
488 PSECURITY_DESCRIPTOR SecurityDescriptor,
490 LPBOOL GroupDefaulted)
492 CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
494 /******************************************************************************
495 * SetSecurityDescriptorGroup [ADVAPI32.@]
497 BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
498 PSID Group, BOOL GroupDefaulted)
500 CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
503 /******************************************************************************
504 * IsValidSecurityDescriptor [ADVAPI32.@]
510 IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
512 CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
515 /******************************************************************************
516 * GetSecurityDescriptorDacl [ADVAPI32.@]
518 BOOL WINAPI GetSecurityDescriptorDacl(
519 IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
520 OUT LPBOOL lpbDaclPresent,
522 OUT LPBOOL lpbDaclDefaulted)
524 CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
525 pDacl, (PBOOLEAN)lpbDaclDefaulted));
528 /******************************************************************************
529 * SetSecurityDescriptorDacl [ADVAPI32.@]
532 SetSecurityDescriptorDacl (
533 PSECURITY_DESCRIPTOR lpsd,
538 CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
540 /******************************************************************************
541 * GetSecurityDescriptorSacl [ADVAPI32.@]
543 BOOL WINAPI GetSecurityDescriptorSacl(
544 IN PSECURITY_DESCRIPTOR lpsd,
545 OUT LPBOOL lpbSaclPresent,
547 OUT LPBOOL lpbSaclDefaulted)
549 CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
550 (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
553 /**************************************************************************
554 * SetSecurityDescriptorSacl [ADVAPI32.@]
556 BOOL WINAPI SetSecurityDescriptorSacl (
557 PSECURITY_DESCRIPTOR lpsd,
562 CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
564 /******************************************************************************
565 * MakeSelfRelativeSD [ADVAPI32.@]
574 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
575 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
576 IN OUT LPDWORD lpdwBufferLength)
578 CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength));
581 /******************************************************************************
582 * GetSecurityDescriptorControl [ADVAPI32.@]
585 BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
586 PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
588 CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
591 /* ##############################
592 ###### ACL FUNCTIONS ######
593 ##############################
596 /*************************************************************************
597 * InitializeAcl [ADVAPI32.@]
599 DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
601 CallWin32ToNt (RtlCreateAcl(acl, size, rev));
604 /* ##############################
605 ###### MISC FUNCTIONS ######
606 ##############################
609 /******************************************************************************
610 * LookupPrivilegeValueW [ADVAPI32.@]
611 * Retrieves LUID used on a system to represent the privilege name.
614 * lpSystemName [I] Address of string specifying the system
615 * lpName [I] Address of string specifying the privilege
616 * lpLuid [I] Address of locally unique identifier
621 LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid )
623 FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
624 debugstr_w(lpName), lpLuid);
625 lpLuid->LowPart = 0x12345678;
626 lpLuid->HighPart = 0x87654321;
630 /******************************************************************************
631 * LookupPrivilegeValueA [ADVAPI32.@]
634 LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid )
636 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
637 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
640 ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
641 HeapFree(GetProcessHeap(), 0, lpNameW);
642 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
646 /******************************************************************************
647 * GetFileSecurityA [ADVAPI32.@]
649 * Obtains Specified information about the security of a file or directory
650 * The information obtained is constrained by the callers access rights and
654 GetFileSecurityA( LPCSTR lpFileName,
655 SECURITY_INFORMATION RequestedInformation,
656 PSECURITY_DESCRIPTOR pSecurityDescriptor,
657 DWORD nLength, LPDWORD lpnLengthNeeded )
659 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
663 /******************************************************************************
664 * GetFileSecurityW [ADVAPI32.@]
666 * Obtains Specified information about the security of a file or directory
667 * The information obtained is constrained by the callers access rights and
672 * RequestedInformation []
673 * pSecurityDescriptor []
678 GetFileSecurityW( LPCWSTR lpFileName,
679 SECURITY_INFORMATION RequestedInformation,
680 PSECURITY_DESCRIPTOR pSecurityDescriptor,
681 DWORD nLength, LPDWORD lpnLengthNeeded )
683 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
688 /******************************************************************************
689 * LookupAccountSidA [ADVAPI32.@]
696 IN OUT LPDWORD accountSize,
698 IN OUT LPDWORD domainSize,
699 OUT PSID_NAME_USE name_use )
701 static const char ac[] = "Administrator";
702 static const char dm[] = "DOMAIN";
703 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
704 debugstr_a(system),sid,
705 account,accountSize,accountSize?*accountSize:0,
706 domain,domainSize,domainSize?*domainSize:0,
709 if (accountSize) *accountSize = strlen(ac)+1;
710 if (account && (*accountSize > strlen(ac)))
713 if (domainSize) *domainSize = strlen(dm)+1;
714 if (domain && (*domainSize > strlen(dm)))
717 if (name_use) *name_use = SidTypeUser;
721 /******************************************************************************
722 * LookupAccountSidW [ADVAPI32.@]
738 IN OUT LPDWORD accountSize,
740 IN OUT LPDWORD domainSize,
741 OUT PSID_NAME_USE name_use )
743 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
744 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
745 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
746 debugstr_w(system),sid,
747 account,accountSize,accountSize?*accountSize:0,
748 domain,domainSize,domainSize?*domainSize:0,
751 if (accountSize) *accountSize = strlenW(ac)+1;
752 if (account && (*accountSize > strlenW(ac)))
753 strcpyW(account, ac);
755 if (domainSize) *domainSize = strlenW(dm)+1;
756 if (domain && (*domainSize > strlenW(dm)))
759 if (name_use) *name_use = SidTypeUser;
763 /******************************************************************************
764 * SetFileSecurityA [ADVAPI32.@]
765 * Sets the security of a file or directory
767 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
768 SECURITY_INFORMATION RequestedInformation,
769 PSECURITY_DESCRIPTOR pSecurityDescriptor)
771 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
775 /******************************************************************************
776 * SetFileSecurityW [ADVAPI32.@]
777 * Sets the security of a file or directory
781 * RequestedInformation []
782 * pSecurityDescriptor []
785 SetFileSecurityW( LPCWSTR lpFileName,
786 SECURITY_INFORMATION RequestedInformation,
787 PSECURITY_DESCRIPTOR pSecurityDescriptor )
789 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
793 /******************************************************************************
794 * QueryWindows31FilesMigration [ADVAPI32.@]
800 QueryWindows31FilesMigration( DWORD x1 )
802 FIXME("(%ld):stub\n",x1);
806 /******************************************************************************
807 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
816 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
819 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
823 /******************************************************************************
824 * LsaOpenPolicy [ADVAPI32.@]
834 IN PLSA_UNICODE_STRING SystemName,
835 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
836 IN ACCESS_MASK DesiredAccess,
837 IN OUT PLSA_HANDLE PolicyHandle)
839 FIXME("(%s,%p,0x%08lx,%p):stub\n",
840 SystemName?debugstr_w(SystemName->Buffer):"null",
841 ObjectAttributes, DesiredAccess, PolicyHandle);
842 ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
843 STATUS_ACCESS_VIOLATION);
844 dumpLsaAttributes(ObjectAttributes);
845 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
846 return STATUS_SUCCESS;
849 /******************************************************************************
850 * LsaQueryInformationPolicy [ADVAPI32.@]
853 LsaQueryInformationPolicy(
854 IN LSA_HANDLE PolicyHandle,
855 IN POLICY_INFORMATION_CLASS InformationClass,
858 FIXME("(%p,0x%08x,%p):stub\n",
859 PolicyHandle, InformationClass, Buffer);
861 if(!Buffer) return FALSE;
862 switch (InformationClass)
864 case PolicyAuditEventsInformation: /* 2 */
866 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
867 p->AuditingMode = FALSE; /* no auditing */
871 case PolicyPrimaryDomainInformation: /* 3 */
872 case PolicyAccountDomainInformation: /* 5 */
875 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
878 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
880 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
881 RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
882 xdi->ppdi.Sid = &(xdi->sid);
883 xdi->sid.Revision = SID_REVISION;
884 xdi->sid.SubAuthorityCount = 1;
885 xdi->sid.IdentifierAuthority = localSidAuthority;
886 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
890 case PolicyAuditLogInformation:
891 case PolicyPdAccountInformation:
892 case PolicyLsaServerRoleInformation:
893 case PolicyReplicaSourceInformation:
894 case PolicyDefaultQuotaInformation:
895 case PolicyModificationInformation:
896 case PolicyAuditFullSetInformation:
897 case PolicyAuditFullQueryInformation:
898 case PolicyDnsDomainInformation:
900 FIXME("category not implemented\n");
907 /******************************************************************************
908 * LsaLookupSids [ADVAPI32.@]
913 LSA_UNICODE_STRING Name;
915 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
919 LSA_UNICODE_STRING Name;
921 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
926 PLSA_TRUST_INFORMATION Domains;
927 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
931 IN LSA_HANDLE PolicyHandle,
934 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
935 OUT PLSA_TRANSLATED_NAME *Names )
937 FIXME("%p %lu %p %p %p\n",
938 PolicyHandle, Count, Sids, ReferencedDomains, Names);
942 /******************************************************************************
943 * LsaFreeMemory [ADVAPI32.@]
946 LsaFreeMemory(IN PVOID Buffer)
948 TRACE("(%p)\n",Buffer);
949 return HeapFree(GetProcessHeap(), 0, Buffer);
951 /******************************************************************************
952 * LsaClose [ADVAPI32.@]
955 LsaClose(IN LSA_HANDLE ObjectHandle)
957 FIXME("(%p):stub\n",ObjectHandle);
961 /******************************************************************************
962 * LsaNtStatusToWinError [ADVAPI32.@]
968 LsaNtStatusToWinError(NTSTATUS Status)
970 return RtlNtStatusToDosError(Status);
973 /******************************************************************************
974 * NotifyBootConfigStatus [ADVAPI32.@]
980 NotifyBootConfigStatus( DWORD x1 )
982 FIXME("(0x%08lx):stub\n",x1);
986 /******************************************************************************
987 * RevertToSelf [ADVAPI32.@]
999 /******************************************************************************
1000 * ImpersonateSelf [ADVAPI32.@]
1003 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1005 return RtlImpersonateSelf(ImpersonationLevel);
1008 /******************************************************************************
1009 * ImpersonateLoggedOnUser [ADVAPI32.@]
1011 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
1013 FIXME("(%p):stub returning FALSE\n", hToken);
1017 /******************************************************************************
1018 * AccessCheck [ADVAPI32.@]
1020 * FIXME check cast LPBOOL to PBOOLEAN
1024 PSECURITY_DESCRIPTOR SecurityDescriptor,
1026 DWORD DesiredAccess,
1027 PGENERIC_MAPPING GenericMapping,
1028 PPRIVILEGE_SET PrivilegeSet,
1029 LPDWORD PrivilegeSetLength,
1030 LPDWORD GrantedAccess,
1031 LPBOOL AccessStatus)
1033 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
1034 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
1037 /*************************************************************************
1038 * SetKernelObjectSecurity [ADVAPI32.@]
1040 BOOL WINAPI SetKernelObjectSecurity (
1042 IN SECURITY_INFORMATION SecurityInformation,
1043 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1045 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1048 /******************************************************************************
1049 * AddAccessAllowedAce [ADVAPI32.@]
1051 BOOL WINAPI AddAccessAllowedAce(
1053 IN DWORD dwAceRevision,
1054 IN DWORD AccessMask,
1057 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1060 /******************************************************************************
1061 * LookupAccountNameA [ADVAPI32.@]
1069 LPSTR ReferencedDomainName,
1070 IN OUT LPDWORD cbReferencedDomainName,
1071 OUT PSID_NAME_USE name_use )
1073 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1077 /******************************************************************************
1078 * GetAce [ADVAPI32.@]
1080 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1082 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1085 /******************************************************************************
1086 * PrivilegeCheck [ADVAPI32.@]
1088 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1090 FIXME("stub %p %p %p\n", ClientToken, RequiredPrivileges, pfResult);