wtsapi32: Improve the stub for WTSQuerySessionInformationW.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
90681e3a76
commit
a389b33c25
@ -1,5 +1,6 @@
|
|||||||
MODULE = wtsapi32.dll
|
MODULE = wtsapi32.dll
|
||||||
IMPORTLIB = wtsapi32
|
IMPORTLIB = wtsapi32
|
||||||
|
IMPORTS = advapi32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
wtsapi32.c
|
wtsapi32.c
|
||||||
|
@ -90,7 +90,23 @@ static void test_WTSEnumerateProcessesW(void)
|
|||||||
WTSFreeMemory(info);
|
WTSFreeMemory(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_WTSQuerySessionInformationW(void)
|
||||||
|
{
|
||||||
|
BOOL ret;
|
||||||
|
WCHAR *buf;
|
||||||
|
DWORD count;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
buf = NULL;
|
||||||
|
ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &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);
|
||||||
|
WTSFreeMemory(buf);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST (wtsapi)
|
START_TEST (wtsapi)
|
||||||
{
|
{
|
||||||
test_WTSEnumerateProcessesW();
|
test_WTSEnumerateProcessesW();
|
||||||
|
test_WTSQuerySessionInformationW();
|
||||||
}
|
}
|
||||||
|
@ -233,6 +233,19 @@ 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 (WTSInfoClass == WTSUserName)
|
||||||
|
{
|
||||||
|
WCHAR *username;
|
||||||
|
DWORD count = 0;
|
||||||
|
|
||||||
|
GetUserNameW(NULL, &count);
|
||||||
|
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
|
||||||
|
if (!(username = heap_alloc(count * sizeof(WCHAR)))) return FALSE;
|
||||||
|
GetUserNameW(username, &count);
|
||||||
|
*Buffer = username;
|
||||||
|
*BytesReturned = count * sizeof(WCHAR);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ DECL_WINELIB_TYPE_AW(WTS_SERVER_INFO)
|
|||||||
DECL_WINELIB_TYPE_AW(PWTS_SERVER_INFO)
|
DECL_WINELIB_TYPE_AW(PWTS_SERVER_INFO)
|
||||||
|
|
||||||
#define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL)
|
#define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL)
|
||||||
|
#define WTS_CURRENT_SESSION (~0u)
|
||||||
|
|
||||||
void WINAPI WTSCloseServer(HANDLE);
|
void WINAPI WTSCloseServer(HANDLE);
|
||||||
BOOL WINAPI WTSConnectSessionA(ULONG, ULONG, PSTR, BOOL);
|
BOOL WINAPI WTSConnectSessionA(ULONG, ULONG, PSTR, BOOL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user