[ADVAPI32]

Implement LsaEnumerateAccountsWithUserRight, LsaEnumeratePrivileges, LsaGetQuotasForAccount and LsaSetQuotasForAccount.

svn path=/trunk/; revision=57382
This commit is contained in:
Eric Kohl 2012-09-25 00:15:24 +00:00
parent 12a3bb46db
commit c108d80dee
3 changed files with 145 additions and 12 deletions

View file

@ -357,12 +357,12 @@
@ stdcall LsaEnumerateAccountRights(ptr ptr ptr ptr)
@ stdcall LsaEnumerateAccounts(ptr ptr ptr long ptr)
@ stdcall LsaEnumerateAccountsWithUserRight(ptr ptr ptr ptr)
@ stub LsaEnumeratePrivileges
@ stdcall LsaEnumeratePrivileges(ptr ptr ptr long ptr)
@ stdcall LsaEnumeratePrivilegesOfAccount(ptr ptr)
@ stdcall LsaEnumerateTrustedDomains(ptr ptr ptr long ptr)
@ stdcall LsaEnumerateTrustedDomainsEx(ptr ptr ptr long ptr)
@ stdcall LsaFreeMemory(ptr)
@ stub LsaGetQuotasForAccount
@ stdcall LsaGetQuotasForAccount(ptr ptr)
@ stub LsaGetRemoteUserName
@ stdcall LsaGetSystemAccessAccount(ptr ptr)
@ stdcall LsaGetUserName(ptr ptr)
@ -399,7 +399,7 @@
@ stdcall LsaSetForestTrustInformation(ptr ptr ptr long ptr)
@ stdcall LsaSetInformationPolicy(long long ptr)
@ stub LsaSetInformationTrustedDomain
@ stub LsaSetQuotasForAccount
@ stdcall LsaSetQuotasForAccount(ptr ptr)
@ stdcall LsaSetSecret(ptr ptr ptr)
@ stub LsaSetSecurityObject
@ stdcall LsaSetSystemAccessAccount(ptr long)

View file

@ -421,17 +421,15 @@ LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle,
AccountSid,
&UserRightsSet);
*CountOfRights = UserRightsSet.Entries;
*UserRights = (PUNICODE_STRING)UserRightsSet.UserRights;
*CountOfRights = UserRightsSet.Entries;
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
if (UserRightsSet.UserRights != NULL)
{
MIDL_user_free(UserRightsSet.UserRights);
}
}
RpcEndExcept;
@ -484,7 +482,7 @@ LsaEnumerateAccounts(IN LSA_HANDLE PolicyHandle,
/*
* @unimplemented
* @implemented
*/
NTSTATUS
WINAPI
@ -493,9 +491,79 @@ LsaEnumerateAccountsWithUserRight(IN LSA_HANDLE PolicyHandle,
OUT PVOID *Buffer,
OUT PULONG CountReturned)
{
FIXME("LsaEnumerateAccountsWithUserRight(%p %p %p %p) stub\n",
LSAPR_ACCOUNT_ENUM_BUFFER AccountEnumBuffer;
NTSTATUS Status;
TRACE("LsaEnumerateAccountsWithUserRight(%p %p %p %p) stub\n",
PolicyHandle, UserRight, Buffer, CountReturned);
return STATUS_NO_MORE_ENTRIES;
AccountEnumBuffer.EntriesRead = 0;
AccountEnumBuffer.Information = NULL;
RpcTryExcept
{
Status = LsarEnumerateAccountsWithUserRight((LSAPR_HANDLE)PolicyHandle,
(PRPC_UNICODE_STRING)UserRight,
&AccountEnumBuffer);
*Buffer = AccountEnumBuffer.Information;
*CountReturned = AccountEnumBuffer.EntriesRead;
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
if (AccountEnumBuffer.Information != NULL)
MIDL_user_free(AccountEnumBuffer.Information);
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return Status;
}
/*
* @implemented
*/
NTSTATUS
WINAPI
LsaEnumeratePrivileges(IN LSA_HANDLE PolicyHandle,
IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
OUT PVOID *Buffer,
IN ULONG PreferedMaximumLength,
OUT PULONG CountReturned)
{
LSAPR_PRIVILEGE_ENUM_BUFFER PrivilegeEnumBuffer;
NTSTATUS Status;
TRACE("LsaEnumeratePrivileges(%p %p %p %lu %p)\n",
PolicyHandle, EnumerationContext, Buffer,
PreferedMaximumLength, CountReturned);
PrivilegeEnumBuffer.Entries = 0;
PrivilegeEnumBuffer.Privileges = NULL;
RpcTryExcept
{
Status = LsarEnumeratePrivileges((LSAPR_HANDLE)PolicyHandle,
EnumerationContext,
&PrivilegeEnumBuffer,
PreferedMaximumLength);
*Buffer = PrivilegeEnumBuffer.Privileges;
*CountReturned = PrivilegeEnumBuffer.Entries;
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
if (PrivilegeEnumBuffer.Privileges != NULL)
MIDL_user_free(PrivilegeEnumBuffer.Privileges);
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return Status;
}
@ -542,10 +610,13 @@ LsaEnumerateTrustedDomains(IN LSA_HANDLE PolicyHandle,
PolicyHandle, EnumerationContext, Buffer,
PreferedMaximumLength, CountReturned);
if (CountReturned) *CountReturned = 0;
if (CountReturned)
*CountReturned = 0;
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
@ -561,7 +632,9 @@ LsaEnumerateTrustedDomainsEx(IN LSA_HANDLE PolicyHandle,
PolicyHandle, EnumerationContext, Buffer,
PreferedMaximumLength, CountReturned);
if (CountReturned) *CountReturned = 0;
if (CountReturned)
*CountReturned = 0;
return STATUS_SUCCESS;
}
@ -578,6 +651,34 @@ LsaFreeMemory(IN PVOID Buffer)
}
/*
* @implemented
*/
NTSTATUS
WINAPI
LsaGetQuotasForAccount(IN LSA_HANDLE AccountHandle,
OUT PQUOTA_LIMITS QuotaLimits)
{
NTSTATUS Status;
TRACE("LsaGetQuotasForAccount(%p %p)\n",
AccountHandle, QuotaLimits);
RpcTryExcept
{
Status = LsarGetQuotasForAccount((LSAPR_HANDLE)AccountHandle,
QuotaLimits);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return Status;
}
/*
* @implemented
*/
@ -607,7 +708,7 @@ LsaGetSystemAccessAccount(IN LSA_HANDLE AccountHandle,
/*
* @unimplemented
* @implemented
*/
NTSTATUS
WINAPI
@ -1458,6 +1559,34 @@ LsaSetInformationPolicy(IN LSA_HANDLE PolicyHandle,
}
/*
* @implemented
*/
NTSTATUS
WINAPI
LsaSetQuotasForAccount(IN LSA_HANDLE AccountHandle,
IN PQUOTA_LIMITS QuotaLimits)
{
NTSTATUS Status;
TRACE("LsaSetQuotasForAccount(%p %p)\n",
AccountHandle, QuotaLimits);
RpcTryExcept
{
Status = LsarSetQuotasForAccount((LSAPR_HANDLE)AccountHandle,
QuotaLimits);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return Status;
}
/*
* @implemented
*/

View file

@ -693,6 +693,8 @@ NTSTATUS NTAPI LsaEnumerateAccounts(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,PVOID*,
ULONG,PULONG);
NTSTATUS NTAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
PVOID*,PULONG);
NTSTATUS NTAPI LsaEnumeratePrivileges(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
PVOID*,ULONG,PULONG);
NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE,PPRIVILEGE_SET*);
NTSTATUS NTAPI LsaEnumerateTrustedDomains(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
PVOID*,ULONG,PULONG);
@ -700,6 +702,7 @@ NTSTATUS NTAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
PVOID*,ULONG,PULONG);
NTSTATUS NTAPI LsaFreeMemory(PVOID);
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID);
NTSTATUS NTAPI LsaGetQuotasForAccount(LSA_HANDLE,PQUOTA_LIMITS);
NTSTATUS NTAPI LsaGetSystemAccessAccount(LSA_HANDLE, PULONG);
NTSTATUS NTAPI LsaGetUserName(PUNICODE_STRING*,PUNICODE_STRING*);
NTSTATUS NTAPI LsaLogonUser(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,
@ -743,6 +746,7 @@ NTSTATUS NTAPI LsaSetDomainInformationPolicy(LSA_HANDLE,
NTSTATUS NTAPI LsaSetInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS, PVOID);
NTSTATUS NTAPI LsaSetLocalInformationPolicy(LSA_HANDLE,
POLICY_LOCAL_INFORMATION_CLASS,PVOID);
NTSTATUS NTAPI LsaSetQuotasForAccount(LSA_HANDLE,PQUOTA_LIMITS);
NTSTATUS NTAPI LsaSetSecret(LSA_HANDLE,PLSA_UNICODE_STRING,PLSA_UNICODE_STRING);
NTSTATUS NTAPI LsaSetSystemAccessAccount(LSA_HANDLE,ULONG);
NTSTATUS NTAPI LsaSetTrustedDomainInformation(LSA_HANDLE,PSID,