Module: wine Branch: master Commit: 090e574adb0c65eb905f5380ff5c4f9dae9bb529 URL: https://gitlab.winehq.org/wine/wine/-/commit/090e574adb0c65eb905f5380ff5c4f9...
Author: Hans Leidekker hans@codeweavers.com Date: Thu Dec 1 16:01:40 2022 +0100
wtsapi32: Improve the stub for WTSQuerySessionInformation(WTSClientProtocolType).
---
dlls/wtsapi32/tests/wtsapi.c | 10 ++++++++++ dlls/wtsapi32/wtsapi32.c | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+)
diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c index 32caa05588c..2023a21e938 100644 --- a/dlls/wtsapi32/tests/wtsapi.c +++ b/dlls/wtsapi32/tests/wtsapi.c @@ -192,6 +192,7 @@ static void test_WTSQuerySessionInformation(void) WCHAR *buf1, usernameW[UNLEN + 1], computernameW[MAX_COMPUTERNAME_LENGTH + 1]; char *buf2, username[UNLEN + 1], computername[MAX_COMPUTERNAME_LENGTH + 1]; DWORD count, tempsize; + USHORT *protocol; BOOL ret;
SetLastError(0xdeadbeef); @@ -283,6 +284,15 @@ static void test_WTSQuerySessionInformation(void) ok(!stricmp(buf2, computername), "expected %s, got %s\n", computername, buf2); ok(count == tempsize + 1, "expected %lu, got %lu\n", tempsize + 1, count); WTSFreeMemory(buf2); + + count = 0; + protocol = NULL; + ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSClientProtocolType, + (char **)&protocol, &count); + ok(ret, "got %lu\n", GetLastError()); + ok(protocol != NULL, "protocol not set\n"); + ok(count == sizeof(*protocol), "got %lu\n", count); + WTSFreeMemory(protocol); }
static void test_WTSQueryUserToken(void) diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c index e7a6297396a..7de1b8124ea 100644 --- a/dlls/wtsapi32/wtsapi32.c +++ b/dlls/wtsapi32/wtsapi32.c @@ -418,6 +418,18 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF return FALSE; }
+ if (class == WTSClientProtocolType) + { + USHORT *protocol; + + if (!(protocol = heap_alloc(sizeof(*protocol)))) return FALSE; + FIXME("returning 0 protocol type\n"); + *protocol = 0; + *buffer = (char *)protocol; + *count = sizeof(*protocol); + return TRUE; + } + if (!WTSQuerySessionInformationW(server, session_id, class, &bufferW, count)) return FALSE;
@@ -458,6 +470,18 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF return FALSE; }
+ if (class == WTSClientProtocolType) + { + USHORT *protocol; + + if (!(protocol = heap_alloc(sizeof(*protocol)))) return FALSE; + FIXME("returning 0 protocol type\n"); + *protocol = 0; + *buffer = (WCHAR *)protocol; + *count = sizeof(*protocol); + return TRUE; + } + if (class == WTSUserName) { DWORD size = UNLEN + 1;