libwinpr-wtsapi: add VC API
This commit is contained in:
parent
1f0caa4161
commit
cea6de16ee
@ -27,6 +27,194 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
/**
|
||||
* Virtual Channel Protocol (Common)
|
||||
*/
|
||||
|
||||
#define CHANNEL_CHUNK_LENGTH 1600
|
||||
|
||||
#define CHANNEL_PDU_LENGTH (CHANNEL_CHUNK_LENGTH + sizeof(CHANNEL_PDU_HEADER))
|
||||
|
||||
#define CHANNEL_FLAG_FIRST 0x01
|
||||
#define CHANNEL_FLAG_LAST 0x02
|
||||
#define CHANNEL_FLAG_ONLY (CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST)
|
||||
#define CHANNEL_FLAG_MIDDLE 0
|
||||
#define CHANNEL_FLAG_FAIL 0x100
|
||||
|
||||
#define CHANNEL_FLAG_SHOW_PROTOCOL 0x10
|
||||
#define CHANNEL_FLAG_SUSPEND 0x20
|
||||
#define CHANNEL_FLAG_RESUME 0x40
|
||||
#define CHANNEL_FLAG_SHADOW_PERSISTENT 0x80
|
||||
|
||||
#define CHANNEL_OPTION_INITIALIZED 0x80000000
|
||||
|
||||
#define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
|
||||
#define CHANNEL_OPTION_ENCRYPT_SC 0x20000000
|
||||
#define CHANNEL_OPTION_ENCRYPT_CS 0x10000000
|
||||
#define CHANNEL_OPTION_PRI_HIGH 0x08000000
|
||||
#define CHANNEL_OPTION_PRI_MED 0x04000000
|
||||
#define CHANNEL_OPTION_PRI_LOW 0x02000000
|
||||
#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000
|
||||
#define CHANNEL_OPTION_COMPRESS 0x00400000
|
||||
#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
|
||||
#define CHANNEL_OPTION_REMOTE_CONTROL_PERSISTENT 0x00100000
|
||||
|
||||
#define CHANNEL_MAX_COUNT 30
|
||||
#define CHANNEL_NAME_LEN 7
|
||||
|
||||
typedef struct tagCHANNEL_DEF
|
||||
{
|
||||
char name[CHANNEL_NAME_LEN + 1];
|
||||
ULONG options;
|
||||
} CHANNEL_DEF;
|
||||
typedef CHANNEL_DEF *PCHANNEL_DEF;
|
||||
typedef PCHANNEL_DEF *PPCHANNEL_DEF;
|
||||
|
||||
typedef struct tagCHANNEL_PDU_HEADER
|
||||
{
|
||||
UINT32 length;
|
||||
UINT32 flags;
|
||||
} CHANNEL_PDU_HEADER, *PCHANNEL_PDU_HEADER;
|
||||
|
||||
/**
|
||||
* Virtual Channel Client API
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define VCAPITYPE __stdcall
|
||||
#define VCEXPORT
|
||||
#else
|
||||
#define VCAPITYPE CALLBACK
|
||||
#define VCEXPORT __export
|
||||
#endif
|
||||
|
||||
typedef VOID VCAPITYPE CHANNEL_INIT_EVENT_FN(LPVOID pInitHandle,
|
||||
UINT event, LPVOID pData, UINT dataLength);
|
||||
|
||||
typedef CHANNEL_INIT_EVENT_FN *PCHANNEL_INIT_EVENT_FN;
|
||||
|
||||
typedef VOID VCAPITYPE CHANNEL_INIT_EVENT_EX_FN(LPVOID lpUserParam,
|
||||
LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength);
|
||||
|
||||
typedef CHANNEL_INIT_EVENT_EX_FN *PCHANNEL_INIT_EVENT_EX_FN;
|
||||
|
||||
#define CHANNEL_EVENT_INITIALIZED 0
|
||||
#define CHANNEL_EVENT_CONNECTED 1
|
||||
#define CHANNEL_EVENT_V1_CONNECTED 2
|
||||
#define CHANNEL_EVENT_DISCONNECTED 3
|
||||
#define CHANNEL_EVENT_TERMINATED 4
|
||||
#define CHANNEL_EVENT_REMOTE_CONTROL_START 5
|
||||
#define CHANNEL_EVENT_REMOTE_CONTROL_STOP 6
|
||||
#define CHANNEL_EVENT_DATA_RECEIVED 10
|
||||
#define CHANNEL_EVENT_WRITE_COMPLETE 11
|
||||
#define CHANNEL_EVENT_WRITE_CANCELLED 12
|
||||
|
||||
typedef VOID VCAPITYPE CHANNEL_OPEN_EVENT_FN(DWORD openHandle, UINT event,
|
||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags);
|
||||
|
||||
typedef CHANNEL_OPEN_EVENT_FN *PCHANNEL_OPEN_EVENT_FN;
|
||||
|
||||
typedef VOID VCAPITYPE CHANNEL_OPEN_EVENT_EX_FN(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags);
|
||||
|
||||
typedef CHANNEL_OPEN_EVENT_EX_FN *PCHANNEL_OPEN_EVENT_EX_FN;
|
||||
|
||||
#define CHANNEL_RC_OK 0
|
||||
#define CHANNEL_RC_ALREADY_INITIALIZED 1
|
||||
#define CHANNEL_RC_NOT_INITIALIZED 2
|
||||
#define CHANNEL_RC_ALREADY_CONNECTED 3
|
||||
#define CHANNEL_RC_NOT_CONNECTED 4
|
||||
#define CHANNEL_RC_TOO_MANY_CHANNELS 5
|
||||
#define CHANNEL_RC_BAD_CHANNEL 6
|
||||
#define CHANNEL_RC_BAD_CHANNEL_HANDLE 7
|
||||
#define CHANNEL_RC_NO_BUFFER 8
|
||||
#define CHANNEL_RC_BAD_INIT_HANDLE 9
|
||||
#define CHANNEL_RC_NOT_OPEN 10
|
||||
#define CHANNEL_RC_BAD_PROC 11
|
||||
#define CHANNEL_RC_NO_MEMORY 12
|
||||
#define CHANNEL_RC_UNKNOWN_CHANNEL_NAME 13
|
||||
#define CHANNEL_RC_ALREADY_OPEN 14
|
||||
#define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY 15
|
||||
#define CHANNEL_RC_NULL_DATA 16
|
||||
#define CHANNEL_RC_ZERO_LENGTH 17
|
||||
#define CHANNEL_RC_INVALID_INSTANCE 18
|
||||
#define CHANNEL_RC_UNSUPPORTED_VERSION 19
|
||||
#define CHANNEL_RC_INITIALIZATION_ERROR 20
|
||||
|
||||
#define VIRTUAL_CHANNEL_VERSION_WIN2000 1
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELINIT(LPVOID* ppInitHandle, PCHANNEL_DEF pChannel,
|
||||
INT channelCount, ULONG versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
|
||||
|
||||
typedef VIRTUALCHANNELINIT *PVIRTUALCHANNELINIT;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELINITEX(LPVOID lpUserParam, LPVOID pInitHandle, PCHANNEL_DEF pChannel,
|
||||
INT channelCount, ULONG versionRequested, PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx);
|
||||
|
||||
typedef VIRTUALCHANNELINITEX *PVIRTUALCHANNELINITEX;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELOPEN(LPVOID pInitHandle, LPDWORD pOpenHandle,
|
||||
PCHAR pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
|
||||
|
||||
typedef VIRTUALCHANNELOPEN *PVIRTUALCHANNELOPEN;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELOPENEX(LPVOID pInitHandle, LPDWORD pOpenHandle,
|
||||
PCHAR pChannelName, PCHANNEL_OPEN_EVENT_EX_FN pChannelOpenEventProcEx);
|
||||
|
||||
typedef VIRTUALCHANNELOPENEX *PVIRTUALCHANNELOPENEX;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELCLOSE(DWORD openHandle);
|
||||
|
||||
typedef VIRTUALCHANNELCLOSE *PVIRTUALCHANNELCLOSE;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELCLOSEEX(LPVOID pInitHandle, DWORD openHandle);
|
||||
|
||||
typedef VIRTUALCHANNELCLOSEEX *PVIRTUALCHANNELCLOSEEX;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELWRITE(DWORD openHandle,
|
||||
LPVOID pData, ULONG dataLength, LPVOID pUserData);
|
||||
|
||||
typedef VIRTUALCHANNELWRITE *PVIRTUALCHANNELWRITE;
|
||||
|
||||
typedef UINT VCAPITYPE VIRTUALCHANNELWRITEEX(LPVOID pInitHandle, DWORD openHandle,
|
||||
LPVOID pData, ULONG dataLength, LPVOID pUserData);
|
||||
|
||||
typedef VIRTUALCHANNELWRITEEX *PVIRTUALCHANNELWRITEEX;
|
||||
|
||||
typedef struct tagCHANNEL_ENTRY_POINTS
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD protocolVersion;
|
||||
PVIRTUALCHANNELINIT pVirtualChannelInit;
|
||||
PVIRTUALCHANNELOPEN pVirtualChannelOpen;
|
||||
PVIRTUALCHANNELCLOSE pVirtualChannelClose;
|
||||
PVIRTUALCHANNELWRITE pVirtualChannelWrite;
|
||||
} CHANNEL_ENTRY_POINTS, *PCHANNEL_ENTRY_POINTS;
|
||||
|
||||
typedef struct tagCHANNEL_ENTRY_POINTS_EX
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD protocolVersion;
|
||||
PVIRTUALCHANNELINITEX pVirtualChannelInitEx;
|
||||
PVIRTUALCHANNELOPENEX pVirtualChannelOpenEx;
|
||||
PVIRTUALCHANNELCLOSEEX pVirtualChannelCloseEx;
|
||||
PVIRTUALCHANNELWRITEEX pVirtualChannelWriteEx;
|
||||
} CHANNEL_ENTRY_POINTS_EX, *PCHANNEL_ENTRY_POINTS_EX;
|
||||
|
||||
typedef BOOL VCAPITYPE VIRTUALCHANNELENTRY(PCHANNEL_ENTRY_POINTS pEntryPoints);
|
||||
|
||||
typedef VIRTUALCHANNELENTRY *PVIRTUALCHANNELENTRY;
|
||||
|
||||
typedef BOOL VCAPITYPE VIRTUALCHANNELENTRYEX(PCHANNEL_ENTRY_POINTS_EX pEntryPointsEx, PVOID pInitHandle);
|
||||
|
||||
typedef VIRTUALCHANNELENTRYEX *PVIRTUALCHANNELENTRYEX;
|
||||
|
||||
typedef HRESULT (VCAPITYPE *PFNVCAPIGETINSTANCE)(REFIID refiid, PULONG pNumObjs, PVOID* ppObjArray);
|
||||
|
||||
/**
|
||||
* Windows Terminal Services API (WtsApi)
|
||||
*/
|
||||
|
||||
#define WTS_CURRENT_SERVER ((HANDLE)NULL)
|
||||
#define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL)
|
||||
#define WTS_CURRENT_SERVER_NAME (NULL)
|
||||
|
@ -160,6 +160,9 @@ typedef struct _LUID
|
||||
LONG HighPart;
|
||||
} LUID, *PLUID;
|
||||
|
||||
typedef GUID IID;
|
||||
typedef IID* REFIID;
|
||||
|
||||
#ifdef UNICODE
|
||||
#define _T(x) L ## x
|
||||
#else
|
||||
|
@ -25,6 +25,11 @@
|
||||
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
/**
|
||||
* Remote Desktop Services API Functions:
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464/
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
BOOL WTSStopRemoteControlSession(ULONG LogonId)
|
||||
|
Loading…
Reference in New Issue
Block a user