mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 19:16:06 +00:00
[WTSAPI32] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
96a173fcdf
commit
e88e8daabf
2 changed files with 94 additions and 17 deletions
|
@ -15,19 +15,22 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
//#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ntstatus.h>
|
#include "ntstatus.h"
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
#include <windef.h>
|
#include "windef.h"
|
||||||
#include <winbase.h>
|
#include "winbase.h"
|
||||||
#include <wine/winternl.h>
|
#include "wine/winternl.h"
|
||||||
#include <wtsapi32.h>
|
#include "wtsapi32.h"
|
||||||
#include <wine/debug.h>
|
#include "wine/debug.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
|
WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
|
||||||
|
|
||||||
|
#ifdef __REACTOS__ /* FIXME: Inspect */
|
||||||
|
#define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3)
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* WTSCloseServer (WTSAPI32.@)
|
* WTSCloseServer (WTSAPI32.@)
|
||||||
|
@ -96,8 +99,13 @@ BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version
|
||||||
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||||
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
||||||
{
|
{
|
||||||
FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
|
WTS_PROCESS_INFOW *processInfo;
|
||||||
ppProcessInfo, pCount);
|
SYSTEM_PROCESS_INFORMATION *spi;
|
||||||
|
ULONG size = 0x4000;
|
||||||
|
void *buf = NULL;
|
||||||
|
NTSTATUS status;
|
||||||
|
DWORD count;
|
||||||
|
WCHAR *name;
|
||||||
|
|
||||||
if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
|
if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
|
||||||
{
|
{
|
||||||
|
@ -105,9 +113,71 @@ BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pCount = 0;
|
if (hServer != WTS_CURRENT_SERVER_HANDLE)
|
||||||
*ppProcessInfo = NULL;
|
{
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
size *= 2;
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
buf = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_OUTOFMEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
status = NtQuerySystemInformation(SystemProcessInformation, buf, size, NULL);
|
||||||
|
}
|
||||||
|
while (status == STATUS_INFO_LENGTH_MISMATCH);
|
||||||
|
|
||||||
|
if (status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
SetLastError(RtlNtStatusToDosError(status));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
spi = buf;
|
||||||
|
count = size = 0;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
size += sizeof(WTS_PROCESS_INFOW) + spi->ProcessName.Length + sizeof(WCHAR);
|
||||||
|
count++;
|
||||||
|
if (spi->NextEntryOffset == 0) break;
|
||||||
|
spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
processInfo = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (!processInfo)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
SetLastError(ERROR_OUTOFMEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
name = (WCHAR *)&processInfo[count];
|
||||||
|
|
||||||
|
*ppProcessInfo = processInfo;
|
||||||
|
*pCount = count;
|
||||||
|
|
||||||
|
spi = buf;
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
|
processInfo->SessionId = 0;
|
||||||
|
processInfo->ProcessId = HandleToUlong(spi->UniqueProcessId);
|
||||||
|
processInfo->pProcessName = name;
|
||||||
|
processInfo->pUserSid = NULL;
|
||||||
|
memcpy( name, spi->ProcessName.Buffer, spi->ProcessName.Length );
|
||||||
|
name[ spi->ProcessName.Length/sizeof(WCHAR) ] = 0;
|
||||||
|
|
||||||
|
processInfo++;
|
||||||
|
name += (spi->ProcessName.Length + sizeof(WCHAR))/sizeof(WCHAR);
|
||||||
|
spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +241,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
|
||||||
*/
|
*/
|
||||||
void WINAPI WTSFreeMemory(PVOID pMemory)
|
void WINAPI WTSFreeMemory(PVOID pMemory)
|
||||||
{
|
{
|
||||||
static int once;
|
HeapFree(GetProcessHeap(), 0, pMemory);
|
||||||
|
|
||||||
if (!once++) FIXME("Stub %p\n", pMemory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
@ -246,9 +314,18 @@ BOOL WINAPI WTSQuerySessionInformationW(
|
||||||
BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
|
BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
|
||||||
{
|
{
|
||||||
FIXME("%u %p\n", session_id, token);
|
FIXME("%u %p\n", session_id, token);
|
||||||
|
|
||||||
|
if (!token)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
|
||||||
|
GetCurrentProcess(), token,
|
||||||
|
0, FALSE, DUPLICATE_SAME_ACCESS);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* WTSQueryUserConfigA (WTSAPI32.@)
|
* WTSQueryUserConfigA (WTSAPI32.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -212,7 +212,7 @@ reactos/dll/win32/wmi # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/wmiutils # Synced to WineStaging-3.3
|
reactos/dll/win32/wmiutils # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/wmvcore # Synced to WineStaging-3.3
|
reactos/dll/win32/wmvcore # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/wshom.ocx # Synced to WineStaging-3.3
|
reactos/dll/win32/wshom.ocx # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/wtsapi32 # Synced to Wine-3.0
|
reactos/dll/win32/wtsapi32 # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/wuapi # Synced to WineStaging-2.9
|
reactos/dll/win32/wuapi # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/xinput1_1 # Synced to WineStaging-2.9
|
reactos/dll/win32/xinput1_1 # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/xinput1_2 # Synced to WineStaging-2.9
|
reactos/dll/win32/xinput1_2 # Synced to WineStaging-2.9
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue