Author: ekohl
Date: Tue Sep 25 00:15:24 2012
New Revision: 57382
URL:
http://svn.reactos.org/svn/reactos?rev=57382&view=rev
Log:
[ADVAPI32]
Implement LsaEnumerateAccountsWithUserRight, LsaEnumeratePrivileges,
LsaGetQuotasForAccount and LsaSetQuotasForAccount.
Modified:
trunk/reactos/dll/win32/advapi32/advapi32.spec
trunk/reactos/dll/win32/advapi32/sec/lsa.c
trunk/reactos/include/psdk/ntsecapi.h
Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Tue Sep 25 00:15:24 2012
@@ -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)
Modified: trunk/reactos/dll/win32/advapi32/sec/lsa.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/lsa…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/lsa.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/lsa.c [iso-8859-1] Tue Sep 25 00:15:24 2012
@@ -421,17 +421,15 @@
AccountSid,
&UserRightsSet);
+ *UserRights = (PUNICODE_STRING)UserRightsSet.UserRights;
*CountOfRights = UserRightsSet.Entries;
- *UserRights = (PUNICODE_STRING)UserRightsSet.UserRights;
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
Status = I_RpcMapWin32Status(RpcExceptionCode());
if (UserRightsSet.UserRights != NULL)
- {
MIDL_user_free(UserRightsSet.UserRights);
- }
}
RpcEndExcept;
@@ -484,7 +482,7 @@
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
WINAPI
@@ -493,9 +491,79 @@
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,9 +610,12 @@
PolicyHandle, EnumerationContext, Buffer,
PreferedMaximumLength, CountReturned);
- if (CountReturned) *CountReturned = 0;
+ if (CountReturned)
+ *CountReturned = 0;
+
return STATUS_SUCCESS;
}
+
/*
* @unimplemented
@@ -561,7 +632,9 @@
PolicyHandle, EnumerationContext, Buffer,
PreferedMaximumLength, CountReturned);
- if (CountReturned) *CountReturned = 0;
+ if (CountReturned)
+ *CountReturned = 0;
+
return STATUS_SUCCESS;
}
@@ -583,6 +656,34 @@
*/
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
+ */
+NTSTATUS
+WINAPI
LsaGetSystemAccessAccount(IN LSA_HANDLE AccountHandle,
OUT PULONG SystemAccess)
{
@@ -607,7 +708,7 @@
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
WINAPI
@@ -1463,6 +1564,34 @@
*/
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
+ */
+NTSTATUS
+WINAPI
LsaSetSecret(IN LSA_HANDLE SecretHandle,
IN PLSA_UNICODE_STRING CurrentValue OPTIONAL,
IN PLSA_UNICODE_STRING OldValue OPTIONAL)
Modified: trunk/reactos/include/psdk/ntsecapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntsecapi.h?re…
==============================================================================
--- trunk/reactos/include/psdk/ntsecapi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/ntsecapi.h [iso-8859-1] Tue Sep 25 00:15:24 2012
@@ -693,6 +693,8 @@
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 @@
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 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,