Author: ekohl
Date: Sun Jul 11 09:33:44 2010
New Revision: 47996
URL:
http://svn.reactos.org/svn/reactos?rev=47996&view=rev
Log:
[ADVAPI32/LSASRV]
- Export LsaLookupPrivilegeName.
- Move mockup code from advapi32 to lsasrv (LsaLookupSids --> LsarLookupSids).
- Make LsaLookupSids call the server function LsarLookupSids.
Modified:
trunk/reactos/dll/win32/advapi32/advapi32.spec
trunk/reactos/dll/win32/advapi32/sec/lsa.c
trunk/reactos/dll/win32/lsasrv/lsarpc.c
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] Sun Jul 11 09:33:44 2010
@@ -373,7 +373,7 @@
@ stdcall LsaLookupNames(long long ptr ptr ptr)
@ stdcall LsaLookupNames2(ptr long long ptr ptr ptr)
@ stub LsaLookupPrivilegeDisplayName
-@ stub LsaLookupPrivilegeName
+@ stdcall LsaLookupPrivilegeName(ptr ptr ptr)
@ stdcall LsaLookupPrivilegeValue(ptr ptr ptr)
@ stdcall LsaLookupSids(ptr long ptr ptr ptr)
@ stdcall LsaNtStatusToWinError(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] Sun Jul 11 09:33:44 2010
@@ -429,7 +429,7 @@
PRPC_UNICODE_STRING NameBuffer = NULL;
NTSTATUS Status;
- TRACE("(%p,%p,%p) stub\n", PolicyHandle, Value, Name);
+ TRACE("(%p,%p,%p)\n", PolicyHandle, Value, Name);
RpcTryExcept
{
@@ -463,7 +463,7 @@
LUID Luid;
NTSTATUS Status;
- TRACE("(%p,%p,%p) stub\n", PolicyHandle, Name, Value);
+ TRACE("(%p,%p,%p)\n", PolicyHandle, Name, Value);
RpcTryExcept
{
@@ -483,7 +483,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
WINAPI
@@ -494,36 +494,49 @@
PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
PLSA_TRANSLATED_NAME *Names)
{
- static const UNICODE_STRING UserName =
RTL_CONSTANT_STRING(L"Administrator");
- PLSA_REFERENCED_DOMAIN_LIST LocalDomains;
- PLSA_TRANSLATED_NAME LocalNames;
-
- TRACE("(%p,%u,%p,%p,%p) stub\n", PolicyHandle, Count, Sids,
+ LSAPR_SID_ENUM_BUFFER SidEnumBuffer;
+ LSAPR_TRANSLATED_NAMES TranslatedNames;
+ ULONG MappedCount = 0;
+ NTSTATUS Status;
+
+ TRACE("(%p,%u,%p,%p,%p)\n", PolicyHandle, Count, Sids,
ReferencedDomains, Names);
- WARN("LsaLookupSids(): stub. Always returning 'Administrator'\n");
- if (Count != 1)
- return STATUS_NONE_MAPPED;
- LocalDomains = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(LSA_TRANSLATED_SID));
- if (!LocalDomains)
- return SCESTATUS_NOT_ENOUGH_RESOURCE;
- LocalNames = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(LSA_TRANSLATED_NAME) +
UserName.MaximumLength);
- if (!LocalNames)
- {
- LsaFreeMemory(LocalDomains);
- return SCESTATUS_NOT_ENOUGH_RESOURCE;
- }
- LocalDomains[0].Entries = 0;
- LocalDomains[0].Domains = NULL;
- LocalNames[0].Use = SidTypeWellKnownGroup;
- LocalNames[0].Name.Buffer = (LPWSTR)((ULONG_PTR)(LocalNames) +
sizeof(LSA_TRANSLATED_NAME));
- LocalNames[0].Name.Length = UserName.Length;
- LocalNames[0].Name.MaximumLength = UserName.MaximumLength;
- RtlCopyMemory(LocalNames[0].Name.Buffer, UserName.Buffer, UserName.MaximumLength);
-
- *ReferencedDomains = LocalDomains;
- *Names = LocalNames;
- return STATUS_SUCCESS;
+ if (Count == 0)
+ return STATUS_INVALID_PARAMETER;
+
+ SidEnumBuffer.Entries = Count;
+ SidEnumBuffer.SidInfo = (PLSAPR_SID_INFORMATION)Sids;
+
+ RpcTryExcept
+ {
+ *ReferencedDomains = NULL;
+ *Names = NULL;
+
+ TranslatedNames.Entries = 0;
+ TranslatedNames.Names = NULL;
+
+ Status = LsarLookupSids((LSAPR_HANDLE)PolicyHandle,
+ &SidEnumBuffer,
+ (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains,
+ &TranslatedNames,
+ LsapLookupWksta,
+ &MappedCount);
+
+ *Names = (PLSA_TRANSLATED_NAME)TranslatedNames.Names;
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ if (TranslatedNames.Names != NULL)
+ {
+ MIDL_user_free(TranslatedNames.Names);
+ }
+
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return Status;
}
/******************************************************************************
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sun Jul 11 09:33:44 2010
@@ -347,8 +347,44 @@
LSAP_LOOKUP_LEVEL LookupLevel,
DWORD *MappedCount)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ static const UNICODE_STRING UserName =
RTL_CONSTANT_STRING(L"Administrator");
+ PLSAPR_TRANSLATED_NAME OutputNames = NULL;
+ ULONG OutputNamesLength;
+ ULONG i;
+
+ TRACE("LsarLookupSids(%p, %p, %p, %p, %d, %p)\n",
+ PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
+ LookupLevel, MappedCount);
+
+ TranslatedNames->Entries = SidEnumBuffer->Entries;
+ TranslatedNames->Names = NULL;
+ *ReferencedDomains = NULL;
+
+ OutputNamesLength = SidEnumBuffer->Entries * sizeof(LSA_TRANSLATED_NAME);
+ OutputNames = MIDL_user_allocate(OutputNamesLength);
+ if (OutputNames == NULL)
+ {
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ RtlZeroMemory(OutputNames, OutputNamesLength);
+
+ for (i = 0; i < SidEnumBuffer->Entries; i++)
+ {
+ OutputNames[i].Use = SidTypeWellKnownGroup;
+ OutputNames[i].DomainIndex = 0;
+ OutputNames[i].Name.Buffer = MIDL_user_allocate(UserName.MaximumLength);
+ OutputNames[i].Name.Length = UserName.Length;
+ OutputNames[i].Name.MaximumLength = UserName.MaximumLength;
+ RtlCopyMemory(OutputNames[i].Name.Buffer, UserName.Buffer,
UserName.MaximumLength);
+ }
+
+ *MappedCount = SidEnumBuffer->Entries;
+
+ TranslatedNames->Entries = SidEnumBuffer->Entries;
+ TranslatedNames->Names = OutputNames;
+
+ return STATUS_SUCCESS;
}