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 UNICODE_STRING lpSystemNameW;
637 UNICODE_STRING lpNameW;
640 RtlCreateUnicodeStringFromAsciiz(&lpSystemNameW, lpSystemName);
641 RtlCreateUnicodeStringFromAsciiz(&lpNameW,lpName);
642 ret = LookupPrivilegeValueW(lpSystemNameW.Buffer, lpNameW.Buffer, lpLuid);
643 RtlFreeUnicodeString(&lpNameW);
644 RtlFreeUnicodeString(&lpSystemNameW);
648 /******************************************************************************
649 * GetFileSecurityA [ADVAPI32.@]
651 * Obtains Specified information about the security of a file or directory
652 * The information obtained is constrained by the callers access rights and
656 GetFileSecurityA( LPCSTR lpFileName,
657 SECURITY_INFORMATION RequestedInformation,
658 PSECURITY_DESCRIPTOR pSecurityDescriptor,
659 DWORD nLength, LPDWORD lpnLengthNeeded )
661 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
665 /******************************************************************************
666 * GetFileSecurityW [ADVAPI32.@]
668 * Obtains Specified information about the security of a file or directory
669 * The information obtained is constrained by the callers access rights and
674 * RequestedInformation []
675 * pSecurityDescriptor []
680 GetFileSecurityW( LPCWSTR lpFileName,
681 SECURITY_INFORMATION RequestedInformation,
682 PSECURITY_DESCRIPTOR pSecurityDescriptor,
683 DWORD nLength, LPDWORD lpnLengthNeeded )
685 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
690 /******************************************************************************
691 * LookupAccountSidA [ADVAPI32.@]
698 IN OUT LPDWORD accountSize,
700 IN OUT LPDWORD domainSize,
701 OUT PSID_NAME_USE name_use )
703 static const char ac[] = "Administrator";
704 static const char dm[] = "DOMAIN";
705 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
706 debugstr_a(system),sid,
707 account,accountSize,accountSize?*accountSize:0,
708 domain,domainSize,domainSize?*domainSize:0,
711 if (accountSize) *accountSize = strlen(ac)+1;
712 if (account && (*accountSize > strlen(ac)))
715 if (domainSize) *domainSize = strlen(dm)+1;
716 if (domain && (*domainSize > strlen(dm)))
719 if (name_use) *name_use = SidTypeUser;
723 /******************************************************************************
724 * LookupAccountSidW [ADVAPI32.@]
740 IN OUT LPDWORD accountSize,
742 IN OUT LPDWORD domainSize,
743 OUT PSID_NAME_USE name_use )
745 static const WCHAR ac[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0};
746 static const WCHAR dm[] = {'D','O','M','A','I','N',0};
747 FIXME("(%s,sid=%p,%p,%p(%lu),%p,%p(%lu),%p): semi-stub\n",
748 debugstr_w(system),sid,
749 account,accountSize,accountSize?*accountSize:0,
750 domain,domainSize,domainSize?*domainSize:0,
753 if (accountSize) *accountSize = strlenW(ac)+1;
754 if (account && (*accountSize > strlenW(ac)))
755 strcpyW(account, ac);
757 if (domainSize) *domainSize = strlenW(dm)+1;
758 if (domain && (*domainSize > strlenW(dm)))
761 if (name_use) *name_use = SidTypeUser;
765 /******************************************************************************
766 * SetFileSecurityA [ADVAPI32.@]
767 * Sets the security of a file or directory
769 BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
770 SECURITY_INFORMATION RequestedInformation,
771 PSECURITY_DESCRIPTOR pSecurityDescriptor)
773 FIXME("(%s) : stub\n", debugstr_a(lpFileName));
777 /******************************************************************************
778 * SetFileSecurityW [ADVAPI32.@]
779 * Sets the security of a file or directory
783 * RequestedInformation []
784 * pSecurityDescriptor []
787 SetFileSecurityW( LPCWSTR lpFileName,
788 SECURITY_INFORMATION RequestedInformation,
789 PSECURITY_DESCRIPTOR pSecurityDescriptor )
791 FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
795 /******************************************************************************
796 * QueryWindows31FilesMigration [ADVAPI32.@]
802 QueryWindows31FilesMigration( DWORD x1 )
804 FIXME("(%ld):stub\n",x1);
808 /******************************************************************************
809 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.@]
818 SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
821 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
825 /******************************************************************************
826 * LsaOpenPolicy [ADVAPI32.@]
836 IN PLSA_UNICODE_STRING SystemName,
837 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
838 IN ACCESS_MASK DesiredAccess,
839 IN OUT PLSA_HANDLE PolicyHandle)
841 FIXME("(%s,%p,0x%08lx,%p):stub\n",
842 SystemName?debugstr_w(SystemName->Buffer):"null",
843 ObjectAttributes, DesiredAccess, PolicyHandle);
844 ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
845 STATUS_ACCESS_VIOLATION);
846 dumpLsaAttributes(ObjectAttributes);
847 if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
848 return STATUS_SUCCESS;
851 /******************************************************************************
852 * LsaQueryInformationPolicy [ADVAPI32.@]
855 LsaQueryInformationPolicy(
856 IN LSA_HANDLE PolicyHandle,
857 IN POLICY_INFORMATION_CLASS InformationClass,
860 FIXME("(%p,0x%08x,%p):stub\n",
861 PolicyHandle, InformationClass, Buffer);
863 if(!Buffer) return FALSE;
864 switch (InformationClass)
866 case PolicyAuditEventsInformation: /* 2 */
868 PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
869 p->AuditingMode = FALSE; /* no auditing */
873 case PolicyPrimaryDomainInformation: /* 3 */
874 case PolicyAccountDomainInformation: /* 5 */
877 { POLICY_PRIMARY_DOMAIN_INFO ppdi;
880 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
882 struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
883 RtlCreateUnicodeStringFromAsciiz(&(xdi->ppdi.Name), "DOMAIN");
884 xdi->ppdi.Sid = &(xdi->sid);
885 xdi->sid.Revision = SID_REVISION;
886 xdi->sid.SubAuthorityCount = 1;
887 xdi->sid.IdentifierAuthority = localSidAuthority;
888 xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
892 case PolicyAuditLogInformation:
893 case PolicyPdAccountInformation:
894 case PolicyLsaServerRoleInformation:
895 case PolicyReplicaSourceInformation:
896 case PolicyDefaultQuotaInformation:
897 case PolicyModificationInformation:
898 case PolicyAuditFullSetInformation:
899 case PolicyAuditFullQueryInformation:
900 case PolicyDnsDomainInformation:
902 FIXME("category not implemented\n");
909 /******************************************************************************
910 * LsaLookupSids [ADVAPI32.@]
915 LSA_UNICODE_STRING Name;
917 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
921 LSA_UNICODE_STRING Name;
923 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
928 PLSA_TRUST_INFORMATION Domains;
929 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
933 IN LSA_HANDLE PolicyHandle,
936 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
937 OUT PLSA_TRANSLATED_NAME *Names )
939 FIXME("%p %lu %p %p %p\n",
940 PolicyHandle, Count, Sids, ReferencedDomains, Names);
944 /******************************************************************************
945 * LsaFreeMemory [ADVAPI32.@]
948 LsaFreeMemory(IN PVOID Buffer)
950 TRACE("(%p)\n",Buffer);
951 return HeapFree(GetProcessHeap(), 0, Buffer);
953 /******************************************************************************
954 * LsaClose [ADVAPI32.@]
957 LsaClose(IN LSA_HANDLE ObjectHandle)
959 FIXME("(%p):stub\n",ObjectHandle);
963 /******************************************************************************
964 * LsaNtStatusToWinError [ADVAPI32.@]
970 LsaNtStatusToWinError(NTSTATUS Status)
972 return RtlNtStatusToDosError(Status);
975 /******************************************************************************
976 * NotifyBootConfigStatus [ADVAPI32.@]
982 NotifyBootConfigStatus( DWORD x1 )
984 FIXME("(0x%08lx):stub\n",x1);
988 /******************************************************************************
989 * RevertToSelf [ADVAPI32.@]
1001 /******************************************************************************
1002 * ImpersonateSelf [ADVAPI32.@]
1005 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
1007 return RtlImpersonateSelf(ImpersonationLevel);
1010 /******************************************************************************
1011 * ImpersonateLoggedOnUser [ADVAPI32.@]
1013 BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
1015 FIXME("(%p):stub returning FALSE\n", hToken);
1019 /******************************************************************************
1020 * AccessCheck [ADVAPI32.@]
1022 * FIXME check cast LPBOOL to PBOOLEAN
1026 PSECURITY_DESCRIPTOR SecurityDescriptor,
1028 DWORD DesiredAccess,
1029 PGENERIC_MAPPING GenericMapping,
1030 PPRIVILEGE_SET PrivilegeSet,
1031 LPDWORD PrivilegeSetLength,
1032 LPDWORD GrantedAccess,
1033 LPBOOL AccessStatus)
1035 CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess,
1036 GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus));
1039 /*************************************************************************
1040 * SetKernelObjectSecurity [ADVAPI32.@]
1042 BOOL WINAPI SetKernelObjectSecurity (
1044 IN SECURITY_INFORMATION SecurityInformation,
1045 IN PSECURITY_DESCRIPTOR SecurityDescriptor )
1047 CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor));
1050 /******************************************************************************
1051 * AddAccessAllowedAce [ADVAPI32.@]
1053 BOOL WINAPI AddAccessAllowedAce(
1055 IN DWORD dwAceRevision,
1056 IN DWORD AccessMask,
1059 return RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid);
1062 /******************************************************************************
1063 * LookupAccountNameA [ADVAPI32.@]
1071 LPSTR ReferencedDomainName,
1072 IN OUT LPDWORD cbReferencedDomainName,
1073 OUT PSID_NAME_USE name_use )
1075 FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
1079 /******************************************************************************
1080 * GetAce [ADVAPI32.@]
1082 BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
1084 CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce));
1087 /******************************************************************************
1088 * PrivilegeCheck [ADVAPI32.@]
1090 BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
1092 FIXME("stub %p %p %p\n", ClientToken, RequiredPrivileges, pfResult);
1098 /******************************************************************************
1099 * GetSecurityInfoExW [ADVAPI32.@]
1101 DWORD WINAPI GetSecurityInfoExW(
1102 HANDLE hObject, SE_OBJECT_TYPE ObjectType,
1103 SECURITY_INFORMATION SecurityInfo, LPCWSTR lpProvider,
1104 LPCWSTR lpProperty, PACTRL_ACCESSW *ppAccessList,
1105 PACTRL_AUDITW *ppAuditList, LPWSTR *lppOwner, LPWSTR *lppGroup
1109 return ERROR_BAD_PROVIDER;