libfreerdp-core: start including wtsapi.h
This commit is contained in:
parent
82b922a70d
commit
de3156512c
@ -38,22 +38,10 @@
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
//#include <winpr/wtsapi.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
typedef enum _WTS_VIRTUAL_CLASS
|
||||
{
|
||||
WTSVirtualClientData,
|
||||
WTSVirtualFileHandle,
|
||||
WTSVirtualEventHandle, /* Extended */
|
||||
WTSVirtualChannelReady /* Extended */
|
||||
} WTS_VIRTUAL_CLASS;
|
||||
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC 0x00000001
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW 0x00000000
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED 0x00000002
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH 0x00000004
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL 0x00000006
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_NO_COMPRESS 0x00000008
|
||||
#define WTSVirtualEventHandle 3 /* Extended */
|
||||
#define WTSVirtualChannelReady 4 /* Extended */
|
||||
|
||||
typedef struct WTSVirtualChannelManager WTSVirtualChannelManager;
|
||||
|
||||
@ -73,65 +61,7 @@ FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(WTSVirtualChannelManag
|
||||
|
||||
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(WTSVirtualChannelManager* vcm, const char* name);
|
||||
|
||||
/**
|
||||
* Opens a static or dynamic virtual channel and return the handle. If the
|
||||
* operation fails, a NULL handle is returned.
|
||||
*
|
||||
* The original MS API has 'DWORD SessionId' as the first argument, while we
|
||||
* use our WTSVirtualChannelManager object instead.
|
||||
*
|
||||
* Static virtual channels must be opened from the main thread. Dynamic virtual channels
|
||||
* can be opened from any thread.
|
||||
*/
|
||||
|
||||
WINPR_API HANDLE WTSVirtualChannelManagerOpenEx(WTSVirtualChannelManager* vcm, LPSTR pVirtualName, DWORD flags);
|
||||
|
||||
/**
|
||||
* Returns information about a specified virtual channel.
|
||||
*
|
||||
* Servers use this function to gain access to a virtual channel file handle
|
||||
* that can be used for asynchronous I/O.
|
||||
*/
|
||||
|
||||
WINPR_API BOOL WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned);
|
||||
|
||||
/**
|
||||
* Frees memory allocated by WTSVirtualChannelQuery
|
||||
*/
|
||||
|
||||
WINPR_API VOID WTSFreeMemory(PVOID pMemory);
|
||||
|
||||
/**
|
||||
* Reads data from the server end of a virtual channel.
|
||||
*
|
||||
* FreeRDP behavior:
|
||||
*
|
||||
* This function will always return a complete channel data packet, i.e. chunks
|
||||
* are already assembled. If BufferSize argument is smaller than the packet
|
||||
* size, it will set the desired size in pBytesRead and return FALSE. The
|
||||
* caller should allocate a large enough buffer and call this function again.
|
||||
* Returning FALSE with pBytesRead set to zero indicates an error has occurred.
|
||||
* If no pending packet to be read, it will set pBytesRead to zero and return
|
||||
* TRUE.
|
||||
*
|
||||
* TimeOut is not supported, and this function will always return immediately.
|
||||
* The caller should use the file handle returned by WTSVirtualChannelQuery to
|
||||
* determine whether a packet has arrived.
|
||||
*/
|
||||
|
||||
WINPR_API BOOL WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer, ULONG BufferSize, PULONG pBytesRead);
|
||||
|
||||
/**
|
||||
* Writes data to the server end of a virtual channel.
|
||||
*/
|
||||
|
||||
WINPR_API BOOL WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer, ULONG Length, PULONG pBytesWritten);
|
||||
|
||||
/**
|
||||
* Closes an open virtual channel handle.
|
||||
*/
|
||||
|
||||
WINPR_API BOOL WTSVirtualChannelClose(HANDLE hChannelHandle);
|
||||
FREERDP_API HANDLE WTSVirtualChannelManagerOpenEx(WTSVirtualChannelManager* vcm, LPSTR pVirtualName, DWORD flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,82 +17,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MS compatible SVC plugin interface
|
||||
* reference:
|
||||
* http://msdn.microsoft.com/en-us/library/aa383580.aspx
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_SVC_H
|
||||
#define FREERDP_SVC_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
#define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry"
|
||||
|
||||
#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 VOID (FREERDP_CC * PCHANNEL_INIT_EVENT_FN)(LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength);
|
||||
|
||||
typedef VOID (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(DWORD openHandle, UINT event,
|
||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags);
|
||||
|
||||
#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 VIRTUAL_CHANNEL_VERSION_WIN2000 1
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELINIT)(LPVOID* ppInitHandle, PCHANNEL_DEF pChannel,
|
||||
INT channelCount, ULONG versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELOPEN)(LPVOID pInitHandle, LPDWORD pOpenHandle,
|
||||
PCHAR pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELCLOSE)(DWORD openHandle);
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELWRITE)(DWORD openHandle, LPVOID pData, ULONG dataLength, LPVOID pUserData);
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(DWORD openHandle, wMessage* event);
|
||||
|
||||
struct _CHANNEL_ENTRY_POINTS
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD protocolVersion;
|
||||
PVIRTUALCHANNELINIT pVirtualChannelInit;
|
||||
PVIRTUALCHANNELOPEN pVirtualChannelOpen;
|
||||
PVIRTUALCHANNELCLOSE pVirtualChannelClose;
|
||||
PVIRTUALCHANNELWRITE pVirtualChannelWrite;
|
||||
};
|
||||
typedef struct _CHANNEL_ENTRY_POINTS CHANNEL_ENTRY_POINTS;
|
||||
typedef CHANNEL_ENTRY_POINTS* PCHANNEL_ENTRY_POINTS;
|
||||
|
||||
typedef int (FREERDP_CC * PVIRTUALCHANNELENTRY)(PCHANNEL_ENTRY_POINTS pEntryPoints);
|
||||
|
||||
#define FREERDP_CHANNEL_MAGIC_NUMBER 0x46524450
|
||||
|
||||
struct _CHANNEL_ENTRY_POINTS_FREERDP
|
||||
|
@ -77,7 +77,7 @@ static const char* const state_transitions[] =
|
||||
"ST_RESEND_LAST_MESSAGE"
|
||||
};
|
||||
|
||||
void license_print_product_info(PRODUCT_INFO* productInfo)
|
||||
void license_print_product_info(LICENSE_PRODUCT_INFO* productInfo)
|
||||
{
|
||||
char* CompanyName = NULL;
|
||||
char* ProductId = NULL;
|
||||
@ -473,7 +473,7 @@ void license_decrypt_platform_challenge(rdpLicense* license)
|
||||
* @param productInfo product information
|
||||
*/
|
||||
|
||||
BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo)
|
||||
BOOL license_read_product_info(wStream* s, LICENSE_PRODUCT_INFO* productInfo)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
@ -504,16 +504,16 @@ BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate New Product Information (PRODUCT_INFO).\n
|
||||
* Allocate New Product Information (LICENSE_PRODUCT_INFO).\n
|
||||
* @msdn{cc241915}
|
||||
* @return new product information
|
||||
*/
|
||||
|
||||
PRODUCT_INFO* license_new_product_info()
|
||||
LICENSE_PRODUCT_INFO* license_new_product_info()
|
||||
{
|
||||
PRODUCT_INFO* productInfo;
|
||||
LICENSE_PRODUCT_INFO* productInfo;
|
||||
|
||||
productInfo = (PRODUCT_INFO*) malloc(sizeof(PRODUCT_INFO));
|
||||
productInfo = (LICENSE_PRODUCT_INFO*) malloc(sizeof(LICENSE_PRODUCT_INFO));
|
||||
|
||||
productInfo->dwVersion = 0;
|
||||
productInfo->cbCompanyName = 0;
|
||||
@ -525,12 +525,12 @@ PRODUCT_INFO* license_new_product_info()
|
||||
}
|
||||
|
||||
/**
|
||||
* Free Product Information (PRODUCT_INFO).\n
|
||||
* Free Product Information (LICENSE_PRODUCT_INFO).\n
|
||||
* @msdn{cc241915}
|
||||
* @param productInfo product information
|
||||
*/
|
||||
|
||||
void license_free_product_info(PRODUCT_INFO* productInfo)
|
||||
void license_free_product_info(LICENSE_PRODUCT_INFO* productInfo)
|
||||
{
|
||||
if (productInfo->pbCompanyName != NULL)
|
||||
free(productInfo->pbCompanyName);
|
||||
|
@ -148,7 +148,7 @@ typedef struct
|
||||
BYTE* pbCompanyName;
|
||||
UINT32 cbProductId;
|
||||
BYTE* pbProductId;
|
||||
} PRODUCT_INFO;
|
||||
} LICENSE_PRODUCT_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -187,7 +187,7 @@ struct rdp_license
|
||||
BYTE SessionKeyBlob[SESSION_KEY_BLOB_LENGTH];
|
||||
BYTE MacSaltKey[MAC_SALT_KEY_LENGTH];
|
||||
BYTE LicensingEncryptionKey[LICENSING_ENCRYPTION_KEY_LENGTH];
|
||||
PRODUCT_INFO* ProductInfo;
|
||||
LICENSE_PRODUCT_INFO* ProductInfo;
|
||||
LICENSE_BLOB* ErrorInfo;
|
||||
LICENSE_BLOB* KeyExchangeList;
|
||||
LICENSE_BLOB* ServerCertificate;
|
||||
@ -210,9 +210,9 @@ void license_generate_hwid(rdpLicense* license);
|
||||
void license_encrypt_premaster_secret(rdpLicense* license);
|
||||
void license_decrypt_platform_challenge(rdpLicense* license);
|
||||
|
||||
PRODUCT_INFO* license_new_product_info(void);
|
||||
void license_free_product_info(PRODUCT_INFO* productInfo);
|
||||
BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo);
|
||||
LICENSE_PRODUCT_INFO* license_new_product_info(void);
|
||||
void license_free_product_info(LICENSE_PRODUCT_INFO* productInfo);
|
||||
BOOL license_read_product_info(wStream* s, LICENSE_PRODUCT_INFO* productInfo);
|
||||
|
||||
LICENSE_BLOB* license_new_binary_blob(UINT16 type);
|
||||
void license_free_binary_blob(LICENSE_BLOB* blob);
|
||||
|
Loading…
Reference in New Issue
Block a user