https://git.reactos.org/?p=reactos.git;a=commitdiff;h=26f8fa7ade5c09c6e313b…
commit 26f8fa7ade5c09c6e313b0b695497b1f8a9c75ac
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Dec 29 21:14:40 2024 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Dec 29 21:14:40 2024 +0100
[WKSSVC] NetrWkstaGetInfo Level 102: Return the number of currently logged-on users
---
base/services/wkssvc/rpcserver.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/base/services/wkssvc/rpcserver.c b/base/services/wkssvc/rpcserver.c
index 0c50e494f33..fe39af081bc 100644
--- a/base/services/wkssvc/rpcserver.c
+++ b/base/services/wkssvc/rpcserver.c
@@ -141,6 +141,7 @@ NetrWkstaGetInfo(
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
LSA_HANDLE PolicyHandle;
PPOLICY_PRIMARY_DOMAIN_INFO DomainInfo = NULL;
+ ULONG LoggedOnUsers;
NTSTATUS NtStatus;
DWORD dwResult = NERR_Success;
@@ -173,6 +174,33 @@ NetrWkstaGetInfo(
return LsaNtStatusToWinError(NtStatus);
}
+ if (Level == 102)
+ {
+ MSV1_0_ENUMUSERS_REQUEST EnumRequest;
+ PMSV1_0_ENUMUSERS_RESPONSE EnumResponseBuffer = NULL;
+ DWORD EnumResponseBufferSize = 0;
+ NTSTATUS ProtocolStatus;
+
+ /* enumerate all currently logged-on users */
+ EnumRequest.MessageType = MsV1_0EnumerateUsers;
+ NtStatus = LsaCallAuthenticationPackage(LsaHandle,
+ LsaAuthenticationPackage,
+ &EnumRequest,
+ sizeof(EnumRequest),
+ (PVOID*)&EnumResponseBuffer,
+ &EnumResponseBufferSize,
+ &ProtocolStatus);
+ if (!NT_SUCCESS(NtStatus))
+ {
+ dwResult = RtlNtStatusToDosError(NtStatus);
+ goto done;
+ }
+
+ LoggedOnUsers = EnumResponseBuffer->NumberOfLoggedOnUsers;
+
+ LsaFreeReturnBuffer(EnumResponseBuffer);
+ }
+
switch (Level)
{
case 100:
@@ -252,7 +280,7 @@ NetrWkstaGetInfo(
if (pWkstaInfo->WkstaInfo102.wki102_lanroot != NULL)
wcscpy(pWkstaInfo->WkstaInfo102.wki102_lanroot, pszLanRoot);
- pWkstaInfo->WkstaInfo102.wki102_logged_on_users = 1; /* FIXME */
+ pWkstaInfo->WkstaInfo102.wki102_logged_on_users = LoggedOnUsers;
*WkstaInfo = pWkstaInfo;
break;
@@ -276,6 +304,7 @@ NetrWkstaGetInfo(
break;
}
+done:
if (DomainInfo != NULL)
LsaFreeMemory(DomainInfo);