Gijs Vermeulen gijsvrm@gmail.com writes:
+BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INFO_CLASS class, char **buffer, DWORD *count) {
- /* FIXME: Forward request to winsta.dll::WinStationQueryInformationA */
- FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
Buffer, BytesReturned);
WCHAR *bufferW = NULL;
TRACE("%p 0x%08x %d %p %p\n", server, session_id, class, buffer, count);
if (!buffer || !count)
{
SetLastError(ERROR_INVALID_USER_BUFFER);
return FALSE;
}
if (WTSQuerySessionInformationW(server, session_id, class, &bufferW, count))
{
*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
if (*count)
{
if (!(*buffer = heap_alloc(*count))) return FALSE;
if ((*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, *buffer, *count, NULL, NULL)))
return TRUE;
}
}
You are leaking bufferW and potentially *buffer also.