Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

WTSEnumerateProcessesEx function

Retrieves information about the active processes on the specified Remote Desktop Session Host (RD Session Host) server or Remote Desktop Virtualization Host (RD Virtualization Host) server.

Syntax


BOOL WINAPI WTSEnumerateProcessesEx(
  _In_     HANDLE hServer,
  _Inout_  DWORD *pLevel,
  _In_     DWORD SessionID,
  _Out_    LPTSTR *ppProcessInfo,
  _Out_    DWORD *pCount
);

Parameters

hServer [in]

A handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the server on which your application is running.

pLevel [in, out]

A pointer to a DWORD variable that, on input, specifies the type of information to return. To return an array of WTS_PROCESS_INFO structures, specify zero. To return an array of WTS_PROCESS_INFO_EX structures, specify one.

If you do not specify a valid value for this parameter, on output, WTSEnumerateProcessesEx sets this parameter to one and returns an error. Otherwise, on output, WTSEnumerateProcessesEx does not change the value of this parameter.

SessionID [in]

The session for which to enumerate processes. To enumerate processes for all sessions on the server, specify WTS_ANY_SESSION.

ppProcessInfo [out]

A pointer to a variable that receives a pointer to an array of WTS_PROCESS_INFO or WTS_PROCESS_INFO_EX structures. The type of structure is determined by the value passed to the pLevel parameter. Each structure in the array contains information about an active process. When you have finished using the array, free it by calling the WTSFreeMemoryEx function. You should also set the pointer to NULL.

pCount [out]

A pointer to a variable that receives the number of structures returned in the buffer referenced by the ppProcessInfo parameter.

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 the GetLastError function.

Remarks

The caller must be a member of the Administrators group to enumerate processes that are running under another user session.

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2

Header

Wtsapi32.h

Library

Wtsapi32.lib

DLL

Wtsapi32.dll

Unicode and ANSI names

WTSEnumerateProcessesW (Unicode) and WTSEnumerateProcessesA (ANSI)

See also

WTSOpenServer
WTS_PROCESS_INFO
WTS_PROCESS_INFO_EX

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.