[PATCH] wtsapi32: add semi-stub for WTSDomainName case in WTSQuerySessionInformation
Louis Lenders
xerox.xerox2000x at gmail.com
Fri Jun 14 08:02:48 CDT 2019
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=47310
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
---
dlls/wtsapi32/tests/wtsapi.c | 9 +++++++++
dlls/wtsapi32/wtsapi32.c | 14 ++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c
index 67f56bbd7f..49ff9a8c5a 100644
--- a/dlls/wtsapi32/tests/wtsapi.c
+++ b/dlls/wtsapi32/tests/wtsapi.c
@@ -102,6 +102,15 @@ static void test_WTSQuerySessionInformationW(void)
ok(ret, "got %u\n", GetLastError());
ok(buf != NULL, "buf not set\n");
ok(count == (lstrlenW(buf) + 1) * sizeof(WCHAR), "got %u\n", count);
+
+ count = 0;
+ buf = NULL;
+ ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSDomainName, &buf, &count);
+ ok(ret, "got %u\n", GetLastError());
+ ok(buf != NULL, "buf not set\n");
+ ok(count == (lstrlenW(buf) + 1) * sizeof(WCHAR), "got %u\n", count);
+ trace("domain name: %s\n", wine_dbgstr_w(buf));
+
WTSFreeMemory(buf);
}
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
index 3edf9215fd..41e3e3eab4 100644
--- a/dlls/wtsapi32/wtsapi32.c
+++ b/dlls/wtsapi32/wtsapi32.c
@@ -246,6 +246,20 @@ BOOL WINAPI WTSQuerySessionInformationW(
*BytesReturned = count * sizeof(WCHAR);
return TRUE;
}
+
+ if (WTSInfoClass == WTSDomainName)
+ {
+ WCHAR *computername;
+ DWORD count = MAX_COMPUTERNAME_LENGTH + 1;
+
+ if (!(computername = heap_alloc(count * sizeof(WCHAR)))) return FALSE;
+ GetComputerNameW(computername, &count);
+ count++; /* include NULL terminator */
+ *Buffer = computername;
+ *BytesReturned = count * sizeof(WCHAR);
+ return TRUE;
+ }
+
return FALSE;
}
--
2.20.1
More information about the wine-devel
mailing list