This document is simply bits and pieces of information I am assembling as I look at wrapping the APIs from Terminal Server for easy use in VB applications (and eventually, scripting).
An initial caveat about scripted use of the final product is in order. Several portions of the API (such as the functions which support channels) are well-suited to use in VB applications; when used within sessions, they are unlikely to produce the problems which VB applications running as services can have.
Unfortunately, the use of them within sessions also means that each component will typically be in a separate user session. This immediately means that there will be significant session overhead while a script is actively executing.
Furthermore, the traditional techniques for keeping a script running if it is sinking events can then produce problems if they are not done correctly. Below are some tips for running scripts on TS. These apply to any script run within a TS session.
I am just beginning to write these [2002.08.30] so expect chaos and changes for a while.
This is my initial set of constants for use in VB. They were pulled from the November 2001 Platform SDK release versions of wtsapi32.h, cchannel.h, and pchannel.h.
Enumerations pulled from the Platform SDK documentation files directly
Types pulled from the Platform SDK documentation of TS API structures.
This will contain wrapping information for functions such as the GetSystemMetrics calls which are a necessity for effective detection of remote computing environments.
The following list was pulled from viewing wtsapi32.dll version 5.0.2134.1 in Dependency Walker. These are the undecorated function names.
WTSCloseServer
WTSDisconnectSession
WTSEnumerateProcessesA
WTSEnumerateProcessesW
WTSEnumerateServersA
WTSEnumerateServersW
WTSEnumerateSessionsA
WTSEnumerateSessionsW
WTSFreeMemory
WTSLogoffSession
WTSOpenServerA
WTSOpenServerW
WTSQuerySessionInformationA
WTSQuerySessionInformationW
WTSQueryUserConfigA
WTSQueryUserConfigW
WTSSendMessageA
WTSSendMessageW
WTSSetSessionInformationA
WTSSetSessionInformationW
WTSSetUserConfigA
WTSSetUserConfigW
WTSShutdownSystem
WTSTerminateProcess
WTSVirtualChannelClose
WTSVirtualChannelOpen
WTSVirtualChannelPurgeInput
WTSVirtualChannelPurgeOutput
WTSVirtualChannelQuery
WTSVirtualChannelRead
WTSVirtualChannelWrite
WTSWaitSystemEvent