Gijs Vermeulen : wtsapi32/tests: Test returned username for WTSQuerySessionInformation(WTSUserName).
Module: wine Branch: master Commit: e07c658fafc39432694f96a762a4a2f6cef20bf7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e07c658fafc39432694f96a76... Author: Gijs Vermeulen <gijsvrm(a)gmail.com> Date: Sun Mar 21 22:50:46 2021 +0100 wtsapi32/tests: Test returned username for WTSQuerySessionInformation(WTSUserName). Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wtsapi32/tests/Makefile.in | 2 +- dlls/wtsapi32/tests/wtsapi.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dlls/wtsapi32/tests/Makefile.in b/dlls/wtsapi32/tests/Makefile.in index a398a8085cd..be0fa8d6772 100644 --- a/dlls/wtsapi32/tests/Makefile.in +++ b/dlls/wtsapi32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = wtsapi32.dll -IMPORTS = wtsapi32 +IMPORTS = wtsapi32 advapi32 C_SRCS = \ wtsapi.c diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c index c9312cd97c5..7cff02de526 100644 --- a/dlls/wtsapi32/tests/wtsapi.c +++ b/dlls/wtsapi32/tests/wtsapi.c @@ -21,6 +21,7 @@ #include <windef.h> #include <winbase.h> #include <winternl.h> +#include <lmcons.h> #include <wtsapi32.h> #include "wine/test.h" @@ -92,10 +93,10 @@ static void test_WTSEnumerateProcessesW(void) static void test_WTSQuerySessionInformation(void) { + WCHAR *buf1, usernameW[UNLEN + 1]; + char *buf2, username[UNLEN + 1]; + DWORD count, tempsize; BOOL ret; - WCHAR *buf1; - char *buf2; - DWORD count; SetLastError(0xdeadbeef); count = 0; @@ -122,6 +123,11 @@ static void test_WTSQuerySessionInformation(void) ok(ret, "got %u\n", GetLastError()); ok(buf1 != NULL, "buf not set\n"); ok(count == (lstrlenW(buf1) + 1) * sizeof(WCHAR), "expected %u, got %u\n", (lstrlenW(buf1) + 1) * sizeof(WCHAR), count); + tempsize = UNLEN + 1; + GetUserNameW(usernameW, &tempsize); + /* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */ + ok(!wcsicmp(buf1, usernameW), "expected %s, got %s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(buf1)); + ok(count == tempsize * sizeof(WCHAR), "expected %u, got %u\n", tempsize * sizeof(WCHAR), count); WTSFreeMemory(buf1); SetLastError(0xdeadbeef); @@ -149,6 +155,11 @@ static void test_WTSQuerySessionInformation(void) ok(ret, "got %u\n", GetLastError()); ok(buf2 != NULL, "buf not set\n"); ok(count == lstrlenA(buf2) + 1, "expected %u, got %u\n", lstrlenA(buf2) + 1, count); + tempsize = UNLEN + 1; + GetUserNameA(username, &tempsize); + /* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */ + ok(!stricmp(buf2, username), "expected %s, got %s\n", username, buf2); + ok(count == tempsize, "expected %u, got %u\n", tempsize, count); WTSFreeMemory(buf2); }
participants (1)
-
Alexandre Julliard