[SAMLIB]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 3 Aug 2013 22:39:58 +0000 (22:39 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 3 Aug 2013 22:39:58 +0000 (22:39 +0000)
Implement SamQueryDisplayInformation.

svn path=/trunk/; revision=59630

reactos/dll/win32/samlib/samlib.c
reactos/dll/win32/samlib/samlib.spec
reactos/include/ddk/ntsam.h

index e5ca812..961e2a5 100644 (file)
@@ -1409,6 +1409,92 @@ SamOpenUser(IN SAM_HANDLE DomainHandle,
 }
 
 
+NTSTATUS
+NTAPI
+SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle,
+                           IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
+                           IN ULONG Index,
+                           IN ULONG EntryCount,
+                           IN ULONG PreferredMaximumLength,
+                           OUT PULONG TotalAvailable,
+                           OUT PULONG TotalReturned,
+                           OUT PULONG ReturnedEntryCount,
+                           OUT PVOID *SortedBuffer)
+{
+    SAMPR_DISPLAY_INFO_BUFFER LocalBuffer;
+    NTSTATUS Status;
+
+    TRACE("(%p %lu %lu %lu %lu %p %p %p %p)\n",
+          DomainHandle, DisplayInformation, Index, EntryCount,
+          PreferredMaximumLength, TotalAvailable, TotalReturned,
+          ReturnedEntryCount, SortedBuffer);
+
+    if ((TotalAvailable == NULL) ||
+        (TotalReturned == NULL) ||
+        (ReturnedEntryCount == NULL) ||
+        (SortedBuffer == NULL))
+        return STATUS_INVALID_PARAMETER;
+
+    RpcTryExcept
+    {
+        Status = SamrQueryDisplayInformation3((SAMPR_HANDLE)DomainHandle,
+                                              DisplayInformation,
+                                              Index,
+                                              EntryCount,
+                                              PreferredMaximumLength,
+                                              TotalAvailable,
+                                              TotalReturned,
+                                              &LocalBuffer);
+        if (NT_SUCCESS(Status))
+        {
+            switch (DisplayInformation)
+            {
+                case DomainDisplayUser:
+                    *ReturnedEntryCount = LocalBuffer.UserInformation.EntriesRead;
+                    *SortedBuffer = LocalBuffer.UserInformation.Buffer;
+                    break;
+
+                case DomainDisplayMachine:
+                    *ReturnedEntryCount = LocalBuffer.MachineInformation.EntriesRead;
+                    *SortedBuffer = LocalBuffer.MachineInformation.Buffer;
+                    break;
+
+                case DomainDisplayGroup:
+                    *ReturnedEntryCount = LocalBuffer.GroupInformation.EntriesRead;
+                    *SortedBuffer = LocalBuffer.GroupInformation.Buffer;
+                    break;
+
+                case DomainDisplayOemUser:
+                    *ReturnedEntryCount = LocalBuffer.OemUserInformation.EntriesRead;
+                    *SortedBuffer = LocalBuffer.OemUserInformation.Buffer;
+                    break;
+
+                case DomainDisplayOemGroup:
+                    *ReturnedEntryCount = LocalBuffer.OemGroupInformation.EntriesRead;
+                    *SortedBuffer = LocalBuffer.OemGroupInformation.Buffer;
+                    break;
+
+                case DomainDisplayServer:
+                    /* FIXME */
+                    break;
+            }
+        }
+        else
+        {
+            *ReturnedEntryCount = 0;
+            *SortedBuffer = NULL;
+        }
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
+}
+
+
 NTSTATUS
 NTAPI
 SamQueryInformationAlias(IN SAM_HANDLE AliasHandle,
index a375ecf..4a4c21b 100644 (file)
@@ -32,7 +32,7 @@
 @ stdcall SamOpenDomain(ptr long ptr ptr)
 @ stdcall SamOpenGroup(ptr long long ptr)
 @ stdcall SamOpenUser(ptr long long ptr)
-@ stub SamQueryDisplayInformation
+@ stdcall SamQueryDisplayInformation(ptr long long long long ptr ptr ptr ptr)
 @ stdcall SamQueryInformationAlias(ptr long ptr)
 @ stdcall SamQueryInformationDomain(ptr long ptr)
 @ stdcall SamQueryInformationGroup(ptr long ptr)
index e9214bb..5f27283 100644 (file)
@@ -901,6 +901,18 @@ SamOpenUser(IN SAM_HANDLE DomainHandle,
             IN ULONG UserId,
             OUT PSAM_HANDLE UserHandle);
 
+NTSTATUS
+NTAPI
+SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle,
+                           IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
+                           IN ULONG Index,
+                           IN ULONG EntryCount,
+                           IN ULONG PreferredMaximumLength,
+                           OUT PULONG TotalAvailable,
+                           OUT PULONG TotalReturned,
+                           OUT PULONG ReturnedEntryCount,
+                           OUT PVOID *SortedBuffer);
+
 NTSTATUS
 NTAPI
 SamQueryInformationAlias(IN SAM_HANDLE AliasHandle,