Constants for VB Terminal Services API Wrappers

(Pre-release)

Following list compiled by extraction from Platform SDK header files.

Extracts from distinct header files are separated by a horizontal line; wtsapi32.h is the critical one.  Comments inline describing constants and categories are primarily derived from the header file internal comments.


Option Explicit

' Module contains constants defined within the primary
' Terminal Services header files:
' wtsapi32.h
' cchannel.h
' pchannel.h
' Source: Nov 2001 Platform SDK, release version include files


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Constants from wtsapi32.h
' Windows Terminal Server public APIs
' 2001-05-29 version, 27097 bytes
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Kept in roughly the order used within wtsapi32.h

' Flags for Console Notification
Public Const NOTIFY_FOR_ALL_SESSIONS = 1&
Public Const NOTIFY_FOR_THIS_SESSION = 0&

' These Constants specify the current server
Public Const WTS_CURRENT_SERVER = 0&
Public Const WTS_CURRENT_SERVER_HANDLE = 0&
' following was shown as a NULL in the API
Public Const WTS_CURRENT_SERVER_NAME = vbNullString

' Specifies the current session (SessionId)
Public Const WTS_CURRENT_SESSION As Long = -1

' Possible pResponse values from WTSSendMessage()
Public Const IDTIMEOUT = 32000&
Public Const IDASYNC = 32001&


' Shutdown flags

' log off all users except current one
' MUST reboot before winstations can be recreated
Public Const WTS_WSD_LOGOFF = 1&
'
' shutdown system
Public Const WTS_WSD_SHUTDOWN = 2&
'
' shutdown and reboot
Public Const WTS_WSD_REBOOT = 4&
'
' shutdown - and power off if hardware supports it
Public Const WTS_WSD_POWEROFF = 8&
'
' reboot without logging off users or shutting down
Public Const WTS_WSD_FASTREBOOT = 10&
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


' WTS_EVENT - Event flags for WTSWaitSystemEvent
Public Const WTS_EVENT_ALL = 2147483647 ' wait for all event types
Public Const WTS_EVENT_CONNECT = 8& ' WinStation connect to client
Public Const WTS_EVENT_CREATE = 1& ' new WinStation created
Public Const WTS_EVENT_DELETE = 2& ' existing WinStation deleted
Public Const WTS_EVENT_DISCONNECT = 16 ' WinStation logged on without
Public Const WTS_EVENT_FLUSH = &H80000000
' unblock all waiters
Public Const WTS_EVENT_LICENSE = 256& ' license state change
Public Const WTS_EVENT_LOGOFF = 64& ' user logged off from
Public Const WTS_EVENT_LOGON = 32& ' user logged on to existing
Public Const WTS_EVENT_NONE = 0& ' return no event
Public Const WTS_EVENT_RENAME = 4& ' existing WinStation renamed
Public Const WTS_EVENT_STATECHANGE = 128& ' WinStation state change

Public Const WTS_PROTOCOL_TYPE_CONSOLE = 0& ' Console
Public Const WTS_PROTOCOL_TYPE_ICA = 1& ' ICA Protocol
Public Const WTS_PROTOCOL_TYPE_RDP = 2& ' RDP Protocol
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Constants from cchannel.h included in Platform SDK
' Virtual Channel Client API
' 2001-04-11 version, 21036 bytes
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Levels of Virtual Channel Support
Public Const VIRTUAL_CHANNEL_VERSION_WIN2000 = 1&

' Events passed to VirtualChannelInitEvent

' Client initialized (no data)
Public Const CHANNEL_EVENT_INITIALIZED = 0&
'
' Connection established (data = name of Server)
Public Const CHANNEL_EVENT_CONNECTED = 1&
'
' Connection established with old Server, so no channel support
Public Const CHANNEL_EVENT_V1_CONNECTED = 2&
'
' Connection ended (no data)
Public Const CHANNEL_EVENT_DISCONNECTED = 3&
'
' Client terminated (no data)
Public Const CHANNEL_EVENT_TERMINATED = 4&
'
' NOTE - 5 through 9 not listed in cchannel.h
' Data received from Server
' (data = incoming data)
Public Const CHANNEL_EVENT_DATA_RECEIVED = 10&
'
' VirtualChannelWrite completed
' (pData - pUserData passed on VirtualChannelWrite)
Public Const CHANNEL_EVENT_WRITE_COMPLETE = 11&
'
' VirtualChannelWrite cancelled
' (pData - pUserData passed on VirtualChannelWrite)
Public Const CHANNEL_EVENT_WRITE_CANCELLED = 12&
'
' Return codes from VirtualChannelXxx functions
Public Const CHANNEL_RC_OK = 0&
Public Const CHANNEL_RC_ALREADY_INITIALIZED = 1&
Public Const CHANNEL_RC_NOT_INITIALIZED = 2&
Public Const CHANNEL_RC_ALREADY_CONNECTED = 3&
Public Const CHANNEL_RC_NOT_CONNECTED = 4&
Public Const CHANNEL_RC_TOO_MANY_CHANNELS = 5&
Public Const CHANNEL_RC_BAD_CHANNEL = 6&
Public Const CHANNEL_RC_BAD_CHANNEL_HANDLE = 7&
Public Const CHANNEL_RC_NO_BUFFER = 8&
Public Const CHANNEL_RC_BAD_INIT_HANDLE = 9&
Public Const CHANNEL_RC_NOT_OPEN = 10&
Public Const CHANNEL_RC_BAD_PROC = 11&
Public Const CHANNEL_RC_NO_MEMORY = 12&
Public Const CHANNEL_RC_UNKNOWN_CHANNEL_NAME = 13&
Public Const CHANNEL_RC_ALREADY_OPEN = 14&
Public Const CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY = 15&
Public Const CHANNEL_RC_NULL_DATA = 16&
Public Const CHANNEL_RC_ZERO_LENGTH = 17&
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Constants from Pchannel.h included in Platform SDK
' Virtual Channel protocol header
' VC stuff common to Client & Server
' 2001-04-11 version, 8603 bytes
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Const CHANNEL_CHUNK_LENGTH = 1600&
Public Const CHANNEL_FLAG_FIRST = 1&
Public Const CHANNEL_FLAG_LAST = 2&
Public Const CHANNEL_FLAG_MIDDLE = 0&
Public Const CHANNEL_FLAG_FAIL = 256&
Public Const CHANNEL_FLAG_SHOW_PROTOCOL = 16&
Public Const CHANNEL_FLAG_SUSPEND = 32&
Public Const CHANNEL_FLAG_RESUME = 64&
Public Const CHANNEL_OPTION_INITIALIZED = &H80000000
Public Const CHANNEL_OPTION_ENCRYPT_RDP = 1073741824
Public Const CHANNEL_OPTION_ENCRYPT_SC = 536870912
Public Const CHANNEL_OPTION_ENCRYPT_CS = 268435456
Public Const CHANNEL_OPTION_PRI_HIGH = 134217728
Public Const CHANNEL_OPTION_PRI_MED = 67108864
Public Const CHANNEL_OPTION_PRI_LOW = 33554432
Public Const CHANNEL_OPTION_COMPRESS_RDP = 8388608
Public Const CHANNEL_OPTION_COMPRESS = 4194304
Public Const CHANNEL_OPTION_SHOW_PROTOCOL = 2097152
Public Const CHANNEL_MAX_COUNT = 30&
Public Const CHANNEL_NAME_LEN = 7&