WTSEnumerateProcessesW function (wtsapi32.h)
Retrieves information about the active processes on a specified Remote Desktop Session Host (RD Session Host) server.
Syntax
BOOL WTSEnumerateProcessesW(
[in] HANDLE hServer,
[in] DWORD Reserved,
[in] DWORD Version,
[out] PWTS_PROCESS_INFOW *ppProcessInfo,
[out] DWORD *pCount
);
Parameters
[in] hServer
Handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.
[in] Reserved
Reserved; must be zero.
[in] Version
Specifies the version of the enumeration request. Must be 1.
[out] ppProcessInfo
Pointer to a variable that receives a pointer to an array of WTS_PROCESS_INFO structures. Each structure in the array contains information about an active process on the specified RD Session Host server. To free the returned buffer, call the WTSFreeMemory function.
[out] pCount
Pointer to a variable that receives the number of WTS_PROCESS_INFO structures returned in the ppProcessInfo buffer.
Return value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The caller must be a member of the Administrators group to enumerate processes that are running under a different user's context.
Note
The wtsapi32.h header defines WTSEnumerateProcesses as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Target Platform | Windows |
Header | wtsapi32.h |
Library | Wtsapi32.lib |
DLL | Wtsapi32.dll |
API set | ext-ms-win-session-wtsapi32-l1-1-0 (introduced in Windows 8) |