forked from Mirrors/wine-wine
wtsapi32: Improve WTSQuerySessionInformationW stub.
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>feature/deterministic
parent
1db2b56336
commit
116890da12
|
@ -97,6 +97,25 @@ static void test_WTSQuerySessionInformation(void)
|
||||||
char *buf2;
|
char *buf2;
|
||||||
DWORD count;
|
DWORD count;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
count = 0;
|
||||||
|
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
|
||||||
|
ok(!ret, "got %u\n", GetLastError());
|
||||||
|
ok(count == 0, "got %u\n", count);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
count = 1;
|
||||||
|
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
|
||||||
|
ok(!ret, "got %u\n", GetLastError());
|
||||||
|
ok(count == 1, "got %u\n", count);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf1, NULL);
|
||||||
|
ok(!ret, "got %u\n", GetLastError());
|
||||||
|
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
buf1 = NULL;
|
buf1 = NULL;
|
||||||
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf1, &count);
|
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf1, &count);
|
||||||
|
|
|
@ -341,6 +341,12 @@ BOOL WINAPI WTSQuerySessionInformationW(
|
||||||
FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
|
||||||
Buffer, BytesReturned);
|
Buffer, BytesReturned);
|
||||||
|
|
||||||
|
if (!Buffer || !BytesReturned)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_USER_BUFFER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (WTSInfoClass == WTSUserName)
|
if (WTSInfoClass == WTSUserName)
|
||||||
{
|
{
|
||||||
WCHAR *username;
|
WCHAR *username;
|
||||||
|
@ -354,6 +360,11 @@ BOOL WINAPI WTSQuerySessionInformationW(
|
||||||
*BytesReturned = count * sizeof(WCHAR);
|
*BytesReturned = count * sizeof(WCHAR);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Buffer = NULL;
|
||||||
|
*BytesReturned = 0;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue