贴出来:
Terminal Services Administration
The Terminal Services API enables you to enumerate and manage Terminal Servers, client sessions, and processes.
To retrieve the names of all the Terminal Servers in a domain, call the
You can use the handle returned by WTSOpenServer to perform the following operations on the server.
Function | Operation |
---|---|
WTSDisconnectSession | Disconnects the client from a specified session. The session remains active and the user can log on again to connect to the same session. |
WTSEnumerateSessions | Returns a list of sessions on the specified Terminal Server. |
WTSEnumerateProcesses | Returns a list of processes on the specified Terminal Server. |
WTSLogoffSession | Logs off the specified session. |
WTSQuerySessionInformation | Returns information about the specified session on the specified Terminal Server. |
WTSSendMessage | Shows a message box on the client display of a specified session. |
WTSShutdownSystem | Shuts down and optionally restarts a specified Terminal Server. |
WTSTerminateProcess | Terminates a specified process on a specified Terminal Server. |
WTSVirtualChannelOpen | Opens a handle to the server end of a specified virtual channel. For more information about virtual channels, see Using Terminal Services Virtual Channels. |
WTSWaitSystemEvent | Waits for an event, such as the creation of a client session or a user logging on to the Terminal Server. |
Several of these functions allocate buffers to return information to the caller. Call the WTSFreeMemory function to free the buffer when you are finished with it.