Milestone 5: deliver embedded RDP sessions and lifecycle hardening

This commit is contained in:
Keith Smith
2026-03-03 18:59:26 -07:00
parent 230a401386
commit 36006bd4aa
2941 changed files with 724359 additions and 77 deletions

View File

@@ -0,0 +1,92 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Addin Loader
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_COMMON_ADDIN_H
#define FREERDP_COMMON_ADDIN_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#define FREERDP_ADDIN_CLIENT 0x00000001
#define FREERDP_ADDIN_SERVER 0x00000002
#define FREERDP_ADDIN_STATIC 0x00000010
#define FREERDP_ADDIN_DYNAMIC 0x00000020
#define FREERDP_ADDIN_NAME 0x00000100
#define FREERDP_ADDIN_SUBSYSTEM 0x00000200
#define FREERDP_ADDIN_TYPE 0x00000400
#define FREERDP_ADDIN_CHANNEL_STATIC 0x00001000
#define FREERDP_ADDIN_CHANNEL_DYNAMIC 0x00002000
#define FREERDP_ADDIN_CHANNEL_DEVICE 0x00004000
#define FREERDP_ADDIN_CHANNEL_ENTRYEX 0x00008000
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
DWORD dwFlags;
CHAR cName[16];
CHAR cType[16];
CHAR cSubsystem[16];
} FREERDP_ADDIN;
typedef PVIRTUALCHANNELENTRY (*FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN)(LPCSTR pszName,
LPCSTR pszSubsystem,
LPCSTR pszType,
DWORD dwFlags);
WINPR_ATTR_NODISCARD
FREERDP_API LPSTR freerdp_get_library_install_path(void);
WINPR_ATTR_NODISCARD
FREERDP_API LPSTR freerdp_get_dynamic_addin_install_path(void);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_register_addin_provider(FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN provider,
DWORD dwFlags);
WINPR_ATTR_NODISCARD
FREERDP_API FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN freerdp_get_current_addin_provider(void);
WINPR_ATTR_NODISCARD
FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath,
LPCSTR pszEntryName);
WINPR_ATTR_NODISCARD
FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName,
LPCSTR pszSubsystem,
LPCSTR pszType,
DWORD dwFlags);
WINPR_ATTR_NODISCARD
FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_channel_addin_entry(LPCSTR pszName,
LPCSTR pszSubsystem,
LPCSTR pszType,
DWORD dwFlags);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_COMMON_ADDIN_H */

View File

@@ -0,0 +1,210 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Alternate Secondary Drawing Orders Interface API
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_UPDATE_ALTSEC_H
#define FREERDP_UPDATE_ALTSEC_H
#include <freerdp/types.h>
#define DSDNG_STRETCH 0x00000001
#define DSDNG_TILE 0x00000002
#define DSDNG_PERPIXELALPHA 0x00000004
#define DSDNG_TRANSPARENT 0x00000008
#define DSDNG_MUSTFLIP 0x00000010
#define DSDNG_TRUESIZE 0x00000020
#define FRAME_START 0x00000000
#define FRAME_END 0x00000001
#define STREAM_BITMAP_END 0x01
#define STREAM_BITMAP_COMPRESSED 0x02
#define STREAM_BITMAP_V2 0x04
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
UINT32 sIndices;
UINT32 cIndices;
UINT16* indices;
} OFFSCREEN_DELETE_LIST;
typedef struct
{
UINT32 id;
UINT32 cx;
UINT32 cy;
OFFSCREEN_DELETE_LIST deleteList;
} CREATE_OFFSCREEN_BITMAP_ORDER;
typedef struct
{
UINT32 bitmapId;
} SWITCH_SURFACE_ORDER;
typedef struct
{
UINT32 flFlags;
UINT32 ulLeftWidth;
UINT32 ulRightWidth;
UINT32 ulTopHeight;
UINT32 ulBottomHeight;
UINT32 crTransparent;
} NINE_GRID_BITMAP_INFO;
typedef struct
{
UINT32 bitmapBpp;
UINT32 bitmapId;
UINT32 cx;
UINT32 cy;
NINE_GRID_BITMAP_INFO nineGridInfo;
} CREATE_NINE_GRID_BITMAP_ORDER;
typedef struct
{
UINT32 action;
} FRAME_MARKER_ORDER;
typedef struct
{
UINT32 bitmapFlags;
UINT32 bitmapBpp;
UINT32 bitmapType;
UINT32 bitmapWidth;
UINT32 bitmapHeight;
UINT32 bitmapSize;
UINT32 bitmapBlockSize;
BYTE* bitmapBlock;
} STREAM_BITMAP_FIRST_ORDER;
typedef struct
{
UINT32 bitmapFlags;
UINT32 bitmapType;
UINT32 bitmapBlockSize;
BYTE* bitmapBlock;
} STREAM_BITMAP_NEXT_ORDER;
typedef struct
{
UINT32 cbSize;
UINT32 cbTotalSize;
UINT32 cbTotalEmfSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_FIRST_ORDER;
typedef struct
{
UINT32 cbSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_NEXT_ORDER;
typedef struct
{
UINT32 cbSize;
UINT32 cbTotalSize;
UINT32 cbTotalEmfSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_END_ORDER;
typedef struct
{
UINT32 flags;
UINT32 cacheType;
UINT32 cacheIndex;
UINT32 cbSize;
UINT32 cbTotalSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_CACHE_FIRST_ORDER;
typedef struct
{
UINT32 flags;
UINT32 cacheType;
UINT32 cacheIndex;
UINT32 cbSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_CACHE_NEXT_ORDER;
typedef struct
{
UINT32 flags;
UINT32 cacheType;
UINT32 cacheIndex;
UINT32 cbSize;
UINT32 cbTotalSize;
BYTE* emfRecords;
} DRAW_GDIPLUS_CACHE_END_ORDER;
typedef BOOL (*pCreateOffscreenBitmap)(
rdpContext* context, const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
typedef BOOL (*pSwitchSurface)(rdpContext* context, const SWITCH_SURFACE_ORDER* switch_surface);
typedef BOOL (*pCreateNineGridBitmap)(
rdpContext* context, const CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap);
typedef BOOL (*pFrameMarker)(rdpContext* context, const FRAME_MARKER_ORDER* frame_marker);
typedef BOOL (*pStreamBitmapFirst)(rdpContext* context,
const STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first);
typedef BOOL (*pStreamBitmapNext)(rdpContext* context,
const STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next);
typedef BOOL (*pDrawGdiPlusFirst)(rdpContext* context,
const DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first);
typedef BOOL (*pDrawGdiPlusNext)(rdpContext* context,
const DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next);
typedef BOOL (*pDrawGdiPlusEnd)(rdpContext* context,
const DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end);
typedef BOOL (*pDrawGdiPlusCacheFirst)(
rdpContext* context, const DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first);
typedef BOOL (*pDrawGdiPlusCacheNext)(
rdpContext* context, const DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
typedef BOOL (*pDrawGdiPlusCacheEnd)(
rdpContext* context, const DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
typedef BOOL (*pDrawOrderInfo)(rdpContext* context, UINT8 orderType, const char* orderName);
struct rdp_altsec_update
{
rdpContext* context; /* 0 */
UINT32 paddingA[16 - 1]; /* 1 */
WINPR_ATTR_NODISCARD pCreateOffscreenBitmap CreateOffscreenBitmap; /* 16 */
WINPR_ATTR_NODISCARD pSwitchSurface SwitchSurface; /* 17 */
WINPR_ATTR_NODISCARD pCreateNineGridBitmap CreateNineGridBitmap; /* 18 */
WINPR_ATTR_NODISCARD pFrameMarker FrameMarker; /* 19 */
WINPR_ATTR_NODISCARD pStreamBitmapFirst StreamBitmapFirst; /* 20 */
WINPR_ATTR_NODISCARD pStreamBitmapNext StreamBitmapNext; /* 21 */
WINPR_ATTR_NODISCARD pDrawGdiPlusFirst DrawGdiPlusFirst; /* 22 */
WINPR_ATTR_NODISCARD pDrawGdiPlusNext DrawGdiPlusNext; /* 23 */
WINPR_ATTR_NODISCARD pDrawGdiPlusEnd DrawGdiPlusEnd; /* 24 */
WINPR_ATTR_NODISCARD pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 25 */
WINPR_ATTR_NODISCARD pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 26 */
WINPR_ATTR_NODISCARD pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 27 */
/* Statistics callback */
WINPR_ATTR_NODISCARD pDrawOrderInfo DrawOrderInfo; /* 28 */
UINT32 paddingB[32 - 29]; /* 29 */
};
typedef struct rdp_altsec_update rdpAltSecUpdate;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_UPDATE_ALTSEC_H */

View File

@@ -0,0 +1,121 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Interface
*
* Copyright 2009-2011 Jay Sorg
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_API_H
#define FREERDP_API_H
#include <winpr/winpr.h>
#include <winpr/wlog.h>
#include <winpr/platform.h>
/* To silence missing prototype warnings for library entry points use this macro.
* It first declares the function as prototype and then again as function implementation
*/
#define FREERDP_ENTRY_POINT(fkt) \
fkt; \
fkt
#ifdef _WIN32
#define FREERDP_CC __cdecl
#else
#define FREERDP_CC
#endif
#if defined _WIN32 || defined __CYGWIN__
#ifdef FREERDP_EXPORTS
#ifdef __GNUC__
#define FREERDP_API __attribute__((dllexport))
#else
#define FREERDP_API __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define FREERDP_API __attribute__((dllimport))
#else
#define FREERDP_API __declspec(dllimport)
#endif
#endif
#else
#if defined(__GNUC__) && (__GNUC__ >= 4)
#if defined(__cplusplus) && (__cplusplus >= 201703L)
#define FREERDP_API [[gnu::visibility("default")]]
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define FREERDP_API [[gnu::visibility("default")]]
#else
#define FREERDP_API __attribute__((visibility("default")))
#endif
#else
#define FREERDP_API
#endif
#endif
#if defined(EXPORT_ALL_SYMBOLS)
#define FREERDP_LOCAL FREERDP_API
#else
#if defined _WIN32 || defined __CYGWIN__
#define FREERDP_LOCAL
#else
#if defined(__GNUC__) && (__GNUC__ >= 4)
#if defined(__cplusplus) && (__cplusplus >= 201703L)
#define FREERDP_LOCAL [[gnu::visibility("hidden")]]
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define FREERDP_LOCAL [[gnu::visibility("hidden")]]
#else
#define FREERDP_LOCAL __attribute__((visibility("hidden")))
#endif
#else
#define FREERDP_LOCAL
#endif
#endif
#endif
#define IFCALL(_cb, ...) \
do \
{ \
if (_cb != nullptr) \
_cb(__VA_ARGS__); \
else \
WLog_VRB("com.freerdp.api", "IFCALL(" #_cb ") == nullptr"); \
} while (0)
#define IFCALLRET(_cb, _ret, ...) \
do \
{ \
if (_cb != nullptr) \
_ret = _cb(__VA_ARGS__); \
else \
WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == nullptr"); \
} while (0)
#if defined(__GNUC__) || defined(__clang__)
#define IFCALLRESULT(_default_return, _cb, ...) \
__extension__({ \
if (_cb == nullptr) \
{ \
WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == nullptr"); \
} \
((_cb != nullptr) ? _cb(__VA_ARGS__) : (_default_return)); \
})
#else
#define IFCALLRESULT(_default_return, _cb, ...) \
((_cb != nullptr) ? _cb(__VA_ARGS__) : (_default_return))
#endif
#define ALIGN64 DECLSPEC_ALIGN(8)
#endif /* FREERDP_API */

View File

@@ -0,0 +1,90 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Assistance
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_REMOTE_ASSISTANCE_H
#define FREERDP_REMOTE_ASSISTANCE_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_assistance_file rdpAssistanceFile;
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* freerdp_assistance_hex_string_to_bin(const void* str, size_t* size);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_assistance_bin_to_hex_string(const void* data, size_t size);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_assistance_generate_pass_stub(DWORD flags);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_assistance_construct_expert_blob(const char* name, const char* pass);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* freerdp_assistance_encrypt_pass_stub(const char* password,
const char* passStub,
size_t* pEncryptedSize);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_assistance_set_connection_string2(rdpAssistanceFile* file,
const char* string,
const char* password);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file,
const char* buffer, size_t size,
const char* password);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name,
const char* password);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_assistance_populate_settings_from_assistance_file(
rdpAssistanceFile* file, rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_assistance_get_encrypted_pass_stub(rdpAssistanceFile* file,
const char** pwd, size_t* size);
FREERDP_API void freerdp_assistance_file_free(rdpAssistanceFile* file);
WINPR_ATTR_MALLOC(freerdp_assistance_file_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpAssistanceFile* freerdp_assistance_file_new(void);
FREERDP_API void freerdp_assistance_print_file(rdpAssistanceFile* file, wLog* log, DWORD level);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_REMOTE_ASSISTANCE_H */

View File

@@ -0,0 +1,150 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Auto-Detect PDUs
*
* Copyright 2014 Dell Software <Mike.McDonald@software.dell.com>
* Copyright 2014 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_AUTODETECT_H
#define FREERDP_AUTODETECT_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
FREERDP_AUTODETECT_STATE_INITIAL,
FREERDP_AUTODETECT_STATE_REQUEST,
FREERDP_AUTODETECT_STATE_RESPONSE,
FREERDP_AUTODETECT_STATE_COMPLETE,
FREERDP_AUTODETECT_STATE_FAIL
} FREERDP_AUTODETECT_STATE;
typedef enum
{
RDP_NETCHAR_RESERVED = 0x0000U,
/* The baseRTT and averageRTT fields are valid */
RDP_NETCHAR_RESULT_TYPE_BASE_RTT_AVG_RTT = 0x0840U,
/* The bandwidth and averageRTT fields are valid */
RDP_NETCHAR_RESULT_TYPE_BW_AVG_RTT = 0x0880U,
/* The baseRTT, bandwidth and averageRTT fields are valid */
RDP_NETCHAR_RESULT_TYPE_BASE_RTT_BW_AVG_RTT = 0x08C0U
} RDP_NETCHAR_RESULT_TYPE;
typedef enum
{
RDP_BW_RESULTS_RESPONSE_TYPE_CONNECTTIME = 0x0003,
RDP_BW_RESULTS_RESPONSE_TYPE_CONTINUOUS = 0x000B
} RDP_BW_RESULTS_RESPONSE_TYPE;
typedef struct rdp_autodetect rdpAutoDetect;
typedef struct rdp_network_characteristics_result rdpNetworkCharacteristicsResult;
typedef BOOL (*pRTTMeasureRequest)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
UINT16 sequenceNumber);
typedef BOOL (*pRTTMeasureResponse)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
UINT16 sequenceNumber);
typedef BOOL (*pBandwidthMeasureStart)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
UINT16 sequenceNumber);
typedef BOOL (*pBandwidthMeasurePayload)(rdpAutoDetect* autodetect,
RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber,
UINT16 payloadLength);
typedef BOOL (*pBandwidthMeasureStop)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
UINT16 sequenceNumber, UINT16 payloadLength);
typedef BOOL (*pBandwidthMeasureResults)(rdpAutoDetect* autodetect,
RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber,
UINT16 responseType, UINT32 timeDelta,
UINT32 byteCount);
typedef BOOL (*pNetworkCharacteristicsResult)(rdpAutoDetect* autodetect,
RDP_TRANSPORT_TYPE transport,
UINT16 sequenceNumber,
const rdpNetworkCharacteristicsResult* result);
typedef BOOL (*pClientBandwidthMeasureResult)(rdpAutoDetect* autodetect,
RDP_TRANSPORT_TYPE transport, UINT16 responseType,
UINT16 sequenceNumber, UINT32 timeDelta,
UINT32 byteCount);
typedef BOOL (*pNetworkCharacteristicsSync)(rdpAutoDetect* autodetect,
RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber,
UINT32 bandwidth, UINT32 rtt);
typedef BOOL (*pRxTxReceived)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
UINT16 requestType, UINT16 sequenceNumber);
typedef FREERDP_AUTODETECT_STATE (*pOnConnectTimeAutoDetect)(rdpAutoDetect* autodetect);
struct rdp_network_characteristics_result
{
/* Specifies, which fields are valid */
RDP_NETCHAR_RESULT_TYPE type;
/* Lowest detected round-trip time in milliseconds. */
UINT32 baseRTT;
/* Current average round-trip time in milliseconds. */
UINT32 averageRTT;
/* Current bandwidth in kilobits per second. */
UINT32 bandwidth;
};
struct rdp_autodetect
{
ALIGN64 rdpContext* context; /* 0 */
/* RTT measurement */
ALIGN64 UINT64 rttMeasureStartTime; /* 1 */
/* Bandwidth measurement */
ALIGN64 UINT64 bandwidthMeasureStartTime; /* 2 */
ALIGN64 UINT64 bandwidthMeasureTimeDelta; /* 3 */
ALIGN64 UINT32 bandwidthMeasureByteCount; /* 4 */
/* Network characteristics (as reported by server) */
ALIGN64 UINT32 netCharBandwidth; /* 5 */
ALIGN64 UINT32 netCharBaseRTT; /* 6 */
ALIGN64 UINT32 netCharAverageRTT; /* 7 */
ALIGN64 BOOL bandwidthMeasureStarted; /* 8 */
ALIGN64 FREERDP_AUTODETECT_STATE state; /* 9 */
ALIGN64 void* custom; /* 10 */
ALIGN64 wLog* log; /* 11 */
UINT64 paddingA[16 - 12]; /* 12 */
WINPR_ATTR_NODISCARD ALIGN64 pRTTMeasureRequest RTTMeasureRequest; /* 16 */
WINPR_ATTR_NODISCARD ALIGN64 pRTTMeasureResponse RTTMeasureResponse; /* 17 */
WINPR_ATTR_NODISCARD ALIGN64 pBandwidthMeasureStart BandwidthMeasureStart; /* 18 */
WINPR_ATTR_NODISCARD ALIGN64 pBandwidthMeasurePayload BandwidthMeasurePayload; /* 19 */
WINPR_ATTR_NODISCARD ALIGN64 pBandwidthMeasureStop BandwidthMeasureStop; /* 20 */
WINPR_ATTR_NODISCARD ALIGN64 pBandwidthMeasureResults BandwidthMeasureResults; /* 21 */
WINPR_ATTR_NODISCARD ALIGN64 pNetworkCharacteristicsResult
NetworkCharacteristicsResult; /* 22 */
WINPR_ATTR_NODISCARD ALIGN64 pClientBandwidthMeasureResult
ClientBandwidthMeasureResult; /* 23 */
WINPR_ATTR_NODISCARD ALIGN64 pNetworkCharacteristicsSync
NetworkCharacteristicsSync; /* 24 */
WINPR_ATTR_NODISCARD ALIGN64 pRxTxReceived RequestReceived; /* 25 */
WINPR_ATTR_NODISCARD ALIGN64 pRxTxReceived ResponseReceived; /* 26 */
WINPR_ATTR_NODISCARD ALIGN64 pOnConnectTimeAutoDetect OnConnectTimeAutoDetectBegin; /* 27 */
WINPR_ATTR_NODISCARD ALIGN64 pOnConnectTimeAutoDetect
OnConnectTimeAutoDetectProgress; /* 28 */
UINT64 paddingB[32 - 29]; /* 29 */
};
WINPR_ATTR_NODISCARD
FREERDP_API rdpAutoDetect* autodetect_get(rdpContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_AUTODETECT_H */

View File

@@ -0,0 +1,109 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Persistent Bitmap Cache
*
* Copyright 2016 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_PERSISTENT_CACHE_H
#define FREERDP_PERSISTENT_CACHE_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/update.h>
#include <winpr/crt.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_persistent_cache rdpPersistentCache;
#pragma pack(push, 1)
/* 12 bytes */
typedef struct
{
BYTE sig[8];
UINT32 flags; /* 0x00000003, 0x00000006 */
} PERSISTENT_CACHE_HEADER_V3;
/* 12 bytes */
typedef struct
{
UINT64 key64;
UINT16 width;
UINT16 height;
} PERSISTENT_CACHE_ENTRY_V3;
/* 20 bytes */
typedef struct
{
UINT64 key64;
UINT16 width;
UINT16 height;
UINT32 size;
UINT32 flags; /* 0x00000011 */
} PERSISTENT_CACHE_ENTRY_V2;
#pragma pack(pop)
typedef struct
{
UINT64 key64;
UINT16 width;
UINT16 height;
UINT32 size;
UINT32 flags;
BYTE* data;
} PERSISTENT_CACHE_ENTRY;
WINPR_ATTR_NODISCARD
FREERDP_API int persistent_cache_get_version(rdpPersistentCache* persistent);
WINPR_ATTR_NODISCARD
FREERDP_API int persistent_cache_get_count(rdpPersistentCache* persistent);
WINPR_ATTR_NODISCARD
FREERDP_API int persistent_cache_read_entry(rdpPersistentCache* persistent,
PERSISTENT_CACHE_ENTRY* entry);
WINPR_ATTR_NODISCARD
FREERDP_API int persistent_cache_write_entry(rdpPersistentCache* persistent,
const PERSISTENT_CACHE_ENTRY* entry);
WINPR_ATTR_NODISCARD
FREERDP_API int persistent_cache_open(rdpPersistentCache* persistent, const char* filename,
BOOL write, UINT32 version);
FREERDP_API int persistent_cache_close(rdpPersistentCache* persistent);
FREERDP_API void persistent_cache_free(rdpPersistentCache* persistent);
WINPR_ATTR_MALLOC(persistent_cache_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpPersistentCache* persistent_cache_new(void);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_PERSISTENT_CACHE_H */

View File

@@ -0,0 +1,70 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Input Redirection Virtual Channel
*
* Copyright 2022 Armin Novak <anovak@thincast.com>
* Copyright 2022 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_AINPUT_H
#define FREERDP_CHANNEL_AINPUT_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#define AINPUT_CHANNEL_NAME "ainput"
#define AINPUT_DVC_CHANNEL_NAME "FreeRDP::Advanced::Input"
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
MSG_AINPUT_VERSION = 0x01,
MSG_AINPUT_MOUSE = 0x02
} eAInputMsgType;
typedef enum
{
AINPUT_FLAGS_WHEEL = 0x0001,
AINPUT_FLAGS_MOVE = 0x0004,
AINPUT_FLAGS_DOWN = 0x0008,
AINPUT_FLAGS_REL = 0x0010,
AINPUT_FLAGS_HAVE_REL = 0x0020,
/* Pointer Flags */
AINPUT_FLAGS_BUTTON1 = 0x1000, /* left */
AINPUT_FLAGS_BUTTON2 = 0x2000, /* right */
AINPUT_FLAGS_BUTTON3 = 0x4000, /* middle */
/* Extended Pointer Flags */
AINPUT_XFLAGS_BUTTON1 = 0x0100,
AINPUT_XFLAGS_BUTTON2 = 0x0200
} AInputEventFlags;
typedef struct ainput_client_context AInputClientContext;
#define AINPUT_VERSION_MAJOR 1
#define AINPUT_VERSION_MINOR 0
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_AINPUT_H */

View File

@@ -0,0 +1,134 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Input Redirection Virtual Channel
*
* Copyright 2010-2011 Vic Lee
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_AUDIN_H
#define FREERDP_CHANNEL_AUDIN_H
#include <freerdp/api.h>
#include <freerdp/codec/audio.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define AUDIN_CHANNEL_NAME "audin"
/** The name of the channel (protocol internal)
*
* \since version 3.0.0
*/
#define AUDIN_DVC_CHANNEL_NAME "AUDIO_INPUT"
typedef struct
{
BYTE MessageId;
} SNDIN_PDU;
typedef enum
{
SNDIN_VERSION_Invalid = 0x00000000,
SNDIN_VERSION_Version_1 = 0x00000001,
SNDIN_VERSION_Version_2 = 0x00000002,
} SNDIN_VERSION_Version;
typedef struct
{
SNDIN_PDU Header;
SNDIN_VERSION_Version Version;
} SNDIN_VERSION;
typedef struct
{
SNDIN_PDU Header;
UINT32 NumFormats;
UINT32 cbSizeFormatsPacket;
AUDIO_FORMAT* SoundFormats;
size_t ExtraDataSize;
} SNDIN_FORMATS;
typedef enum
{
SPEAKER_FRONT_LEFT = 0x00000001,
SPEAKER_FRONT_RIGHT = 0x00000002,
SPEAKER_FRONT_CENTER = 0x00000004,
SPEAKER_LOW_FREQUENCY = 0x00000008,
SPEAKER_BACK_LEFT = 0x00000010,
SPEAKER_BACK_RIGHT = 0x00000020,
SPEAKER_FRONT_LEFT_OF_CENTER = 0x00000040,
SPEAKER_FRONT_RIGHT_OF_CENTER = 0x00000080,
SPEAKER_BACK_CENTER = 0x00000100,
SPEAKER_SIDE_LEFT = 0x00000200,
SPEAKER_SIDE_RIGHT = 0x00000400,
SPEAKER_TOP_CENTER = 0x00000800,
SPEAKER_TOP_FRONT_LEFT = 0x00001000,
SPEAKER_TOP_FRONT_CENTER = 0x00002000,
SPEAKER_TOP_FRONT_RIGHT = 0x00004000,
SPEAKER_TOP_BACK_LEFT = 0x00008000,
SPEAKER_TOP_BACK_CENTER = 0x00010000,
SPEAKER_TOP_BACK_RIGHT = 0x00020000,
} AUDIN_SPEAKER;
typedef struct
{
union
{
UINT16 wValidBitsPerSample;
UINT16 wSamplesPerBlock;
UINT16 wReserved;
} Samples;
AUDIN_SPEAKER dwChannelMask;
GUID SubFormat;
} WAVEFORMAT_EXTENSIBLE;
typedef struct
{
SNDIN_PDU Header;
UINT32 FramesPerPacket;
UINT32 initialFormat;
AUDIO_FORMAT captureFormat;
WAVEFORMAT_EXTENSIBLE* ExtraFormatData;
} SNDIN_OPEN;
typedef struct
{
SNDIN_PDU Header;
UINT32 Result;
} SNDIN_OPEN_REPLY;
typedef struct
{
SNDIN_PDU Header;
} SNDIN_DATA_INCOMING;
typedef struct
{
SNDIN_PDU Header;
wStream* Data;
} SNDIN_DATA;
typedef struct
{
SNDIN_PDU Header;
UINT32 NewFormat;
} SNDIN_FORMATCHANGE;
#endif /* FREERDP_CHANNEL_AUDIN_H */

View File

@@ -0,0 +1,121 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Virtual Channel Manager
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNELS_H
#define FREERDP_CHANNELS_H
#include <winpr/crt.h>
#include <winpr/wtsapi.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** @since version 3.9.0 */
typedef BOOL (*freerdp_channel_handle_fkt_t)(rdpContext* context, void* userdata);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings,
PVIRTUALCHANNELENTRY entry, void* data);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings,
PVIRTUALCHANNELENTRYEX entryEx, void* data);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings,
const char* name, void* data);
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use freerdp_channels_get_event_handle",
WINPR_ATTR_NODISCARD FREERDP_API BOOL freerdp_channels_get_fds(
rdpChannels* channels, freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count));
#endif
FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API void* freerdp_channels_get_static_channel_interface(rdpChannels* channels,
const char* name);
/** @brief A channel may register an event handle and a callback function to be called by \b
* freerdp_check_event_handles
*
* If a channel can not or does not want to use a thread to process data asynchronously it can
* register a \b non-blocking function that does this processing. Notification is done with the
* \b event-handle which will trigger the RDP loop. So this function is triggered until the \b
* event-handle is reset.
* @note This function may be called even without the \b event-handle to be set, so it must be
* capable of handling these calls properly.
*
* @param channels A pointer to the channels instance to register with. Must not be \b nullptr
* @param handle A \b event-handle to be used to notify the RDP main thread that the callback
* function should be called again. Must not be \b INVALID_HANDLE_PARAM
* @param fkt The callback function responsible to handle the channel specifics. Must not be \b
* nullptr
* @param userdata A pointer to a channel specific context. Most likely the channel context.
* May be \b nullptr if not required.
*
* @return \b TRUE if successful, \b FALSE if any error occurs.
* @since version 3.9.0 */
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_channel_register(rdpChannels* channels, HANDLE handle,
freerdp_channel_handle_fkt_t fkt,
void* userdata);
/** @brief Remove an existing registration for \b event-handle from the channels instance
*
* @param channels A pointer to the channels instance to register with. Must not be \b nullptr
* @param handle A \b event-handle to be used to notify the RDP main thread that the callback
* function should be called again. Must not be \b INVALID_HANDLE_PARAM
*
* @return \b TRUE if successful, \b FALSE if any error occurs.
* @since version 3.9.0 */
FREERDP_API BOOL freerdp_client_channel_unregister(rdpChannels* channels, HANDLE handle);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE freerdp_channels_get_event_handle(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_channels_process_pending_messages(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_channels_data(freerdp* instance, UINT16 channelId, const BYTE* data,
size_t dataSize, UINT32 flags, size_t totalSize);
WINPR_ATTR_NODISCARD
FREERDP_API UINT16 freerdp_channels_get_id_by_name(freerdp* instance, const char* channel_name);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_channels_get_name_by_id(freerdp* instance, UINT16 channelId);
WINPR_ATTR_NODISCARD
FREERDP_API const WtsApiFunctionTable* FreeRDP_InitWtsApi(void);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNELS_H */

View File

@@ -0,0 +1,213 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Clipboard Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_CLIPRDR_H
#define FREERDP_CHANNEL_CLIPRDR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/utils/cliprdr_utils.h>
#include <winpr/shell.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define CLIPRDR_CHANNEL_NAME "cliprdr"
#define CLIPRDR_SVC_CHANNEL_NAME "cliprdr"
/* CLIPRDR_HEADER.msgType */
typedef enum
{
CB_TYPE_NONE = 0x0000, /** @since version 3.10.0 */
CB_MONITOR_READY = 0x0001,
CB_FORMAT_LIST = 0x0002,
CB_FORMAT_LIST_RESPONSE = 0x0003,
CB_FORMAT_DATA_REQUEST = 0x0004,
CB_FORMAT_DATA_RESPONSE = 0x0005,
CB_TEMP_DIRECTORY = 0x0006,
CB_CLIP_CAPS = 0x0007,
CB_FILECONTENTS_REQUEST = 0x0008,
CB_FILECONTENTS_RESPONSE = 0x0009,
CB_LOCK_CLIPDATA = 0x000A,
CB_UNLOCK_CLIPDATA = 0x000B
} CliprdrMsgType;
/* CLIPRDR_HEADER.msgFlags */
#define CB_RESPONSE_OK 0x0001
#define CB_RESPONSE_FAIL 0x0002
#define CB_ASCII_NAMES 0x0004
/* CLIPRDR_CAPS_SET.capabilitySetType */
#define CB_CAPSTYPE_GENERAL 0x0001
/* CLIPRDR_GENERAL_CAPABILITY.lengthCapability */
#define CB_CAPSTYPE_GENERAL_LEN 12
/* CLIPRDR_GENERAL_CAPABILITY.version */
#define CB_CAPS_VERSION_1 0x00000001
#define CB_CAPS_VERSION_2 0x00000002
/* CLIPRDR_GENERAL_CAPABILITY.generalFlags */
#define CB_USE_LONG_FORMAT_NAMES 0x00000002
#define CB_STREAM_FILECLIP_ENABLED 0x00000004
#define CB_FILECLIP_NO_FILE_PATHS 0x00000008
#define CB_CAN_LOCK_CLIPDATA 0x00000010
#define CB_HUGE_FILE_SUPPORT_ENABLED 0x00000020
/* File Contents Request Flags */
#define FILECONTENTS_SIZE 0x00000001
#define FILECONTENTS_RANGE 0x00000002
#ifdef __cplusplus
extern "C"
{
#endif
/* Special Clipboard Response Formats */
typedef struct
{
UINT32 mappingMode;
UINT32 xExt;
UINT32 yExt;
UINT32 metaFileSize;
BYTE* metaFileData;
} CLIPRDR_MFPICT;
/* Clipboard Messages */
typedef struct
{
UINT16 msgType;
UINT16 msgFlags;
UINT32 dataLen;
} CLIPRDR_HEADER;
typedef struct
{
UINT16 capabilitySetType;
UINT16 capabilitySetLength;
} CLIPRDR_CAPABILITY_SET;
typedef struct
{
UINT16 capabilitySetType;
UINT16 capabilitySetLength;
UINT32 version;
UINT32 generalFlags;
} CLIPRDR_GENERAL_CAPABILITY_SET;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 cCapabilitiesSets;
CLIPRDR_CAPABILITY_SET* capabilitySets;
} CLIPRDR_CAPABILITIES;
typedef struct
{
CLIPRDR_HEADER common;
} CLIPRDR_MONITOR_READY;
typedef struct
{
CLIPRDR_HEADER common;
char szTempDir[520];
} CLIPRDR_TEMP_DIRECTORY;
typedef struct
{
UINT32 formatId;
char* formatName;
} CLIPRDR_FORMAT;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 numFormats;
CLIPRDR_FORMAT* formats;
} CLIPRDR_FORMAT_LIST;
typedef struct
{
CLIPRDR_HEADER common;
} CLIPRDR_FORMAT_LIST_RESPONSE;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 clipDataId;
} CLIPRDR_LOCK_CLIPBOARD_DATA;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 clipDataId;
} CLIPRDR_UNLOCK_CLIPBOARD_DATA;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 requestedFormatId;
} CLIPRDR_FORMAT_DATA_REQUEST;
typedef struct
{
CLIPRDR_HEADER common;
const BYTE* requestedFormatData;
} CLIPRDR_FORMAT_DATA_RESPONSE;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 streamId;
UINT32 listIndex;
UINT32 dwFlags;
UINT32 nPositionLow;
UINT32 nPositionHigh;
UINT32 cbRequested;
BOOL haveClipDataId;
UINT32 clipDataId;
} CLIPRDR_FILE_CONTENTS_REQUEST;
typedef struct
{
CLIPRDR_HEADER common;
UINT32 streamId;
UINT32 cbRequested;
const BYTE* requestedData;
} CLIPRDR_FILE_CONTENTS_RESPONSE;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CLIPRDR_H */

View File

@@ -0,0 +1,85 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDPEDISP Virtual Channel Extension
*
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DISP_H
#define FREERDP_CHANNEL_DISP_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#define DISPLAY_CONTROL_PDU_TYPE_CAPS 0x00000005
#define DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
#define DISPLAY_CONTROL_MONITOR_LAYOUT_SIZE 40
#define DISP_CHANNEL_NAME "disp"
#define DISP_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::DisplayControl"
#define DISPLAY_CONTROL_MONITOR_PRIMARY 0x00000001
#define DISPLAY_CONTROL_HEADER_LENGTH 0x00000008
#define DISPLAY_CONTROL_MIN_MONITOR_WIDTH 200
#define DISPLAY_CONTROL_MAX_MONITOR_WIDTH 8192
#define DISPLAY_CONTROL_MIN_MONITOR_HEIGHT 200
#define DISPLAY_CONTROL_MAX_MONITOR_HEIGHT 8192
#define DISPLAY_CONTROL_MIN_PHYSICAL_MONITOR_WIDTH 10
#define DISPLAY_CONTROL_MAX_PHYSICAL_MONITOR_WIDTH 10000
#define DISPLAY_CONTROL_MIN_PHYSICAL_MONITOR_HEIGHT 10
#define DISPLAY_CONTROL_MAX_PHYSICAL_MONITOR_HEIGHT 10000
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
UINT32 type;
UINT32 length;
} DISPLAY_CONTROL_HEADER;
typedef struct
{
UINT32 Flags;
INT32 Left;
INT32 Top;
UINT32 Width;
UINT32 Height;
UINT32 PhysicalWidth;
UINT32 PhysicalHeight;
UINT32 Orientation;
UINT32 DesktopScaleFactor;
UINT32 DeviceScaleFactor;
} DISPLAY_CONTROL_MONITOR_LAYOUT;
typedef struct
{
UINT32 MonitorLayoutSize;
UINT32 NumMonitors;
DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors;
} DISPLAY_CONTROL_MONITOR_LAYOUT_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DISP_H */

View File

@@ -0,0 +1,72 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Virtual Channel
*
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DRDYNVC_H
#define FREERDP_CHANNEL_DRDYNVC_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define DRDYNVC_CHANNEL_NAME "drdynvc"
#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc"
#ifdef __cplusplus
extern "C"
{
#endif
/* defined in MS-RDPEDYC 2.2.5.1 Soft-Sync Request PDU (DYNVC_SOFT_SYNC_REQUEST) */
enum
{
SOFT_SYNC_TCP_FLUSHED = 0x01,
SOFT_SYNC_CHANNEL_LIST_PRESENT = 0x02
};
/* define in MS-RDPEDYC 2.2.5.1.1 Soft-Sync Channel List (DYNVC_SOFT_SYNC_CHANNEL_LIST) */
enum
{
TUNNELTYPE_UDPFECR = 0x00000001,
TUNNELTYPE_UDPFECL = 0x00000003
};
/* @brief dynamic channel commands */
typedef enum
{
CREATE_REQUEST_PDU = 0x01,
DATA_FIRST_PDU = 0x02,
DATA_PDU = 0x03,
CLOSE_REQUEST_PDU = 0x04,
CAPABILITY_REQUEST_PDU = 0x05,
DATA_FIRST_COMPRESSED_PDU = 0x06,
DATA_COMPRESSED_PDU = 0x07,
SOFT_SYNC_REQUEST_PDU = 0x08,
SOFT_SYNC_RESPONSE_PDU = 0x09
} DynamicChannelPDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DRDYNVC_H */

View File

@@ -0,0 +1,42 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Input Redirection Virtual Channel
*
* Copyright 2020 Armin Novak <anovak@thincast.com>
* Copyright 2020 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_ECHO_H
#define FREERDP_CHANNEL_ECHO_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define ECHO_CHANNEL_NAME "echo"
#define ECHO_DVC_CHANNEL_NAME "ECHO"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_ECHO_H */

View File

@@ -0,0 +1,186 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Multiparty Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_ENCOMSP_H
#define FREERDP_CHANNEL_ENCOMSP_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define ENCOMSP_CHANNEL_NAME "encomsp"
#define ENCOMSP_SVC_CHANNEL_NAME "encomsp"
typedef struct
{
UINT16 cchString;
WCHAR wString[1024];
} ENCOMSP_UNICODE_STRING;
/* Filter Updated PDU Flags */
#define ENCOMSP_FILTER_ENABLED 0x0001
/* Application Created PDU Flags */
#define ENCOMSP_APPLICATION_SHARED 0x0001
/* Window Created PDU Flags */
#define ENCOMSP_WINDOW_SHARED 0x0001
/* Participant Created PDU Flags */
#define ENCOMSP_MAY_VIEW 0x0001
#define ENCOMSP_MAY_INTERACT 0x0002
#define ENCOMSP_IS_PARTICIPANT 0x0004
/* Participant Removed PDU Disconnection Types */
#define ENCOMSP_PARTICIPANT_DISCONNECTION_REASON_APP 0x00000000
#define ENCOMSP_PARTICIPANT_DISCONNECTION_REASON_CLI 0x00000002
/* Change Participant Control Level PDU Flags */
#define ENCOMSP_REQUEST_VIEW 0x0001
#define ENCOMSP_REQUEST_INTERACT 0x0002
#define ENCOMSP_ALLOW_CONTROL_REQUESTS 0x0008
/* PDU Order Types */
#define ODTYPE_FILTER_STATE_UPDATED 0x0001
#define ODTYPE_APP_REMOVED 0x0002
#define ODTYPE_APP_CREATED 0x0003
#define ODTYPE_WND_REMOVED 0x0004
#define ODTYPE_WND_CREATED 0x0005
#define ODTYPE_WND_SHOW 0x0006
#define ODTYPE_PARTICIPANT_REMOVED 0x0007
#define ODTYPE_PARTICIPANT_CREATED 0x0008
#define ODTYPE_PARTICIPANT_CTRL_CHANGED 0x0009
#define ODTYPE_GRAPHICS_STREAM_PAUSED 0x000A
#define ODTYPE_GRAPHICS_STREAM_RESUMED 0x000B
#define DEFINE_ENCOMSP_HEADER_COMMON() \
UINT16 Type; \
UINT16 Length
#define ENCOMSP_ORDER_HEADER_SIZE 4
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
} ENCOMSP_ORDER_HEADER;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
BYTE Flags;
} ENCOMSP_FILTER_UPDATED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT16 Flags;
UINT32 AppId;
ENCOMSP_UNICODE_STRING Name;
} ENCOMSP_APPLICATION_CREATED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT32 AppId;
} ENCOMSP_APPLICATION_REMOVED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT16 Flags;
UINT32 AppId;
UINT32 WndId;
ENCOMSP_UNICODE_STRING Name;
} ENCOMSP_WINDOW_CREATED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT32 WndId;
} ENCOMSP_WINDOW_REMOVED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT32 WndId;
} ENCOMSP_SHOW_WINDOW_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT32 ParticipantId;
UINT32 GroupId;
UINT16 Flags;
ENCOMSP_UNICODE_STRING FriendlyName;
} ENCOMSP_PARTICIPANT_CREATED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT32 ParticipantId;
UINT32 DiscType;
UINT32 DiscCode;
} ENCOMSP_PARTICIPANT_REMOVED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
UINT16 Flags;
UINT32 ParticipantId;
} ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
} ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU;
typedef struct
{
DEFINE_ENCOMSP_HEADER_COMMON();
} ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_ENCOMSP_H */

View File

@@ -0,0 +1,73 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Geometry tracking Virtual Channel Extension
*
* Copyright 2017 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_GEOMETRY_H
#define FREERDP_CHANNEL_GEOMETRY_H
#include <winpr/wtypes.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define GEOMETRY_CHANNEL_NAME "geometry"
#define GEOMETRY_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Geometry::v08.01"
#ifdef __cplusplus
extern "C"
{
#endif
enum
{
GEOMETRY_UPDATE = 1,
GEOMETRY_CLEAR = 2
};
enum
{
RDH_RECTANGLE = 1
};
typedef struct
{
RDP_RECT boundingRect;
UINT32 nRectCount;
RDP_RECT* rects;
} FREERDP_RGNDATA;
typedef struct
{
UINT32 version;
UINT64 mappingId;
UINT32 updateType;
UINT64 topLevelId;
INT32 left, top, right, bottom;
INT32 topLevelLeft, topLevelTop, topLevelRight, topLevelBottom;
UINT32 geometryType;
FREERDP_RGNDATA geometry;
} MAPPED_GEOMETRY_PACKET;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_GEOMETRY_H */

View File

@@ -0,0 +1,165 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDPXXXX Remote App Graphics Redirection Virtual Channel Extension
*
* Copyright 2020 Hideyuki Nagase <hideyukn@microsoft.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_GFXREDIR_H
#define FREERDP_CHANNEL_GFXREDIR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define GFXREDIR_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::RemoteAppGraphicsRedirection"
/* GFXREDIR_LEGACY_CAPS_PDU.version */
#define GFXREDIR_CHANNEL_VERSION_LEGACY 1
#define GFXREDIR_CHANNEL_VERSION_MAJOR 2
#define GFXREDIR_CHANNEL_VERSION_MINOR 0
/* GFXREDIR_CAPS_VERSION1 */
#define GFXREDIR_CMDID_LEGACY_CAPS 0x00000001
#define GFXREDIR_CMDID_ERROR 0x00000006
#define GFXREDIR_CMDID_CAPS_ADVERTISE 0x00000008
#define GFXREDIR_CMDID_CAPS_CONFIRM 0x00000009
/* GFXREDIR_CAPS_VERSION2_0 */
#define GFXREDIR_CMDID_OPEN_POOL 0x0000000a
#define GFXREDIR_CMDID_CLOSE_POOL 0x0000000b
#define GFXREDIR_CMDID_CREATE_BUFFER 0x0000000c
#define GFXREDIR_CMDID_DESTROY_BUFFER 0x0000000d
#define GFXREDIR_CMDID_PRESENT_BUFFER 0x0000000e
#define GFXREDIR_CMDID_PRESENT_BUFFER_ACK 0x0000000f
/* GFXREDIR_HEADER */
#define GFXREDIR_HEADER_SIZE 8
/* GFXREDIR_CAPS_HEADER */
#define GFXREDIR_CAPS_HEADER_SIZE 12
/* GFXREDIR_CAPS_HEADER.signature */
#define GFXREDIR_CAPS_SIGNATURE 0x53504143 /* = 'SPAC' */
/* GFXREDIR_CAPS_HEADER.version */
#define GFXREDIR_CAPS_VERSION1 0x1
#define GFXREDIR_CAPS_VERSION2_0 0x2000
/* GFXREDIR_CREATE_BUFFER_PDU.format */
#define GFXREDIR_BUFFER_PIXEL_FORMAT_XRGB_8888 1
#define GFXREDIR_BUFFER_PIXEL_FORMAT_ARGB_8888 2
/* GFXREDIR_PRESENT_BUFFER_PDU.numOpaqueRects */
#define GFXREDIR_MAX_OPAQUE_RECTS 0x10
typedef struct
{
UINT32 cmdId;
UINT32 length;
} GFXREDIR_HEADER;
typedef struct
{
UINT16 version; // GFXREDIR_CHANNEL_VERSION_LEGACY
} GFXREDIR_LEGACY_CAPS_PDU;
typedef struct
{
UINT32 signature; // GFXREDIR_CAPS_SIGNATURE
UINT32 version; // GFXREDIR_CAPS_VERSION
UINT32 length; // GFXREDIR_CAPS_HEADER_SIZE + size of capsData
} GFXREDIR_CAPS_HEADER;
typedef struct
{
GFXREDIR_CAPS_HEADER header;
UINT32 supportedFeatures; /* Reserved for future extensions */
} GFXREDIR_CAPS_V2_0_PDU;
typedef struct
{
UINT32 errorCode;
} GFXREDIR_ERROR_PDU;
typedef struct
{
UINT32 length; // length of caps;
const BYTE* caps; // points variable length array of GFXREDIR_CAPS_HEADER.
} GFXREDIR_CAPS_ADVERTISE_PDU;
typedef struct
{
UINT32 version; // confirmed version, must be one of advertised by client.
UINT32 length; // GFXREDIR_CAPS_HEADER_SIZE + size of capsData.
const BYTE* capsData; // confirmed capsData from selected GFXREDIR_CAPS_HEADER.capsData.
} GFXREDIR_CAPS_CONFIRM_PDU;
typedef struct
{
UINT64 poolId;
UINT64 poolSize;
UINT32 sectionNameLength; // number of characters, must include null terminated char.
const unsigned short* sectionName; // Windows-style 2 bytes wchar_t with null-terminated.
} GFXREDIR_OPEN_POOL_PDU;
typedef struct
{
UINT64 poolId;
} GFXREDIR_CLOSE_POOL_PDU;
typedef struct
{
UINT64 poolId;
UINT64 bufferId;
UINT64 offset;
UINT32 stride;
UINT32 width;
UINT32 height;
UINT32 format; // GFXREDIR_BUFFER_PIXEL_FORMAT_
} GFXREDIR_CREATE_BUFFER_PDU;
typedef struct
{
UINT64 bufferId;
} GFXREDIR_DESTROY_BUFFER_PDU;
typedef struct
{
UINT64 timestamp;
UINT64 presentId;
UINT64 windowId;
UINT64 bufferId;
UINT32 orientation; // 0, 90, 180 or 270.
UINT32 targetWidth;
UINT32 targetHeight;
RECTANGLE_32 dirtyRect;
UINT32 numOpaqueRects;
RECTANGLE_32* opaqueRects;
} GFXREDIR_PRESENT_BUFFER_PDU;
typedef struct
{
UINT64 windowId;
UINT64 presentId;
} GFXREDIR_PRESENT_BUFFER_ACK_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_GFXREDIR_H */

View File

@@ -0,0 +1,128 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Location Virtual Channel Extension
*
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_LOCATION_H
#define FREERDP_CHANNEL_LOCATION_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** @defgroup channel_location Location Channel
* @brief Location channel providing redirection of client side Network/GPS location to the RDP
* server
* @{
*/
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define LOCATION_CHANNEL_NAME "location" /** @since version 3.4.0 */
#define LOCATION_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Location"
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
PDUTYPE_LOC_RESERVED = 0x0000,
PDUTYPE_SERVER_READY = 0x0001,
PDUTYPE_CLIENT_READY = 0x0002,
PDUTYPE_BASE_LOCATION3D = 0x0003,
PDUTYPE_LOCATION2D_DELTA = 0x0004,
PDUTYPE_LOCATION3D_DELTA = 0x0005,
} LOCATION_PDUTYPE;
#define LOCATION_HEADER_SIZE 6
typedef struct
{
LOCATION_PDUTYPE pduType;
UINT32 pduLength;
} RDPLOCATION_HEADER;
typedef enum
{
RDPLOCATION_PROTOCOL_VERSION_100 = 0x00010000,
RDPLOCATION_PROTOCOL_VERSION_200 = 0x00020000,
} RDPLOCATION_PROTOCOL_VERSION;
typedef struct
{
RDPLOCATION_HEADER header;
RDPLOCATION_PROTOCOL_VERSION protocolVersion;
UINT32 flags;
} RDPLOCATION_SERVER_READY_PDU;
typedef struct
{
RDPLOCATION_HEADER header;
RDPLOCATION_PROTOCOL_VERSION protocolVersion;
UINT32 flags;
} RDPLOCATION_CLIENT_READY_PDU;
typedef enum
{
LOCATIONSOURCE_IP = 0x00,
LOCATIONSOURCE_WIFI = 0x01,
LOCATIONSOURCE_CELL = 0x02,
LOCATIONSOURCE_GNSS = 0x03,
} LOCATIONSOURCE;
typedef struct
{
RDPLOCATION_HEADER header;
double latitude;
double longitude;
INT32 altitude;
double* speed;
double* heading;
double* horizontalAccuracy;
LOCATIONSOURCE* source;
} RDPLOCATION_BASE_LOCATION3D_PDU;
typedef struct
{
RDPLOCATION_HEADER header;
double latitudeDelta;
double longitudeDelta;
double* speedDelta;
double* headingDelta;
} RDPLOCATION_LOCATION2D_DELTA_PDU;
typedef struct
{
RDPLOCATION_HEADER header;
double latitudeDelta;
double longitudeDelta;
INT32 altitudeDelta;
double* speedDelta;
double* headingDelta;
} RDPLOCATION_LOCATION3D_DELTA_PDU;
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* FREERDP_CHANNEL_LOCATION_H */

View File

@@ -0,0 +1,35 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Channel log defines
*
* Copyright 2014 Armin Novak <armin.novak@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNELS_LOG_H
#define FREERDP_CHANNELS_LOG_H
#include <winpr/wlog.h>
#include <freerdp/log.h>
#define CHANNELS_TAG(tag) FREERDP_TAG("channels.") tag
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_UTILS_DEBUG_H */

View File

@@ -0,0 +1,26 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Applications Integrated Locally (RAIL)
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RAIL_H
#define FREERDP_CHANNEL_RAIL_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#endif /* FREERDP_CHANNEL_RAIL_H */

View File

@@ -0,0 +1,38 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* TCP redirection Virtual Channel
*
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDP2TCP_H
#define FREERDP_CHANNEL_RDP2TCP_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#define RDP2TCP_DVC_CHANNEL_NAME "rdp2tcp"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDP2TCP_H */

View File

@@ -0,0 +1,396 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Device Redirection Virtual Channel
*
* Copyright 2010-2011 Vic Lee
* Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPDR_H
#define FREERDP_CHANNEL_RDPDR_H
#include <winpr/nt.h>
#include <winpr/io.h>
#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/interlocked.h>
#include <winpr/collections.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPDR_CHANNEL_NAME "rdpdr"
#define RDPDR_SVC_CHANNEL_NAME "rdpdr"
#define RDPDR_DEVICE_IO_REQUEST_LENGTH 24
#define RDPDR_DEVICE_IO_RESPONSE_LENGTH 16
#define RDPDR_DEVICE_IO_CONTROL_REQ_HDR_LENGTH 32
#define RDPDR_DEVICE_IO_CONTROL_RSP_HDR_LENGTH 4
#define RDPDR_VERSION_MAJOR 0x0001
#define RDPDR_VERSION_MINOR_RDP50 0x0002
#define RDPDR_VERSION_MINOR_RDP51 0x0005
#define RDPDR_VERSION_MINOR_RDP52 0x000A
#define RDPDR_VERSION_MINOR_RDP6X 0x000C
#define RDPDR_VERSION_MINOR_RDP10X 0x000D
/* RDPDR_HEADER.Component */
enum RDPDR_CTYP
{
RDPDR_CTYP_CORE = 0x4472,
RDPDR_CTYP_PRN = 0x5052
};
/* RDPDR_HEADER.PacketId */
enum RDPDR_PAKID
{
PAKID_CORE_SERVER_ANNOUNCE = 0x496E,
PAKID_CORE_CLIENTID_CONFIRM = 0x4343,
PAKID_CORE_CLIENT_NAME = 0x434E,
PAKID_CORE_DEVICELIST_ANNOUNCE = 0x4441,
PAKID_CORE_DEVICE_REPLY = 0x6472,
PAKID_CORE_DEVICE_IOREQUEST = 0x4952,
PAKID_CORE_DEVICE_IOCOMPLETION = 0x4943,
PAKID_CORE_SERVER_CAPABILITY = 0x5350,
PAKID_CORE_CLIENT_CAPABILITY = 0x4350,
PAKID_CORE_DEVICELIST_REMOVE = 0x444D,
PAKID_CORE_USER_LOGGEDON = 0x554C,
PAKID_PRN_CACHE_DATA = 0x5043,
PAKID_PRN_USING_XPS = 0x5543
};
/* CAPABILITY_HEADER.CapabilityType */
enum RDPDR_CAP_TYPE
{
CAP_GENERAL_TYPE = 0x0001,
CAP_PRINTER_TYPE = 0x0002,
CAP_PORT_TYPE = 0x0003,
CAP_DRIVE_TYPE = 0x0004,
CAP_SMARTCARD_TYPE = 0x0005
};
/* CAPABILITY_HEADER.Version */
enum RDPDR_CAP_VERSION
{
GENERAL_CAPABILITY_VERSION_01 = 0x00000001,
GENERAL_CAPABILITY_VERSION_02 = 0x00000002,
PRINT_CAPABILITY_VERSION_01 = 0x00000001,
PORT_CAPABILITY_VERSION_01 = 0x00000001,
DRIVE_CAPABILITY_VERSION_01 = 0x00000001,
DRIVE_CAPABILITY_VERSION_02 = 0x00000002,
SMARTCARD_CAPABILITY_VERSION_01 = 0x00000001
};
/* DR_DEVICE_IOREQUEST.MajorFunction */
enum IRP_MJ
{
IRP_MJ_CREATE = 0x00000000,
IRP_MJ_CLOSE = 0x00000002,
IRP_MJ_READ = 0x00000003,
IRP_MJ_WRITE = 0x00000004,
IRP_MJ_DEVICE_CONTROL = 0x0000000E,
IRP_MJ_QUERY_VOLUME_INFORMATION = 0x0000000A,
IRP_MJ_SET_VOLUME_INFORMATION = 0x0000000B,
IRP_MJ_QUERY_INFORMATION = 0x00000005,
IRP_MJ_SET_INFORMATION = 0x00000006,
IRP_MJ_DIRECTORY_CONTROL = 0x0000000C,
IRP_MJ_LOCK_CONTROL = 0x00000011
};
/* DR_DEVICE_IOREQUEST.MinorFunction */
enum IRP_MN
{
IRP_MN_QUERY_DIRECTORY = 0x00000001,
IRP_MN_NOTIFY_CHANGE_DIRECTORY = 0x00000002
};
/* DR_CREATE_REQ.CreateDisposition */
/* DR_CREATE_REQ.CreateOptions [MS-SMB2] */
/* DR_CREATE_REQ.DesiredAccess [MS-SMB2] */
/* DR_CREATE_RSP.Information */
/* DR_DRIVE_CREATE_RSP.DeviceCreateResponse */
/* DR_CORE_CLIENT_ANNOUNCE_RSP.VersionMinor */
#define RDPDR_MAJOR_RDP_VERSION 1
enum RDPDR_MINOR_RDP_VERSION
{
RDPDR_MINOR_RDP_VERSION_5_0 = 0x0002,
RDPDR_MINOR_RDP_VERSION_5_1 = 0x0005,
RDPDR_MINOR_RDP_VERSION_5_2 = 0x000A,
RDPDR_MINOR_RDP_VERSION_6_X = 0x000C,
RDPDR_MINOR_RDP_VERSION_13 = 0x000D
};
/* DR_CORE_CLIENT_NAME_REQ.UnicodeFlag */
enum RDPDR_CLIENT_NAME_FLAG
{
RDPDR_CLIENT_NAME_UNICODE = 0x00000001,
RDPDR_CLIENT_NAME_ASCII = 0x00000000
};
/* GENERAL_CAPS_SET.ioCode1 */
enum RDPDR_CAPS_IRP_MJ
{
RDPDR_IRP_MJ_CREATE = 0x00000001,
RDPDR_IRP_MJ_CLEANUP = 0x00000002,
RDPDR_IRP_MJ_CLOSE = 0x00000004,
RDPDR_IRP_MJ_READ = 0x00000008,
RDPDR_IRP_MJ_WRITE = 0x00000010,
RDPDR_IRP_MJ_FLUSH_BUFFERS = 0x00000020,
RDPDR_IRP_MJ_SHUTDOWN = 0x00000040,
RDPDR_IRP_MJ_DEVICE_CONTROL = 0x00000080,
RDPDR_IRP_MJ_QUERY_VOLUME_INFORMATION = 0x00000100,
RDPDR_IRP_MJ_SET_VOLUME_INFORMATION = 0x00000200,
RDPDR_IRP_MJ_QUERY_INFORMATION = 0x00000400,
RDPDR_IRP_MJ_SET_INFORMATION = 0x00000800,
RDPDR_IRP_MJ_DIRECTORY_CONTROL = 0x00001000,
RDPDR_IRP_MJ_LOCK_CONTROL = 0x00002000,
RDPDR_IRP_MJ_QUERY_SECURITY = 0x00004000,
RDPDR_IRP_MJ_SET_SECURITY = 0x00008000
};
/* GENERAL_CAPS_SET.extendedPDU */
enum RDPDR_CAPS_PDU
{
RDPDR_DEVICE_REMOVE_PDUS = 0x00000001,
RDPDR_CLIENT_DISPLAY_NAME_PDU = 0x00000002,
RDPDR_USER_LOGGEDON_PDU = 0x00000004
};
/* GENERAL_CAPS_SET.extraFlags1 */
enum RDPDR_CAPS_FLAG
{
ENABLE_ASYNCIO = 0x00000001
};
/* DR_DRIVE_LOCK_REQ.Operation */
enum RDP_LOWIO_OP
{
RDP_LOWIO_OP_SHAREDLOCK = 0x00000002,
RDP_LOWIO_OP_EXCLUSIVELOCK = 0x00000003,
RDP_LOWIO_OP_UNLOCK = 0x00000004,
RDP_LOWIO_OP_UNLOCK_MULTIPLE = 0x00000005
};
enum RDPDR_PRINTER_ANNOUNCE_FLAG
{
RDPDR_PRINTER_ANNOUNCE_FLAG_ASCII = 0x00000001,
RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER = 0x00000002,
RDPDR_PRINTER_ANNOUNCE_FLAG_NETWORKPRINTER = 0x00000004,
RDPDR_PRINTER_ANNOUNCE_FLAG_TSPRINTER = 0x00000008,
RDPDR_PRINTER_ANNOUNCE_FLAG_XPSFORMAT = 0x00000010
};
/* [MS-FSCC] FileAttributes */
/* Included with winpr/file.h */
/* [MS-FSCC] FSCTL Structures */
#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
#define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION 0x1400ec
#define FSCTL_PIPE_PEEK 0x11400c
#define FSCTL_PIPE_TRANSCEIVE 0x11c017
#define FSCTL_PIPE_WAIT 0x110018
#define FSCTL_QUERY_ON_DISK_VOLUME_INFO 0x9013c
#define FSCTL_QUERY_SPARING_INFO 0x90138
#endif
#ifndef _WIN32
#define FSCTL_CREATE_OR_GET_OBJECT_ID 0x900c0
#define FSCTL_GET_REPARSE_POINT 0x900a8
#define FSCTL_GET_RETRIEVAL_POINTERS 0x90073
#define FSCTL_IS_PATHNAME_VALID 0x9002c
#define FSCTL_READ_FILE_USN_DATA 0x900eb
#define FSCTL_RECALL_FILE 0x90117
#define FSCTL_QUERY_FAT_BPB 0x90058
#define FSCTL_QUERY_ALLOCATED_RANGES 0x940cf
#define FSCTL_SET_COMPRESSION 0x9c040
#define FSCTL_SET_ENCRYPTION 0x900D7
#define FSCTL_SET_OBJECT_ID 0x90098
#define FSCTL_SET_OBJECT_ID_EXTENDED 0x900bc
#define FSCTL_SET_REPARSE_POINT 0x900a4
#define FSCTL_SET_SPARSE 0x900c4
#define FSCTL_SET_ZERO_DATA 0x980c8
#define FSCTL_SIS_COPYFILE 0x90100
#define FSCTL_WRITE_USN_CLOSE_RECORD 0x900ef
#endif
#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
#define FSCTL_SET_DEFECT_MANAGEMENT 0x98134
#define FSCTL_SET_ZERO_ON_DEALLOCATION 0x90194
#endif
/* [MS-FSCC] FileFsAttributeInformation.FileSystemAttributes */
#ifndef _WIN32
#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
#define FILE_SUPPORTS_HARD_LINKS 0x00400000
#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
#define FILE_READ_ONLY_VOLUME 0x00080000
#define FILE_NAMED_STREAMS 0x00040000
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
#define FILE_VOLUME_IS_COMPRESSED 0x00008000
#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
#define FILE_VOLUME_QUOTAS 0x00000020
#define FILE_FILE_COMPRESSION 0x00000010
#define FILE_PERSISTENT_ACLS 0x00000008
#define FILE_UNICODE_ON_DISK 0x00000004
#define FILE_CASE_PRESERVED_NAMES 0x00000002
#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
#endif
/* [MS-FSCC] FileFsDeviceInformation.DeviceType */
#ifndef FILE_DEVICE_CD_ROM
#define FILE_DEVICE_CD_ROM 0x00000002
#endif
#ifndef FILE_DEVICE_DISK
#define FILE_DEVICE_DISK 0x00000007
#endif
/* [MS-FSCC] FileFsDeviceInformation.Characteristics */
enum FILE_FS_DEVICE_FLAG
{
FILE_REMOVABLE_MEDIA = 0x00000001,
FILE_READ_ONLY_DEVICE = 0x00000002,
FILE_FLOPPY_DISKETTE = 0x00000004,
FILE_WRITE_ONCE_MEDIA = 0x00000008,
FILE_REMOTE_DEVICE = 0x00000010,
FILE_DEVICE_IS_MOUNTED = 0x00000020,
FILE_VIRTUAL_VOLUME = 0x00000040,
FILE_DEVICE_SECURE_OPEN = 0x00000100
};
#ifndef __MINGW32__
enum FILE_FS_INFORMATION_CLASS
{
FileFsVolumeInformation = 1,
FileFsLabelInformation,
FileFsSizeInformation,
FileFsDeviceInformation,
FileFsAttributeInformation,
FileFsControlInformation,
FileFsFullSizeInformation,
FileFsObjectIdInformation,
FileFsDriverPathInformation,
FileFsMaximumInformation
};
#endif
typedef struct S_DEVICE DEVICE;
typedef struct S_IRP IRP;
typedef struct S_DEVMAN DEVMAN;
typedef UINT (*pcCustomComponentRequest)(DEVICE* device, UINT16 component, UINT16 packetId,
wStream* s);
typedef UINT (*pcIRPRequest)(DEVICE* device, IRP* irp);
typedef UINT (*pcInitDevice)(DEVICE* device);
typedef UINT (*pcFreeDevice)(DEVICE* device);
struct S_DEVICE
{
UINT32 id;
UINT32 type;
const char* name;
wStream* data;
WINPR_ATTR_NODISCARD pcCustomComponentRequest CustomComponentRequest;
WINPR_ATTR_NODISCARD pcIRPRequest IRPRequest;
WINPR_ATTR_NODISCARD pcInitDevice Init;
pcFreeDevice Free;
};
typedef UINT (*pcIRPResponse)(IRP* irp);
struct S_IRP
{
WINPR_SLIST_ENTRY ItemEntry;
DEVICE* device;
DEVMAN* devman;
UINT32 FileId;
UINT32 CompletionId;
UINT32 MajorFunction;
UINT32 MinorFunction;
wStream* input;
NTSTATUS IoStatus;
wStream* output;
WINPR_ATTR_NODISCARD pcIRPResponse Complete;
pcIRPResponse Discard;
HANDLE thread;
BOOL cancelled;
};
struct S_DEVMAN
{
void* plugin;
UINT32 id_sequence;
wListDictionary* devices;
};
typedef UINT (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device);
typedef struct
{
DEVMAN* devman;
WINPR_ATTR_NODISCARD pcRegisterDevice RegisterDevice;
RDPDR_DEVICE* device;
rdpContext* rdpcontext;
} DEVICE_SERVICE_ENTRY_POINTS;
typedef DEVICE_SERVICE_ENTRY_POINTS* PDEVICE_SERVICE_ENTRY_POINTS;
typedef UINT(VCAPITYPE* PDEVICE_SERVICE_ENTRY)(PDEVICE_SERVICE_ENTRY_POINTS);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPDR_H */

View File

@@ -0,0 +1,39 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Authentication redirection channel
*
* Copyright 2023 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEAR_H
#define FREERDP_CHANNEL_RDPEAR_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#define RDPEAR_CHANNEL_NAME "rdpear"
#define RDPEAR_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::AuthRedirection"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEAR_H */

View File

@@ -0,0 +1,359 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Capture Virtual Channel Extension
*
* Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPECAM_H
#define FREERDP_CHANNEL_RDPECAM_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPECAM_CHANNEL_NAME "rdpecam"
#define RDPECAM_DVC_CHANNEL_NAME "rdpecam"
#define RDPECAM_CONTROL_DVC_CHANNEL_NAME "RDCamera_Device_Enumerator"
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
CAM_MSG_ID_Invalid = 0x00,
CAM_MSG_ID_SuccessResponse = 0x01,
CAM_MSG_ID_ErrorResponse = 0x02,
CAM_MSG_ID_SelectVersionRequest = 0x03,
CAM_MSG_ID_SelectVersionResponse = 0x04,
CAM_MSG_ID_DeviceAddedNotification = 0x05,
CAM_MSG_ID_DeviceRemovedNotification = 0x06,
CAM_MSG_ID_ActivateDeviceRequest = 0x07,
CAM_MSG_ID_DeactivateDeviceRequest = 0x08,
CAM_MSG_ID_StreamListRequest = 0x09,
CAM_MSG_ID_StreamListResponse = 0x0A,
CAM_MSG_ID_MediaTypeListRequest = 0x0B,
CAM_MSG_ID_MediaTypeListResponse = 0x0C,
CAM_MSG_ID_CurrentMediaTypeRequest = 0x0D,
CAM_MSG_ID_CurrentMediaTypeResponse = 0x0E,
CAM_MSG_ID_StartStreamsRequest = 0x0F,
CAM_MSG_ID_StopStreamsRequest = 0x10,
CAM_MSG_ID_SampleRequest = 0x11,
CAM_MSG_ID_SampleResponse = 0x12,
CAM_MSG_ID_SampleErrorResponse = 0x13,
CAM_MSG_ID_PropertyListRequest = 0x14,
CAM_MSG_ID_PropertyListResponse = 0x15,
CAM_MSG_ID_PropertyValueRequest = 0x16,
CAM_MSG_ID_PropertyValueResponse = 0x17,
CAM_MSG_ID_SetPropertyValueRequest = 0x18,
} CAM_MSG_ID;
#define CAM_HEADER_SIZE 2
typedef struct
{
BYTE Version;
CAM_MSG_ID MessageId;
} CAM_SHARED_MSG_HEADER;
/* Messages Exchanged on the Device Enumeration Channel (2.2.2) */
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_SELECT_VERSION_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_SELECT_VERSION_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
WCHAR* DeviceName;
char* VirtualChannelName;
} CAM_DEVICE_ADDED_NOTIFICATION;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
char* VirtualChannelName;
} CAM_DEVICE_REMOVED_NOTIFICATION;
/* Messages Exchanged on Device Channels (2.2.3) */
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_SUCCESS_RESPONSE;
typedef enum
{
CAM_ERROR_CODE_None = 0x00000000,
CAM_ERROR_CODE_UnexpectedError = 0x00000001,
CAM_ERROR_CODE_InvalidMessage = 0x00000002,
CAM_ERROR_CODE_NotInitialized = 0x00000003,
CAM_ERROR_CODE_InvalidRequest = 0x00000004,
CAM_ERROR_CODE_InvalidStreamNumber = 0x00000005,
CAM_ERROR_CODE_InvalidMediaType = 0x00000006,
CAM_ERROR_CODE_OutOfMemory = 0x00000007,
CAM_ERROR_CODE_ItemNotFound = 0x00000008,
CAM_ERROR_CODE_SetNotFound = 0x00000009,
CAM_ERROR_CODE_OperationNotSupported = 0x0000000A,
} CAM_ERROR_CODE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
CAM_ERROR_CODE ErrorCode;
} CAM_ERROR_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_ACTIVATE_DEVICE_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_DEACTIVATE_DEVICE_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_STREAM_LIST_REQUEST;
typedef enum
{
CAM_STREAM_FRAME_SOURCE_TYPE_Color = 0x0001,
CAM_STREAM_FRAME_SOURCE_TYPE_Infrared = 0x0002,
CAM_STREAM_FRAME_SOURCE_TYPE_Custom = 0x0008,
} CAM_STREAM_FRAME_SOURCE_TYPES;
typedef enum
{
CAM_STREAM_CATEGORY_Capture = 0x01,
} CAM_STREAM_CATEGORY;
typedef struct
{
CAM_STREAM_FRAME_SOURCE_TYPES FrameSourceTypes;
CAM_STREAM_CATEGORY StreamCategory;
BYTE Selected;
BYTE CanBeShared;
} CAM_STREAM_DESCRIPTION;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE N_Descriptions;
CAM_STREAM_DESCRIPTION StreamDescriptions[255];
} CAM_STREAM_LIST_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE StreamIndex;
} CAM_MEDIA_TYPE_LIST_REQUEST;
typedef enum
{
CAM_MEDIA_FORMAT_INVALID = 0x00,
CAM_MEDIA_FORMAT_H264 = 0x01,
CAM_MEDIA_FORMAT_MJPG = 0x02,
CAM_MEDIA_FORMAT_YUY2 = 0x03,
CAM_MEDIA_FORMAT_NV12 = 0x04,
CAM_MEDIA_FORMAT_I420 = 0x05,
CAM_MEDIA_FORMAT_RGB24 = 0x06,
CAM_MEDIA_FORMAT_RGB32 = 0x07,
} CAM_MEDIA_FORMAT;
typedef enum
{
AM_MEDIA_TYPE_DESCRIPTION_FLAG_Invalid = 0x00,
CAM_MEDIA_TYPE_DESCRIPTION_FLAG_DecodingRequired = 0x01,
CAM_MEDIA_TYPE_DESCRIPTION_FLAG_BottomUpImage = 0x02,
} CAM_MEDIA_TYPE_DESCRIPTION_FLAGS;
typedef struct
{
CAM_MEDIA_FORMAT Format;
UINT32 Width;
UINT32 Height;
UINT32 FrameRateNumerator;
UINT32 FrameRateDenominator;
UINT32 PixelAspectRatioNumerator;
UINT32 PixelAspectRatioDenominator;
CAM_MEDIA_TYPE_DESCRIPTION_FLAGS Flags;
} CAM_MEDIA_TYPE_DESCRIPTION;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
size_t N_Descriptions;
CAM_MEDIA_TYPE_DESCRIPTION* MediaTypeDescriptions;
} CAM_MEDIA_TYPE_LIST_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE StreamIndex;
} CAM_CURRENT_MEDIA_TYPE_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription;
} CAM_CURRENT_MEDIA_TYPE_RESPONSE;
typedef struct
{
BYTE StreamIndex;
CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription;
} CAM_START_STREAM_INFO;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE N_Infos;
CAM_START_STREAM_INFO StartStreamsInfo[255];
} CAM_START_STREAMS_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_STOP_STREAMS_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE StreamIndex;
} CAM_SAMPLE_REQUEST;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE StreamIndex;
size_t SampleSize;
BYTE* Sample;
} CAM_SAMPLE_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
BYTE StreamIndex;
CAM_ERROR_CODE ErrorCode;
} CAM_SAMPLE_ERROR_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
} CAM_PROPERTY_LIST_REQUEST;
typedef enum
{
CAM_PROPERTY_SET_CameraControl = 0x01,
CAM_PROPERTY_SET_VideoProcAmp = 0x02
} CAM_PROPERTY_SET;
/* CameraControl properties */
typedef enum
{
CAM_PROPERTY_ID_CAMERA_CONTROL_Exposure = 0x01,
CAM_PROPERTY_ID_CAMERA_CONTROL_Focus = 0x02,
CAM_PROPERTY_ID_CAMERA_CONTROL_Pan = 0x03,
CAM_PROPERTY_ID_CAMERA_CONTROL_Roll = 0x04,
CAM_PROPERTY_ID_CAMERA_CONTROL_Tilt = 0x05,
CAM_PROPERTY_ID_CAMERA_CONTROL_Zoom = 0x06
} CAM_PROPERTY_ID;
/* VideoProcAmp properties */
typedef enum
{
CAM_PROPERTY_ID_VIDEO_PROC_AMP_BacklightCompensation = 0x01,
CAM_PROPERTY_ID_VIDEO_PROC_AMP_Brightness = 0x02,
CAM_PROPERTY_ID_VIDEO_PROC_AMP_Contrast = 0x03,
CAM_PROPERTY_ID_VIDEO_PROC_AMP_Hue = 0x04,
CAM_PROPERTY_ID_VIDEO_PROC_AMP_WhiteBalance = 0x05
} CAM_PROPERTY_ID_VIDEO;
typedef enum
{
CAM_PROPERTY_CAPABILITY_Manual = 0x01u,
CAM_PROPERTY_CAPABILITY_Auto = 0x02u
} CAM_PROPERTY_CAPABILITIES;
typedef struct
{
CAM_PROPERTY_SET PropertySet;
BYTE PropertyId;
UINT32 Capabilities;
INT32 MinValue;
INT32 MaxValue;
INT32 Step;
INT32 DefaultValue;
} CAM_PROPERTY_DESCRIPTION;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
size_t N_Properties;
CAM_PROPERTY_DESCRIPTION* Properties;
} CAM_PROPERTY_LIST_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
CAM_PROPERTY_SET PropertySet;
BYTE PropertyId;
} CAM_PROPERTY_VALUE_REQUEST;
typedef enum
{
CAM_PROPERTY_MODE_Manual = 0x01,
CAM_PROPERTY_MODE_Auto = 0x02,
} CAM_PROPERTY_MODE;
typedef struct
{
CAM_PROPERTY_MODE Mode;
INT32 Value;
} CAM_PROPERTY_VALUE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
CAM_PROPERTY_VALUE PropertyValue;
} CAM_PROPERTY_VALUE_RESPONSE;
typedef struct
{
CAM_SHARED_MSG_HEADER Header;
CAM_PROPERTY_SET PropertySet;
BYTE PropertyId;
CAM_PROPERTY_VALUE PropertyValue;
} CAM_SET_PROPERTY_VALUE_REQUEST;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPECAM_H */

View File

@@ -0,0 +1,170 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Extended Input channel common definitions
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2014 Thincast Technologies Gmbh.
* Copyright 2014 David FORT <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEI_H
#define FREERDP_CHANNEL_RDPEI_H
#include <winpr/wtypes.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define RDPINPUT_HEADER_LENGTH 6
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPEI_CHANNEL_NAME "rdpei"
#define RDPEI_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Input"
/** @brief protocol version */
enum
{
RDPINPUT_PROTOCOL_V10 = 0x00010000,
RDPINPUT_PROTOCOL_V101 = 0x00010001,
RDPINPUT_PROTOCOL_V200 = 0x00020000,
RDPINPUT_PROTOCOL_V300 = 0x00030000
};
/* Server feature flags */
#define SC_READY_MULTIPEN_INJECTION_SUPPORTED 0x0001
/* Client Ready Flags */
#define CS_READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001
#define CS_READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002
#define CS_READY_FLAGS_ENABLE_MULTIPEN_INJECTION 0x00000004
/* 2.2.3.3.1.1 RDPINPUT_TOUCH_CONTACT */
#define CONTACT_DATA_CONTACTRECT_PRESENT 0x0001
#define CONTACT_DATA_ORIENTATION_PRESENT 0x0002
#define CONTACT_DATA_PRESSURE_PRESENT 0x0004
typedef enum
{
RDPINPUT_PEN_CONTACT_PENFLAGS_PRESENT = 0x0001,
RDPINPUT_PEN_CONTACT_PRESSURE_PRESENT = 0x0002,
RDPINPUT_PEN_CONTACT_ROTATION_PRESENT = 0x0004,
RDPINPUT_PEN_CONTACT_TILTX_PRESENT = 0x0008,
RDPINPUT_PEN_CONTACT_TILTY_PRESENT = 0x0010
} RDPINPUT_PEN_FIELDS_PRESENT;
/*
* Valid combinations of RDPINPUT_CONTACT_FLAGS:
*
* See [MS-RDPEI] 2.2.3.3.1.1 RDPINPUT_TOUCH_CONTACT and 3.1.1.1 Touch Contact State Transitions
*
* UP
* UP | CANCELED
* UPDATE
* UPDATE | CANCELED
* DOWN | INRANGE | INCONTACT
* UPDATE | INRANGE | INCONTACT
* UP | INRANGE
* UPDATE | INRANGE
*/
typedef enum
{
RDPINPUT_CONTACT_FLAG_DOWN = 0x0001,
RDPINPUT_CONTACT_FLAG_UPDATE = 0x0002,
RDPINPUT_CONTACT_FLAG_UP = 0x0004,
RDPINPUT_CONTACT_FLAG_INRANGE = 0x0008,
RDPINPUT_CONTACT_FLAG_INCONTACT = 0x0010,
RDPINPUT_CONTACT_FLAG_CANCELED = 0x0020
} RDPINPUT_CONTACT_FLAGS;
typedef enum
{
RDPINPUT_PEN_FLAG_BARREL_PRESSED = 0x0001,
RDPINPUT_PEN_FLAG_ERASER_PRESSED = 0x0002,
RDPINPUT_PEN_FLAG_INVERTED = 0x0004
} RDPINPUT_PEN_FLAGS;
/** @brief a contact point */
typedef struct
{
UINT32 contactId;
UINT16 fieldsPresent; /* Mask of CONTACT_DATA_*_PRESENT values */
INT32 x;
INT32 y;
UINT32 contactFlags; /* See RDPINPUT_CONTACT_FLAG* */
INT16 contactRectLeft; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */
INT16 contactRectTop; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */
INT16 contactRectRight; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */
INT16 contactRectBottom; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */
UINT32 orientation; /* Present if CONTACT_DATA_ORIENTATION_PRESENT, values in degree, [0-359] */
UINT32 pressure; /* Present if CONTACT_DATA_PRESSURE_PRESENT, normalized value [0-1024] */
} RDPINPUT_CONTACT_DATA;
/** @brief a frame containing contact points */
typedef struct
{
UINT16 contactCount;
UINT64 frameOffset;
RDPINPUT_CONTACT_DATA* contacts;
} RDPINPUT_TOUCH_FRAME;
/** @brief a touch event with some frames*/
typedef struct
{
UINT32 encodeTime;
UINT16 frameCount;
RDPINPUT_TOUCH_FRAME* frames;
} RDPINPUT_TOUCH_EVENT;
typedef struct
{
UINT8 deviceId;
UINT16 fieldsPresent; /* Mask of RDPINPUT_PEN_FIELDS_PRESENT values */
INT32 x;
INT32 y;
UINT32 contactFlags; /* See RDPINPUT_CONTACT_FLAG* */
UINT32 penFlags; /* Present if RDPINPUT_PEN_CONTACT_PENFLAGS_PRESENT, values see
RDPINPUT_PEN_FLAGS */
UINT16 rotation; /* Present if RDPINPUT_PEN_CONTACT_ROTATION_PRESENT, In degree, [0-359] */
UINT32
pressure; /* Present if RDPINPUT_PEN_CONTACT_PRESSURE_PRESENT, normalized value [0-1024] */
INT16 tiltX; /* Present if PEN_CONTACT_TILTX_PRESENT, range [-90, 90] */
INT16 tiltY; /* Present if PEN_CONTACT_TILTY_PRESENT, range [-90, 90] */
} RDPINPUT_PEN_CONTACT;
typedef struct
{
UINT16 contactCount;
UINT64 frameOffset;
RDPINPUT_PEN_CONTACT* contacts;
} RDPINPUT_PEN_FRAME;
/** @brief a touch event with some frames*/
typedef struct
{
UINT32 encodeTime;
UINT16 frameCount;
RDPINPUT_PEN_FRAME* frames;
} RDPINPUT_PEN_EVENT;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEI_H */

View File

@@ -0,0 +1,154 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Mouse Cursor Virtual Channel Extension
*
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEMSC_H
#define FREERDP_CHANNEL_RDPEMSC_H
/** @defgroup channel_rdpemsc [MS-RDPEMSC]
* @{
*/
/** \file @code [MS-RDPEMSC] @endcode Mouse Cursor Virtual Channel Extension
* \link
* https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpemsc/2591b507-cd5a-4537-be29-b45540543dc8
* \since version 3.0.0
*/
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPEMSC_CHANNEL_NAME "mousecursor"
#define RDPEMSC_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::MouseCursor"
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
PDUTYPE_EMSC_RESERVED = 0x00,
PDUTYPE_CS_CAPS_ADVERTISE = 0x01,
PDUTYPE_SC_CAPS_CONFIRM = 0x02,
PDUTYPE_SC_MOUSEPTR_UPDATE = 0x03,
} RDP_MOUSE_CURSOR_PDUTYPE;
typedef enum
{
TS_UPDATETYPE_MOUSEPTR_SYSTEM_NULL = 0x05,
TS_UPDATETYPE_MOUSEPTR_SYSTEM_DEFAULT = 0x06,
TS_UPDATETYPE_MOUSEPTR_POSITION = 0x08,
TS_UPDATETYPE_MOUSEPTR_CACHED = 0x0A,
TS_UPDATETYPE_MOUSEPTR_POINTER = 0x0B,
TS_UPDATETYPE_MOUSEPTR_LARGE_POINTER = 0x0C,
} TS_UPDATETYPE_MOUSEPTR;
#define RDPEMSC_HEADER_SIZE 4
typedef struct
{
RDP_MOUSE_CURSOR_PDUTYPE pduType;
TS_UPDATETYPE_MOUSEPTR updateType;
UINT16 reserved;
} RDP_MOUSE_CURSOR_HEADER;
typedef enum
{
RDP_MOUSE_CURSOR_CAPVERSION_INVALID = 0x00000000, /** @since version 3.3.0 */
RDP_MOUSE_CURSOR_CAPVERSION_1 = 0x00000001,
} RDP_MOUSE_CURSOR_CAPVERSION;
typedef struct
{
UINT32 signature;
RDP_MOUSE_CURSOR_CAPVERSION version;
UINT32 size;
} RDP_MOUSE_CURSOR_CAPSET;
typedef struct
{
RDP_MOUSE_CURSOR_CAPSET capsetHeader;
} RDP_MOUSE_CURSOR_CAPSET_VERSION1;
typedef struct
{
RDP_MOUSE_CURSOR_HEADER header;
wArrayList* capsSets;
} RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU;
typedef struct
{
RDP_MOUSE_CURSOR_HEADER header;
RDP_MOUSE_CURSOR_CAPSET* capsSet;
} RDP_MOUSE_CURSOR_CAPS_CONFIRM_PDU;
typedef struct
{
UINT16 xPos;
UINT16 yPos;
} TS_POINT16;
typedef struct
{
UINT16 xorBpp;
UINT16 cacheIndex;
TS_POINT16 hotSpot;
UINT16 width;
UINT16 height;
UINT16 lengthAndMask;
UINT16 lengthXorMask;
BYTE* xorMaskData;
BYTE* andMaskData;
BYTE pad;
} TS_POINTERATTRIBUTE;
typedef struct
{
UINT16 xorBpp;
UINT16 cacheIndex;
TS_POINT16 hotSpot;
UINT16 width;
UINT16 height;
UINT32 lengthAndMask;
UINT32 lengthXorMask;
BYTE* xorMaskData;
BYTE* andMaskData;
BYTE pad;
} TS_LARGEPOINTERATTRIBUTE;
typedef struct
{
RDP_MOUSE_CURSOR_HEADER header;
TS_POINT16* position;
UINT16* cachedPointerIndex;
TS_POINTERATTRIBUTE* pointerAttribute;
TS_LARGEPOINTERATTRIBUTE* largePointerAttribute;
} RDP_MOUSE_CURSOR_MOUSEPTR_UPDATE_PDU;
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* FREERDP_CHANNEL_RDPEMSC_H */

View File

@@ -0,0 +1,43 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Capture Virtual Channel Extension
*
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEWA_H
#define FREERDP_CHANNEL_RDPEWA_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPEWA_CHANNEL_NAME "rdpewa"
#define RDPEWA_DVC_CHANNEL_NAME "rdpewa"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEWA_H */

View File

@@ -0,0 +1,413 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Graphics Pipeline Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPGFX_H
#define FREERDP_CHANNEL_RDPGFX_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define RDPGFX_CHANNEL_NAME "rdpgfx"
#define RDPGFX_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Graphics"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Common Data Types
*/
typedef struct
{
UINT16 x;
UINT16 y;
} RDPGFX_POINT16;
typedef struct
{
BYTE B;
BYTE G;
BYTE R;
BYTE XA;
} RDPGFX_COLOR32;
#define GFX_PIXEL_FORMAT_XRGB_8888 0x20
#define GFX_PIXEL_FORMAT_ARGB_8888 0x21
typedef BYTE RDPGFX_PIXELFORMAT;
#define RDPGFX_CMDID_UNUSED_0000 0x0000
#define RDPGFX_CMDID_WIRETOSURFACE_1 0x0001
#define RDPGFX_CMDID_WIRETOSURFACE_2 0x0002
#define RDPGFX_CMDID_DELETEENCODINGCONTEXT 0x0003
#define RDPGFX_CMDID_SOLIDFILL 0x0004
#define RDPGFX_CMDID_SURFACETOSURFACE 0x0005
#define RDPGFX_CMDID_SURFACETOCACHE 0x0006
#define RDPGFX_CMDID_CACHETOSURFACE 0x0007
#define RDPGFX_CMDID_EVICTCACHEENTRY 0x0008
#define RDPGFX_CMDID_CREATESURFACE 0x0009
#define RDPGFX_CMDID_DELETESURFACE 0x000A
#define RDPGFX_CMDID_STARTFRAME 0x000B
#define RDPGFX_CMDID_ENDFRAME 0x000C
#define RDPGFX_CMDID_FRAMEACKNOWLEDGE 0x000D
#define RDPGFX_CMDID_RESETGRAPHICS 0x000E
#define RDPGFX_CMDID_MAPSURFACETOOUTPUT 0x000F
#define RDPGFX_CMDID_CACHEIMPORTOFFER 0x0010
#define RDPGFX_CMDID_CACHEIMPORTREPLY 0x0011
#define RDPGFX_CMDID_CAPSADVERTISE 0x0012
#define RDPGFX_CMDID_CAPSCONFIRM 0x0013
#define RDPGFX_CMDID_UNUSED_0014 0x0014
#define RDPGFX_CMDID_MAPSURFACETOWINDOW 0x0015
#define RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE 0x0016
#define RDPGFX_CMDID_MAPSURFACETOSCALEDOUTPUT 0x0017
#define RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW 0x0018
#define RDPGFX_HEADER_SIZE 8
typedef struct
{
UINT16 cmdId;
UINT16 flags;
UINT32 pduLength;
} RDPGFX_HEADER;
/**
* Capability Sets [MS-RDPEGFX] 2.2.3
*/
#define RDPGFX_CAPVERSION_8 0x00080004 /** [MS-RDPEGFX] 2.2.3.1 */
#define RDPGFX_CAPVERSION_81 0x00080105 /** [MS-RDPEGFX] 2.2.3.2 */
#define RDPGFX_CAPVERSION_10 0x000A0002 /** [MS-RDPEGFX] 2.2.3.3 */
#define RDPGFX_CAPVERSION_101 0x000A0100 /** [MS-RDPEGFX] 2.2.3.4 */
#define RDPGFX_CAPVERSION_102 0x000A0200 /** [MS-RDPEGFX] 2.2.3.5 */
#define RDPGFX_CAPVERSION_103 0x000A0301 /** [MS-RDPEGFX] 2.2.3.6 */
#define RDPGFX_CAPVERSION_104 0x000A0400 /** [MS-RDPEGFX] 2.2.3.7 */
#define RDPGFX_CAPVERSION_105 0x000A0502 /** [MS-RDPEGFX] 2.2.3.8 */
#define RDPGFX_CAPVERSION_106 \
0x000A0600 /** [MS-RDPEGFX] 2.2.3.9 (the value in the doc is wrong, see \
* [MS-RDPEGFX]-180912-errata] \
* Since this is/was documented for a long time, also define \
* the incorrect value in case some server actually uses it. \
*/
#define RDPGFX_CAPVERSION_106_ERR 0x000A0601
#define RDPGFX_CAPVERSION_107 0x000A0701 /** [MS-RDPEGFX] 2.2.3.10 */
#define RDPGFX_NUMBER_CAPSETS 11
#define RDPGFX_CAPSET_BASE_SIZE 8
typedef struct
{
UINT32 version;
UINT32 length;
UINT32 flags;
} RDPGFX_CAPSET;
#define RDPGFX_CAPS_FLAG_THINCLIENT 0x00000001U /* 8.0+ */
#define RDPGFX_CAPS_FLAG_SMALL_CACHE 0x00000002U /* 8.0+ */
#define RDPGFX_CAPS_FLAG_AVC420_ENABLED 0x00000010U /* 8.1+ */
#define RDPGFX_CAPS_FLAG_AVC_DISABLED 0x00000020U /* 10.0+ */
#define RDPGFX_CAPS_FLAG_AVC_THINCLIENT 0x00000040U /* 10.3+ */
#define RDPGFX_CAPS_FLAG_SCALEDMAP_DISABLE 0x00000080U /* 10.7+ */
typedef struct
{
UINT32 version;
UINT32 capsDataLength;
UINT32 flags;
} RDPGFX_CAPSET_VERSION8;
typedef struct
{
UINT32 version;
UINT32 capsDataLength;
UINT32 flags;
} RDPGFX_CAPSET_VERSION81;
typedef struct
{
UINT32 version;
UINT32 capsDataLength;
UINT32 flags;
} RDPGFX_CAPSET_VERSION10;
/**
* Graphics Messages
*/
#define RDPGFX_CODECID_UNCOMPRESSED 0x0000
#define RDPGFX_CODECID_CAVIDEO 0x0003
#define RDPGFX_CODECID_CLEARCODEC 0x0008
#define RDPGFX_CODECID_PLANAR 0x000A
#define RDPGFX_CODECID_AVC420 0x000B
#define RDPGFX_CODECID_ALPHA 0x000C
#define RDPGFX_CODECID_AVC444 0x000E
#define RDPGFX_CODECID_AVC444v2 0x000F
#define RDPGFX_WIRE_TO_SURFACE_PDU_1_SIZE 17
typedef struct
{
UINT16 surfaceId;
UINT16 codecId;
RDPGFX_PIXELFORMAT pixelFormat;
RECTANGLE_16 destRect;
UINT32 bitmapDataLength;
BYTE* bitmapData;
} RDPGFX_WIRE_TO_SURFACE_PDU_1;
#define RDPGFX_CODECID_CAPROGRESSIVE 0x0009
#define RDPGFX_CODECID_CAPROGRESSIVE_V2 0x000D
#define RDPGFX_WIRE_TO_SURFACE_PDU_2_SIZE 13
typedef struct
{
UINT16 surfaceId;
UINT16 codecId;
UINT32 codecContextId;
RDPGFX_PIXELFORMAT pixelFormat;
UINT32 bitmapDataLength;
BYTE* bitmapData;
} RDPGFX_WIRE_TO_SURFACE_PDU_2;
typedef struct
{
UINT32 surfaceId;
UINT32 codecId;
UINT32 contextId;
UINT32 format; /* FreeRDP color format. @see freerdp/codec/color.h */
UINT32 left;
UINT32 top;
UINT32 right;
UINT32 bottom;
UINT32 width;
UINT32 height;
UINT32 length;
BYTE* data;
void* extra;
} RDPGFX_SURFACE_COMMAND;
typedef struct
{
UINT16 surfaceId;
UINT32 codecContextId;
} RDPGFX_DELETE_ENCODING_CONTEXT_PDU;
typedef struct
{
UINT16 surfaceId;
RDPGFX_COLOR32 fillPixel;
UINT16 fillRectCount;
RECTANGLE_16* fillRects;
} RDPGFX_SOLID_FILL_PDU;
typedef struct
{
UINT16 surfaceIdSrc;
UINT16 surfaceIdDest;
RECTANGLE_16 rectSrc;
UINT16 destPtsCount;
RDPGFX_POINT16* destPts;
} RDPGFX_SURFACE_TO_SURFACE_PDU;
typedef struct
{
UINT16 surfaceId;
UINT64 cacheKey;
UINT16 cacheSlot;
RECTANGLE_16 rectSrc;
} RDPGFX_SURFACE_TO_CACHE_PDU;
typedef struct
{
UINT16 cacheSlot;
UINT16 surfaceId;
UINT16 destPtsCount;
RDPGFX_POINT16* destPts;
} RDPGFX_CACHE_TO_SURFACE_PDU;
typedef struct
{
UINT16 cacheSlot;
} RDPGFX_EVICT_CACHE_ENTRY_PDU;
typedef struct
{
UINT16 surfaceId;
UINT16 width;
UINT16 height;
RDPGFX_PIXELFORMAT pixelFormat;
} RDPGFX_CREATE_SURFACE_PDU;
typedef struct
{
UINT16 surfaceId;
} RDPGFX_DELETE_SURFACE_PDU;
#define RDPGFX_START_FRAME_PDU_SIZE 8
typedef struct
{
UINT32 timestamp;
UINT32 frameId;
} RDPGFX_START_FRAME_PDU;
#define RDPGFX_END_FRAME_PDU_SIZE 4
typedef struct
{
UINT32 frameId;
} RDPGFX_END_FRAME_PDU;
#define QUEUE_DEPTH_UNAVAILABLE 0x00000000
#define SUSPEND_FRAME_ACKNOWLEDGEMENT 0xFFFFFFFF
typedef struct
{
UINT32 queueDepth;
UINT32 frameId;
UINT32 totalFramesDecoded;
} RDPGFX_FRAME_ACKNOWLEDGE_PDU;
typedef struct
{
UINT32 width;
UINT32 height;
UINT32 monitorCount;
MONITOR_DEF* monitorDefArray;
} RDPGFX_RESET_GRAPHICS_PDU;
typedef struct
{
UINT16 surfaceId;
UINT16 reserved;
UINT32 outputOriginX;
UINT32 outputOriginY;
} RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU;
typedef struct
{
UINT16 surfaceId;
UINT16 reserved;
UINT32 outputOriginX;
UINT32 outputOriginY;
UINT32 targetWidth;
UINT32 targetHeight;
} RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU;
typedef struct
{
UINT64 cacheKey;
UINT32 bitmapLength;
} RDPGFX_CACHE_ENTRY_METADATA;
#define RDPGFX_CACHE_ENTRY_MAX_COUNT 5462
typedef struct
{
UINT16 cacheEntriesCount;
RDPGFX_CACHE_ENTRY_METADATA cacheEntries[RDPGFX_CACHE_ENTRY_MAX_COUNT];
} RDPGFX_CACHE_IMPORT_OFFER_PDU;
typedef struct
{
UINT16 importedEntriesCount;
UINT16 cacheSlots[RDPGFX_CACHE_ENTRY_MAX_COUNT];
} RDPGFX_CACHE_IMPORT_REPLY_PDU;
typedef struct
{
UINT16 capsSetCount;
RDPGFX_CAPSET* capsSets;
} RDPGFX_CAPS_ADVERTISE_PDU;
typedef struct
{
RDPGFX_CAPSET* capsSet;
} RDPGFX_CAPS_CONFIRM_PDU;
typedef struct
{
UINT16 surfaceId;
UINT64 windowId;
UINT32 mappedWidth;
UINT32 mappedHeight;
} RDPGFX_MAP_SURFACE_TO_WINDOW_PDU;
typedef struct
{
UINT16 surfaceId;
UINT64 windowId;
UINT32 mappedWidth;
UINT32 mappedHeight;
UINT32 targetWidth;
UINT32 targetHeight;
} RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU;
/* H264 */
typedef struct
{
BYTE qpVal;
BYTE qualityVal;
BYTE qp;
BYTE r;
BYTE p;
} RDPGFX_H264_QUANT_QUALITY;
typedef struct
{
UINT32 numRegionRects;
RECTANGLE_16* regionRects;
RDPGFX_H264_QUANT_QUALITY* quantQualityVals;
} RDPGFX_H264_METABLOCK;
typedef struct
{
RDPGFX_H264_METABLOCK meta;
UINT32 length;
BYTE* data;
} RDPGFX_AVC420_BITMAP_STREAM;
typedef struct
{
UINT32 cbAvc420EncodedBitstream1;
BYTE LC;
RDPGFX_AVC420_BITMAP_STREAM bitstream[2];
} RDPGFX_AVC444_BITMAP_STREAM;
typedef struct
{
UINT32 frameId;
UINT32 timestamp;
UINT16 timeDiffSE;
UINT16 timeDiffEDR;
} RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPGFX_H */

View File

@@ -0,0 +1,32 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Virtual Channel Types
*
* Copyright 2012 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPSND_H
#define FREERDP_CHANNEL_RDPSND_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/audio.h>
#define RDPSND_CHANNEL_NAME "rdpsnd"
#define RDPSND_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_DVC"
#define RDPSND_LOSSY_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_LOSSY_DVC"
#endif /* FREERDP_CHANNEL_RDPSND_H */

View File

@@ -0,0 +1,165 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Assistance Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_REMDESK_H
#define FREERDP_CHANNEL_REMDESK_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define REMDESK_CHANNEL_NAME "remdesk"
#define REMDESK_SVC_CHANNEL_NAME "remdesk"
#define REMDESK_ERROR_NOERROR 0
#define REMDESK_ERROR_NOINFO 1
#define REMDESK_ERROR_LOCALNOTERROR 3
#define REMDESK_ERROR_REMOTEBYUSER 4
#define REMDESK_ERROR_BYSERVER 5
#define REMDESK_ERROR_DNSLOOKUPFAILED 6
#define REMDESK_ERROR_OUTOFMEMORY 7
#define REMDESK_ERROR_CONNECTIONTIMEDOUT 8
#define REMDESK_ERROR_SOCKETCONNECTFAILED 9
#define REMDESK_ERROR_HOSTNOTFOUND 11
#define REMDESK_ERROR_WINSOCKSENDFAILED 12
#define REMDESK_ERROR_INVALIDIPADDR 14
#define REMDESK_ERROR_SOCKETRECVFAILED 15
#define REMDESK_ERROR_INVALIDENCRYPTION 18
#define REMDESK_ERROR_GETHOSTBYNAMEFAILED 20
#define REMDESK_ERROR_LICENSINGFAILED 21
#define REMDESK_ERROR_ENCRYPTIONERROR 22
#define REMDESK_ERROR_DECRYPTIONERROR 23
#define REMDESK_ERROR_INVALIDPARAMETERSTRING 24
#define REMDESK_ERROR_HELPSESSIONNOTFOUND 25
#define REMDESK_ERROR_INVALIDPASSWORD 26
#define REMDESK_ERROR_HELPSESSIONEXPIRED 27
#define REMDESK_ERROR_CANTOPENRESOLVER 28
#define REMDESK_ERROR_UNKNOWNSESSMGRERROR 29
#define REMDESK_ERROR_CANTFORMLINKTOUSERSESSION 30
#define REMDESK_ERROR_RCPROTOCOLERROR 32
#define REMDESK_ERROR_RCUNKNOWNERROR 33
#define REMDESK_ERROR_INTERNALERROR 34
#define REMDESK_ERROR_HELPEERESPONSEPENDING 35
#define REMDESK_ERROR_HELPEESAIDYES 36
#define REMDESK_ERROR_HELPEEALREADYBEINGHELPED 37
#define REMDESK_ERROR_HELPEECONSIDERINGHELP 38
#define REMDESK_ERROR_HELPEENEVERRESPONDED 40
#define REMDESK_ERROR_HELPEESAIDNO 41
#define REMDESK_ERROR_HELPSESSIONACCESSDENIED 42
#define REMDESK_ERROR_USERNOTFOUND 43
#define REMDESK_ERROR_SESSMGRERRORNOTINIT 44
#define REMDESK_ERROR_SELFHELPNOTSUPPORTED 45
#define REMDESK_ERROR_INCOMPATIBLEVERSION 47
#define REMDESK_ERROR_SESSIONNOTCONNECTED 48
#define REMDESK_ERROR_SYSTEMSHUTDOWN 50
#define REMDESK_ERROR_STOPLISTENBYUSER 51
#define REMDESK_ERROR_WINSOCK_FAILED 52
#define REMDESK_ERROR_MISMATCHPARMS 53
#define REMDESK_ERROR_PASSWORDS_DONT_MATCH 61
#define REMDESK_ERROR_SHADOWEND_BASE 300
#define REMDESK_ERROR_SHADOWEND_CONFIGCHANGE 301
#define REMDESK_ERROR_SHADOWEND_UNKNOWN 302
typedef struct
{
UINT32 DataLength;
char ChannelName[32];
} REMDESK_CHANNEL_HEADER;
#define REMDESK_CHANNEL_CTL_NAME "RC_CTL"
#define REMDESK_CHANNEL_CTL_SIZE 22
typedef struct
{
REMDESK_CHANNEL_HEADER ch;
UINT32 msgType;
} REMDESK_CTL_HEADER;
#define REMDESK_CTL_REMOTE_CONTROL_DESKTOP 1
#define REMDESK_CTL_RESULT 2
#define REMDESK_CTL_AUTHENTICATE 3
#define REMDESK_CTL_SERVER_ANNOUNCE 4
#define REMDESK_CTL_DISCONNECT 5
#define REMDESK_CTL_VERSIONINFO 6
#define REMDESK_CTL_ISCONNECTED 7
#define REMDESK_CTL_VERIFY_PASSWORD 8
#define REMDESK_CTL_EXPERT_ON_VISTA 9
#define REMDESK_CTL_RANOVICE_NAME 10
#define REMDESK_CTL_RAEXPERT_NAME 11
#define REMDESK_CTL_TOKEN 12
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
UINT32 result;
} REMDESK_CTL_RESULT_PDU;
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
UINT32 versionMajor;
UINT32 versionMinor;
} REMDESK_CTL_VERSION_INFO_PDU;
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
char* raConnectionString;
char* expertBlob;
} REMDESK_CTL_AUTHENTICATE_PDU;
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
char* raConnectionString;
} REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU;
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
char* expertBlob;
} REMDESK_CTL_VERIFY_PASSWORD_PDU;
typedef struct
{
REMDESK_CTL_HEADER ctlHeader;
BYTE* EncryptedPassword;
UINT32 EncryptedPasswordLength;
} REMDESK_CTL_EXPERT_ON_VISTA_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_REMDESK_H */

View File

@@ -0,0 +1,500 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Smartcard Redirection Virtual Channel
*
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_SCARD_H
#define FREERDP_CHANNEL_SCARD_H
#include <winpr/crt.h>
#include <winpr/smartcard.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define RDP_SCARD_CTL_CODE(code) \
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, (code), METHOD_BUFFERED, FILE_ANY_ACCESS)
#define SCARD_IOCTL_ESTABLISHCONTEXT RDP_SCARD_CTL_CODE(5) /* SCardEstablishContext */
#define SCARD_IOCTL_RELEASECONTEXT RDP_SCARD_CTL_CODE(6) /* SCardReleaseContext */
#define SCARD_IOCTL_ISVALIDCONTEXT RDP_SCARD_CTL_CODE(7) /* SCardIsValidContext */
#define SCARD_IOCTL_LISTREADERGROUPSA RDP_SCARD_CTL_CODE(8) /* SCardListReaderGroupsA */
#define SCARD_IOCTL_LISTREADERGROUPSW RDP_SCARD_CTL_CODE(9) /* SCardListReaderGroupsW */
#define SCARD_IOCTL_LISTREADERSA RDP_SCARD_CTL_CODE(10) /* SCardListReadersA */
#define SCARD_IOCTL_LISTREADERSW RDP_SCARD_CTL_CODE(11) /* SCardListReadersW */
#define SCARD_IOCTL_INTRODUCEREADERGROUPA RDP_SCARD_CTL_CODE(20) /* SCardIntroduceReaderGroupA */
#define SCARD_IOCTL_INTRODUCEREADERGROUPW RDP_SCARD_CTL_CODE(21) /* SCardIntroduceReaderGroupW */
#define SCARD_IOCTL_FORGETREADERGROUPA RDP_SCARD_CTL_CODE(22) /* SCardForgetReaderGroupA */
#define SCARD_IOCTL_FORGETREADERGROUPW RDP_SCARD_CTL_CODE(23) /* SCardForgetReaderGroupW */
#define SCARD_IOCTL_INTRODUCEREADERA RDP_SCARD_CTL_CODE(24) /* SCardIntroduceReaderA */
#define SCARD_IOCTL_INTRODUCEREADERW RDP_SCARD_CTL_CODE(25) /* SCardIntroduceReaderW */
#define SCARD_IOCTL_FORGETREADERA RDP_SCARD_CTL_CODE(26) /* SCardForgetReaderA */
#define SCARD_IOCTL_FORGETREADERW RDP_SCARD_CTL_CODE(27) /* SCardForgetReaderW */
#define SCARD_IOCTL_ADDREADERTOGROUPA RDP_SCARD_CTL_CODE(28) /* SCardAddReaderToGroupA */
#define SCARD_IOCTL_ADDREADERTOGROUPW RDP_SCARD_CTL_CODE(29) /* SCardAddReaderToGroupW */
#define SCARD_IOCTL_REMOVEREADERFROMGROUPA \
RDP_SCARD_CTL_CODE(30) /* SCardRemoveReaderFromGroupA \
*/
#define SCARD_IOCTL_REMOVEREADERFROMGROUPW \
RDP_SCARD_CTL_CODE(31) /* SCardRemoveReaderFromGroupW \
*/
#define SCARD_IOCTL_LOCATECARDSA RDP_SCARD_CTL_CODE(38) /* SCardLocateCardsA */
#define SCARD_IOCTL_LOCATECARDSW RDP_SCARD_CTL_CODE(39) /* SCardLocateCardsW */
#define SCARD_IOCTL_GETSTATUSCHANGEA RDP_SCARD_CTL_CODE(40) /* SCardGetStatusChangeA */
#define SCARD_IOCTL_GETSTATUSCHANGEW RDP_SCARD_CTL_CODE(41) /* SCardGetStatusChangeW */
#define SCARD_IOCTL_CANCEL RDP_SCARD_CTL_CODE(42) /* SCardCancel */
#define SCARD_IOCTL_CONNECTA RDP_SCARD_CTL_CODE(43) /* SCardConnectA */
#define SCARD_IOCTL_CONNECTW RDP_SCARD_CTL_CODE(44) /* SCardConnectW */
#define SCARD_IOCTL_RECONNECT RDP_SCARD_CTL_CODE(45) /* SCardReconnect */
#define SCARD_IOCTL_DISCONNECT RDP_SCARD_CTL_CODE(46) /* SCardDisconnect */
#define SCARD_IOCTL_BEGINTRANSACTION RDP_SCARD_CTL_CODE(47) /* SCardBeginTransaction */
#define SCARD_IOCTL_ENDTRANSACTION RDP_SCARD_CTL_CODE(48) /* SCardEndTransaction */
#define SCARD_IOCTL_STATE RDP_SCARD_CTL_CODE(49) /* SCardState */
#define SCARD_IOCTL_STATUSA RDP_SCARD_CTL_CODE(50) /* SCardStatusA */
#define SCARD_IOCTL_STATUSW RDP_SCARD_CTL_CODE(51) /* SCardStatusW */
#define SCARD_IOCTL_TRANSMIT RDP_SCARD_CTL_CODE(52) /* SCardTransmit */
#define SCARD_IOCTL_CONTROL RDP_SCARD_CTL_CODE(53) /* SCardControl */
#define SCARD_IOCTL_GETATTRIB RDP_SCARD_CTL_CODE(54) /* SCardGetAttrib */
#define SCARD_IOCTL_SETATTRIB RDP_SCARD_CTL_CODE(55) /* SCardSetAttrib */
#define SCARD_IOCTL_ACCESSSTARTEDEVENT RDP_SCARD_CTL_CODE(56) /* SCardAccessStartedEvent */
#define SCARD_IOCTL_RELEASETARTEDEVENT RDP_SCARD_CTL_CODE(57) /* SCardReleaseStartedEvent */
#define SCARD_IOCTL_LOCATECARDSBYATRA RDP_SCARD_CTL_CODE(58) /* SCardLocateCardsByATRA */
#define SCARD_IOCTL_LOCATECARDSBYATRW RDP_SCARD_CTL_CODE(59) /* SCardLocateCardsByATRW */
#define SCARD_IOCTL_READCACHEA RDP_SCARD_CTL_CODE(60) /* SCardReadCacheA */
#define SCARD_IOCTL_READCACHEW RDP_SCARD_CTL_CODE(61) /* SCardReadCacheW */
#define SCARD_IOCTL_WRITECACHEA RDP_SCARD_CTL_CODE(62) /* SCardWriteCacheA */
#define SCARD_IOCTL_WRITECACHEW RDP_SCARD_CTL_CODE(63) /* SCardWriteCacheW */
#define SCARD_IOCTL_GETTRANSMITCOUNT RDP_SCARD_CTL_CODE(64) /* SCardGetTransmitCount */
#define SCARD_IOCTL_GETREADERICON RDP_SCARD_CTL_CODE(65) /* SCardGetReaderIconA */
#define SCARD_IOCTL_GETDEVICETYPEID RDP_SCARD_CTL_CODE(66) /* SCardGetDeviceTypeIdA */
#pragma pack(push, 1)
/* interface type_scard_pack */
/* [unique][version][uuid] */
typedef struct
{
/* [range] */ DWORD cbContext;
/* [size_is][unique] */ BYTE pbContext[8];
} REDIR_SCARDCONTEXT;
typedef struct
{
/* [range] */ DWORD cbHandle;
/* [size_is] */ BYTE pbHandle[8];
} REDIR_SCARDHANDLE;
typedef struct
{
LONG ReturnCode;
} Long_Return;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cBytes;
/* [size_is][unique] */ BYTE* msz;
} ListReaderGroups_Return, ListReaders_Return;
typedef struct
{
LONG ReturnCode;
REDIR_SCARDCONTEXT hContext;
} EstablishContext_Return;
typedef struct
{
DWORD dwCurrentState;
DWORD dwEventState;
/* [range] */ DWORD cbAtr;
BYTE rgbAtr[36];
} ReaderState_Return;
typedef struct
{
/* [range] */ DWORD cbAtr;
BYTE rgbAtr[36];
BYTE rgbMask[36];
} LocateCards_ATRMask;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cReaders;
/* [size_is] */ ReaderState_Return* rgReaderStates;
} LocateCards_Return, GetStatusChange_Return;
typedef struct
{
LONG ReturnCode;
ULONG cbDataLen;
BYTE* pbData;
} GetReaderIcon_Return;
typedef struct
{
LONG ReturnCode;
ULONG dwDeviceId;
} GetDeviceTypeId_Return;
typedef struct
{
LONG ReturnCode;
REDIR_SCARDCONTEXT hContext;
REDIR_SCARDHANDLE hCard;
DWORD dwActiveProtocol;
} Connect_Return;
typedef struct
{
LONG ReturnCode;
DWORD dwActiveProtocol;
} Reconnect_Return;
typedef struct
{
LONG ReturnCode;
DWORD dwState;
DWORD dwProtocol;
/* [range] */ DWORD cbAtrLen;
/* [size_is][unique] */ BYTE rgAtr[36];
} State_Return;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cBytes;
/* [size_is][unique] */ BYTE* mszReaderNames;
DWORD dwState;
DWORD dwProtocol;
BYTE pbAtr[32];
/* [range] */ DWORD cbAtrLen;
} Status_Return;
typedef struct
{
DWORD dwProtocol;
/* [range] */ DWORD cbExtraBytes;
/* [size_is][unique] */ BYTE* pbExtraBytes;
} SCardIO_Request;
typedef struct
{
LONG ReturnCode;
/* [unique] */ LPSCARD_IO_REQUEST pioRecvPci;
/* [range] */ DWORD cbRecvLength;
/* [size_is][unique] */ BYTE* pbRecvBuffer;
} Transmit_Return;
typedef struct
{
LONG ReturnCode;
DWORD cTransmitCount;
} GetTransmitCount_Return;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cbOutBufferSize;
/* [size_is][unique] */ BYTE* pvOutBuffer;
} Control_Return;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cbAttrLen;
/* [size_is][unique] */ BYTE* pbAttr;
} GetAttrib_Return;
typedef struct
{
LONG ReturnCode;
/* [range] */ DWORD cbDataLen;
/* [size_is][unique] */ BYTE* pbData;
} ReadCache_Return;
#pragma pack(pop)
typedef struct
{
REDIR_SCARDCONTEXT hContext;
REDIR_SCARDHANDLE hCard;
} Handles_Call;
typedef struct
{
Handles_Call handles;
LONG fmszGroupsIsNULL;
DWORD cchGroups;
} ListReaderGroups_Call;
typedef struct
{
Handles_Call handles;
/* [range] */ DWORD cBytes;
/* [size_is][unique] */ BYTE* mszGroups;
LONG fmszReadersIsNULL;
DWORD cchReaders;
} ListReaders_Call;
typedef struct
{
Handles_Call handles;
DWORD dwTimeOut;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
} GetStatusChangeA_Call;
typedef struct
{
Handles_Call handles;
/* [range] */ DWORD cBytes;
/* [size_is] */ CHAR* mszCards;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
} LocateCardsA_Call;
typedef struct
{
Handles_Call handles;
/* [range] */ DWORD cBytes;
/* [size_is] */ WCHAR* mszCards;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
} LocateCardsW_Call;
typedef struct
{
Handles_Call handles;
/* [range] */ DWORD cAtrs;
/* [size_is] */ LocateCards_ATRMask* rgAtrMasks;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
} LocateCardsByATRA_Call;
typedef struct
{
Handles_Call handles;
/* [range] */ DWORD cAtrs;
/* [size_is] */ LocateCards_ATRMask* rgAtrMasks;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
} LocateCardsByATRW_Call;
typedef struct
{
Handles_Call handles;
DWORD dwTimeOut;
/* [range] */ DWORD cReaders;
/* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
} GetStatusChangeW_Call;
typedef struct
{
Handles_Call handles;
WCHAR* szReaderName;
} GetReaderIcon_Call;
typedef struct
{
Handles_Call handles;
WCHAR* szReaderName;
} GetDeviceTypeId_Call;
typedef struct
{
Handles_Call handles;
DWORD dwShareMode;
DWORD dwPreferredProtocols;
} Connect_Common_Call;
typedef struct
{
Connect_Common_Call Common;
/* [string] */ CHAR* szReader;
} ConnectA_Call;
typedef struct
{
Connect_Common_Call Common;
/* [string] */ WCHAR* szReader;
} ConnectW_Call;
typedef struct
{
Handles_Call handles;
DWORD dwShareMode;
DWORD dwPreferredProtocols;
DWORD dwInitialization;
} Reconnect_Call;
typedef struct
{
Handles_Call handles;
DWORD dwDisposition;
} HCardAndDisposition_Call;
typedef struct
{
Handles_Call handles;
LONG fpbAtrIsNULL;
DWORD cbAtrLen;
} State_Call;
typedef struct
{
Handles_Call handles;
LONG fmszReaderNamesIsNULL;
DWORD cchReaderLen;
DWORD cbAtrLen;
} Status_Call;
typedef struct
{
Handles_Call handles;
LPSCARD_IO_REQUEST pioSendPci;
/* [range] */ DWORD cbSendLength;
/* [size_is] */ BYTE* pbSendBuffer;
/* [unique] */ LPSCARD_IO_REQUEST pioRecvPci;
LONG fpbRecvBufferIsNULL;
DWORD cbRecvLength;
} Transmit_Call;
typedef struct
{
Handles_Call handles;
LONG LongValue;
} Long_Call;
typedef struct
{
Handles_Call handles;
} Context_Call;
typedef struct
{
Handles_Call handles;
/* [string] */ char* sz;
} ContextAndStringA_Call;
typedef struct
{
Handles_Call handles;
/* [string] */ WCHAR* sz;
} ContextAndStringW_Call;
typedef struct
{
Handles_Call handles;
/* [string] */ char* sz1;
/* [string] */ char* sz2;
} ContextAndTwoStringA_Call;
typedef struct
{
Handles_Call handles;
/* [string] */ WCHAR* sz1;
/* [string] */ WCHAR* sz2;
} ContextAndTwoStringW_Call;
typedef struct
{
Handles_Call handles;
DWORD dwScope;
} EstablishContext_Call;
typedef struct
{
Handles_Call handles;
} GetTransmitCount_Call;
typedef struct
{
Handles_Call handles;
DWORD dwControlCode;
/* [range] */ DWORD cbInBufferSize;
/* [size_is][unique] */ BYTE* pvInBuffer;
LONG fpvOutBufferIsNULL;
DWORD cbOutBufferSize;
} Control_Call;
typedef struct
{
Handles_Call handles;
DWORD dwAttrId;
LONG fpbAttrIsNULL;
DWORD cbAttrLen;
} GetAttrib_Call;
typedef struct
{
Handles_Call handles;
DWORD dwAttrId;
/* [range] */ DWORD cbAttrLen;
/* [size_is] */ BYTE* pbAttr;
} SetAttrib_Call;
typedef struct
{
Handles_Call handles;
UUID* CardIdentifier;
DWORD FreshnessCounter;
LONG fPbDataIsNULL;
DWORD cbDataLen;
} ReadCache_Common;
typedef struct
{
ReadCache_Common Common;
/* [string] */ char* szLookupName;
} ReadCacheA_Call;
typedef struct
{
ReadCache_Common Common;
/* [string] */ WCHAR* szLookupName;
} ReadCacheW_Call;
typedef struct
{
Handles_Call handles;
UUID* CardIdentifier;
DWORD FreshnessCounter;
/* [range] */ DWORD cbDataLen;
/* [size_is][unique] */ BYTE* pbData;
} WriteCache_Common;
typedef struct
{
WriteCache_Common Common;
/* [string] */ char* szLookupName;
} WriteCacheA_Call;
typedef struct
{
WriteCache_Common Common;
/* [string] */ WCHAR* szLookupName;
} WriteCacheW_Call;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_SCARD_H */

View File

@@ -0,0 +1,51 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Telemetry Virtual Channel Extension
*
* Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_TELEMETRY_H
#define FREERDP_CHANNEL_TELEMETRY_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define TELEMETRY_CHANNEL_NAME "telemetry"
#define TELEMETRY_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Telemetry"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
UINT32 PromptForCredentialsMillis;
UINT32 PromptForCredentialsDoneMillis;
UINT32 GraphicsChannelOpenedMillis;
UINT32 FirstGraphicsReceivedMillis;
} TELEMETRY_RDP_TELEMETRY_PDU;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_TELEMETRY_H */

View File

@@ -0,0 +1,40 @@
/*
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Redirection Virtual Channel - Callback interface
*
* (C) Copyright 2014 Thincast Technologies GmbH
* (C) Copyright 2014 Armin Novak <armin.novak@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* DEPRECATION WARNING:
*
* This channel is unmaintained and not used since windows 7.
* Only compile and use it if absolutely necessary, otherwise
* deactivate it or use the newer [MS-RDPEVOR] video redirection.
*/
#ifndef FREERDP_CHANNEL_TSMF_H
#define FREERDP_CHANNEL_TSMF_H
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define TSMF_CHANNEL_NAME "tsmf"
#define TSMF_DVC_CHANNEL_NAME "TSMF"
#endif /* FREERDP_CHANNEL_TSMF_H */

View File

@@ -0,0 +1,35 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Server USB redirection Virtual Channel
*
* Copyright 2019 Armin Novak <armin.novak@thincast.com>
* Copyright 2019 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_URBDRC_H
#define FREERDP_CHANNEL_URBDRC_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define URBDRC_CHANNEL_NAME "urbdrc"
#define URBDRC_DVC_CHANNEL_NAME "urbdrc"
#endif /* FREERDP_CHANNEL_URBDRC_H */

View File

@@ -0,0 +1,126 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Optimized Remoting Virtual Channel Extension
*
* Copyright 2018 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_VIDEO_H
#define FREERDP_CHANNEL_VIDEO_H
#include <winpr/wtypes.h>
#include <freerdp/types.h>
/** The command line name of the channel
*
* \since version 3.0.0
*/
#define VIDEO_CHANNEL_NAME "video"
#define VIDEO_CONTROL_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Control::v08.01"
#define VIDEO_DATA_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Data::v08.01"
#ifdef __cplusplus
extern "C"
{
#endif
/** @brief TSNM packet type */
enum
{
TSMM_PACKET_TYPE_PRESENTATION_REQUEST = 1,
TSMM_PACKET_TYPE_PRESENTATION_RESPONSE = 2,
TSMM_PACKET_TYPE_CLIENT_NOTIFICATION = 3,
TSMM_PACKET_TYPE_VIDEO_DATA = 4
};
/** @brief TSMM_PRESENTATION_REQUEST commands */
enum
{
TSMM_START_PRESENTATION = 1,
TSMM_STOP_PRESENTATION = 2
};
/** @brief presentation request struct */
typedef struct
{
BYTE PresentationId;
BYTE Version;
BYTE Command;
BYTE FrameRate;
UINT32 SourceWidth, SourceHeight;
UINT32 ScaledWidth, ScaledHeight;
UINT64 hnsTimestampOffset;
UINT64 GeometryMappingId;
BYTE VideoSubtypeId[16];
UINT32 cbExtra;
BYTE* pExtraData;
} TSMM_PRESENTATION_REQUEST;
/** @brief response to a TSMM_PRESENTATION_REQUEST */
typedef struct
{
BYTE PresentationId;
} TSMM_PRESENTATION_RESPONSE;
/** @brief TSMM_VIDEO_DATA flags */
enum
{
TSMM_VIDEO_DATA_FLAG_HAS_TIMESTAMPS = 0x01,
TSMM_VIDEO_DATA_FLAG_KEYFRAME = 0x02,
TSMM_VIDEO_DATA_FLAG_NEW_FRAMERATE = 0x04
};
/** @brief a video data packet */
typedef struct
{
BYTE PresentationId;
BYTE Version;
BYTE Flags;
UINT64 hnsTimestamp;
UINT64 hnsDuration;
UINT16 CurrentPacketIndex;
UINT16 PacketsInSample;
UINT32 SampleNumber;
UINT32 cbSample;
BYTE* pSample;
} TSMM_VIDEO_DATA;
/** @brief values for NotificationType in TSMM_CLIENT_NOTIFICATION */
enum
{
TSMM_CLIENT_NOTIFICATION_TYPE_NETWORK_ERROR = 1,
TSMM_CLIENT_NOTIFICATION_TYPE_FRAMERATE_OVERRIDE = 2
};
/** @brief struct used when NotificationType is FRAMERATE_OVERRIDE */
typedef struct
{
UINT32 Flags;
UINT32 DesiredFrameRate;
} TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE;
/** @brief a client to server notification struct */
typedef struct
{
BYTE PresentationId;
BYTE NotificationType;
TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE FramerateOverride;
} TSMM_CLIENT_NOTIFICATION;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_VIDEO_H */

View File

@@ -0,0 +1,129 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Server Virtual Channel Interface
*
* Copyright 2011-2012 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The server-side virtual channel API follows the Microsoft Remote Desktop
* Services API functions WTSVirtualChannel* defined in:
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464.aspx
*
* Difference between the MS API are documented in this header. All functions
* are implemented in and integrated with libfreerdp-channels.
*
* Unlike MS API, all functions except WTSVirtualChannelOpenEx in this
* implementation are thread-safe.
*/
#ifndef FREERDP_WTSVC_H
#define FREERDP_WTSVC_H
#include <freerdp/types.h>
#include <freerdp/peer.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/wtsapi.h>
#ifdef __cplusplus
extern "C"
{
#endif
enum
{
DRDYNVC_STATE_NONE = 0,
DRDYNVC_STATE_INITIALIZED = 1,
DRDYNVC_STATE_READY = 2,
DRDYNVC_STATE_FAILED = 3
};
typedef BOOL (*psDVCCreationStatusCallback)(void* userdata, UINT32 channelId,
INT32 creationStatus);
/**
* WTSVirtualChannelManager functions are FreeRDP extensions to the API.
*/
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use WTSVirtualChannelManagerGetEventHandle",
FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(
HANDLE hServer, void** fds, int* fds_count));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSVirtualChannelManagerOpen(HANDLE hServer);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptorEx(HANDLE hServer, BOOL autoOpen);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(HANDLE hServer, const char* name);
WINPR_ATTR_NODISCARD
FREERDP_API BYTE WTSVirtualChannelManagerGetDrdynvcState(HANDLE hServer);
FREERDP_API void WTSVirtualChannelManagerSetDVCCreationCallback(HANDLE hServer,
psDVCCreationStatusCallback cb,
void* userdata);
/**
* Extended FreeRDP WTS functions for channel handling
*/
WINPR_ATTR_NODISCARD
FREERDP_API UINT16 WTSChannelGetId(freerdp_peer* client, const char* channel_name);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSIsChannelJoinedByName(freerdp_peer* client, const char* channel_name);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSIsChannelJoinedById(freerdp_peer* client, UINT16 channel_id);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSChannelSetHandleByName(freerdp_peer* client, const char* channel_name,
void* handle);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL WTSChannelSetHandleById(freerdp_peer* client, UINT16 channel_id, void* handle);
WINPR_ATTR_NODISCARD
FREERDP_API void* WTSChannelGetHandleByName(freerdp_peer* client, const char* channel_name);
WINPR_ATTR_NODISCARD
FREERDP_API void* WTSChannelGetHandleById(freerdp_peer* client, UINT16 channel_id);
WINPR_ATTR_NODISCARD
FREERDP_API const char* WTSChannelGetName(freerdp_peer* client, UINT16 channel_id);
WINPR_ATTR_NODISCARD
FREERDP_API char** WTSGetAcceptedChannelNames(freerdp_peer* client, size_t* count);
WINPR_ATTR_NODISCARD
FREERDP_API INT64 WTSChannelGetOptions(freerdp_peer* client, UINT16 channel_id);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 WTSChannelGetIdByHandle(HANDLE hChannelHandle);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_WTSVC_H */

View File

@@ -0,0 +1,382 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Client Interface
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2025 Siemens
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_H
#define FREERDP_CLIENT_H
#include <winpr/cmdline.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/config.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/event.h>
#include <freerdp/freerdp.h>
#if defined(CHANNEL_AINPUT_CLIENT)
#include <freerdp/client/ainput.h>
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
#include <freerdp/client/rdpei.h>
#endif
#if defined(CHANNEL_ENCOMSP_CLIENT)
#include <freerdp/client/encomsp.h>
#endif
/** @brief Opaqye handle for AAD wrapper
* @since version 3.16.0
*/
typedef struct MIBClientWrapper MIBClientWrapper;
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Entry Points
*/
typedef BOOL (*pRdpGlobalInit)(void);
typedef void (*pRdpGlobalUninit)(void);
typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context);
typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
typedef int (*pRdpClientStart)(rdpContext* context);
typedef int (*pRdpClientStop)(rdpContext* context);
struct rdp_client_entry_points_v1
{
DWORD Size;
DWORD Version;
rdpSettings* settings;
WINPR_ATTR_NODISCARD pRdpGlobalInit GlobalInit;
pRdpGlobalUninit GlobalUninit;
DWORD ContextSize;
WINPR_ATTR_NODISCARD pRdpClientNew ClientNew;
pRdpClientFree ClientFree;
WINPR_ATTR_NODISCARD pRdpClientStart ClientStart;
pRdpClientStop ClientStop;
};
#define RDP_CLIENT_INTERFACE_VERSION 1
#define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry"
typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
/* Common Client Interface */
#define FREERDP_MAX_TOUCH_CONTACTS 10
typedef struct
{
ALIGN64 INT32 id;
ALIGN64 UINT32 count;
ALIGN64 INT32 x;
ALIGN64 INT32 y;
ALIGN64 UINT32 flags;
ALIGN64 UINT32 pressure;
} FreeRDP_TouchContact;
#define FREERDP_MAX_PEN_DEVICES 10
typedef struct pen_device
{
ALIGN64 INT32 deviceid;
ALIGN64 UINT32 flags;
ALIGN64 double max_pressure;
ALIGN64 BOOL hovering;
ALIGN64 BOOL pressed;
ALIGN64 INT32 last_x;
ALIGN64 INT32 last_y;
} FreeRDP_PenDevice;
struct rdp_client_context
{
rdpContext context;
ALIGN64 HANDLE thread; /**< (offset 0) */
#if defined(CHANNEL_AINPUT_CLIENT)
ALIGN64 AInputClientContext* ainput; /**< (offset 1) */
#else
UINT64 reserved1;
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
ALIGN64 RdpeiClientContext* rdpei; /**< (offset 2) */
#else
UINT64 reserved2;
#endif
ALIGN64 INT32 lastX; /**< (offset 3) */
ALIGN64 INT32 lastY; /**< (offset 4) */
ALIGN64 BOOL mouse_grabbed; /** < (offset 5) */
#if defined(CHANNEL_ENCOMSP_CLIENT)
ALIGN64 EncomspClientContext* encomsp; /** < (offset 6) */
ALIGN64 BOOL controlToggle; /**< (offset 7) */
#else
UINT64 reserved3[2];
#endif
ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS]; /**< (offset 8) */
ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES]; /**< (offset 9) */
ALIGN64 MIBClientWrapper* mibClientWrapper; /**< (offset 10) @since version 3.16.0 */
ALIGN64 BOOL pressed_buttons[5]; /**< (offset 11) @since version 3.17.0 */
UINT64 reserved[129 - 16]; /**< (offset 16) */
};
/* Common client functions */
FREERDP_API void freerdp_client_context_free(rdpContext* context);
WINPR_ATTR_MALLOC(freerdp_client_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_start(rdpContext* context);
FREERDP_API int freerdp_client_stop(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc,
char** argv, BOOL allowUnknown);
/**
* @brief freerdp_client_settings_parse_command_line_ex
* @param settings Pointer to the settings to populate
* @param argc Number of command line arguments
* @param argv Array of command line arguments
* @param allowUnknown Skip unknown arguments instead of aborting parser
* @param args The allowed command line arguments (client specific, client-common ones are added
* internally)
* @param count Number of client specific command line arguments
* @param handle_userdata Custom user data pointer, will be passed to callback
* @return >=0 for success, <0 in case of parsing failures
* @since version 3.9.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_command_line_ex(
rdpSettings* settings, int argc, char** argv, BOOL allowUnknown,
COMMAND_LINE_ARGUMENT_A* args, size_t count,
freerdp_command_line_handle_option_t handle_option, void* handle_userdata);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_connection_file(rdpSettings* settings,
const char* filename);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings,
const BYTE* buffer,
size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings,
const char* filename,
BOOL unicode);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc,
char* argv[]);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance, char** username, char** password,
char** domain, rdp_auth_reason reason);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_cli_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list,
DWORD count, DWORD* choice, BOOL gateway);
WINPR_ATTR_NODISCARD
FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_cli_get_access_token(freerdp* instance, AccessTokenType tokenType,
char** token, size_t count, ...);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_common_get_access_token(freerdp* instance, const char* request,
char** token);
WINPR_ATTR_NODISCARD
FREERDP_API SSIZE_T client_common_retry_dialog(freerdp* instance, const char* what,
size_t current, void* userarg);
FREERDP_API void
freerdp_client_OnChannelConnectedEventHandler(void* context,
const ChannelConnectedEventArgs* e);
FREERDP_API void
freerdp_client_OnChannelDisconnectedEventHandler(void* context,
const ChannelDisconnectedEventArgs* e);
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
WINPR_ATTR_NODISCARD FREERDP_API BOOL client_cli_authenticate(
freerdp* instance, char** username, char** password, char** domain));
WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
WINPR_ATTR_NODISCARD FREERDP_API BOOL client_cli_gw_authenticate(
freerdp* instance, char** username, char** password, char** domain));
WINPR_DEPRECATED_VAR("Use client_cli_verify_certificate_ex",
WINPR_ATTR_NODISCARD FREERDP_API DWORD client_cli_verify_certificate(
freerdp* instance, const char* common_name, const char* subject,
const char* issuer, const char* fingerprint, BOOL host_mismatch));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host,
UINT16 port, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, DWORD flags);
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR(
"Use client_cli_verify_changed_certificate_ex",
WINPR_ATTR_NODISCARD FREERDP_API DWORD client_cli_verify_changed_certificate(
freerdp* instance, const char* common_name, const char* subject, const char* issuer,
const char* fingerprint, const char* old_subject, const char* old_issuer,
const char* old_fingerprint));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API DWORD client_cli_verify_changed_certificate_ex(
freerdp* instance, const char* host, UINT16 port, const char* common_name,
const char* subject, const char* issuer, const char* fingerprint, const char* old_subject,
const char* old_issuer, const char* old_fingerprint, DWORD flags);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type,
BOOL isDisplayMandatory,
BOOL isConsentMandatory, size_t length,
const WCHAR* message);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_auto_reconnect(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL client_auto_reconnect_ex(freerdp* instance,
BOOL (*window_events)(freerdp* instance));
typedef enum
{
FREERDP_TOUCH_DOWN = 0x01,
FREERDP_TOUCH_UP = 0x02,
FREERDP_TOUCH_MOTION = 0x04,
FREERDP_TOUCH_CANCEL = 0x08, /** @since version 3.22.0 */
FREERDP_TOUCH_HAS_PRESSURE = 0x100
} FreeRDPTouchEventType;
FREERDP_API BOOL freerdp_client_handle_touch(rdpClientContext* cctx, UINT32 flags, INT32 finger,
UINT32 pressure, INT32 x, INT32 y);
typedef enum
{
FREERDP_PEN_REGISTER = 0x01,
FREERDP_PEN_ERASER_PRESSED = 0x02,
FREERDP_PEN_PRESS = 0x04,
FREERDP_PEN_MOTION = 0x08,
FREERDP_PEN_RELEASE = 0x10,
FREERDP_PEN_BARREL_PRESSED = 0x20,
FREERDP_PEN_HAS_PRESSURE = 0x40,
FREERDP_PEN_HAS_ROTATION = 0x80,
FREERDP_PEN_HAS_TILTX = 0x100,
FREERDP_PEN_HAS_TILTY = 0x200,
FREERDP_PEN_IS_INVERTED = 0x400
} FreeRDPPenEventType;
FREERDP_API BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid,
...);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_is_pen(rdpClientContext* cctx, INT32 deviceid);
FREERDP_API BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx);
FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags);
/** @brief this function checks if relative mouse events are supported and enabled for this
* session.
*
* @param cctx The \b rdpClientContext to check
*
* @return \b TRUE if relative mouse events are to be sent, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_use_relative_mouse_events(rdpClientContext* cctx);
FREERDP_API BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative,
UINT16 mflags, INT32 x, INT32 y);
FREERDP_API BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx,
BOOL relative, UINT16 mflags,
INT32 x, INT32 y);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_common_stop(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance);
#if defined(CHANNEL_ENCOMSP_CLIENT)
FREERDP_API BOOL freerdp_client_encomsp_toggle_control(EncomspClientContext* encomsp);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_encomsp_set_control(EncomspClientContext* encomsp,
BOOL control);
#endif
/** @brief type of AAD request
* @since version 3.16.0
*/
typedef enum
{
FREERDP_CLIENT_AAD_AUTH_REQUEST,
FREERDP_CLIENT_AAD_TOKEN_REQUEST,
FREERDP_CLIENT_AAD_AVD_AUTH_REQUEST,
FREERDP_CLIENT_AAD_AVD_TOKEN_REQUEST,
} freerdp_client_aad_type;
/** @brief helper function to construct a connection URL for AAD authentication
*
* @param cctx The client context to use
* @return An allocated string that can be used to connect
* @since version 3.16.0
*/
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_client_get_aad_url(rdpClientContext* cctx,
freerdp_client_aad_type type, ...);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_H */

View File

@@ -0,0 +1,48 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Display Update Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_AINPUT_CLIENT_AINPUT_H
#define FREERDP_CHANNEL_AINPUT_CLIENT_AINPUT_H
#include <winpr/assert.h>
#include <freerdp/channels/ainput.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef UINT (*pcAInputSendInputEvent)(AInputClientContext* context, UINT64 flags, INT32 x,
INT32 y);
struct ainput_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcAInputSendInputEvent AInputSendInputEvent;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_AINPUT_CLIENT_AINPUT_H */

View File

@@ -0,0 +1,76 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Input Redirection Virtual Channel
*
* Copyright 2010-2011 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H
#define FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/audin.h>
#include <freerdp/codec/audio.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Subsystem Interface
*/
typedef UINT (*AudinReceive)(const AUDIO_FORMAT* format, const BYTE* data, size_t size,
void* userData);
typedef struct s_IAudinDevice IAudinDevice;
struct s_IAudinDevice
{
WINPR_ATTR_NODISCARD UINT (*Open)(IAudinDevice* devplugin, AudinReceive receive,
void* userData);
WINPR_ATTR_NODISCARD BOOL (*FormatSupported)(IAudinDevice* devplugin,
const AUDIO_FORMAT* format);
WINPR_ATTR_NODISCARD UINT (*SetFormat)(IAudinDevice* devplugin, const AUDIO_FORMAT* format,
UINT32 FramesPerPacket);
WINPR_ATTR_NODISCARD UINT (*Close)(IAudinDevice* devplugin);
WINPR_ATTR_NODISCARD UINT (*Free)(IAudinDevice* devplugin);
};
#define AUDIN_DEVICE_EXPORT_FUNC_NAME "freerdp_audin_client_subsystem_entry"
typedef UINT (*PREGISTERAUDINDEVICE)(IWTSPlugin* plugin, IAudinDevice* device);
typedef struct
{
IWTSPlugin* plugin;
WINPR_ATTR_NODISCARD PREGISTERAUDINDEVICE pRegisterAudinDevice;
const ADDIN_ARGV* args;
rdpContext* rdpcontext;
} FREERDP_AUDIN_DEVICE_ENTRY_POINTS;
typedef FREERDP_AUDIN_DEVICE_ENTRY_POINTS* PFREERDP_AUDIN_DEVICE_ENTRY_POINTS;
typedef UINT(VCAPITYPE* PFREERDP_AUDIN_DEVICE_ENTRY)(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H */

View File

@@ -0,0 +1,101 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Client Channels
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNELS_CLIENT_H
#define FREERDP_CHANNELS_CLIENT_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/config.h>
#include <freerdp/addin.h>
#include <freerdp/channels/channels.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} GENERIC_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
GENERIC_CHANNEL_CALLBACK* channel_callback;
} GENERIC_LISTENER_CALLBACK;
typedef struct GENERIC_DYNVC_PLUGIN GENERIC_DYNVC_PLUGIN;
typedef UINT (*DYNVC_PLUGIN_INIT_FN)(GENERIC_DYNVC_PLUGIN* plugin, rdpContext* context,
rdpSettings* settings);
typedef void (*DYNVC_PLUGIN_TERMINATE_FN)(GENERIC_DYNVC_PLUGIN* plugin);
struct GENERIC_DYNVC_PLUGIN
{
IWTSPlugin iface;
GENERIC_LISTENER_CALLBACK* listener_callback;
IWTSListener* listener;
BOOL attached;
BOOL initialized;
wLog* log;
char* dynvc_name;
size_t channelCallbackSize;
const IWTSVirtualChannelCallback* channel_callbacks;
DYNVC_PLUGIN_TERMINATE_FN terminatePluginFn;
};
#if defined(WITH_CHANNELS)
WINPR_ATTR_NODISCARD
FREERDP_API void* freerdp_channels_client_find_static_entry(const char* name,
const char* identifier);
WINPR_ATTR_NODISCARD
FREERDP_API PVIRTUALCHANNELENTRY freerdp_channels_load_static_addin_entry(LPCSTR pszName,
LPCSTR pszSubsystem,
LPCSTR pszType,
DWORD dwFlags);
WINPR_ATTR_NODISCARD
FREERDP_API FREERDP_ADDIN** freerdp_channels_list_addins(LPCSTR pszName, LPCSTR pszSubsystem,
LPCSTR pszType, DWORD dwFlags);
FREERDP_API void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_initialize_generic_dynvc_plugin(GENERIC_DYNVC_PLUGIN* plugin);
WINPR_ATTR_NODISCARD
FREERDP_API UINT freerdp_generic_DVCPluginEntry(
IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* logTag, const char* name,
size_t pluginSize, size_t channelCallbackSize,
const IWTSVirtualChannelCallback* channel_callbacks, DYNVC_PLUGIN_INIT_FN initPluginFn,
DYNVC_PLUGIN_TERMINATE_FN terminatePluginFn);
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNELS_CLIENT_H */

View File

@@ -0,0 +1,118 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Clipboard Redirection
*
* Copyright 2010-2011 Vic Lee
* Copyright 2023 Armin Novak <armin.novak@thincst.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_X11_CLIPRDR_FILE_H
#define FREERDP_CLIENT_X11_CLIPRDR_FILE_H
#include <winpr/clipboard.h>
#include <freerdp/client/cliprdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct cliprdr_file_context CliprdrFileContext;
FREERDP_API void cliprdr_file_context_free(CliprdrFileContext* file);
WINPR_ATTR_MALLOC(cliprdr_file_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API CliprdrFileContext* cliprdr_file_context_new(void* context);
/**! \brief returns if the implementation supports pasting files in a client file browser.
*
* \param file the file context to query
*
* \return \b TRUE if files can be pasted locally, \b FALSE if not (e.g. no FUSE, ...)
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL cliprdr_file_context_has_local_support(CliprdrFileContext* file);
/**! \brief sets state of local file paste support
*
* \param file the file context to update
* \param available \b TRUE if the client supports pasting files to local file browsers, \b
* FALSE otherwise
*
* \return \b TRUE for success, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL cliprdr_file_context_set_locally_available(CliprdrFileContext* file,
BOOL available);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL cliprdr_file_context_remote_set_flags(CliprdrFileContext* file, UINT32 flags);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 cliprdr_file_context_remote_get_flags(CliprdrFileContext* file);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 cliprdr_file_context_current_flags(CliprdrFileContext* file);
WINPR_ATTR_NODISCARD
FREERDP_API void* cliprdr_file_context_get_context(CliprdrFileContext* file);
FREERDP_API BOOL cliprdr_file_context_init(CliprdrFileContext* file,
CliprdrClientContext* cliprdr);
FREERDP_API BOOL cliprdr_file_context_uninit(CliprdrFileContext* file,
CliprdrClientContext* cliprdr);
FREERDP_API BOOL cliprdr_file_context_clear(CliprdrFileContext* file);
WINPR_ATTR_NODISCARD
FREERDP_API UINT
cliprdr_file_context_notify_new_server_format_list(CliprdrFileContext* file_context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT
cliprdr_file_context_notify_new_client_format_list(CliprdrFileContext* file_context);
/** \brief updates the files the client announces to the server
*
* \param file the file context to update
* \param data the file list
* \param size the length of the file list
*
* \return \b TRUE for success, \b FALSE otherwise
*/
FREERDP_API BOOL cliprdr_file_context_update_client_data(CliprdrFileContext* file,
const char* data, size_t size);
/** \brief updates the files the server announces to the client
*
* \param file the file context to update
* \param clip the clipboard instance to use
* \param data the file list [MS-RDPECLIP] 2.2.5.2.3 Packed File List (CLIPRDR_FILELIST)
* \param size the length of the file list
*
* \return \b TRUE for success, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file,
wClipboard* clip, const void* data,
size_t size);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_X11_CLIPRDR_FILE_H */

View File

@@ -0,0 +1,201 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Clipboard Virtual Channel Extension
*
* Copyright 2011 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H
#define FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/message.h>
#include <freerdp/channels/cliprdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_cliprdr_client_context CliprdrClientContext;
typedef UINT (*pcCliprdrServerCapabilities)(CliprdrClientContext* context,
const CLIPRDR_CAPABILITIES* capabilities);
typedef UINT (*pcCliprdrClientCapabilities)(CliprdrClientContext* context,
const CLIPRDR_CAPABILITIES* capabilities);
typedef UINT (*pcCliprdrMonitorReady)(CliprdrClientContext* context,
const CLIPRDR_MONITOR_READY* monitorReady);
typedef UINT (*pcCliprdrTempDirectory)(CliprdrClientContext* context,
const CLIPRDR_TEMP_DIRECTORY* tempDirectory);
typedef UINT (*pcCliprdrClientFormatList)(CliprdrClientContext* context,
const CLIPRDR_FORMAT_LIST* formatList);
typedef UINT (*pcCliprdrServerFormatList)(CliprdrClientContext* context,
const CLIPRDR_FORMAT_LIST* formatList);
typedef UINT (*pcCliprdrClientFormatListResponse)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse);
typedef UINT (*pcCliprdrServerFormatListResponse)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse);
typedef UINT (*pcCliprdrClientLockClipboardData)(
CliprdrClientContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData);
typedef UINT (*pcCliprdrServerLockClipboardData)(
CliprdrClientContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData);
typedef UINT (*pcCliprdrClientUnlockClipboardData)(
CliprdrClientContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData);
typedef UINT (*pcCliprdrServerUnlockClipboardData)(
CliprdrClientContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData);
typedef UINT (*pcCliprdrClientFormatDataRequest)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest);
typedef UINT (*pcCliprdrServerFormatDataRequest)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest);
typedef UINT (*pcCliprdrClientFormatDataResponse)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse);
typedef UINT (*pcCliprdrServerFormatDataResponse)(
CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse);
typedef UINT (*pcCliprdrClientFileContentsRequest)(
CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
typedef UINT (*pcCliprdrServerFileContentsRequest)(
CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
typedef UINT (*pcCliprdrClientFileContentsResponse)(
CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse);
typedef UINT (*pcCliprdrServerFileContentsResponse)(
CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse);
struct s_cliprdr_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcCliprdrServerCapabilities ServerCapabilities;
WINPR_ATTR_NODISCARD pcCliprdrClientCapabilities ClientCapabilities;
WINPR_ATTR_NODISCARD pcCliprdrMonitorReady MonitorReady;
WINPR_ATTR_NODISCARD pcCliprdrTempDirectory TempDirectory;
WINPR_ATTR_NODISCARD pcCliprdrClientFormatList ClientFormatList;
WINPR_ATTR_NODISCARD pcCliprdrServerFormatList ServerFormatList;
WINPR_ATTR_NODISCARD pcCliprdrClientFormatListResponse ClientFormatListResponse;
WINPR_ATTR_NODISCARD pcCliprdrServerFormatListResponse ServerFormatListResponse;
WINPR_ATTR_NODISCARD pcCliprdrClientLockClipboardData ClientLockClipboardData;
WINPR_ATTR_NODISCARD pcCliprdrServerLockClipboardData ServerLockClipboardData;
WINPR_ATTR_NODISCARD pcCliprdrClientUnlockClipboardData ClientUnlockClipboardData;
WINPR_ATTR_NODISCARD pcCliprdrServerUnlockClipboardData ServerUnlockClipboardData;
WINPR_ATTR_NODISCARD pcCliprdrClientFormatDataRequest ClientFormatDataRequest;
WINPR_ATTR_NODISCARD pcCliprdrServerFormatDataRequest ServerFormatDataRequest;
WINPR_ATTR_NODISCARD pcCliprdrClientFormatDataResponse ClientFormatDataResponse;
WINPR_ATTR_NODISCARD pcCliprdrServerFormatDataResponse ServerFormatDataResponse;
WINPR_ATTR_NODISCARD pcCliprdrClientFileContentsRequest ClientFileContentsRequest;
WINPR_ATTR_NODISCARD pcCliprdrServerFileContentsRequest ServerFileContentsRequest;
WINPR_ATTR_NODISCARD pcCliprdrClientFileContentsResponse ClientFileContentsResponse;
WINPR_ATTR_NODISCARD pcCliprdrServerFileContentsResponse ServerFileContentsResponse;
UINT32 lastRequestedFormatId;
rdpContext* rdpcontext;
};
typedef struct
{
UINT32 id;
char* name;
int length;
} CLIPRDR_FORMAT_NAME;
/**
* Clipboard Events
*/
typedef struct
{
wMessage event;
UINT32 capabilities;
} RDP_CB_CLIP_CAPS;
typedef struct
{
wMessage event;
UINT32 capabilities;
} RDP_CB_MONITOR_READY_EVENT;
typedef struct
{
wMessage event;
UINT32* formats;
UINT16 num_formats;
BYTE* raw_format_data;
UINT32 raw_format_data_size;
BOOL raw_format_unicode;
} RDP_CB_FORMAT_LIST_EVENT;
typedef struct
{
wMessage event;
UINT32 format;
} RDP_CB_DATA_REQUEST_EVENT;
typedef struct
{
wMessage event;
BYTE* data;
UINT32 size;
} RDP_CB_DATA_RESPONSE_EVENT;
typedef struct
{
wMessage event;
UINT32 streamId;
UINT32 lindex;
UINT32 dwFlags;
UINT32 nPositionLow;
UINT32 nPositionHigh;
UINT32 cbRequested;
UINT32 clipDataId;
} RDP_CB_FILECONTENTS_REQUEST_EVENT;
typedef struct
{
wMessage event;
BYTE* data;
UINT32 size;
UINT32 streamId;
} RDP_CB_FILECONTENTS_RESPONSE_EVENT;
typedef struct
{
wMessage event;
UINT32 clipDataId;
} RDP_CB_LOCK_CLIPDATA_EVENT;
typedef struct
{
wMessage event;
UINT32 clipDataId;
} RDP_CB_UNLOCK_CLIPDATA_EVENT;
typedef struct
{
wMessage event;
char dirname[520];
} RDP_CB_TEMPDIR_EVENT;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H */

View File

@@ -0,0 +1,177 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Client Command-Line Interface
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_CMDLINE_H
#define FREERDP_CLIENT_CMDLINE_H
#include <winpr/cmdline.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** @brief Callback function type definition for command line handling
*
* @param arg A pointer to the argument to handle
* @param custom A pointer to user defined data
*
* @return \b 0 for success or a \b COMMAND_LINE_ERROR code
*
* @since version 3.12.0
*/
typedef int (*freerdp_command_line_handle_option_t)(const COMMAND_LINE_ARGUMENT_A* arg,
void* custom);
/** \brief parses command line arguments to appropriate settings values.
*
* \param settings The settings instance to store the parsed values to
* \param argc the number of argv values
* \param argv an array of strings (char pointer)
* \param allowUnknown Allow unknown command line arguments or \b FALSE if not.
*
* \return \b 0 in case of success, a negative number in case of failure.
*/
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
int argc, char** argv,
BOOL allowUnknown);
/** \brief parses command line arguments to appropriate settings values. Additionally allows
* supplying custom command line arguments and a handler function.
*
* \param settings The settings instance to store the parsed values to
* \param argc the number of argv values
* \param argv an array of strings (char pointer)
* \param allowUnknown Allow unknown command line arguments or \b FALSE if not.
* \param args Pointer to the custom arguments
* \param count The number of custom arguments
* \param handle_option the handler function for custom arguments.
* \param handle_userdata custom data supplied to \b handle_option as context
*
* \since version 3.0.0
*
* \return \b 0 in case of success, a negative number in case of failure.
*/
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_parse_command_line_arguments_ex(
rdpSettings* settings, int argc, char** argv, BOOL allowUnknown,
COMMAND_LINE_ARGUMENT_A* args, size_t count,
freerdp_command_line_handle_option_t handle_option, void* handle_userdata);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_settings_command_line_status_print(rdpSettings* settings,
int status, int argc,
char** argv);
WINPR_ATTR_NODISCARD
FREERDP_API int
freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int status,
int argc, char** argv,
const COMMAND_LINE_ARGUMENT_A* custom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings);
/** Print a command line warning about the component being unmaintained.
*
* \since version 3.0.0
*/
FREERDP_API void freerdp_client_warn_unmaintained(int argc, char* argv[]);
/** Print a command line warning about the component being experimental.
*
* \since version 3.0.0
*/
FREERDP_API void freerdp_client_warn_experimental(int argc, char* argv[]);
/** Print a command line warning about the component being deprecated.
*
* \since version 3.0.0
*/
FREERDP_API void freerdp_client_warn_deprecated(int argc, char* argv[]);
FREERDP_API BOOL freerdp_client_print_version(void);
/** @brief prints the version of the client including the binary name extracted from \b argv
*
* @param argc the number of command line arguments, must be >= 0
* @param argv the array of command line argument strings
*
* @return \b TRUE for success
*
* @since version 3.10.0
*/
FREERDP_API BOOL freerdp_client_print_version_ex(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_buildconfig(void);
/** @brief prints the buidconfiguration of the client including the binary name extracted from
* \b argv
*
* @param argc the number of command line arguments, must be >= 0
* @param argv the array of command line argument strings
*
* @return \b TRUE for success
*
* @since version 3.10.0
*/
FREERDP_API BOOL freerdp_client_print_buildconfig_ex(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_command_line_help(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_command_line_help_ex(
int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_parse_username(const char* username, char** user, char** domain);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_parse_hostname(const char* hostname, char** host, int* port);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count,
const char* const* params);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count,
const char* const* params);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count,
const char* const* params);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_CMDLINE_H */

View File

@@ -0,0 +1,52 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Display Update Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DISP_CLIENT_DISP_H
#define FREERDP_CHANNEL_DISP_CLIENT_DISP_H
#include <freerdp/channels/disp.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_disp_client_context DispClientContext;
typedef UINT (*pcDispCaps)(DispClientContext* context, UINT32 MaxNumMonitors,
UINT32 MaxMonitorAreaFactorA, UINT32 MaxMonitorAreaFactorB);
typedef UINT (*pcDispSendMonitorLayout)(DispClientContext* context, UINT32 NumMonitors,
DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors);
struct s_disp_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcDispCaps DisplayControlCaps;
WINPR_ATTR_NODISCARD pcDispSendMonitorLayout SendMonitorLayout;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DISP_CLIENT_DISP_H */

View File

@@ -0,0 +1,64 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H
#define FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H
#include <winpr/wtypes.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_drdynvc_client_context DrdynvcClientContext;
typedef int (*pcDrdynvcGetVersion)(DrdynvcClientContext* context);
typedef UINT (*pcDrdynvcOnChannelConnected)(DrdynvcClientContext* context, const char* name,
void* pInterface);
typedef UINT (*pcDrdynvcOnChannelDisconnected)(DrdynvcClientContext* context, const char* name,
void* pInterface);
typedef UINT (*pcDrdynvcOnChannelAttached)(DrdynvcClientContext* context, const char* name,
void* pInterface);
typedef UINT (*pcDrdynvcOnChannelDetached)(DrdynvcClientContext* context, const char* name,
void* pInterface);
struct s_drdynvc_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcDrdynvcGetVersion GetVersion;
WINPR_ATTR_NODISCARD pcDrdynvcOnChannelConnected OnChannelConnected;
WINPR_ATTR_NODISCARD pcDrdynvcOnChannelDisconnected OnChannelDisconnected;
WINPR_ATTR_NODISCARD pcDrdynvcOnChannelAttached OnChannelAttached;
WINPR_ATTR_NODISCARD pcDrdynvcOnChannelDetached OnChannelDetached;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H */

View File

@@ -0,0 +1,88 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Multiparty Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H
#define FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H
#include <freerdp/channels/encomsp.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_encomsp_client_context EncomspClientContext;
typedef UINT (*pcEncomspFilterUpdated)(EncomspClientContext* context,
const ENCOMSP_FILTER_UPDATED_PDU* filterUpdated);
typedef UINT (*pcEncomspApplicationCreated)(
EncomspClientContext* context, const ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated);
typedef UINT (*pcEncomspApplicationRemoved)(
EncomspClientContext* context, const ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved);
typedef UINT (*pcEncomspWindowCreated)(EncomspClientContext* context,
const ENCOMSP_WINDOW_CREATED_PDU* windowCreated);
typedef UINT (*pcEncomspWindowRemoved)(EncomspClientContext* context,
const ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved);
typedef UINT (*pcEncomspShowWindow)(EncomspClientContext* context,
const ENCOMSP_SHOW_WINDOW_PDU* showWindow);
typedef UINT (*pcEncomspParticipantCreated)(
EncomspClientContext* context, const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated);
typedef UINT (*pcEncomspParticipantRemoved)(
EncomspClientContext* context, const ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved);
typedef UINT (*pcEncomspChangeParticipantControlLevel)(
EncomspClientContext* context,
const ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel);
typedef UINT (*pcEncomspGraphicsStreamPaused)(
EncomspClientContext* context,
const ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused);
typedef UINT (*pcEncomspGraphicsStreamResumed)(
EncomspClientContext* context,
const ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed);
struct s_encomsp_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcEncomspFilterUpdated FilterUpdated;
WINPR_ATTR_NODISCARD pcEncomspApplicationCreated ApplicationCreated;
WINPR_ATTR_NODISCARD pcEncomspApplicationRemoved ApplicationRemoved;
WINPR_ATTR_NODISCARD pcEncomspWindowCreated WindowCreated;
WINPR_ATTR_NODISCARD pcEncomspWindowRemoved WindowRemoved;
WINPR_ATTR_NODISCARD pcEncomspShowWindow ShowWindow;
WINPR_ATTR_NODISCARD pcEncomspParticipantCreated ParticipantCreated;
WINPR_ATTR_NODISCARD pcEncomspParticipantRemoved ParticipantRemoved;
WINPR_ATTR_NODISCARD pcEncomspChangeParticipantControlLevel ChangeParticipantControlLevel;
WINPR_ATTR_NODISCARD pcEncomspGraphicsStreamPaused GraphicsStreamPaused;
WINPR_ATTR_NODISCARD pcEncomspGraphicsStreamResumed GraphicsStreamResumed;
UINT32 participantId;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H */

View File

@@ -0,0 +1,124 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* .rdp file
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_RDP_FILE_H
#define FREERDP_CLIENT_RDP_FILE_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
/* Ignore invalid integer values */
#define RDP_FILE_FLAG_PARSE_INT_RELAXED 1
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_file rdpFile;
typedef BOOL (*rdp_file_fkt_parse)(void* context, const char* key, char type,
const char* value);
/* When using freerdp_client_parse_rdp_file_ex or freerdp_client_parse_rdp_file_buffer_ex
* set the context for the callback with this function. */
FREERDP_API void freerdp_client_rdp_file_set_callback_context(rdpFile* file, void* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name,
rdp_file_fkt_parse parse);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, const BYTE* buffer,
size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer,
size_t size, rdp_file_fkt_parse parse);
/** @brief Populate \b settings from RDP \b file. Do only notify about inconsistencies and not
* correct them.
*
* @param file A pointer to the RDP file to use
* @param settings A pointer to the settings to update
*
* @return \b TRUE for success, \b FALSE otherwise
* @version since 3.17.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file_unchecked(
const rdpFile* file, rdpSettings* settings);
/** @brief Populate \b settings from RDP \b file. Do correct inconsistencies detected.
*
* @param file A pointer to the RDP file to use
* @param settings A pointer to the settings to update
*
* @return \b TRUE for success, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file,
rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file,
const rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name,
BOOL unicode);
WINPR_ATTR_NODISCARD
FREERDP_API size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer,
size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_rdp_file_set_string_option(rdpFile* file, const char* name,
const char* value);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_client_rdp_file_get_string_option(const rdpFile* file,
const char* name);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_rdp_file_set_integer_option(rdpFile* file, const char* name,
int value);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_client_rdp_file_get_integer_option(const rdpFile* file,
const char* name);
FREERDP_API void freerdp_client_rdp_file_free(rdpFile* file);
WINPR_ATTR_MALLOC(freerdp_client_rdp_file_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpFile* freerdp_client_rdp_file_new(void);
WINPR_ATTR_MALLOC(freerdp_client_rdp_file_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_RDP_FILE_H */

View File

@@ -0,0 +1,76 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Geometry tracking Virtual Channel Extension
*
* Copyright 2017 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNELS_CLIENT_GEOMETRY_H
#define FREERDP_CHANNELS_CLIENT_GEOMETRY_H
#include <winpr/collections.h>
#include <freerdp/api.h>
#include <freerdp/channels/geometry.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_geometry_client_context GeometryClientContext;
typedef struct S_MAPPED_GEOMETRY MAPPED_GEOMETRY;
typedef BOOL (*pcMappedGeometryAdded)(GeometryClientContext* context,
MAPPED_GEOMETRY* geometry);
typedef BOOL (*pcMappedGeometryUpdate)(MAPPED_GEOMETRY* geometry);
typedef BOOL (*pcMappedGeometryClear)(MAPPED_GEOMETRY* geometry);
/** @brief a geometry record tracked by the geometry channel */
struct S_MAPPED_GEOMETRY
{
volatile LONG refCounter;
UINT64 mappingId;
UINT64 topLevelId;
INT32 left, top, right, bottom;
INT32 topLevelLeft, topLevelTop, topLevelRight, topLevelBottom;
FREERDP_RGNDATA geometry;
void* custom;
WINPR_ATTR_NODISCARD pcMappedGeometryUpdate MappedGeometryUpdate;
WINPR_ATTR_NODISCARD pcMappedGeometryClear MappedGeometryClear;
};
/** @brief the geometry context for client channel */
struct s_geometry_client_context
{
wHashTable* geometries;
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcMappedGeometryAdded MappedGeometryAdded;
UINT32 remoteVersion;
};
FREERDP_API void mappedGeometryRef(MAPPED_GEOMETRY* g);
FREERDP_API void mappedGeometryUnref(MAPPED_GEOMETRY* g);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNELS_CLIENT_GEOMETRY_H */

View File

@@ -0,0 +1,107 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Location Virtual Channel Extension
*
* Copyright 2024 Armin Novak <anovak@thincast.com>
* Copyright 2024 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_LOCATION_CLIENT_LOCATION_H
#define FREERDP_CHANNEL_LOCATION_CLIENT_LOCATION_H
#include <freerdp/channels/location.h>
/** @file
* @since version 3.4.0
*/
#ifdef __cplusplus
extern "C"
{
#endif
/** @since version 3.4.0 */
typedef struct s_location_client_context LocationClientContext;
/** @since version 3.4.0 */
typedef UINT (*pcLocationStart)(LocationClientContext* context, UINT32 version, UINT32 flags);
/** @since version 3.4.0 */
typedef UINT (*pcLocationStop)(LocationClientContext* context);
/** @since version 3.4.0 */
typedef UINT (*pcLocationSend)(LocationClientContext* context, LOCATION_PDUTYPE type,
size_t count, ...);
/** @since version 3.4.0 */
struct s_location_client_context
{
void* handle;
void* custom;
/**! \brief initialize location services on client
*
* \param context The client context to operate on
* \param version The location channel version (determines which features are available.
* \param flags The location channel flags.
*
* \return \b CHANNEL_RC_OK for success, an appropriate error otherwise.
*/
WINPR_ATTR_NODISCARD pcLocationStart LocationStart;
/**! \brief stop location services on client
*
* \param context The client context to operate on
*
* \return \b CHANNEL_RC_OK for success, an appropriate error otherwise.
*/
WINPR_ATTR_NODISCARD pcLocationStop LocationStop;
/**! \brief Send a location update.
*
* This function sends location updates to a server.
* The following parameter formats are supported:
*
* \param type one of the following:
* PDUTYPE_BASE_LOCATION3D : count = 3 | 7
* latitude : double, required
* longitude : double, required
* altitude : INT32, required
* speed : double, optional
* heading : double, optional
* horizontalAccuracy : double, optional
* source : int, optional
* PDUTYPE_LOCATION2D_DELTA : count = 2 | 4
* latitudeDelta : double, required
* longitudeDelta : double, required
* speedDelta : double, optional
* headingDelta : double, optional
* PDUTYPE_LOCATION3D_DELTA : count = 3 | 5
* latitudeDelta : double, required
* longitudeDelta : double, required
* altitudeDelta : INT32, optional
* speedDelta : double, optional
* headingDelta : double, optional
* \param count the number of variable arguments following
*
* return \b CHANNEL_RC_OK for success, an appropriate error otherwise.
*/
WINPR_ATTR_NODISCARD pcLocationSend LocationSend;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_LOCATION_CLIENT_LOCATION_H */

View File

@@ -0,0 +1,89 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Print Virtual Channel
*
* Copyright 2010-2011 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H
#define FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H
#include <freerdp/channels/rdpdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_printer_driver rdpPrinterDriver;
typedef struct rdp_printer rdpPrinter;
typedef struct rdp_print_job rdpPrintJob;
typedef void (*pcReferencePrinterDriver)(rdpPrinterDriver* driver);
typedef rdpPrinter** (*pcEnumPrinters)(rdpPrinterDriver* driver);
typedef void (*pcReleaseEnumPrinters)(rdpPrinter** printers);
typedef rdpPrinter* (*pcGetPrinter)(rdpPrinterDriver* driver, const char* name,
const char* driverName, BOOL isDefault);
typedef void (*pcReferencePrinter)(rdpPrinter* printer);
struct rdp_printer_driver
{
WINPR_ATTR_NODISCARD pcEnumPrinters EnumPrinters;
pcReleaseEnumPrinters ReleaseEnumPrinters;
WINPR_ATTR_NODISCARD pcGetPrinter GetPrinter;
pcReferencePrinterDriver AddRef;
pcReferencePrinterDriver ReleaseRef;
};
typedef rdpPrintJob* (*pcCreatePrintJob)(rdpPrinter* printer, UINT32 id);
typedef rdpPrintJob* (*pcFindPrintJob)(rdpPrinter* printer, UINT32 id);
struct rdp_printer
{
size_t id;
char* name;
char* driver;
BOOL is_default;
size_t references;
rdpPrinterDriver* backend;
WINPR_ATTR_NODISCARD pcCreatePrintJob CreatePrintJob;
WINPR_ATTR_NODISCARD pcFindPrintJob FindPrintJob;
pcReferencePrinter AddRef;
pcReferencePrinter ReleaseRef;
};
typedef UINT (*pcWritePrintJob)(rdpPrintJob* printjob, const BYTE* data, size_t size);
typedef void (*pcClosePrintJob)(rdpPrintJob* printjob);
struct rdp_print_job
{
UINT32 id;
rdpPrinter* printer;
WINPR_ATTR_NODISCARD pcWritePrintJob Write;
pcClosePrintJob Close;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H */

View File

@@ -0,0 +1,144 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Applications Integrated Locally (RAIL)
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H
#define FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/rail.h>
#include <freerdp/message.h>
#include <freerdp/channels/rail.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_rail_client_context RailClientContext;
typedef UINT (*pcRailOnOpen)(RailClientContext* context, BOOL* sendHandshake);
typedef UINT (*pcRailClientExecute)(RailClientContext* context, const RAIL_EXEC_ORDER* exec);
typedef UINT (*pcRailClientActivate)(RailClientContext* context,
const RAIL_ACTIVATE_ORDER* activate);
typedef UINT (*pcRailClientSystemParam)(RailClientContext* context,
const RAIL_SYSPARAM_ORDER* sysparam);
typedef UINT (*pcRailServerSystemParam)(RailClientContext* context,
const RAIL_SYSPARAM_ORDER* sysparam);
typedef UINT (*pcRailClientSystemCommand)(RailClientContext* context,
const RAIL_SYSCOMMAND_ORDER* syscommand);
typedef UINT (*pcRailClientHandshake)(RailClientContext* context,
const RAIL_HANDSHAKE_ORDER* handshake);
typedef UINT (*pcRailServerHandshake)(RailClientContext* context,
const RAIL_HANDSHAKE_ORDER* handshake);
typedef UINT (*pcRailServerHandshakeEx)(RailClientContext* context,
const RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
typedef UINT (*pcRailClientNotifyEvent)(RailClientContext* context,
const RAIL_NOTIFY_EVENT_ORDER* notifyEvent);
typedef UINT (*pcRailClientWindowMove)(RailClientContext* context,
const RAIL_WINDOW_MOVE_ORDER* windowMove);
typedef UINT (*pcRailServerLocalMoveSize)(RailClientContext* context,
const RAIL_LOCALMOVESIZE_ORDER* localMoveSize);
typedef UINT (*pcRailServerMinMaxInfo)(RailClientContext* context,
const RAIL_MINMAXINFO_ORDER* minMaxInfo);
typedef UINT (*pcRailClientInformation)(RailClientContext* context,
const RAIL_CLIENT_STATUS_ORDER* clientStatus);
typedef UINT (*pcRailClientSystemMenu)(RailClientContext* context,
const RAIL_SYSMENU_ORDER* sysmenu);
typedef UINT (*pcRailServerTaskBarInfo)(RailClientContext* context,
const RAIL_TASKBAR_INFO_ORDER* taskBarInfo);
typedef UINT (*pcRailClientLanguageBarInfo)(RailClientContext* context,
const RAIL_LANGBAR_INFO_ORDER* langBarInfo);
typedef UINT (*pcRailServerLanguageBarInfo)(RailClientContext* context,
const RAIL_LANGBAR_INFO_ORDER* langBarInfo);
typedef UINT (*pcRailClientLanguageIMEInfo)(RailClientContext* context,
const RAIL_LANGUAGEIME_INFO_ORDER* langImeInfo);
typedef UINT (*pcRailServerExecuteResult)(RailClientContext* context,
const RAIL_EXEC_RESULT_ORDER* execResult);
typedef UINT (*pcRailClientGetAppIdRequest)(RailClientContext* context,
const RAIL_GET_APPID_REQ_ORDER* getAppIdReq);
typedef UINT (*pcRailServerGetAppIdResponse)(RailClientContext* context,
const RAIL_GET_APPID_RESP_ORDER* getAppIdResp);
typedef UINT (*pcRailServerZOrderSync)(RailClientContext* context,
const RAIL_ZORDER_SYNC* zorder);
typedef UINT (*pcRailServerCloak)(RailClientContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*pcRailClientCloak)(RailClientContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*pcRailServerPowerDisplayRequest)(RailClientContext* context,
const RAIL_POWER_DISPLAY_REQUEST* power);
typedef UINT (*pcRailClientSnapArrange)(RailClientContext* context,
const RAIL_SNAP_ARRANGE* snap);
typedef UINT (*pcRailServerGetAppidResponseExtended)(RailClientContext* context,
const RAIL_GET_APPID_RESP_EX* id);
typedef UINT (*pcRailClientCompartmentInfo)(RailClientContext* context,
const RAIL_COMPARTMENT_INFO_ORDER* compartmentInfo);
typedef UINT (*pcRailClientTextScale)(RailClientContext* context, UINT32 TextScale);
typedef UINT (*pcRailClientCaretBlinkRate)(RailClientContext* context, UINT32 CaretBlinkRate);
struct s_rail_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcRailClientExecute ClientExecute;
WINPR_ATTR_NODISCARD pcRailClientActivate ClientActivate;
WINPR_ATTR_NODISCARD pcRailClientSystemParam ClientSystemParam;
WINPR_ATTR_NODISCARD pcRailServerSystemParam ServerSystemParam;
WINPR_ATTR_NODISCARD pcRailClientSystemCommand ClientSystemCommand;
WINPR_ATTR_NODISCARD pcRailClientHandshake ClientHandshake;
WINPR_ATTR_NODISCARD pcRailServerHandshake ServerHandshake;
WINPR_ATTR_NODISCARD pcRailServerHandshakeEx ServerHandshakeEx;
WINPR_ATTR_NODISCARD pcRailClientNotifyEvent ClientNotifyEvent;
WINPR_ATTR_NODISCARD pcRailClientWindowMove ClientWindowMove;
WINPR_ATTR_NODISCARD pcRailServerLocalMoveSize ServerLocalMoveSize;
WINPR_ATTR_NODISCARD pcRailServerMinMaxInfo ServerMinMaxInfo;
WINPR_ATTR_NODISCARD pcRailClientInformation ClientInformation;
WINPR_ATTR_NODISCARD pcRailClientSystemMenu ClientSystemMenu;
WINPR_ATTR_NODISCARD pcRailServerTaskBarInfo ServerTaskBarInfo;
WINPR_ATTR_NODISCARD pcRailClientLanguageBarInfo ClientLanguageBarInfo;
WINPR_ATTR_NODISCARD pcRailServerLanguageBarInfo ServerLanguageBarInfo;
WINPR_ATTR_NODISCARD pcRailClientLanguageIMEInfo ClientLanguageIMEInfo;
WINPR_ATTR_NODISCARD pcRailServerExecuteResult ServerExecuteResult;
WINPR_ATTR_NODISCARD pcRailClientGetAppIdRequest ClientGetAppIdRequest;
WINPR_ATTR_NODISCARD pcRailServerGetAppIdResponse ServerGetAppIdResponse;
WINPR_ATTR_NODISCARD pcRailServerZOrderSync ServerZOrderSync;
WINPR_ATTR_NODISCARD pcRailClientCloak ClientCloak;
WINPR_ATTR_NODISCARD pcRailServerCloak ServerCloak;
WINPR_ATTR_NODISCARD pcRailServerPowerDisplayRequest ServerPowerDisplayRequest;
WINPR_ATTR_NODISCARD pcRailClientSnapArrange ClientSnapArrange;
WINPR_ATTR_NODISCARD pcRailServerGetAppidResponseExtended ServerGetAppidResponseExtended;
WINPR_ATTR_NODISCARD pcRailClientCompartmentInfo ClientCompartmentInfo;
WINPR_ATTR_NODISCARD pcRailOnOpen OnOpen;
WINPR_ATTR_NODISCARD pcRailClientTextScale ClientTextScale;
WINPR_ATTR_NODISCARD pcRailClientCaretBlinkRate ClientCaretBlinkRate;
};
WINPR_ATTR_NODISCARD
FREERDP_API UINT client_rail_server_start_cmd(RailClientContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H */

View File

@@ -0,0 +1,98 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Device Redirection Virtual Channel Extension
*
* Copyright 2025 Armin Novak <anovak@thincast.com>
* Copyright 2025 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_H
#define FREERDP_CHANNEL_RDPDR_CLIENT_H
#include <freerdp/channels/rdpdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** @enum RdpdrHotplugEventType
* @brief Hotplug event types.
*
* @since version 3.16.0
*/
typedef enum
{
RDPDR_HOTPLUG_FIRST_CHECK,
RDPDR_HOTPLUG_CHECK_FOR_CHANGES
} RdpdrHotplugEventType;
typedef struct s_rdpdr_client_context RdpdrClientContext;
/** @brief register a new device and announce it to remote
*
* @param context The \ref RdpdrClientContext to operate on.
* @param device A pointer to a \ref RDPDR_DEVICE struct to register. Contents is copied.
* @param pid A pointer to a variable that will be set to a unique identifier for that device.
*
* @return \ref CHANNEL_RC_OK for success or an appropriate error code otherwise.
*
* @since version 3.16.0
*/
typedef UINT (*pcRdpdrRegisterDevice)(RdpdrClientContext* context, const RDPDR_DEVICE* device,
uint32_t* pid);
/** @brief unregister a new device and announce it to remote
*
* @param context The \ref RdpdrClientContext to operate on.
* @param count The number of uintptr_t id unique identifiers for a device (see \ref
* pcRdpdrRegisterDevice) following
*
* @return \ref CHANNEL_RC_OK for success or an appropriate error code otherwise.
* @since version 3.16.0
*/
typedef UINT (*pcRdpdrUnregisterDevice)(RdpdrClientContext* context, size_t count,
const uint32_t ids[]);
/** @brief Check for device changes and announce it to remote
*
* @param context The \ref RdpdrClientContext to operate on.
* @param type The event type.
*
* @return \ref CHANNEL_RC_OK for success or an appropriate error code otherwise.
* @since version 3.16.0
*/
typedef UINT (*pcRdpdrHotplugDevice)(RdpdrClientContext* context, RdpdrHotplugEventType type);
/** @struct s_rdpdr_client_context
* @brief rdpdr channel client context
*
* @since version 3.16.0
*/
struct s_rdpdr_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcRdpdrRegisterDevice RdpdrRegisterDevice;
WINPR_ATTR_NODISCARD pcRdpdrUnregisterDevice RdpdrUnregisterDevice;
WINPR_ATTR_NODISCARD pcRdpdrHotplugDevice RdpdrHotplugDevice;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_H */

View File

@@ -0,0 +1,110 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H
#define FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H
#include <freerdp/channels/rdpei.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct s_rdpei_client_context RdpeiClientContext;
typedef UINT32 (*pcRdpeiGetVersion)(RdpeiClientContext* context);
typedef UINT32 (*pcRdpeiGetFeatures)(RdpeiClientContext* context);
typedef UINT (*pcRdpeiAddContact)(RdpeiClientContext* context,
const RDPINPUT_CONTACT_DATA* contact);
typedef UINT (*pcRdpeiTouchEvent)(RdpeiClientContext* context, INT32 externalId, INT32 x,
INT32 y, INT32* contactId);
typedef UINT (*pcRdpeiTouchRawEvent)(RdpeiClientContext* context, INT32 externalId, INT32 x,
INT32 y, INT32* contactId, UINT32 contactFlags,
UINT32 fieldFlags, ...);
typedef UINT (*pcRdpeiTouchRawEventVA)(RdpeiClientContext* context, INT32 externalId, INT32 x,
INT32 y, INT32* contactId, UINT32 contactFlags,
UINT32 fieldFlags, va_list args);
typedef UINT (*pcRdpeiAddPen)(RdpeiClientContext* context, INT32 externalId,
const RDPINPUT_PEN_CONTACT* contact);
typedef UINT (*pcRdpeiPen)(RdpeiClientContext* context, INT32 externalId, UINT32 fieldFlags,
INT32 x, INT32 y, ...);
typedef UINT (*pcRdpeiPenRawEvent)(RdpeiClientContext* context, INT32 externalId,
UINT32 contactFlags, UINT32 fieldFlags, INT32 x, INT32 y,
...);
typedef UINT (*pcRdpeiPenRawEventVA)(RdpeiClientContext* context, INT32 externalId,
UINT32 contactFlags, UINT32 fieldFlags, INT32 x, INT32 y,
va_list args);
typedef UINT (*pcRdpeiSuspendTouch)(RdpeiClientContext* context);
typedef UINT (*pcRdpeiResumeTouch)(RdpeiClientContext* context);
struct s_rdpei_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcRdpeiGetVersion GetVersion;
WINPR_ATTR_NODISCARD pcRdpeiGetFeatures GetFeatures;
WINPR_ATTR_NODISCARD pcRdpeiAddContact AddContact;
WINPR_ATTR_NODISCARD pcRdpeiTouchEvent TouchBegin;
WINPR_ATTR_NODISCARD pcRdpeiTouchEvent TouchUpdate;
WINPR_ATTR_NODISCARD pcRdpeiTouchEvent TouchEnd;
WINPR_ATTR_NODISCARD pcRdpeiAddPen AddPen;
WINPR_ATTR_NODISCARD pcRdpeiPen PenBegin;
WINPR_ATTR_NODISCARD pcRdpeiPen PenUpdate;
WINPR_ATTR_NODISCARD pcRdpeiPen PenEnd;
WINPR_ATTR_NODISCARD pcRdpeiPen PenHoverBegin;
WINPR_ATTR_NODISCARD pcRdpeiPen PenHoverUpdate;
WINPR_ATTR_NODISCARD pcRdpeiPen PenHoverCancel;
WINPR_ATTR_NODISCARD pcRdpeiSuspendTouch SuspendTouch;
WINPR_ATTR_NODISCARD pcRdpeiResumeTouch ResumeTouch;
WINPR_ATTR_NODISCARD pcRdpeiTouchEvent TouchCancel;
WINPR_ATTR_NODISCARD pcRdpeiTouchRawEvent TouchRawEvent;
WINPR_ATTR_NODISCARD pcRdpeiTouchRawEventVA TouchRawEventVA;
WINPR_ATTR_NODISCARD pcRdpeiPen PenCancel;
WINPR_ATTR_NODISCARD pcRdpeiPenRawEvent PenRawEvent;
WINPR_ATTR_NODISCARD pcRdpeiPenRawEventVA PenRawEventVA;
UINT32 clientFeaturesMask;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H */

View File

@@ -0,0 +1,190 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Graphics Pipeline Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H
#define FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codecs.h>
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/utils/profiler.h>
#include <freerdp/cache/persistent.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct gdi_gfx_surface gdiGfxSurface;
typedef struct s_rdpgfx_client_context RdpgfxClientContext;
typedef UINT (*pcRdpgfxResetGraphics)(RdpgfxClientContext* context,
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics);
typedef UINT (*pcRdpgfxStartFrame)(RdpgfxClientContext* context,
const RDPGFX_START_FRAME_PDU* startFrame);
typedef UINT (*pcRdpgfxEndFrame)(RdpgfxClientContext* context,
const RDPGFX_END_FRAME_PDU* endFrame);
typedef UINT (*pcRdpgfxSurfaceCommand)(RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd);
typedef UINT (*pcRdpgfxDeleteEncodingContext)(
RdpgfxClientContext* context,
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext);
typedef UINT (*pcRdpgfxCreateSurface)(RdpgfxClientContext* context,
const RDPGFX_CREATE_SURFACE_PDU* createSurface);
typedef UINT (*pcRdpgfxDeleteSurface)(RdpgfxClientContext* context,
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface);
typedef UINT (*pcRdpgfxSolidFill)(RdpgfxClientContext* context,
const RDPGFX_SOLID_FILL_PDU* solidFill);
typedef UINT (*pcRdpgfxSurfaceToSurface)(RdpgfxClientContext* context,
const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface);
typedef UINT (*pcRdpgfxSurfaceToCache)(RdpgfxClientContext* context,
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache);
typedef UINT (*pcRdpgfxCacheToSurface)(RdpgfxClientContext* context,
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface);
typedef UINT (*pcRdpgfxCacheImportOffer)(RdpgfxClientContext* context,
const RDPGFX_CACHE_IMPORT_OFFER_PDU* cacheImportOffer);
typedef UINT (*pcRdpgfxCacheImportReply)(RdpgfxClientContext* context,
const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply);
typedef UINT (*pcRdpgfxEvictCacheEntry)(RdpgfxClientContext* context,
const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry);
typedef UINT (*pcRdpgfxImportCacheEntry)(RdpgfxClientContext* context, UINT16 cacheSlot,
const PERSISTENT_CACHE_ENTRY* importCacheEntry);
typedef UINT (*pcRdpgfxExportCacheEntry)(RdpgfxClientContext* context, UINT16 cacheSlot,
PERSISTENT_CACHE_ENTRY* importCacheEntry);
typedef UINT (*pcRdpgfxMapSurfaceToOutput)(
RdpgfxClientContext* context, const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput);
typedef UINT (*pcRdpgfxMapSurfaceToScaledOutput)(
RdpgfxClientContext* context,
const RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU* surfaceToOutput);
typedef UINT (*pcRdpgfxMapSurfaceToWindow)(
RdpgfxClientContext* context, const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow);
typedef UINT (*pcRdpgfxMapSurfaceToScaledWindow)(
RdpgfxClientContext* context,
const RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU* surfaceToWindow);
typedef UINT (*pcRdpgfxSetSurfaceData)(RdpgfxClientContext* context, UINT16 surfaceId,
void* pData);
typedef void* (*pcRdpgfxGetSurfaceData)(RdpgfxClientContext* context, UINT16 surfaceId);
typedef UINT (*pcRdpgfxGetSurfaceIds)(RdpgfxClientContext* context, UINT16** ppSurfaceIds,
UINT16* count);
typedef UINT (*pcRdpgfxSetCacheSlotData)(RdpgfxClientContext* context, UINT16 cacheSlot,
void* pData);
typedef void* (*pcRdpgfxGetCacheSlotData)(RdpgfxClientContext* context, UINT16 cacheSlot);
typedef UINT (*pcRdpgfxUpdateSurfaces)(RdpgfxClientContext* context);
typedef UINT (*pcRdpgfxUpdateWindowFromSurface)(RdpgfxClientContext* context,
gdiGfxSurface* surface);
typedef UINT (*pcRdpgfxUpdateSurfaceArea)(RdpgfxClientContext* context, UINT16 surfaceId,
UINT32 nrRects, const RECTANGLE_16* rects);
typedef UINT (*pcRdpgfxOnOpen)(RdpgfxClientContext* context, BOOL* do_caps_advertise,
BOOL* do_frame_acks);
typedef UINT (*pcRdpgfxOnClose)(RdpgfxClientContext* context);
typedef UINT (*pcRdpgfxCapsAdvertise)(RdpgfxClientContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise);
typedef UINT (*pcRdpgfxCapsConfirm)(RdpgfxClientContext* context,
const RDPGFX_CAPS_CONFIRM_PDU* capsConfirm);
typedef UINT (*pcRdpgfxFrameAcknowledge)(RdpgfxClientContext* context,
const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge);
typedef UINT (*pcRdpgfxQoeFrameAcknowledge)(
RdpgfxClientContext* context, const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* qoeFrameAcknowledge);
typedef UINT (*pcRdpgfxMapWindowForSurface)(RdpgfxClientContext* context, UINT16 surfaceID,
UINT64 windowID);
typedef UINT (*pcRdpgfxUnmapWindowForSurface)(RdpgfxClientContext* context, UINT64 windowID);
struct s_rdpgfx_client_context
{
void* handle;
void* custom;
/* Implementations require locking */
WINPR_ATTR_NODISCARD pcRdpgfxResetGraphics ResetGraphics;
WINPR_ATTR_NODISCARD pcRdpgfxStartFrame StartFrame;
WINPR_ATTR_NODISCARD pcRdpgfxEndFrame EndFrame;
WINPR_ATTR_NODISCARD pcRdpgfxSurfaceCommand SurfaceCommand;
WINPR_ATTR_NODISCARD pcRdpgfxDeleteEncodingContext DeleteEncodingContext;
WINPR_ATTR_NODISCARD pcRdpgfxCreateSurface CreateSurface;
WINPR_ATTR_NODISCARD pcRdpgfxDeleteSurface DeleteSurface;
WINPR_ATTR_NODISCARD pcRdpgfxSolidFill SolidFill;
WINPR_ATTR_NODISCARD pcRdpgfxSurfaceToSurface SurfaceToSurface;
WINPR_ATTR_NODISCARD pcRdpgfxSurfaceToCache SurfaceToCache;
WINPR_ATTR_NODISCARD pcRdpgfxCacheToSurface CacheToSurface;
WINPR_ATTR_NODISCARD pcRdpgfxCacheImportOffer CacheImportOffer;
WINPR_ATTR_NODISCARD pcRdpgfxCacheImportReply CacheImportReply;
WINPR_ATTR_NODISCARD pcRdpgfxImportCacheEntry ImportCacheEntry;
WINPR_ATTR_NODISCARD pcRdpgfxExportCacheEntry ExportCacheEntry;
WINPR_ATTR_NODISCARD pcRdpgfxEvictCacheEntry EvictCacheEntry;
WINPR_ATTR_NODISCARD pcRdpgfxMapSurfaceToOutput MapSurfaceToOutput;
WINPR_ATTR_NODISCARD pcRdpgfxMapSurfaceToScaledOutput MapSurfaceToScaledOutput;
WINPR_ATTR_NODISCARD pcRdpgfxMapSurfaceToWindow MapSurfaceToWindow;
WINPR_ATTR_NODISCARD pcRdpgfxMapSurfaceToScaledWindow MapSurfaceToScaledWindow;
WINPR_ATTR_NODISCARD pcRdpgfxGetSurfaceIds GetSurfaceIds;
WINPR_ATTR_NODISCARD pcRdpgfxSetSurfaceData SetSurfaceData;
WINPR_ATTR_NODISCARD pcRdpgfxGetSurfaceData GetSurfaceData;
WINPR_ATTR_NODISCARD pcRdpgfxSetCacheSlotData SetCacheSlotData;
WINPR_ATTR_NODISCARD pcRdpgfxGetCacheSlotData GetCacheSlotData;
/* Proxy callbacks */
WINPR_ATTR_NODISCARD pcRdpgfxOnOpen OnOpen;
WINPR_ATTR_NODISCARD pcRdpgfxOnClose OnClose;
WINPR_ATTR_NODISCARD pcRdpgfxCapsAdvertise CapsAdvertise;
WINPR_ATTR_NODISCARD pcRdpgfxCapsConfirm CapsConfirm;
WINPR_ATTR_NODISCARD pcRdpgfxFrameAcknowledge FrameAcknowledge;
WINPR_ATTR_NODISCARD pcRdpgfxQoeFrameAcknowledge QoeFrameAcknowledge;
/* No locking required */
WINPR_ATTR_NODISCARD pcRdpgfxUpdateSurfaces UpdateSurfaces;
WINPR_ATTR_NODISCARD pcRdpgfxUpdateSurfaceArea UpdateSurfaceArea;
WINPR_ATTR_NODISCARD pcRdpgfxUpdateWindowFromSurface UpdateWindowFromSurface;
/* These callbacks allow creating/destroying a window directly
* mapped to a surface.
* NOTE: The surface is already locked.
*/
WINPR_ATTR_NODISCARD pcRdpgfxMapWindowForSurface MapWindowForSurface;
WINPR_ATTR_NODISCARD pcRdpgfxUnmapWindowForSurface UnmapWindowForSurface;
CRITICAL_SECTION mux;
rdpCodecs* codecs;
PROFILER_DEFINE(SurfaceProfiler)
};
FREERDP_API void rdpgfx_client_context_free(RdpgfxClientContext* context);
WINPR_ATTR_MALLOC(rdpgfx_client_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RdpgfxClientContext* rdpgfx_client_context_new(rdpContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H */

View File

@@ -0,0 +1,92 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Output Virtual Channel
*
* Copyright 2010-2011 Vic Lee
* Copyright 2012-2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H
#define FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H
#include <freerdp/channels/rdpsnd.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Subsystem Interface
*/
typedef struct rdpsnd_plugin rdpsndPlugin;
typedef struct rdpsnd_device_plugin rdpsndDevicePlugin;
typedef BOOL (*pcFormatSupported)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format);
typedef BOOL (*pcOpen)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format, UINT32 latency);
typedef UINT32 (*pcGetVolume)(rdpsndDevicePlugin* device);
typedef BOOL (*pcSetVolume)(rdpsndDevicePlugin* device, UINT32 value);
typedef UINT (*pcPlay)(rdpsndDevicePlugin* device, const BYTE* data, size_t size);
typedef UINT (*pcPlayEx)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format,
const BYTE* data, size_t size);
typedef void (*pcStart)(rdpsndDevicePlugin* device);
typedef void (*pcClose)(rdpsndDevicePlugin* device);
typedef void (*pcFree)(rdpsndDevicePlugin* device);
typedef BOOL (*pcDefaultFormat)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* desired,
AUDIO_FORMAT* defaultFormat);
typedef UINT (*pcServerFormatAnnounce)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* formats,
size_t count);
struct rdpsnd_device_plugin
{
rdpsndPlugin* rdpsnd;
WINPR_ATTR_NODISCARD pcFormatSupported FormatSupported;
WINPR_ATTR_NODISCARD pcOpen Open;
WINPR_ATTR_NODISCARD pcGetVolume GetVolume;
WINPR_ATTR_NODISCARD pcSetVolume SetVolume;
WINPR_ATTR_NODISCARD pcPlay Play;
pcStart Start; /* Deprecated, unused. */
pcClose Close;
pcFree Free;
WINPR_ATTR_NODISCARD pcDefaultFormat DefaultFormat;
WINPR_ATTR_NODISCARD pcServerFormatAnnounce ServerFormatAnnounce;
WINPR_ATTR_NODISCARD pcPlayEx PlayEx;
};
#define RDPSND_DEVICE_EXPORT_FUNC_NAME "freerdp_rdpsnd_client_subsystem_entry"
typedef void (*PREGISTERRDPSNDDEVICE)(rdpsndPlugin* rdpsnd, rdpsndDevicePlugin* device);
typedef struct
{
rdpsndPlugin* rdpsnd;
PREGISTERRDPSNDDEVICE pRegisterRdpsndDevice;
const ADDIN_ARGV* args;
} FREERDP_RDPSND_DEVICE_ENTRY_POINTS;
typedef FREERDP_RDPSND_DEVICE_ENTRY_POINTS* PFREERDP_RDPSND_DEVICE_ENTRY_POINTS;
typedef UINT(VCAPITYPE* PFREERDP_RDPSND_DEVICE_ENTRY)(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints);
WINPR_ATTR_NODISCARD
FREERDP_API rdpContext* freerdp_rdpsnd_get_context(rdpsndPlugin* plugin);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H */

View File

@@ -0,0 +1,44 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Assistance Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H
#define FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H
#include <freerdp/channels/remdesk.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
typedef struct
{
void* handle;
void* custom;
} RemdeskClientContext;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H */

View File

@@ -0,0 +1,95 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* SSH Agent Virtual Channel Extension
*
* Copyright 2017 Ben Cohen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_CLIENT_SSHAGENT_H
#define FREERDP_CHANNEL_CLIENT_SSHAGENT_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/message.h>
#include <freerdp/channels/cliprdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
int ProtocolVersion;
int MaxConnections;
} SSHAgentClientContext;
/*
* The channel is defined by the sshagent channel in xrdp as follows.
*
* Server to client commands
* -------------------------
*
* Capabilities (at start of channel stream):
*
* INT32 SA_TAG_CAPABILITY
* INT32 SSHAGENT_CHAN_PROT_VERSION := 1
* INT32 SSHAGENT_MAX_CONNECTIONS
*
* Open connection:
*
* INT32 SA_TAG_OPEN
* INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1)
*
* Send data:
*
* INT32 SA_TAG_WRITE
* INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1)
* INT32 Data length
* DATA ...
*
* Close connection:
*
* INT32 SA_TAG_CLOSE
* INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1)
*
* Client to server commands
* -------------------------
*
* Capabilities (in reply to server capabilities):
*
* INT32 SA_TAG_CAPABILITY
* INT32 SSHAGENT_CHAN_PROT_VERSION := 1
* INT32 SSHAGENT_MAX_CONNECTIONS
*
* Send data:
*
* INT32 SA_TAG_WRITE
* INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1)
* INT32 Data length
* DATA ...
*
* Close connection (abnormal):
*
* INT32 SA_TAG_CLOSE
* INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1)
*/
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CLIENT_SSHAGENT_H */

View File

@@ -0,0 +1,79 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Multimedia Redirection Virtual Channel Types
*
* Copyright 2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* DEPRECATION WARNING:
*
* This channel is unmaintained and not used since windows 7.
* Only compile and use it if absolutely necessary, otherwise
* deactivate it or use the newer [MS-RDPEVOR] video redirection.
*/
#ifndef FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H
#define FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H
#include <freerdp/codec/region.h>
#include <freerdp/channels/tsmf.h>
/* RDP_VIDEO_FRAME_EVENT.frame_pixfmt */
/* http://www.fourcc.org/yuv.php */
#define RDP_PIXFMT_I420 0x30323449
#define RDP_PIXFMT_YV12 0x32315659
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
BYTE* frameData;
UINT32 frameSize;
UINT32 framePixFmt;
INT16 frameWidth;
INT16 frameHeight;
INT16 x;
INT16 y;
INT16 width;
INT16 height;
UINT16 numVisibleRects;
RECTANGLE_16* visibleRects;
} TSMF_VIDEO_FRAME_EVENT;
/**
* Client Interface
*/
typedef struct s_tsmf_client_context TsmfClientContext;
typedef int (*pcTsmfFrameEvent)(TsmfClientContext* context, TSMF_VIDEO_FRAME_EVENT* event);
struct s_tsmf_client_context
{
void* handle;
void* custom;
WINPR_ATTR_NODISCARD pcTsmfFrameEvent FrameEvent;
};
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H */

View File

@@ -0,0 +1,37 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Smartcard client functions
*
* Copyright 2021 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef UTILS_SMARTCARD_CLI_H__
#define UTILS_SMARTCARD_CLI_H__
#include <freerdp/api.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
FREERDP_API BOOL freerdp_smartcard_list(const rdpSettings* settings);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* UTILS_SMARTCARD_CLI_H__ */

View File

@@ -0,0 +1,75 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Optimized Remoting Virtual Channel Extension
*
* Copyright 2017 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNELS_CLIENT_VIDEO_H
#define FREERDP_CHANNELS_CLIENT_VIDEO_H
#include <freerdp/client/geometry.h>
#include <freerdp/channels/video.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_VideoClientContext VideoClientContext;
typedef struct s_VideoClientContextPriv VideoClientContextPriv;
/** @brief an implementation of surface used by the video channel */
typedef struct
{
UINT32 x, y, w, h;
UINT32 alignedWidth, alignedHeight;
BYTE* data;
DWORD format;
UINT32 scanline;
} VideoSurface;
typedef void (*pcVideoTimer)(VideoClientContext* video, UINT64 now);
typedef void (*pcVideoSetGeometry)(VideoClientContext* video, GeometryClientContext* geometry);
typedef VideoSurface* (*pcVideoCreateSurface)(VideoClientContext* video, UINT32 x, UINT32 y,
UINT32 width, UINT32 height);
typedef BOOL (*pcVideoShowSurface)(VideoClientContext* video, const VideoSurface* surface,
UINT32 destinationWidth, UINT32 destinationHeight);
typedef BOOL (*pcVideoDeleteSurface)(VideoClientContext* video, VideoSurface* surface);
/** @brief context for the video (MS-RDPEVOR) channel */
struct s_VideoClientContext
{
void* handle;
void* custom;
VideoClientContextPriv* priv;
pcVideoSetGeometry setGeometry;
pcVideoTimer timer;
WINPR_ATTR_NODISCARD pcVideoCreateSurface createSurface;
WINPR_ATTR_NODISCARD pcVideoShowSurface showSurface;
pcVideoDeleteSurface deleteSurface;
};
WINPR_ATTR_NODISCARD
FREERDP_API VideoSurface* VideoClient_CreateCommonContext(size_t size, UINT32 x, UINT32 y,
UINT32 w, UINT32 h);
FREERDP_API void VideoClient_DestroyCommonContext(VideoSurface* surface);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNELS_CLIENT_VIDEO_H */

View File

@@ -0,0 +1,244 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Audio Formats
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_AUDIO_H
#define FREERDP_CODEC_AUDIO_H
#include <winpr/wlog.h>
#include <winpr/wtypes.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct AUDIO_FORMAT
{
UINT16 wFormatTag;
UINT16 nChannels;
UINT32 nSamplesPerSec;
UINT32 nAvgBytesPerSec;
UINT16 nBlockAlign;
UINT16 wBitsPerSample;
UINT16 cbSize;
BYTE* data;
};
typedef struct AUDIO_FORMAT AUDIO_FORMAT;
#define SNDC_CLOSE 1
#define SNDC_WAVE 2
#define SNDC_SETVOLUME 3
#define SNDC_SETPITCH 4
#define SNDC_WAVECONFIRM 5
#define SNDC_TRAINING 6
#define SNDC_FORMATS 7
#define SNDC_CRYPTKEY 8
#define SNDC_WAVEENCRYPT 9
#define SNDC_UDPWAVE 10
#define SNDC_UDPWAVELAST 11
#define SNDC_QUALITYMODE 12
#define SNDC_WAVE2 13
#define TSSNDCAPS_ALIVE 1
#define TSSNDCAPS_VOLUME 2
#define TSSNDCAPS_PITCH 4
#define DYNAMIC_QUALITY 0x0000
#define MEDIUM_QUALITY 0x0001
#define HIGH_QUALITY 0x0002
/*
* Format Tags:
* http://tools.ietf.org/html/rfc2361
*/
#ifndef WAVE_FORMAT_UNKNOWN
#define WAVE_FORMAT_UNKNOWN 0x0000
#endif /* !WAVE_FORMAT_UNKNOWN */
#ifndef WAVE_FORMAT_PCM
#define WAVE_FORMAT_PCM 0x0001
#endif /* !WAVE_FORMAT_PCM */
#ifndef WAVE_FORMAT_ADPCM
#define WAVE_FORMAT_ADPCM 0x0002
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
#define WAVE_FORMAT_VSELP 0x0004
#define WAVE_FORMAT_IBM_CVSD 0x0005
#define WAVE_FORMAT_ALAW 0x0006
#define WAVE_FORMAT_MULAW 0x0007
#define WAVE_FORMAT_OKI_ADPCM 0x0010
#define WAVE_FORMAT_DVI_ADPCM 0x0011
#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012
#define WAVE_FORMAT_SIERRA_ADPCM 0x0013
#define WAVE_FORMAT_G723_ADPCM 0x0014
#define WAVE_FORMAT_DIGISTD 0x0015
#define WAVE_FORMAT_DIGIFIX 0x0016
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017
#define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018
#define WAVE_FORMAT_CU_CODEC 0x0019
#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020
#define WAVE_FORMAT_SONARC 0x0021
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022
#define WAVE_FORMAT_ECHOSC1 0x0023
#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024
#define WAVE_FORMAT_APTX 0x0025
#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026
#define WAVE_FORMAT_PROSODY_1612 0x0027
#define WAVE_FORMAT_LRC 0x0028
#define WAVE_FORMAT_DOLBY_AC2 0x0030
#define WAVE_FORMAT_GSM610 0x0031
#define WAVE_FORMAT_MSNAUDIO 0x0032
#define WAVE_FORMAT_ANTEX_ADPCME 0x0033
#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034
#define WAVE_FORMAT_DIGIREAL 0x0035
#define WAVE_FORMAT_DIGIADPCM 0x0036
#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037
#define WAVE_FORMAT_NMS_VBXADPCM 0x0038
#define WAVE_FORMAT_ROLAND_RDAC 0x0039
#define WAVE_FORMAT_ECHOSC3 0x003A
#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B
#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C
#define WAVE_FORMAT_XEBEC 0x003D
#define WAVE_FORMAT_G721_ADPCM 0x0040
#define WAVE_FORMAT_G728_CELP 0x0041
#define WAVE_FORMAT_MSG723 0x0042
#define WAVE_FORMAT_MPEG 0x0050
#define WAVE_FORMAT_RT24 0x0052
#define WAVE_FORMAT_PAC 0x0053
#endif /* !WAVE_FORMAT_ADPCM */
#ifndef WAVE_FORMAT_MPEGLAYER3
#define WAVE_FORMAT_MPEGLAYER3 0x0055
#endif
#ifndef WAVE_FORMAT_LUCENT_G723
#define WAVE_FORMAT_LUCENT_G723 0x0059
#define WAVE_FORMAT_CIRRUS 0x0060
#define WAVE_FORMAT_ESPCM 0x0061
#define WAVE_FORMAT_VOXWARE 0x0062
#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063
#define WAVE_FORMAT_G726_ADPCM 0x0064
#define WAVE_FORMAT_G722_ADPCM 0x0065
#define WAVE_FORMAT_DSAT 0x0066
#define WAVE_FORMAT_DSAT_DISPLAY 0x0067
#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069
#define WAVE_FORMAT_VOXWARE_AC8 0x0070
#define WAVE_FORMAT_VOXWARE_AC10 0x0071
#define WAVE_FORMAT_VOXWARE_AC16 0x0072
#define WAVE_FORMAT_VOXWARE_AC20 0x0073
#define WAVE_FORMAT_VOXWARE_RT24 0x0074
#define WAVE_FORMAT_VOXWARE_RT29 0x0075
#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076
#define WAVE_FORMAT_VOXWARE_VR12 0x0077
#define WAVE_FORMAT_VOXWARE_VR18 0x0078
#define WAVE_FORMAT_VOXWARE_TQ40 0x0079
#define WAVE_FORMAT_SOFTSOUND 0x0080
#define WAVE_FORMAT_VOXWARE_TQ60 0x0081
#define WAVE_FORMAT_MSRT24 0x0082
#define WAVE_FORMAT_G729A 0x0083
#define WAVE_FORMAT_MVI_MV12 0x0084
#define WAVE_FORMAT_DF_G726 0x0085
#define WAVE_FORMAT_DF_GSM610 0x0086
#define WAVE_FORMAT_ISIAUDIO 0x0088
#define WAVE_FORMAT_ONLIVE 0x0089
#define WAVE_FORMAT_SBC24 0x0091
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097
#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098
#define WAVE_FORMAT_PACKED 0x0099
#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100
#define WAVE_FORMAT_IRAT 0x0101
#define WAVE_FORMAT_VIVO_G723 0x0111
#define WAVE_FORMAT_VIVO_SIREN 0x0112
#define WAVE_FORMAT_DIGITAL_G723 0x0123
#define WAVE_FORMAT_WMAUDIO2 0x0161
#define WAVE_FORMAT_WMAUDIO3 0x0162
#define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163
#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203
#define WAVE_FORMAT_QUARTERDECK 0x0220
#define WAVE_FORMAT_FM_TOWNS_SND 0x0300
#define WAVE_FORMAT_BTV_DIGITAL 0x0400
#define WAVE_FORMAT_VME_VMPCM 0x0680
#define WAVE_FORMAT_OLIGSM 0x1000
#define WAVE_FORMAT_OLIADPCM 0x1001
#define WAVE_FORMAT_OLICELP 0x1002
#define WAVE_FORMAT_OLISBC 0x1003
#define WAVE_FORMAT_OLIOPR 0x1004
#define WAVE_FORMAT_LH_CODEC 0x1100
#define WAVE_FORMAT_NORRIS 0x1400
#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500
#define WAVE_FORMAT_DVM 0x2000
#endif /* !WAVE_FORMAT_LUCENT_G723 */
/** Opus format identifier
* \since version 3.0.0
*/
#define WAVE_FORMAT_OPUS 0x704F
#define WAVE_FORMAT_AAC_MS 0xA106
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
/**
* Audio Format Functions
*/
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 audio_format_compute_time_length(const AUDIO_FORMAT* format, size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API const char* audio_format_get_tag_string(UINT16 wFormatTag);
FREERDP_API void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format);
FREERDP_API void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats,
UINT16 count);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL audio_format_read(wStream* s, AUDIO_FORMAT* format);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format);
FREERDP_API BOOL audio_format_copy(const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
AUDIO_FORMAT* WINPR_RESTRICT dstFormat);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL audio_format_compatible(const AUDIO_FORMAT* with, const AUDIO_FORMAT* what);
FREERDP_API void audio_format_free(AUDIO_FORMAT* format);
FREERDP_API void audio_formats_free(AUDIO_FORMAT* formats, size_t count);
WINPR_ATTR_MALLOC(audio_formats_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API AUDIO_FORMAT* audio_format_new(void);
WINPR_ATTR_MALLOC(audio_formats_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API AUDIO_FORMAT* audio_formats_new(size_t count);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_AUDIO_H */

View File

@@ -0,0 +1,46 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Compressed Bitmap
*
* Copyright 2011 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_BITMAP_H
#define FREERDP_CODEC_BITMAP_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/color.h>
#include <winpr/crt.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API SSIZE_T freerdp_bitmap_compress(const void* WINPR_RESTRICT srcData, UINT32 width,
UINT32 height, wStream* WINPR_RESTRICT s,
UINT32 bpp, UINT32 byte_limit, UINT32 start_line,
wStream* WINPR_RESTRICT temp_s, UINT32 e);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_BITMAP_H */

View File

@@ -0,0 +1,39 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Bulk Data Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_BULK_H
#define FREERDP_CODEC_BULK_H
#include <freerdp/api.h>
#include <freerdp/types.h>
/* Level-2 Compression Flags */
#define PACKET_COMPRESSED 0x20
#define PACKET_AT_FRONT 0x40
#define PACKET_FLUSHED 0x80
/* Level-1 Compression Flags */
#define L1_PACKET_AT_FRONT 0x04
#define L1_NO_COMPRESSION 0x02
#define L1_COMPRESSED 0x01
#define L1_INNER_COMPRESSION 0x10
#endif /* FREERDP_CODEC_BULK_H */

View File

@@ -0,0 +1,63 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ClearCodec Bitmap Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_CLEAR_H
#define FREERDP_CODEC_CLEAR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/codec/color.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_CLEAR_CONTEXT CLEAR_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API int clear_compress(CLEAR_CONTEXT* WINPR_RESTRICT clear,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
BYTE** WINPR_RESTRICT ppDstData,
UINT32* WINPR_RESTRICT pDstSize);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 clear_decompress(CLEAR_CONTEXT* WINPR_RESTRICT clear,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight, BYTE* WINPR_RESTRICT pDstData,
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight,
const gdiPalette* WINPR_RESTRICT palette);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL clear_context_reset(CLEAR_CONTEXT* WINPR_RESTRICT clear);
FREERDP_API void clear_context_free(CLEAR_CONTEXT* WINPR_RESTRICT clear);
WINPR_ATTR_MALLOC(clear_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API CLEAR_CONTEXT* clear_context_new(BOOL Compressor);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_CLEAR_H */

View File

@@ -0,0 +1,527 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Color Conversion Routines
*
* Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_COLOR_H
#define FREERDP_CODEC_COLOR_H
#include <winpr/crt.h>
#include <freerdp/api.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define FREERDP_PIXEL_FORMAT_TYPE_A 0
#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1
#define FREERDP_PIXEL_FORMAT_TYPE_ABGR 2
#define FREERDP_PIXEL_FORMAT_TYPE_RGBA 3
#define FREERDP_PIXEL_FORMAT_TYPE_BGRA 4
#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) \
(FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR)
/** @brief Flags for image copy operations */
enum FREERDP_IMAGE_FLAGS
{
FREERDP_FLIP_NONE = 0,
FREERDP_FLIP_VERTICAL = 1,
FREERDP_FLIP_HORIZONTAL = 2,
FREERDP_KEEP_DST_ALPHA = 4
};
#define FREERDP_PIXEL_FORMAT(_bpp, _type, _a, _r, _g, _b) \
((_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b))
#define FREERDP_PIXEL_FORMAT_TYPE(_format) (((_format) >> 16) & 0x07)
/*** Design considerations
*
* The format naming scheme is based on byte position in memory.
* RGBA for example names a byte array with red on position 0, green on 1 etc.
*
* To read and write the appropriate format from / to memory use FreeRDPReadColor and
* FreeRDPWriteColor.
*
* The single pixel manipulation functions use an intermediate integer representation
* that must not be interpreted outside the functions as it is platform dependent.
*
* X for alpha channel denotes unused (but existing) alpha channel data.
*/
/** @defgroup PIXEL_FORMAT Pixel formats
* @brief PIXEL color ordering formats known
* @{
*/
/* 32bpp formats */
#define PIXEL_FORMAT_ARGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8)
#define PIXEL_FORMAT_XRGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_ABGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8)
#define PIXEL_FORMAT_XBGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGRA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8)
#define PIXEL_FORMAT_BGRX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8)
#define PIXEL_FORMAT_RGBA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8)
#define PIXEL_FORMAT_RGBX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGRX32_DEPTH30 \
FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 10, 10, 10)
#define PIXEL_FORMAT_RGBX32_DEPTH30 \
FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 10, 10, 10)
/* 24bpp formats */
#define PIXEL_FORMAT_RGB24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGR24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
/* 16bpp formats */
#define PIXEL_FORMAT_RGB16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5)
#define PIXEL_FORMAT_BGR16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5)
#define PIXEL_FORMAT_ARGB15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5)
#define PIXEL_FORMAT_RGB15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5)
#define PIXEL_FORMAT_ABGR15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5)
#define PIXEL_FORMAT_BGR15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5)
/* 8bpp formats */
#define PIXEL_FORMAT_RGB8 FREERDP_PIXEL_FORMAT(8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0)
/* 4 bpp formats */
#define PIXEL_FORMAT_A4 FREERDP_PIXEL_FORMAT(4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0)
/* 1bpp formats */
#define PIXEL_FORMAT_MONO FREERDP_PIXEL_FORMAT(1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0)
/** @} */
struct gdi_palette
{
UINT32 format;
UINT32 palette[256];
};
typedef struct gdi_palette gdiPalette;
/* Compare two color formats but ignore differences in alpha channel.
*/
WINPR_ATTR_NODISCARD
FREERDP_API DWORD FreeRDPAreColorFormatsEqualNoAlpha(DWORD first, DWORD second);
/* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */
/***
*
* Get a string representation of a color
*
* @param format The pixel color format
*
* @return A string representation of format
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define GetColorFormatName(...) FreeRDPGetColorFormatName(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
FREERDP_API const char* FreeRDPGetColorFormatName(UINT32 format);
/** @brief convert a string to a \ref PIXEL_FORMAT
*
* @param name The string representing the format
*
* @return the \ref PIXEL_FORMAT value or \b 0 for failure
* @since version 3.18.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API uint32_t FreeRDPGetColorFromatFromName(const char* name);
/***
*
* Converts a pixel color in internal representation to its red, green, blue
* and alpha components.
*
* @param color The color in format internal representation
* @param format one of PIXEL_FORMAT_* color format defines
* @param _r red color value
* @param _g green color value
* @param _b blue color value
* @param _a alpha color value
* @param palette palette to use (only used for 8 bit color!)
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define SplitColor(...) FreeRDPSplitColor(__VA_ARGS__)
#endif
FREERDP_API void FreeRDPSplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g, BYTE* _b,
BYTE* _a, const gdiPalette* palette);
/***
*
* Converts red, green, blue and alpha values to internal representation.
*
* @param format one of PIXEL_FORMAT_* color format defines
* @param r red color value
* @param g green color value
* @param b blue color value
* @param a alpha color value
*
* @return The pixel color in the desired format. Value is in internal
* representation.
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define GetColor(...) FreeRDPGetColor(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 FreeRDPGetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a);
/***
*
* Returns the number of bits the format format uses.
*
* @param format One of PIXEL_FORMAT_* defines
*
* @return The number of bits the format requires per pixel.
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define GetBitsPerPixel(...) FreeRDPGetBitsPerPixel(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
static inline UINT32 FreeRDPGetBitsPerPixel(UINT32 format)
{
return (((format) >> 24) & 0x3F);
}
/***
* @param format one of PIXEL_FORMAT_* color format defines
*
* @return TRUE if the format has an alpha channel, FALSE otherwise.
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define ColorHasAlpha(...) FreeRDPColorHasAlpha(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
static inline BOOL FreeRDPColorHasAlpha(UINT32 format)
{
UINT32 alpha = (((format) >> 12) & 0x0F);
return (alpha != 0);
}
/***
*
* Read a pixel from memory to internal representation
*
* @param src The source buffer
* @param format The PIXEL_FORMAT_* define the source buffer uses for encoding
*
* @return The pixel color in internal representation
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define ReadColor(...) FreeRDPReadColor(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 FreeRDPReadColor(const BYTE* WINPR_RESTRICT src, UINT32 format);
/***
*
* Write a pixel from internal representation to memory
*
* @param dst The destination buffer
* @param format The PIXEL_FORMAT_* define for encoding
* @param color The pixel color in internal representation
*
* @return TRUE if successful, FALSE otherwise
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define WriteColor(...) FreeRDPWriteColor(__VA_ARGS__)
#define WriteColorIgnoreAlpha(...) FreeRDPWriteColorIgnoreAlpha(__VA_ARGS__)
#endif
FREERDP_API BOOL FreeRDPWriteColor(BYTE* WINPR_RESTRICT dst, UINT32 format, UINT32 color);
FREERDP_API BOOL FreeRDPWriteColorIgnoreAlpha(BYTE* WINPR_RESTRICT dst, UINT32 format,
UINT32 color);
/***
*
* Converts a pixel in internal representation format srcFormat to internal
* representation format dstFormat
*
* @param color The pixel color in srcFormat representation
* @param srcFormat The PIXEL_FORMAT_* of color
* @param dstFormat The PIXEL_FORMAT_* of the return.
* @param palette palette to use (only used for 8 bit color!)
*
* @return The converted pixel color in dstFormat representation
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define ConvertColor(...) FreeRDPConvertColor(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
static inline UINT32 FreeRDPConvertColor(UINT32 color, UINT32 srcFormat, UINT32 dstFormat,
const gdiPalette* palette)
{
BYTE r = 0;
BYTE g = 0;
BYTE b = 0;
BYTE a = 0;
FreeRDPSplitColor(color, srcFormat, &r, &g, &b, &a, palette);
return FreeRDPGetColor(dstFormat, r, g, b, a);
}
/***
*
* Returns the number of bytes the format format uses.
*
* @param format One of PIXEL_FORMAT_* defines
*
* @return The number of bytes the format requires per pixel.
*/
#if defined(WITH_FREERDP_DEPRECATED)
#define GetBytesPerPixel(...) FreeRDPGetBytesPerPixel(__VA_ARGS__)
#endif
WINPR_ATTR_NODISCARD
static inline UINT32 FreeRDPGetBytesPerPixel(UINT32 format)
{
return (FreeRDPGetBitsPerPixel(format) + 7) / 8;
}
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
/***
*
* @param width width to copy in pixels
* @param height height to copy in pixels
* @param data source buffer, must be (nWidth + 7) / 8 bytes long
*
* @return A buffer allocated with winpr_aligned_malloc(width * height, 16)
* if successful, nullptr otherwise.
*/
WINPR_DEPRECATED_VAR("[since 3.21.0] use freerdp_glyph_convert_ex instead",
WINPR_ATTR_MALLOC(winpr_aligned_free, 1)
WINPR_ATTR_NODISCARD FREERDP_API BYTE* freerdp_glyph_convert(
UINT32 width, UINT32 height, const BYTE* WINPR_RESTRICT data));
#endif
/***
*
* @param width width to copy in pixels
* @param height height to copy in pixels
* @param data source buffer, must be (nWidth + 7) / 8 bytes long
* @param len the length of \ref data in bytes
*
* @return A buffer allocated with winpr_aligned_malloc(width * height, 16)
* if successful, nullptr otherwise.
* @since version 3.21.0
*/
WINPR_ATTR_MALLOC(winpr_aligned_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* freerdp_glyph_convert_ex(UINT32 width, UINT32 height,
const BYTE* WINPR_RESTRICT data, size_t len);
/***
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param pSrcData source buffer, must be (nWidth + 7) / 8 bytes long
* @param backColor The background color in internal representation format
* @param foreColor The foreground color in internal representation format
* @param palette palette to use (only used for 8 bit color!)
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy_from_monochrome(
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData,
UINT32 backColor, UINT32 foreColor, const gdiPalette* WINPR_RESTRICT palette);
/***
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param bitsColor icon's image data buffer
* @param cbBitsColor length of the image data buffer in bytes
* @param bitsMask icon's 1bpp image mask buffer
* @param cbBitsMask length of the image mask buffer in bytes
* @param colorTable icon's image color table
* @param cbColorTable length of the image color table buffer in bytes
* @param bpp color image data bits per pixel
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy_from_icon_data(
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
UINT32 nYDst, UINT16 nWidth, UINT16 nHeight, const BYTE* WINPR_RESTRICT bitsColor,
UINT16 cbBitsColor, const BYTE* WINPR_RESTRICT bitsMask, UINT16 cbBitsMask,
const BYTE* WINPR_RESTRICT colorTable, UINT16 cbColorTable, UINT32 bpp);
/***
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param xorMask XOR mask buffer
* @param xorMaskLength XOR mask length in bytes
* @param andMask AND mask buffer
* @param andMaskLength AND mask length in bytes
* @param xorBpp XOR bits per pixel
* @param palette palette to use (only used for 8 bit color!)
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT xorMask,
UINT32 xorMaskLength, const BYTE* WINPR_RESTRICT andMask, UINT32 andMaskLength,
UINT32 xorBpp, const gdiPalette* WINPR_RESTRICT palette);
/*** Copies an image from source to destination, converting if necessary.
* Source and destination may overlap.
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param pSrcData source buffer
* @param SrcFormat source buffer format
* @param nSrcStep source buffer stride (line in bytes) 0 for default
* @param nXSrc source buffer x offset in pixels
* @param nYSrc source buffer y offset in pixels
* @param palette palette to use (only used for 8 bit color!)
* @param flags Image flipping flags FREERDP_FLIP_NONE et al
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* WINPR_RESTRICT palette, UINT32 flags);
/**
* @brief Same as @ref freerdp_image_copy but only for overlapping source and destination
* @since version 3.6.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy_overlap(
BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight, const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc,
UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette, UINT32 flags);
/*** Same as @ref freerdp_image_copy but only for non overlapping source and destination
* @since version 3.6.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_copy_no_overlap(
BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette,
UINT32 flags);
/*** Scale an image to destination
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nDstWidth width of destination in pixels
* @param nDstHeight height of destination in pixels
* @param pSrcData source buffer
* @param SrcFormat source buffer format
* @param nSrcStep source buffer stride (line in bytes) 0 for default
* @param nXSrc source buffer x offset in pixels
* @param nYSrc source buffer y offset in pixels
* @param nSrcWidth width of source in pixels
* @param nSrcHeight height of source in pixels
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_scale(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nDstWidth, UINT32 nDstHeight,
const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
UINT32 nSrcWidth, UINT32 nSrcHeight);
/** @brief fill an area with the color provided.
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param color Pixel color in DstFormat (internal representation format,
* use FreeRDPGetColor to create)
*
* @return TRUE if success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight, UINT32 color);
#define FREERDP_IMAGE_FILL_IGNORE_ALPHA 1 /** @since version 3.13.0 */
/** @brief fill an area with the color provided. If flag \b FREERDP_IMAGE_FILL_IGNORE_ALPHA is
* set the destination alpha value will be kept.
*
* @param pDstData destination buffer
* @param DstFormat destination buffer format
* @param nDstStep destination buffer stride (line in bytes) 0 for default
* @param nXDst destination buffer offset x
* @param nYDst destination buffer offset y
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param color Pixel color in DstFormat (internal representation format,
* use FreeRDPGetColor to create)
* @param flags \b FREERDP_IMAGE_FILL_* flags
*
* @return TRUE if success, FALSE otherwise
*
* @since version 3.13.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_image_fill_ex(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT32 color,
UINT32 flags);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_COLOR_H */

View File

@@ -0,0 +1,66 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Digital Sound Processing
*
* Copyright 2010-2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_DSP_H
#define FREERDP_CODEC_DSP_H
#include <winpr/stream.h>
#include <freerdp/api.h>
#include <freerdp/codec/audio.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_FREERDP_DSP_CONTEXT FREERDP_DSP_CONTEXT;
FREERDP_API void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context);
WINPR_ATTR_MALLOC(freerdp_dsp_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(BOOL encoder);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_dsp_supports_format(const AUDIO_FORMAT* WINPR_RESTRICT format,
BOOL encode);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
const BYTE* WINPR_RESTRICT data, size_t length,
wStream* WINPR_RESTRICT out);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_dsp_decode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
const BYTE* WINPR_RESTRICT data, size_t length,
wStream* WINPR_RESTRICT out);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_dsp_context_reset(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
const AUDIO_FORMAT* WINPR_RESTRICT targetFormat,
UINT32 FramesPerPacket);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_DSP_H */

View File

@@ -0,0 +1,146 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* H.264 Bitmap Compression
*
* Copyright 2014 Mike McDonald <Mike.McDonald@software.dell.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_H264_H
#define FREERDP_CODEC_H264_H
#include <winpr/wlog.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/rdpgfx.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_H264_CONTEXT_SUBSYSTEM H264_CONTEXT_SUBSYSTEM;
typedef struct S_H264_CONTEXT H264_CONTEXT;
typedef struct S_YUV_CONTEXT YUV_CONTEXT;
typedef enum
{
H264_RATECONTROL_VBR = 0,
H264_RATECONTROL_CQP
} H264_RATECONTROL_MODE;
/**
* @brief The usage types for H264 encoding
* @since version 3.6.0
*/
typedef enum
{
H264_SCREEN_CONTENT_REAL_TIME = 0,
H264_SCREEN_CONTENT_NON_REAL_TIME,
H264_CAMERA_VIDEO_REAL_TIME,
H264_CAMERA_VIDEO_NON_REAL_TIME,
} H264_USAGETYPE;
typedef enum
{
H264_CONTEXT_OPTION_RATECONTROL,
H264_CONTEXT_OPTION_BITRATE,
H264_CONTEXT_OPTION_FRAMERATE,
H264_CONTEXT_OPTION_QP,
H264_CONTEXT_OPTION_USAGETYPE, /** @since version 3.6.0 */
H264_CONTEXT_OPTION_HW_ACCEL, /** set to request hw accel, get to check if hw accel is on,
@since version 3.11.0 */
} H264_CONTEXT_OPTION;
FREERDP_API void free_h264_metablock(RDPGFX_H264_METABLOCK* meta);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option,
UINT32 value);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
const RECTANGLE_16* regionRect, BYTE** ppDstData,
UINT32* pDstSize, RDPGFX_H264_METABLOCK* meta);
/** @brief API for user to fill YUV I420 buffer before encoding
*
* @param h264 The h264 context to query
* @param nSrcStride The size of a line in bytes of the source image
* @param nSrcWidth The width of the source image in pixels
* @param nSrcHeight The height of the source image
* @param YUVData A pointer to hold the current YUV buffers
* @param stride A pointer to hold the byte length of a line in the YUV buffers
* @return \b >= 0 for success, \b <0 for an error
* @since version 3.6.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API INT32 h264_get_yuv_buffer(H264_CONTEXT* h264, UINT32 nSrcStride, UINT32 nSrcWidth,
UINT32 nSrcHeight, BYTE* YUVData[3], UINT32 stride[3]);
/**
* @brief Compress currently filled image data to H264 stream
*
* @param h264 The H264 context to use for compression
* @param ppDstData A pointer that will hold the allocated result buffer
* @param pDstSize A pointer for the destination buffer size in bytes
* @return \b >= 0 for success, \b <0 for an error
* @since version 3.6.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API INT32 h264_compress(H264_CONTEXT* h264, BYTE** ppDstData, UINT32* pDstSize);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize,
BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep,
UINT32 nDstWidth, UINT32 nDstHeight,
const RECTANGLE_16* regionRects, UINT32 numRegionRect);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
BYTE version, const RECTANGLE_16* regionRect, BYTE* op,
BYTE** pDstData, UINT32* pDstSize, BYTE** pAuxDstData,
UINT32* pAuxDstSize, RDPGFX_H264_METABLOCK* meta,
RDPGFX_H264_METABLOCK* auxMeta);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op,
const RECTANGLE_16* regionRects, UINT32 numRegionRect,
const BYTE* pSrcData, UINT32 SrcSize,
const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect,
const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData,
DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth,
UINT32 nDstHeight, UINT32 codecId);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height);
FREERDP_API void h264_context_free(H264_CONTEXT* h264);
WINPR_ATTR_MALLOC(h264_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_H264_H */

View File

@@ -0,0 +1,69 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Interleaved RLE Bitmap Codec
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_INTERLEAVED_H
#define FREERDP_CODEC_INTERLEAVED_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_BITMAP_INTERLEAVED_CONTEXT BITMAP_INTERLEAVED_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
UINT32 nSrcWidth, UINT32 nSrcHeight, UINT32 bpp,
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nDstWidth, UINT32 nDstHeight,
const gdiPalette* WINPR_RESTRICT palette);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved,
BYTE* WINPR_RESTRICT pDstData,
UINT32* WINPR_RESTRICT pDstSize, UINT32 nWidth,
UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData,
UINT32 SrcFormat, UINT32 nSrcStep, UINT32 nXSrc,
UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette,
UINT32 bpp);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL
bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved);
FREERDP_API void
bitmap_interleaved_context_free(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved);
WINPR_ATTR_MALLOC(bitmap_interleaved_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_INTERLEAVED_H */

View File

@@ -0,0 +1,39 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Compressed Bitmap
*
* Copyright 2012 Jay Sorg <jay.sorg@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_JPEG_H
#define FREERDP_CODEC_JPEG_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL jpeg_decompress(const BYTE* input, BYTE* output, int width, int height,
int size, int bpp);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_JPEG_H */

View File

@@ -0,0 +1,145 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* NSCodec Codec
*
* Copyright 2011 Samsung, Author Jiten Pathy
* Copyright 2012 Vic Lee
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_NSCODEC_H
#define FREERDP_CODEC_NSCODEC_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C"
{
#endif
/// parameter types available to change in a \ref NSC_CONTEXT See [MS-RDPNSC] 2.2.1 NSCodec
/// Capability Set (TS_NSCODEC_CAPABILITYSET) for details
typedef enum
{
NSC_COLOR_LOSS_LEVEL, /**< \b colorLossLevel */
NSC_ALLOW_SUBSAMPLING, /**< \b fAllowSubsampling */
NSC_DYNAMIC_COLOR_FIDELITY, /**< \b fAllowDynamicFidelity */
NSC_COLOR_FORMAT /**< \ref PIXEL_FORMAT color format used for internal bitmap buffer */
} NSC_PARAMETER;
typedef struct S_NSC_CONTEXT NSC_CONTEXT;
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use nsc_context_set_parameters(NSC_COLOR_FORMAT)",
WINPR_ATTR_NODISCARD FREERDP_API BOOL nsc_context_set_pixel_format(
NSC_CONTEXT* context, UINT32 pixel_format));
#endif
/** @brief Set a \ref NSC_PARAMETER for a \ref NSC_CONTEXT
*
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
* @param what A \ref NSC_PARAMETER to identify what to change
* @param value The value to set
*
* @return \b TRUE if successful, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* WINPR_RESTRICT context,
NSC_PARAMETER what, UINT32 value);
/** @brief decode a NSC message
*
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
* @param bpp The bit depth of the data
* @param width The width in pixels of the NSC surface
* @param height The height in pixels of the NSC surface
* @param data The data to decode
* @param length The length of \ref data in bytes
* @param pDstData The destination buffer. Must be at least \n nDstStride * nHeight in size.
* @param DstFormat The color format of the destination
* @param nDstStride The number of bytes per destination buffer line. Must be larger than
* bytes(DstFormat) * nWidth or \0 (in which case it is set to former minimum bound)
* @param nXDst The X offset in the destination buffer in pixels
* @param nYDst The Y offset in the destination buffer in pixels
* @param nWidth The width of the destination buffer in pixels
* @param nHeight The height of the destination buffer in pixels
* @param flip Image flipping flags FREERDP_FLIP_NONE et al passed on to \ref
* freerdp_image_copy
*
* @return \b TRUE in case of success, \b FALSE for any error. Check WLog for details.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* WINPR_RESTRICT context, UINT16 bpp,
UINT32 width, UINT32 height, const BYTE* data,
UINT32 length, BYTE* WINPR_RESTRICT pDstData,
UINT32 DstFormat, UINT32 nDstStride, UINT32 nXDst,
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 flip);
/** @brief Encode a bitmap with \b NSC
*
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
* @param s a \ref wStream used to write \b NSC encoded data to. Must not be \b nullptr
* @param bmpdata A pointer to the bitmap to encode. Format must match \b NSC_COLOR_FORMAT
* @param width The width of the bitmap in pixels
* @param height The height of the bitmap in pixels
* @param scanline The stride of a bitmap line in bytes. If \b 0 the value of \b width * bytes
* \b NSC_COLOR_FORMAT is used.
*
* @bug Versions < 3.23.0 do not support \b 0 for scanlines and abort.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* WINPR_RESTRICT context,
wStream* WINPR_RESTRICT s,
const BYTE* WINPR_RESTRICT bmpdata, UINT32 width,
UINT32 height, UINT32 scanline);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR(
"[since 3.23.0] deprecated, insecure! missing length checks. use nsc_process_message",
WINPR_ATTR_NODISCARD FREERDP_API BOOL
nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
BYTE* WINPR_RESTRICT bmpdata, UINT32 x, UINT32 y, UINT32 width,
UINT32 height, UINT32 rowstride, UINT32 format, UINT32 flip));
#endif
/** @brief This function resets a \ref NSC_CONTEXT to a new resolution
*
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
* @param width The width of the context in pixels
* @param height The height of the context in pixels
*
* @return \b TRUE if successful, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL nsc_context_reset(NSC_CONTEXT* WINPR_RESTRICT context, UINT32 width,
UINT32 height);
FREERDP_API void nsc_context_free(NSC_CONTEXT* context);
WINPR_ATTR_MALLOC(nsc_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API NSC_CONTEXT* nsc_context_new(void);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_NSCODEC_H */

View File

@@ -0,0 +1,88 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP6 Planar Codec
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_PLANAR_H
#define FREERDP_CODEC_PLANAR_H
#include <winpr/cast.h>
#include <winpr/crt.h>
#include <freerdp/config.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#define PLANAR_FORMAT_HEADER_CS (1 << 3)
#define PLANAR_FORMAT_HEADER_RLE (1 << 4)
#define PLANAR_FORMAT_HEADER_NA (1 << 5)
#define PLANAR_FORMAT_HEADER_CLL_MASK 0x07
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT data, UINT32 format,
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* WINPR_RESTRICT dstData,
UINT32* WINPR_RESTRICT pDstSize);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height);
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
WINPR_ATTR_MALLOC(freerdp_bitmap_planar_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 width,
UINT32 height);
FREERDP_API void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
BOOL bgr);
FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
BOOL topdown);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("use freerdp_bitmap_decompress_planar instead",
WINPR_ATTR_NODISCARD FREERDP_API BOOL planar_decompress(
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize, UINT32 nSrcWidth,
UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
UINT32 nDstHeight, BOOL vFlip));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_bitmap_decompress_planar(
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar, const BYTE* WINPR_RESTRICT pSrcData,
UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData,
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
UINT32 nDstHeight, BOOL vFlip);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_PLANAR_H */

View File

@@ -0,0 +1,98 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Progressive Codec Bitmap Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_PROGRESSIVE_H
#define FREERDP_CODEC_PROGRESSIVE_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <winpr/wlog.h>
#include <winpr/collections.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_PROGRESSIVE_CONTEXT PROGRESSIVE_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
UINT32 SrcFormat, UINT32 Width, UINT32 Height,
UINT32 ScanLine,
const REGION16* WINPR_RESTRICT invalidRegion,
BYTE** WINPR_RESTRICT ppDstData,
UINT32* WINPR_RESTRICT pDstSize);
WINPR_ATTR_NODISCARD
FREERDP_API INT32 progressive_decompress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
REGION16* WINPR_RESTRICT invalidRegion,
UINT16 surfaceId, UINT32 frameId);
WINPR_ATTR_NODISCARD
FREERDP_API INT32
progressive_create_surface_context(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
UINT16 surfaceId, UINT32 width, UINT32 height);
FREERDP_API int
progressive_delete_surface_context(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
UINT16 surfaceId);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL progressive_context_reset(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive);
FREERDP_API void progressive_context_free(PROGRESSIVE_CONTEXT* progressive);
WINPR_ATTR_MALLOC(progressive_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new(BOOL Compressor);
WINPR_ATTR_MALLOC(progressive_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new_ex(BOOL Compressor,
UINT32 ThreadingFlags);
/** Write a RFX message as simple progressive message to a stream.
* Forward wrapper for \link rfx_write_message_progressive_simple
* @param progressive The progressive codec context
* @param s The stream to write to
* @param msg The message to encode
*
* @since version 3.0.0
* @return \b TRUE in case of success, \b FALSE for any error
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL progressive_rfx_write_message_progressive_simple(
PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive, wStream* WINPR_RESTRICT s,
const RFX_MESSAGE* WINPR_RESTRICT msg);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_PROGRESSIVE_H */

View File

@@ -0,0 +1,160 @@
/**
* Copyright © 2014 Thincast Technologies GmbH
* Copyright © 2014 Hardening <contact@hardening-consulting.com>
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The copyright holders make
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef FREERDP_CODEC_REGION_H
#define FREERDP_CODEC_REGION_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_REGION16_DATA REGION16_DATA;
typedef struct
{
RECTANGLE_16 extents;
REGION16_DATA* data;
} REGION16;
/** computes if two rectangles are equal
* @param r1 first rectangle
* @param r2 second rectangle
* @return if the two rectangles are equal
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
/** computes if two rectangles intersect
* @param r1 first rectangle
* @param r2 second rectangle
* @return if the two rectangles intersect
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
/** computes the intersection of two rectangles
* @param r1 first rectangle
* @param r2 second rectangle
* @param dst resulting intersection
* @return if the two rectangles intersect
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1, const RECTANGLE_16* r2,
RECTANGLE_16* dst);
/** initialize a region16
* @param region the region to initialise
*/
FREERDP_API void region16_init(REGION16* region);
/** @return the number of rectangles of this region16 */
WINPR_ATTR_NODISCARD
FREERDP_API int region16_n_rects(const REGION16* region);
/** returns a pointer to rectangles and the number of rectangles in this region.
* nbRects can be set to nullptr if not interested in the number of rectangles.
* @param region the input region
* @param nbRects if non-nullptr returns the number of rectangles
* @return a pointer on the rectangles
*/
WINPR_ATTR_NODISCARD
FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects);
/** @return the extents rectangle of this region */
WINPR_ATTR_NODISCARD
FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region);
/** returns if the rectangle is empty
* @param rect the rectangle to check
* @return if the rectangle is empty
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect);
/** returns if the region is empty
* @param region the region to check
* @return if the region is empty
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL region16_is_empty(const REGION16* region);
/** clears the region, the region is reset to a (0,0,0,0) region
* @param region the region to clear
*/
FREERDP_API void region16_clear(REGION16* region);
/** dumps the region on stderr
* @param region the region to dump
*/
FREERDP_API void region16_print(const REGION16* region);
/** copies the region to another region
* @param dst destination region
* @param src source region
* @return if the operation was successful (false meaning out-of-memory)
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src);
/** adds a rectangle in src and stores the resulting region in dst
* @param dst destination region
* @param src source region
* @param rect the rectangle to add
* @return if the operation was successful (false meaning out-of-memory)
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src,
const RECTANGLE_16* rect);
/** returns if a rectangle intersects the region
* @param src the region
* @param arg2 the rectangle
* @return if region and rectangle intersect
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL region16_intersects_rect(const REGION16* src, const RECTANGLE_16* arg2);
/** computes the intersection between a region and a rectangle
* @param dst destination region
* @param src the source region
* @param rect the rectangle that intersects
* @return if the operation was successful (false meaning out-of-memory)
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src,
const RECTANGLE_16* rect);
/** release internal data associated with this region
* @param region the region to release
*/
FREERDP_API void region16_uninit(REGION16* region);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_REGION_H */

View File

@@ -0,0 +1,216 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RemoteFX Codec
*
* Copyright 2011 Vic Lee
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_REMOTEFX_H
#define FREERDP_CODEC_REMOTEFX_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/codec/region.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
RLGR1,
RLGR3
} RLGR_MODE;
typedef struct
{
UINT16 x;
UINT16 y;
UINT16 width;
UINT16 height;
} RFX_RECT;
typedef struct
{
UINT16 x;
UINT16 y;
UINT32 width;
UINT32 height;
BYTE* data;
UINT32 scanline;
BOOL allocated;
BYTE quantIdxY;
BYTE quantIdxCb;
BYTE quantIdxCr;
UINT16 xIdx;
UINT16 yIdx;
UINT16 YLen;
UINT16 CbLen;
UINT16 CrLen;
BYTE* YData;
BYTE* CbData;
BYTE* CrData;
BYTE* YCbCrData;
} RFX_TILE;
typedef struct S_RFX_MESSAGE_LIST RFX_MESSAGE_LIST;
typedef struct S_RFX_MESSAGE RFX_MESSAGE;
typedef struct S_RFX_CONTEXT RFX_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT data, UINT32 length,
UINT32 left, UINT32 top, BYTE* WINPR_RESTRICT dst,
UINT32 dstFormat, UINT32 dstStride, UINT32 dstHeight,
REGION16* WINPR_RESTRICT invalidRegion);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 rfx_message_get_frame_idx(const RFX_MESSAGE* WINPR_RESTRICT message);
WINPR_ATTR_NODISCARD
FREERDP_API const UINT32* rfx_message_get_quants(const RFX_MESSAGE* WINPR_RESTRICT message,
UINT16* WINPR_RESTRICT numQuantVals);
WINPR_ATTR_NODISCARD
FREERDP_API const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* WINPR_RESTRICT message,
UINT16* WINPR_RESTRICT numTiles);
WINPR_ATTR_NODISCARD
FREERDP_API UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* WINPR_RESTRICT message);
WINPR_ATTR_NODISCARD
FREERDP_API const RFX_RECT* rfx_message_get_rects(const RFX_MESSAGE* WINPR_RESTRICT message,
UINT16* WINPR_RESTRICT numRects);
WINPR_ATTR_NODISCARD
FREERDP_API UINT16 rfx_message_get_rect_count(const RFX_MESSAGE* WINPR_RESTRICT message);
FREERDP_API void rfx_message_free(RFX_CONTEXT* WINPR_RESTRICT context,
RFX_MESSAGE* WINPR_RESTRICT message);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* WINPR_RESTRICT context,
wStream* WINPR_RESTRICT s,
const RFX_RECT* WINPR_RESTRICT rects, size_t numRects,
const BYTE* WINPR_RESTRICT data, UINT32 width,
UINT32 height, UINT32 scanline);
WINPR_ATTR_MALLOC(rfx_message_free, 2)
WINPR_ATTR_NODISCARD
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* WINPR_RESTRICT context,
const RFX_RECT* WINPR_RESTRICT rects,
size_t numRects, const BYTE* WINPR_RESTRICT data,
UINT32 width, UINT32 height, size_t scanline);
FREERDP_API void rfx_message_list_free(RFX_MESSAGE_LIST* messages);
WINPR_ATTR_MALLOC(rfx_message_list_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RFX_MESSAGE_LIST*
rfx_encode_messages(RFX_CONTEXT* WINPR_RESTRICT context, const RFX_RECT* WINPR_RESTRICT rects,
size_t numRects, const BYTE* WINPR_RESTRICT data, UINT32 width,
UINT32 height, UINT32 scanline, size_t* WINPR_RESTRICT numMessages,
size_t maxDataSize);
WINPR_ATTR_NODISCARD
FREERDP_API const RFX_MESSAGE*
rfx_message_list_get(const RFX_MESSAGE_LIST* WINPR_RESTRICT messages, size_t idx);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* WINPR_RESTRICT context,
wStream* WINPR_RESTRICT s,
const RFX_MESSAGE* WINPR_RESTRICT message);
FREERDP_API void rfx_context_free(RFX_CONTEXT* context);
WINPR_ATTR_MALLOC(rfx_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RFX_CONTEXT* rfx_context_new_ex(BOOL encoder, UINT32 ThreadingFlags);
WINPR_ATTR_MALLOC(rfx_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* WINPR_RESTRICT context, UINT32 width,
UINT32 height);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_context_set_mode(RFX_CONTEXT* WINPR_RESTRICT context, RLGR_MODE mode);
/** Getter for RFX mode
* @param context The RFX context to query
*
* @since version 3.0.0
*
* @return The RFX mode that is currently in use
*/
WINPR_ATTR_NODISCARD
FREERDP_API RLGR_MODE rfx_context_get_mode(RFX_CONTEXT* WINPR_RESTRICT context);
FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* WINPR_RESTRICT context,
UINT32 pixel_format);
/** Getter for RFX pixel format
* @param context The RFX context to query
*
* @since version 3.0.0
*
* @return The RFX pixel format that is currently in use
*/
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 rfx_context_get_pixel_format(RFX_CONTEXT* WINPR_RESTRICT context);
FREERDP_API void rfx_context_set_palette(RFX_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT palette);
/** Getter for RFX palette
* @param context The RFX context to query
*
* @since version 3.0.0
*
* @return The RFX palette that is currently in use or \b nullptr
*/
WINPR_ATTR_NODISCARD
FREERDP_API const BYTE* rfx_context_get_palette(RFX_CONTEXT* WINPR_RESTRICT context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 rfx_context_get_frame_idx(const RFX_CONTEXT* WINPR_RESTRICT context);
/** Write a RFX message as simple progressive message to a stream.
*
* @param rfx The RFX codec context
* @param s The stream to write to
* @param msg The message to encode
*
* @since version 3.0.0
* @return \b TRUE in case of success, \b FALSE for any error
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rfx_write_message_progressive_simple(RFX_CONTEXT* WINPR_RESTRICT rfx,
wStream* WINPR_RESTRICT s,
const RFX_MESSAGE* WINPR_RESTRICT msg);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_REMOTEFX_H */

View File

@@ -0,0 +1,78 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* YUV decoder
*
* Copyright 2017 David Fort <contact@hardening-consulting.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_YUV_H
#define FREERDP_CODEC_YUV_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_YUV_CONTEXT YUV_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API BOOL yuv420_context_decode(
YUV_CONTEXT* WINPR_RESTRICT context, const BYTE* WINPR_RESTRICT pYUVData[3],
const UINT32 iStride[3], UINT32 yuvHeight, DWORD DstFormat, BYTE* WINPR_RESTRICT dest,
UINT32 nDstStep, const RECTANGLE_16* WINPR_RESTRICT regionRects, UINT32 numRegionRects);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL yuv420_context_encode(YUV_CONTEXT* WINPR_RESTRICT context,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 nSrcStep,
UINT32 SrcFormat, const UINT32 iStride[3],
BYTE* WINPR_RESTRICT pYUVData[3],
const RECTANGLE_16* WINPR_RESTRICT regionRects,
UINT32 numRegionRects);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL yuv444_context_decode(
YUV_CONTEXT* WINPR_RESTRICT context, BYTE type, const BYTE* WINPR_RESTRICT pYUVData[3],
const UINT32 iStride[3], UINT32 srcYuvHeight, BYTE* WINPR_RESTRICT pYUVDstData[3],
const UINT32 iDstStride[3], DWORD DstFormat, BYTE* WINPR_RESTRICT dest, UINT32 nDstStep,
const RECTANGLE_16* WINPR_RESTRICT regionRects, UINT32 numRegionRects);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL yuv444_context_encode(YUV_CONTEXT* WINPR_RESTRICT context, BYTE version,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 nSrcStep,
UINT32 SrcFormat, const UINT32 iStride[3],
BYTE* WINPR_RESTRICT pYUVLumaData[3],
BYTE* WINPR_RESTRICT pYUVChromaData[3],
const RECTANGLE_16* WINPR_RESTRICT regionRects,
UINT32 numRegionRects);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL yuv_context_reset(YUV_CONTEXT* WINPR_RESTRICT context, UINT32 width,
UINT32 height);
FREERDP_API void yuv_context_free(YUV_CONTEXT* context);
WINPR_ATTR_MALLOC(yuv_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API YUV_CONTEXT* yuv_context_new(BOOL encoder, UINT32 ThreadingFlags);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_YUV_H */

View File

@@ -0,0 +1,72 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ZGFX (RDP8) Bulk Data Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODEC_ZGFX_H
#define FREERDP_CODEC_ZGFX_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/bulk.h>
#define ZGFX_SEGMENTED_SINGLE 0xE0
#define ZGFX_SEGMENTED_MULTIPART 0xE1
#define ZGFX_PACKET_COMPR_TYPE_RDP8 0x04
#define ZGFX_SEGMENTED_MAXSIZE 65535
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct S_ZGFX_CONTEXT ZGFX_CONTEXT;
WINPR_ATTR_NODISCARD
FREERDP_API int zgfx_decompress(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
BYTE** WINPR_RESTRICT ppDstData,
UINT32* WINPR_RESTRICT pDstSize, UINT32 flags);
WINPR_ATTR_NODISCARD
FREERDP_API int zgfx_compress(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
BYTE** WINPR_RESTRICT ppDstData, UINT32* WINPR_RESTRICT pDstSize,
UINT32* WINPR_RESTRICT pFlags);
WINPR_ATTR_NODISCARD
FREERDP_API int zgfx_compress_to_stream(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
wStream* WINPR_RESTRICT sDst,
const BYTE* WINPR_RESTRICT pUncompressed,
UINT32 uncompressedSize, UINT32* WINPR_RESTRICT pFlags);
FREERDP_API void zgfx_context_reset(ZGFX_CONTEXT* WINPR_RESTRICT zgfx, BOOL flush);
FREERDP_API void zgfx_context_free(ZGFX_CONTEXT* zgfx);
WINPR_ATTR_MALLOC(zgfx_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_ZGFX_H */

View File

@@ -0,0 +1,115 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP Codecs
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CODECS_H
#define FREERDP_CODECS_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/codec/h264.h>
#include <freerdp/codec/clear.h>
#include <freerdp/codec/planar.h>
#include <freerdp/codec/interleaved.h>
#include <freerdp/codec/progressive.h>
typedef enum
{
FREERDP_CODEC_INTERLEAVED = 0x00000001,
FREERDP_CODEC_PLANAR = 0x00000002,
FREERDP_CODEC_NSCODEC = 0x00000004,
FREERDP_CODEC_REMOTEFX = 0x00000008,
FREERDP_CODEC_CLEARCODEC = 0x00000010,
FREERDP_CODEC_ALPHACODEC = 0x00000020,
FREERDP_CODEC_PROGRESSIVE = 0x00000040,
FREERDP_CODEC_AVC420 = 0x00000080,
FREERDP_CODEC_AVC444 = 0x00000100,
FREERDP_CODEC_ALL = 0x7FFFFFFF /* C enum types are restricted to int */
} FreeRDP_CodecFlags;
#ifdef __cplusplus
extern "C"
{
#endif
struct rdp_codecs
{
UINT32 ThreadingFlags; /** @since version 3.6.0 */
RFX_CONTEXT* rfx;
NSC_CONTEXT* nsc;
H264_CONTEXT* h264;
CLEAR_CONTEXT* clear;
PROGRESSIVE_CONTEXT* progressive;
BITMAP_PLANAR_CONTEXT* planar;
BITMAP_INTERLEAVED_CONTEXT* interleaved;
};
typedef struct rdp_codecs rdpCodecs;
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width,
UINT32 height);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
UINT32 height);
/**
* @brief Free a rdpCodecs instance
* @param codecs A pointer to a rdpCodecs instance or nullptr
* @since version 3.6.0
*/
FREERDP_API void freerdp_client_codecs_free(rdpCodecs* codecs);
/**
* @brief Allocate a rdpCodecs instance.
* @return A newly allocated instance or \b nullptr in case of failure.
* @since version 3.6.0
*/
WINPR_ATTR_MALLOC(freerdp_client_codecs_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCodecs* freerdp_client_codecs_new(UINT32 ThreadingFlags);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("[since 3.6.0] Use freerdp_client_codecs_free",
FREERDP_API void codecs_free(rdpCodecs* codecs));
WINPR_DEPRECATED_VAR(
"[since 3.6.0] Use freerdp_client_codecs_new",
WINPR_ATTR_MALLOC(codecs_free, 1)
WINPR_ATTR_NODISCARD FREERDP_API rdpCodecs* codecs_new(rdpContext* context));
#endif
/** @brief return a string representation of the given codecid
* * @param id The codec to stringify
* @return The name of the codecid
* @since version 3.18.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_codec_id_to_str(UINT32 id);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODECS_H */

View File

@@ -0,0 +1,70 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP Constants
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CONSTANTS_H
#define FREERDP_CONSTANTS_H
/**
* Codec IDs
*/
enum RDP_CODEC_ID
{
RDP_CODEC_ID_NONE = 0x00,
RDP_CODEC_ID_NSCODEC = 0x01,
RDP_CODEC_ID_JPEG = 0x02,
RDP_CODEC_ID_REMOTEFX = 0x03,
RDP_CODEC_ID_IMAGE_REMOTEFX = 0x04
};
/**
* CPU Optimization flags
*/
#define CPU_SSE2 0x1
/**
* OSMajorType
*/
#define OSMAJORTYPE_UNSPECIFIED 0x0000
#define OSMAJORTYPE_WINDOWS 0x0001
#define OSMAJORTYPE_OS2 0x0002
#define OSMAJORTYPE_MACINTOSH 0x0003
#define OSMAJORTYPE_UNIX 0x0004
#define OSMAJORTYPE_IOS 0x0005
#define OSMAJORTYPE_OSX 0x0006
#define OSMAJORTYPE_ANDROID 0x0007
#define OSMAJORTYPE_CHROME_OS 0x0008
/**
* OSMinorType
*/
#define OSMINORTYPE_UNSPECIFIED 0x0000
#define OSMINORTYPE_WINDOWS_31X 0x0001
#define OSMINORTYPE_WINDOWS_95 0x0002
#define OSMINORTYPE_WINDOWS_NT 0x0003
#define OSMINORTYPE_OS2_V21 0x0004
#define OSMINORTYPE_POWER_PC 0x0005
#define OSMINORTYPE_MACINTOSH 0x0006
#define OSMINORTYPE_NATIVE_XSERVER 0x0007
#define OSMINORTYPE_PSEUDO_XSERVER 0x0008
#define OSMINORTYPE_WINDOWS_RT 0x0009
/* As of 2022-03-29 the following does not exist officially in [MS-RDPBCGR] */
#define OSMINORTYPE_NATIVE_WAYLAND (0xFFFF - 1)
#define OSMINORTYPE_NATIVE_SDL (0xFFFF - 2)
#endif /* FREERDP_CONSTANTS_H */

View File

@@ -0,0 +1,164 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ASN.1 Basic Encoding Rules (BER)
*
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_BER_H
#define FREERDP_CRYPTO_BER_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <winpr/stream.h>
/* BER type */
/* Class - bits 8 and 7 */
#define BER_CLASS_MASK 0xC0
#define BER_CLASS_UNIV 0x00 /* 0 0 */
#define BER_CLASS_APPL 0x40 /* 0 1 */
#define BER_CLASS_CTXT 0x80 /* 1 0 */
#define BER_CLASS_PRIV 0xC0 /* 1 1 */
/* P/C - bit 6 */
#define BER_PC_MASK 0x20
#define BER_PRIMITIVE 0x00 /* 0 */
#define BER_CONSTRUCT 0x20 /* 1 */
/* Tag - bits 5 to 1 */
#define BER_TAG_MASK 0x1F
#define BER_TAG_BOOLEAN 0x01
#define BER_TAG_INTEGER 0x02
#define BER_TAG_BIT_STRING 0x03
#define BER_TAG_OCTET_STRING 0x04
#define BER_TAG_OBJECT_IDENFIER 0x06
#define BER_TAG_ENUMERATED 0x0A
#define BER_TAG_SEQUENCE 0x10
#define BER_TAG_SEQUENCE_OF 0x10
#define BER_PC(_pc) (_pc ? BER_CONSTRUCT : BER_PRIMITIVE)
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_length(wStream* s, size_t* length);
FREERDP_API size_t ber_write_length(wStream* s, size_t length);
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
WINPR_ATTR_NODISCARD
FREERDP_API size_t _ber_sizeof_length(size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_universal_tag(wStream* s, BYTE tag, BOOL pc);
FREERDP_API size_t ber_write_universal_tag(wStream* s, BYTE tag, BOOL pc);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_application_tag(wStream* s, BYTE tag, size_t* length);
FREERDP_API void ber_write_application_tag(wStream* s, BYTE tag, size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_enumerated(wStream* s, BYTE* enumerated, BYTE count);
FREERDP_API void ber_write_enumerated(wStream* s, BYTE enumerated, BYTE count);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_contextual_tag(wStream* s, BYTE tag, size_t* length, BOOL pc);
FREERDP_API size_t ber_write_contextual_tag(wStream* s, BYTE tag, size_t length, BOOL pc);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_contextual_tag(size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_sequence_tag(wStream* s, size_t* length);
FREERDP_API size_t ber_write_sequence_tag(wStream* s, size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_sequence(size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_sequence_tag(size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_bit_string(wStream* s, size_t* length, BYTE* padding);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_octet_string_tag(wStream* s, size_t* length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_octet_string(wStream* s, BYTE** content, size_t* length);
FREERDP_API size_t ber_write_octet_string_tag(wStream* s, size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_octet_string(size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_contextual_octet_string(size_t length);
FREERDP_API size_t ber_write_char_to_unicode_octet_string(wStream* s, const char* str);
FREERDP_API size_t ber_write_contextual_char_to_unicode_octet_string(wStream* s, BYTE tag,
const char* oct_str);
FREERDP_API size_t ber_write_octet_string(wStream* s, const BYTE* oct_str, size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_char_from_unicode_octet_string(wStream* s, char** str);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_unicode_octet_string(wStream* s, LPWSTR* str);
FREERDP_API size_t ber_write_contextual_octet_string(wStream* s, BYTE tag, const BYTE* oct_str,
size_t length);
FREERDP_API size_t ber_write_contextual_unicode_octet_string(wStream* s, BYTE tag, LPWSTR str);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_BOOL(wStream* s, BOOL* value);
FREERDP_API void ber_write_BOOL(wStream* s, BOOL value);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_integer(wStream* s, UINT32* value);
FREERDP_API size_t ber_write_integer(wStream* s, UINT32 value);
FREERDP_API size_t ber_write_contextual_integer(wStream* s, BYTE tag, UINT32 value);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL ber_read_integer_length(wStream* s, size_t* length);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_integer(UINT32 value);
WINPR_ATTR_NODISCARD
FREERDP_API size_t ber_sizeof_contextual_integer(UINT32 value);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_BER_H */

View File

@@ -0,0 +1,172 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Certificate Handling
*
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_CERTIFICATE_H
#define FREERDP_CRYPTO_CERTIFICATE_H
#include <winpr/crypto.h>
#include <freerdp/api.h>
#ifdef __cplusplus
extern "C"
{
#endif
enum FREERDP_CERT_PARAM
{
FREERDP_CERT_RSA_E,
FREERDP_CERT_RSA_N
};
typedef struct rdp_certificate rdpCertificate;
FREERDP_API void freerdp_certificate_free(rdpCertificate* certificate);
WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificate* freerdp_certificate_new(void);
WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificate* freerdp_certificate_new_from_file(const char* file);
WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificate* freerdp_certificate_new_from_pem(const char* pem);
WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificate* freerdp_certificate_new_from_der(const BYTE* data, size_t length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_is_rsa(const rdpCertificate* certificate);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_hash(const rdpCertificate* certificate,
const char* hash, size_t* plength);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_fingerprint_by_hash(const rdpCertificate* certificate,
const char* hash);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char*
freerdp_certificate_get_fingerprint_by_hash_ex(const rdpCertificate* certificate,
const char* hash, BOOL separator);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_fingerprint(const rdpCertificate* certificate);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_pem(const rdpCertificate* certificate,
size_t* pLength);
/**
* @brief Get the certificate as PEM string
* @param certificate A certificate instance to query
* @param pLength A pointer to the size in bytes of the PEM string
* @param withCertChain \b TRUE to export a full chain PEM, \b FALSE for only the last
* certificate in the chain
* @return A newly allocated string containing the requested PEM (free to deallocate) or nullptr
* @since version 3.8.0
*/
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_pem_ex(const rdpCertificate* certificate,
size_t* pLength, BOOL withCertChain);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* freerdp_certificate_get_der(const rdpCertificate* certificate,
size_t* pLength);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_subject(const rdpCertificate* certificate);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_issuer(const rdpCertificate* certificate);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_upn(const rdpCertificate* certificate);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_email(const rdpCertificate* certificate);
/**
* @brief return the date string of the certificate validity
* @param certificate The certificate instance to query
* @param startDate \b TRUE return the start date, \b FALSE for the end date
* @return A newly allocated string containing the date, use \b free to deallocate
* @since version 3.8.0
*/
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_validity(const rdpCertificate* certificate,
BOOL startDate);
WINPR_ATTR_NODISCARD
FREERDP_API WINPR_MD_TYPE freerdp_certificate_get_signature_alg(const rdpCertificate* cert);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_common_name(const rdpCertificate* cert,
size_t* plength);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char** freerdp_certificate_get_dns_names(const rdpCertificate* cert, size_t* pcount,
size_t** pplengths);
FREERDP_API void freerdp_certificate_free_dns_names(size_t count, size_t* lengths,
char** names);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_check_eku(const rdpCertificate* certificate, int nid);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_get_public_key(const rdpCertificate* cert,
BYTE** PublicKey, DWORD* PublicKeyLength);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_verify(const rdpCertificate* cert,
const char* certificate_store_path);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_is_rdp_security_compatible(const rdpCertificate* cert);
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_get_param(const rdpCertificate* cert,
enum FREERDP_CERT_PARAM what, size_t* psize);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_CERTIFICATE_H */

View File

@@ -0,0 +1,92 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Certificate Handling
*
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_CERTIFICATE_DATA_H
#define FREERDP_CRYPTO_CERTIFICATE_DATA_H
#include <freerdp/api.h>
#include <freerdp/settings.h>
#include <freerdp/crypto/certificate.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_certificate_data rdpCertificateData;
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_data_hash(const char* hostname, UINT16 port);
FREERDP_API void freerdp_certificate_data_free(rdpCertificateData* data);
WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificateData* freerdp_certificate_data_new(const char* hostname, UINT16 port,
const rdpCertificate* xcert);
WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificateData* freerdp_certificate_data_new_from_pem(const char* hostname,
UINT16 port,
const char* pem,
size_t length);
WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificateData*
freerdp_certificate_data_new_from_file(const char* hostname, UINT16 port, const char* file);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_data_equal(const rdpCertificateData* a,
const rdpCertificateData* b);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_hash(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_host(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API UINT16 freerdp_certificate_data_get_port(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_pem(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_pem_ex(const rdpCertificateData* cert,
BOOL withFullChain);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_subject(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_certificate_data_get_issuer(const rdpCertificateData* cert);
WINPR_ATTR_NODISCARD
FREERDP_API const char*
freerdp_certificate_data_get_fingerprint(const rdpCertificateData* cert);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_CERTIFICATE_DATA_H */

View File

@@ -0,0 +1,93 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Certificate Handling
*
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_CERTIFICATE_STORE_H
#define FREERDP_CRYPTO_CERTIFICATE_STORE_H
#include <freerdp/api.h>
#include <freerdp/settings.h>
#include <freerdp/crypto/certificate_data.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_certificate_store rdpCertificateStore;
typedef enum
{
CERT_STORE_NOT_FOUND = 1,
CERT_STORE_MATCH = 0,
CERT_STORE_MISMATCH = -1
} freerdp_certificate_store_result;
FREERDP_API void freerdp_certificate_store_free(rdpCertificateStore* store);
WINPR_ATTR_MALLOC(freerdp_certificate_store_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificateStore* freerdp_certificate_store_new(const rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API freerdp_certificate_store_result freerdp_certificate_store_contains_data(
rdpCertificateStore* store, const rdpCertificateData* data);
WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpCertificateData*
freerdp_certificate_store_load_data(rdpCertificateStore* store, const char* host, UINT16 port);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_store_save_data(rdpCertificateStore* store,
const rdpCertificateData* data);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_certificate_store_remove_data(rdpCertificateStore* store,
const rdpCertificateData* data);
WINPR_ATTR_NODISCARD
FREERDP_API const char*
freerdp_certificate_store_get_certs_path(const rdpCertificateStore* store);
WINPR_ATTR_NODISCARD
FREERDP_API const char*
freerdp_certificate_store_get_hosts_path(const rdpCertificateStore* store);
/** Query the certificate store path
*
* @param store The certificate store to query
* @param host The hostname to look up
* @param port The port to look up
*
* @since version 3.0.0
*
* @return The certificate store file path or \b nullptr
*/
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_certificate_store_get_cert_path(const rdpCertificateStore* store,
const char* host, UINT16 port);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_CERTIFICATE_STORE_H */

View File

@@ -0,0 +1,80 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Cryptographic Abstraction Layer
*
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_H
#define FREERDP_CRYPTO_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/crypto/certificate_data.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct rdp_CertInfo
{
BYTE* Modulus;
DWORD ModulusLength;
BYTE exponent[4];
};
typedef struct rdp_CertInfo rdpCertInfo;
WINPR_ATTR_NODISCARD
FREERDP_API char* crypto_base64_encode(const BYTE* WINPR_RESTRICT data, size_t length);
/** BASE64 encode data
*
* @param data The data to encode
* @param length The length of the data in bytes
* @param withCrLf Option to split the encoded data with CRLF linebreaks
*
* @since version 3.0.0
*
* @return The encoded BASE64 string or \b nullptr if failed
*/
WINPR_ATTR_NODISCARD
FREERDP_API char* crypto_base64_encode_ex(const BYTE* WINPR_RESTRICT data, size_t length,
BOOL withCrLf);
FREERDP_API void crypto_base64_decode(const char* WINPR_RESTRICT enc_data, size_t length,
BYTE** WINPR_RESTRICT dec_data,
size_t* WINPR_RESTRICT res_length);
WINPR_ATTR_NODISCARD
FREERDP_API char* crypto_base64url_encode(const BYTE* WINPR_RESTRICT data, size_t length);
FREERDP_API void crypto_base64url_decode(const char* WINPR_RESTRICT enc_data, size_t length,
BYTE** WINPR_RESTRICT dec_data,
size_t* WINPR_RESTRICT res_length);
WINPR_ATTR_NODISCARD
FREERDP_API char* crypto_read_pem(const char* WINPR_RESTRICT filename,
size_t* WINPR_RESTRICT plength);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL crypto_write_pem(const char* WINPR_RESTRICT filename,
const char* WINPR_RESTRICT pem, size_t length);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_H */

View File

@@ -0,0 +1,55 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ASN.1 Basic Encoding Rules (DER)
*
* Copyright 2011 Samsung, Author Jiten Pathy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_DER_H
#define FREERDP_CRYPTO_DER_H
#include <freerdp/config.h>
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
#include <freerdp/crypto/er.h>
#ifdef __cplusplus
extern "C"
{
#endif
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int _der_skip_length(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int der_write_length(wStream* s, int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int der_get_content_length(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int der_skip_octet_string(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int der_skip_sequence_tag(int length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int der_write_sequence_tag(wStream* s, int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int der_skip_contextual_tag(int length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int der_write_contextual_tag(wStream* s, BYTE tag, int length,
BOOL pc));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API void der_write_octet_string(wStream* s, BYTE* oct_str,
int length));
#ifdef __cplusplus
}
#endif
#endif
#endif /* FREERDP_CRYPTO_DER_H */

View File

@@ -0,0 +1,132 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ASN.1 Encoding Rules (BER/DER common functions)
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Modified by Jiten Pathy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_ER_H
#define FREERDP_CRYPTO_ER_H
#include <freerdp/config.h>
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <winpr/stream.h>
/* ER type */
/* Class - bits 8 and 7 */
#define ER_CLASS_MASK 0xC0
#define ER_CLASS_UNIV 0x00 /* 0 0 */
#define ER_CLASS_APPL 0x40 /* 0 1 */
#define ER_CLASS_CTXT 0x80 /* 1 0 */
#define ER_CLASS_PRIV 0xC0 /* 1 1 */
/* P/C - bit 6 */
#define ER_PC_MASK 0x20
#define ER_PRIMITIVE 0x00 /* 0 */
#define ER_CONSTRUCT 0x20 /* 1 */
/* Tag - bits 5 to 1 */
#define ER_TAG_MASK 0x1F
#define ER_TAG_BOOLEAN 0x01
#define ER_TAG_INTEGER 0x02
#define ER_TAG_BIT_STRING 0x03
#define ER_TAG_OCTET_STRING 0x04
#define ER_TAG_OBJECT_IDENTIFIER 0x06
#define ER_TAG_ENUMERATED 0x0A
#define ER_TAG_SEQUENCE 0x10
#define ER_TAG_SEQUENCE_OF 0x10
#define ER_TAG_GENERAL_STRING 0x1B
#define ER_TAG_GENERALIZED_TIME 0x18
#define ER_PC(_pc) (_pc ? ER_CONSTRUCT : ER_PRIMITIVE)
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API void er_read_length(wStream* s, int* length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int er_write_length(wStream* s, int length, BOOL flag));
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int _er_skip_length(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_get_content_length(int length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_universal_tag(wStream* s, BYTE tag, BOOL pc));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API void er_write_universal_tag(wStream* s, BYTE tag, BOOL pc));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_application_tag(wStream* s, BYTE tag,
int* length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API void er_write_application_tag(wStream* s, BYTE tag, int length,
BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_enumerated(wStream* s, BYTE* enumerated,
BYTE count));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API void er_write_enumerated(wStream* s, BYTE enumerated,
BYTE count, BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_contextual_tag(wStream* s, BYTE tag, int* length,
BOOL pc));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int er_write_contextual_tag(wStream* s, BYTE tag, int length,
BOOL pc, BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_skip_contextual_tag(int length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_sequence_tag(wStream* s, int* length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int er_write_sequence_tag(wStream* s, int length, BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_skip_sequence(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_skip_sequence_tag(int length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_bit_string(wStream* s, int* length,
BYTE* padding));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_write_bit_string_tag(wStream* s, UINT32 length,
BYTE padding, BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_octet_string(wStream* s, int* length));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API void er_write_octet_string(wStream* s, BYTE* oct_str,
int length, BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API int er_write_octet_string_tag(wStream* s, int length,
BOOL flag));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_skip_octet_string(int length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API BOOL er_read_BOOL(wStream* s, BOOL* value));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API void er_write_BOOL(wStream* s, BOOL value));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_integer(wStream* s, UINT32* value));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_write_integer(wStream* s, INT32 value));
WINPR_DEPRECATED_VAR("since 3.22.0",
FREERDP_API BOOL er_read_integer_length(wStream* s, int* length));
WINPR_DEPRECATED_VAR("since 3.22.0", FREERDP_API int er_skip_integer(INT32 value));
#ifdef __cplusplus
}
#endif
#endif
#endif /* FREERDP_CRYPTO_ER_H */

View File

@@ -0,0 +1,105 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* ASN.1 Packed Encoding Rules (BER)
*
* Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_PER_H
#define FREERDP_CRYPTO_PER_H
#include <freerdp/api.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_length(wStream* s, UINT16* length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_length(wStream* s, UINT16 length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_choice(wStream* s, BYTE* choice);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_choice(wStream* s, BYTE choice);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_selection(wStream* s, BYTE* selection);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_selection(wStream* s, BYTE selection);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_number_of_sets(wStream* s, BYTE* number);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_number_of_sets(wStream* s, BYTE number);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_padding(wStream* s, UINT16 length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_padding(wStream* s, UINT16 length);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_integer(wStream* s, UINT32* integer);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_integer16(wStream* s, UINT16* integer, UINT16 min);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_integer(wStream* s, UINT32 integer);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_integer16(wStream* s, UINT16 integer, UINT16 min);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_enumerated(wStream* s, BYTE* enumerated, BYTE count);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_enumerated(wStream* s, BYTE enumerated, BYTE count);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_object_identifier(wStream* s, const BYTE oid[6]);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_object_identifier(wStream* s, const BYTE oid[6]);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_octet_string(wStream* s, const BYTE* oct_str, UINT16 length,
UINT16 min);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_octet_string(wStream* s, const BYTE* oct_str, UINT16 length,
UINT16 min);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_read_numeric_string(wStream* s, UINT16 min);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL per_write_numeric_string(wStream* s, const BYTE* num_str, UINT16 length,
UINT16 min);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_PER_H */

View File

@@ -0,0 +1,104 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Private key Handling
*
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CRYPTO_PRIVATEKEY_H
#define FREERDP_CRYPTO_PRIVATEKEY_H
#include <freerdp/api.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_private_key rdpPrivateKey;
FREERDP_API void freerdp_key_free(rdpPrivateKey* key);
WINPR_ATTR_MALLOC(freerdp_key_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpPrivateKey* freerdp_key_new(void);
WINPR_ATTR_NODISCARD
FREERDP_API rdpPrivateKey* freerdp_key_new_from_file(const char* keyfile);
WINPR_ATTR_MALLOC(freerdp_key_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpPrivateKey* freerdp_key_new_from_pem(const char* pem);
/** @brief Create a private key from file \b keyfile with optional password \b password
*
* @param keyfile The file to read the key from
* @param password The optional password the key is enecrypted with, \b nullptr for unencrypted
* @return An allocated private key, \b nullptr in case of failure.
* @since version 3.16.0
*/
WINPR_ATTR_MALLOC(freerdp_key_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpPrivateKey* freerdp_key_new_from_file_enc(const char* keyfile,
const char* password);
/** @brief Create a private key from a PEM file with optional \b password
*
* @param pem The PEM string to use
* @param password The optional password, use \b nullptr if no encryption is used.
* @return An allocated private key, \b nullptr in case of failure.
* @since version 3.16.0
*/
WINPR_ATTR_MALLOC(freerdp_key_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpPrivateKey* freerdp_key_new_from_pem_enc(const char* pem, const char* password);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_key_is_rsa(const rdpPrivateKey* key);
WINPR_ATTR_NODISCARD
FREERDP_API size_t freerdp_key_get_bits(const rdpPrivateKey* key);
/** @brief Create a PEM from a private key
*
* @param key The key to convert
* @param plen Optional pointer, value set to strlen of the PEM
* @param password Optional password string. If \b nullptr an unencrypted PEM is written.
* @return A PEM string or \b nullptr in case of errors
*
* @since version 3.16.0
*/
WINPR_ATTR_MALLOC(free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API char* freerdp_key_get_pem(const rdpPrivateKey* key, size_t* plen,
const char* password);
/** @brief Create a new private key
*
* @param key The key to initialize
* @param type The key type (RSA, ...)
* @param count The number of arguments following, depends on type
* @return \b TRUE for success, \b FALSE otherwise
* @since version 3.16.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_key_generate(rdpPrivateKey* key, const char* type, size_t count, ...);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CRYPTO_PRIVATEKEY_H */

View File

@@ -0,0 +1,40 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Display update notifications
*
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_DISPLAY_H
#define FREERDP_DISPLAY_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_display_send_monitor_layout(rdpContext* context, UINT32 monitorCount,
const MONITOR_DEF* monitorDefArray);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_DISPLAY_UPDATE_H */

View File

@@ -0,0 +1,185 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Interface
*
* Copyright 2010-2011 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* DVC Plugin API: See the original MS DVC Client API:
* http://msdn.microsoft.com/en-us/library/bb540880%28v=VS.85%29.aspx
*
* The FreeRDP DVC Plugin API is a simulation of the MS DVC Client API in C.
* The main difference is that every interface method must take an instance
* pointer as the first parameter.
*/
/**
* Implemented by DRDYNVC:
* o IWTSVirtualChannelManager
* o IWTSListener
* o IWTSVirtualChannel
*
* Implemented by DVC plugin:
* o IWTSPlugin
* o IWTSListenerCallback
* o IWTSVirtualChannelCallback
*
* A basic DVC plugin implementation:
* 1. DVCPluginEntry:
* The plugin entry point, which creates and initializes a new IWTSPlugin
* instance
* 2. IWTSPlugin.Initialize:
* Call IWTSVirtualChannelManager.CreateListener with a newly created
* IWTSListenerCallback instance
* 3. IWTSListenerCallback.OnNewChannelConnection:
* Create IWTSVirtualChannelCallback instance if the new channel is accepted
*/
#ifndef FREERDP_DVC_H
#define FREERDP_DVC_H
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_IWTSVirtualChannelManager IWTSVirtualChannelManager;
typedef struct s_IWTSListener IWTSListener;
typedef struct s_IWTSVirtualChannel IWTSVirtualChannel;
typedef struct s_IWTSPlugin IWTSPlugin;
typedef struct s_IWTSListenerCallback IWTSListenerCallback;
typedef struct s_IWTSVirtualChannelCallback IWTSVirtualChannelCallback;
struct s_IWTSListener
{
/* Retrieves the listener-specific configuration. */
WINPR_ATTR_NODISCARD UINT (*GetConfiguration)(IWTSListener* pListener,
void** ppPropertyBag);
void* pInterface;
};
struct s_IWTSVirtualChannel
{
/* Starts a write request on the channel. */
WINPR_ATTR_NODISCARD UINT (*Write)(IWTSVirtualChannel* pChannel, ULONG cbSize,
const BYTE* pBuffer, void* pReserved);
/* Closes the channel. */
WINPR_ATTR_NODISCARD UINT (*Close)(IWTSVirtualChannel* pChannel);
};
struct s_IWTSVirtualChannelManager
{
/* Returns an instance of a listener object that listens on a specific
endpoint, or creates a static channel. */
WINPR_ATTR_NODISCARD UINT (*CreateListener)(IWTSVirtualChannelManager* pChannelMgr,
const char* pszChannelName, ULONG ulFlags,
IWTSListenerCallback* pListenerCallback,
IWTSListener** ppListener);
/* Find the channel or ID to send data to a specific endpoint. */
WINPR_ATTR_NODISCARD UINT32 (*GetChannelId)(IWTSVirtualChannel* channel);
WINPR_ATTR_NODISCARD IWTSVirtualChannel* (*FindChannelById)(
IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId);
WINPR_ATTR_NODISCARD const char* (*GetChannelName)(IWTSVirtualChannel* channel);
UINT (*DestroyListener)(IWTSVirtualChannelManager* pChannelMgr, IWTSListener* ppListener);
};
struct s_IWTSPlugin
{
/* Used for the first call that is made from the client to the plug-in. */
WINPR_ATTR_NODISCARD UINT (*Initialize)(IWTSPlugin* pPlugin,
IWTSVirtualChannelManager* pChannelMgr);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has successfully connected to the Remote Desktop Session Host (RD
Session Host) server. */
WINPR_ATTR_NODISCARD UINT (*Connected)(IWTSPlugin* pPlugin);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has disconnected from the RD Session Host server. */
WINPR_ATTR_NODISCARD UINT (*Disconnected)(IWTSPlugin* pPlugin, DWORD dwDisconnectCode);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has terminated. */
WINPR_ATTR_NODISCARD UINT (*Terminated)(IWTSPlugin* pPlugin);
WINPR_ATTR_NODISCARD UINT (*Attached)(IWTSPlugin* pPlugin);
WINPR_ATTR_NODISCARD UINT (*Detached)(IWTSPlugin* pPlugin);
/* Extended */
void* pInterface;
};
struct s_IWTSListenerCallback
{
/* Accepts or denies a connection request for an incoming connection to
the associated listener. */
WINPR_ATTR_NODISCARD
UINT (*OnNewChannelConnection)(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback);
void* pInterface;
};
struct s_IWTSVirtualChannelCallback
{
WINPR_ATTR_NODISCARD UINT (*OnDataReceived)(
IWTSVirtualChannelCallback* pChannelCallback,
wStream* data); /**< Notifies the user about data that is being received. */
WINPR_ATTR_NODISCARD UINT (*OnOpen)(
IWTSVirtualChannelCallback*
pChannelCallback); /**< Notifies the user that the channel has been opened. */
WINPR_ATTR_NODISCARD UINT (*OnClose)(
IWTSVirtualChannelCallback*
pChannelCallback); /**< Notifies the user that the channel has been closed. */
void* pInterface;
};
/* The DVC Plugin entry points */
typedef struct rdp_context rdpContext; /* forward declaration, necessary to avoid
* circular includes */
typedef struct S_IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS;
struct S_IDRDYNVC_ENTRY_POINTS
{
WINPR_ATTR_NODISCARD UINT (*RegisterPlugin)(IDRDYNVC_ENTRY_POINTS* pEntryPoints,
const char* name, IWTSPlugin* pPlugin);
IWTSPlugin* (*GetPlugin)(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name);
const ADDIN_ARGV* (*GetPluginData)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
WINPR_ATTR_NODISCARD rdpSettings* (*GetRdpSettings)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
WINPR_ATTR_NODISCARD rdpContext* (*GetRdpContext)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
};
typedef UINT(VCAPITYPE* PDVC_PLUGIN_ENTRY)(IDRDYNVC_ENTRY_POINTS*);
WINPR_ATTR_NODISCARD
FREERDP_API void* get_callback_by_name(const char* name, void** context);
FREERDP_API void add_callback_by_name(const char* name, void* fkt, void* context);
FREERDP_API void remove_callback_by_name(const char* name, void* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_DVC_H */

View File

@@ -0,0 +1,444 @@
/**
* WinPR: Windows Portable Runtime
* Smart Card API emulation
*
* Copyright 2021 Armin Novak <armin.novak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_SMARTCARD_EMULATE_PRIVATE_H
#define WINPR_SMARTCARD_EMULATE_PRIVATE_H
#include <winpr/platform.h>
#include <winpr/smartcard.h>
#include <freerdp/api.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct smartcard_emulation_context SmartcardEmulationContext;
FREERDP_API void Emulate_Free(SmartcardEmulationContext* context);
WINPR_ATTR_MALLOC(Emulate_Free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API SmartcardEmulationContext* Emulate_New(const rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL Emulate_IsConfigured(SmartcardEmulationContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardEstablishContext(SmartcardEmulationContext* smartcard,
DWORD dwScope, LPCVOID pvReserved1,
LPCVOID pvReserved2,
LPSCARDCONTEXT phContext);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardReleaseContext(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIsValidContext(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPSTR mszGroups,
LPDWORD pcchGroups);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPWSTR mszGroups,
LPDWORD pcchGroups);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReadersA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR mszGroups,
LPSTR mszReaders, LPDWORD pcchReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR mszGroups,
LPWSTR mszReaders, LPDWORD pcchReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCBYTE pbAtr,
LPCGUID rgquidInterfaces,
DWORD cguidInterfaceCount, CHAR* mszCards,
LPDWORD pcchCards);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCBYTE pbAtr,
LPCGUID rgquidInterfaces,
DWORD cguidInterfaceCount, WCHAR* mszCards,
LPDWORD pcchCards);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szCard,
LPGUID pguidInterfaces,
LPDWORD pcguidInterfaces);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szCard,
LPGUID pguidInterfaces,
LPDWORD pcguidInterfaces);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szCard,
LPGUID pguidProviderId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szCard,
LPGUID pguidProviderId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
DWORD dwProviderId, CHAR* szProvider, LPDWORD pcchProvider);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
DWORD dwProviderId, WCHAR* szProvider, LPDWORD pcchProvider);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szReaderName, LPCSTR szDeviceName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szReaderName,
LPCWSTR szDeviceName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetReaderA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szReaderName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetReaderW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szReaderName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szReaderName, LPCSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szReaderName,
LPCWSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI
Emulate_SCardRemoveReaderFromGroupA(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPCSTR szReaderName, LPCSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI
Emulate_SCardRemoveReaderFromGroupW(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPCWSTR szReaderName, LPCWSTR szGroupName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
DWORD dwProviderId, LPCSTR szProvider);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
DWORD dwProviderId, LPCWSTR szProvider);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szCardName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szCardName);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardFreeMemory(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPVOID pvMem);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE WINAPI Emulate_SCardAccessStartedEvent(SmartcardEmulationContext* smartcard);
FREERDP_API void WINAPI Emulate_SCardReleaseStartedEvent(SmartcardEmulationContext* smartcard);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardLocateCardsA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR mszCards,
LPSCARD_READERSTATEA rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardLocateCardsW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR mszCards,
LPSCARD_READERSTATEW rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
LPSCARD_READERSTATEA rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
LPSCARD_READERSTATEW rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, DWORD dwTimeout,
LPSCARD_READERSTATEA rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, DWORD dwTimeout,
LPSCARD_READERSTATEW rgReaderStates,
DWORD cReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardCancel(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardConnectA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szReader,
DWORD dwShareMode, DWORD dwPreferredProtocols,
LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardConnectW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szReader,
DWORD dwShareMode, DWORD dwPreferredProtocols,
LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardReconnect(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwShareMode,
DWORD dwPreferredProtocols,
DWORD dwInitialization,
LPDWORD pdwActiveProtocol);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardDisconnect(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwDisposition);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardBeginTransaction(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardEndTransaction(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwDisposition);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardCancelTransaction(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardState(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, LPDWORD pdwState,
LPDWORD pdwProtocol, LPBYTE pbAtr,
LPDWORD pcbAtrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardStatusA(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, LPSTR mszReaderNames,
LPDWORD pcchReaderLen, LPDWORD pdwState,
LPDWORD pdwProtocol, LPBYTE pbAtr,
LPDWORD pcbAtrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardStatusW(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, LPWSTR mszReaderNames,
LPDWORD pcchReaderLen, LPDWORD pdwState,
LPDWORD pdwProtocol, LPBYTE pbAtr,
LPDWORD pcbAtrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardTransmit(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci,
LPCBYTE pbSendBuffer, DWORD cbSendLength,
LPSCARD_IO_REQUEST pioRecvPci,
LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetTransmitCount(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard,
LPDWORD pcTransmitCount);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardControl(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwControlCode,
LPCVOID lpInBuffer, DWORD cbInBufferSize,
LPVOID lpOutBuffer, DWORD cbOutBufferSize,
LPDWORD lpBytesReturned);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
LPDWORD pcbAttrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardSetAttrib(SmartcardEmulationContext* smartcard,
SCARDHANDLE hCard, DWORD dwAttrId,
LPCBYTE pbAttr, DWORD cbAttrLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardA(SmartcardEmulationContext* smartcard,
LPOPENCARDNAMEA_EX pDlgStruc);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardW(SmartcardEmulationContext* smartcard,
LPOPENCARDNAMEW_EX pDlgStruc);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_GetOpenCardNameA(SmartcardEmulationContext* smartcard,
LPOPENCARDNAMEA pDlgStruc);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_GetOpenCardNameW(SmartcardEmulationContext* smartcard,
LPOPENCARDNAMEW pDlgStruc);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardDlgExtendedError(SmartcardEmulationContext* smartcard);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardReadCacheA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, UUID* CardIdentifier,
DWORD FreshnessCounter, LPSTR LookupName,
PBYTE Data, DWORD* DataLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardReadCacheW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, UUID* CardIdentifier,
DWORD FreshnessCounter, LPWSTR LookupName,
PBYTE Data, DWORD* DataLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardWriteCacheA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, UUID* CardIdentifier,
DWORD FreshnessCounter, LPSTR LookupName,
PBYTE Data, DWORD DataLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardWriteCacheW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, UUID* CardIdentifier,
DWORD FreshnessCounter, LPWSTR LookupName,
PBYTE Data, DWORD DataLen);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szReaderName,
LPBYTE pbIcon, LPDWORD pcbIcon);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szReaderName,
LPBYTE pbIcon, LPDWORD pcbIcon);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szReaderName,
LPDWORD pdwDeviceTypeId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szReaderName,
LPDWORD pdwDeviceTypeId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szReaderName,
LPSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szReaderName,
LPWSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szDeviceInstanceId,
LPSTR mszReaders, LPDWORD pcchReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szDeviceInstanceId,
LPWSTR mszReaders, LPDWORD pcchReaders);
WINPR_ATTR_NODISCARD
FREERDP_API LONG WINAPI Emulate_SCardAudit(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, DWORD dwEvent);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_SMARTCARD_EMULATE_PRIVATE_H */

View File

@@ -0,0 +1,377 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Error Codes
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_ERROR_H
#define FREERDP_ERROR_H
#include <winpr/crt.h>
#include <freerdp/api.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Error categories */
#define CAT_NONE "success"
#define CAT_USE "use"
#define CAT_BROKER "broker"
#define CAT_GATEWAY "gateway"
#define CAT_LICENSING "licensing"
#define CAT_SERVER "server"
#define CAT_CONFIG "config"
#define CAT_PROTOCOL "protocol"
#define CAT_ADMIN "administrative"
/**
* Error Info Codes (Error Info PDU)
*/
/* Protocol-independent codes */
#define ERRINFO_RPC_INITIATED_DISCONNECT 0x00000001
#define ERRINFO_RPC_INITIATED_LOGOFF 0x00000002
#define ERRINFO_IDLE_TIMEOUT 0x00000003
#define ERRINFO_LOGON_TIMEOUT 0x00000004
#define ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION 0x00000005
#define ERRINFO_OUT_OF_MEMORY 0x00000006
#define ERRINFO_SERVER_DENIED_CONNECTION 0x00000007
#define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES 0x00000009
#define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED 0x0000000A
#define ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER 0x0000000B
#define ERRINFO_LOGOFF_BY_USER 0x0000000C
#define ERRINFO_CLOSE_STACK_ON_DRIVER_NOT_READY 0x0000000F
#define ERRINFO_SERVER_DWM_CRASH 0x00000010
#define ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE 0x00000011
#define ERRINFO_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE 0x00000012
#define ERRINFO_SERVER_WINLOGON_CRASH 0x00000017
#define ERRINFO_SERVER_CSRSS_CRASH 0x00000018
/* Protocol-independent licensing codes */
#define ERRINFO_LICENSE_INTERNAL 0x00000100
#define ERRINFO_LICENSE_NO_LICENSE_SERVER 0x00000101
#define ERRINFO_LICENSE_NO_LICENSE 0x00000102
#define ERRINFO_LICENSE_BAD_CLIENT_MSG 0x00000103
#define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE 0x00000104
#define ERRINFO_LICENSE_BAD_CLIENT_LICENSE 0x00000105
#define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL 0x00000106
#define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL 0x00000107
#define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION 0x00000108
#define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE 0x00000109
#define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS 0x0000010A
/* Protocol-independent codes generated by the Connection Broker */
#define ERRINFO_CB_DESTINATION_NOT_FOUND 0x0000400
#define ERRINFO_CB_LOADING_DESTINATION 0x0000402
#define ERRINFO_CB_REDIRECTING_TO_DESTINATION 0x0000404
#define ERRINFO_CB_SESSION_ONLINE_VM_WAKE 0x0000405
#define ERRINFO_CB_SESSION_ONLINE_VM_BOOT 0x0000406
#define ERRINFO_CB_SESSION_ONLINE_VM_NO_DNS 0x0000407
#define ERRINFO_CB_DESTINATION_POOL_NOT_FREE 0x0000408
#define ERRINFO_CB_CONNECTION_CANCELLED 0x0000409
#define ERRINFO_CB_CONNECTION_ERROR_INVALID_SETTINGS 0x0000410
#define ERRINFO_CB_SESSION_ONLINE_VM_BOOT_TIMEOUT 0x0000411
#define ERRINFO_CB_SESSION_ONLINE_VM_SESSMON_FAILED 0x0000412
/* RDP specific codes */
#define ERRINFO_UNKNOWN_DATA_PDU_TYPE 0x000010C9
#define ERRINFO_UNKNOWN_PDU_TYPE 0x000010CA
#define ERRINFO_DATA_PDU_SEQUENCE 0x000010CB
#define ERRINFO_CONTROL_PDU_SEQUENCE 0x000010CD
#define ERRINFO_INVALID_CONTROL_PDU_ACTION 0x000010CE
#define ERRINFO_INVALID_INPUT_PDU_TYPE 0x000010CF
#define ERRINFO_INVALID_INPUT_PDU_MOUSE 0x000010D0
#define ERRINFO_INVALID_REFRESH_RECT_PDU 0x000010D1
#define ERRINFO_CREATE_USER_DATA_FAILED 0x000010D2
#define ERRINFO_CONNECT_FAILED 0x000010D3
#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_SHAREID 0x000010D4
#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR 0x000010D5
#define ERRINFO_PERSISTENT_KEY_PDU_BAD_LENGTH 0x000010DA
#define ERRINFO_PERSISTENT_KEY_PDU_ILLEGAL_FIRST 0x000010DB
#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS 0x000010DC
#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS 0x000010DD
#define ERRINFO_INPUT_PDU_BAD_LENGTH 0x000010DE
#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH 0x000010DF
#define ERRINFO_SECURITY_DATA_TOO_SHORT 0x000010E0
#define ERRINFO_VCHANNEL_DATA_TOO_SHORT 0x000010E1
#define ERRINFO_SHARE_DATA_TOO_SHORT 0x000010E2
#define ERRINFO_BAD_SUPPRESS_OUTPUT_PDU 0x000010E3
#define ERRINFO_CONFIRM_ACTIVE_PDU_TOO_SHORT 0x000010E5
#define ERRINFO_CAPABILITY_SET_TOO_SMALL 0x000010E7
#define ERRINFO_CAPABILITY_SET_TOO_LARGE 0x000010E8
#define ERRINFO_NO_CURSOR_CACHE 0x000010E9
#define ERRINFO_BAD_CAPABILITIES 0x000010EA
#define ERRINFO_VIRTUAL_CHANNEL_DECOMPRESSION 0x000010EC
#define ERRINFO_INVALID_VC_COMPRESSION_TYPE 0x000010ED
#define ERRINFO_INVALID_CHANNEL_ID 0x000010EF
#define ERRINFO_VCHANNELS_TOO_MANY 0x000010F0
#define ERRINFO_REMOTEAPP_NOT_ENABLED 0x000010F3
#define ERRINFO_CACHE_CAP_NOT_SET 0x000010F4
#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2 0x000010F5
#define ERRINFO_OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F6
#define ERRINFO_DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F7
#define ERRINFO_GDIPLUS_PDU_BAD_LENGTH 0x000010F8
#define ERRINFO_SECURITY_DATA_TOO_SHORT2 0x00001111
#define ERRINFO_SECURITY_DATA_TOO_SHORT3 0x00001112
#define ERRINFO_SECURITY_DATA_TOO_SHORT4 0x00001113
#define ERRINFO_SECURITY_DATA_TOO_SHORT5 0x00001114
#define ERRINFO_SECURITY_DATA_TOO_SHORT6 0x00001115
#define ERRINFO_SECURITY_DATA_TOO_SHORT7 0x00001116
#define ERRINFO_SECURITY_DATA_TOO_SHORT8 0x00001117
#define ERRINFO_SECURITY_DATA_TOO_SHORT9 0x00001118
#define ERRINFO_SECURITY_DATA_TOO_SHORT10 0x00001119
#define ERRINFO_SECURITY_DATA_TOO_SHORT11 0x0000111A
#define ERRINFO_SECURITY_DATA_TOO_SHORT12 0x0000111B
#define ERRINFO_SECURITY_DATA_TOO_SHORT13 0x0000111C
#define ERRINFO_SECURITY_DATA_TOO_SHORT14 0x0000111D
#define ERRINFO_SECURITY_DATA_TOO_SHORT15 0x0000111E
#define ERRINFO_SECURITY_DATA_TOO_SHORT16 0x0000111F
#define ERRINFO_SECURITY_DATA_TOO_SHORT17 0x00001120
#define ERRINFO_SECURITY_DATA_TOO_SHORT18 0x00001121
#define ERRINFO_SECURITY_DATA_TOO_SHORT19 0x00001122
#define ERRINFO_SECURITY_DATA_TOO_SHORT20 0x00001123
#define ERRINFO_SECURITY_DATA_TOO_SHORT21 0x00001124
#define ERRINFO_SECURITY_DATA_TOO_SHORT22 0x00001125
#define ERRINFO_SECURITY_DATA_TOO_SHORT23 0x00001126
#define ERRINFO_BAD_MONITOR_DATA 0x00001129
#define ERRINFO_VC_DECOMPRESSED_REASSEMBLE_FAILED 0x0000112A
#define ERRINFO_VC_DATA_TOO_LONG 0x0000112B
#define ERRINFO_BAD_FRAME_ACK_DATA 0x0000112C
#define ERRINFO_GRAPHICS_MODE_NOT_SUPPORTED 0x0000112D
#define ERRINFO_GRAPHICS_SUBSYSTEM_RESET_FAILED 0x0000112E
#define ERRINFO_GRAPHICS_SUBSYSTEM_FAILED 0x0000112F
#define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_SHORT 0x00001130
#define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_LONG 0x00001131
#define ERRINFO_DYNAMIC_DST_DISABLED_FIELD_MISSING 0x00001132
#define ERRINFO_VC_DECODING_ERROR 0x00001133
#define ERRINFO_VIRTUALDESKTOPTOOLARGE 0x00001134
#define ERRINFO_MONITORGEOMETRYVALIDATIONFAILED 0x00001135
#define ERRINFO_INVALIDMONITORCOUNT 0x00001136
#define ERRINFO_UPDATE_SESSION_KEY_FAILED 0x00001191
#define ERRINFO_DECRYPT_FAILED 0x00001192
#define ERRINFO_ENCRYPT_FAILED 0x00001193
#define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH 0x00001194
#define ERRINFO_DECRYPT_FAILED2 0x00001195
#define ERRINFO_PEER_DISCONNECTED 0x00001196
#define ERRINFO_SUCCESS 0x00000000
#define ERRINFO_NONE 0xFFFFFFFF
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_info_string(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_info_name(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_info_category(UINT32 code);
/**
* FreeRDP Context Error Codes
*/
#define MAKE_FREERDP_ERROR(_class, _type) (((FREERDP_ERROR_##_class##_CLASS) << 16) | (_type))
#define GET_FREERDP_ERROR_CLASS(_errorCode) ((_errorCode >> 16) & 0xFFFF)
#define GET_FREERDP_ERROR_TYPE(_errorCode) (_errorCode & 0xFFFF)
#define GET_FREERDP_ERROR_SUBCODE
#define FREERDP_ERROR_BASE 0
/**
* Error Base Codes
*/
#define FREERDP_ERROR_ERRBASE_CLASS (FREERDP_ERROR_BASE + 0)
#define ERRBASE_SUCCESS ERRINFO_SUCCESS
#define ERRBASE_NONE ERRINFO_NONE
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_base_string(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_base_name(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_base_category(UINT32 code);
#define FREERDP_ERROR_SUCCESS ERRINFO_SUCCESS
#define FREERDP_ERROR_NONE ERRINFO_NONE
/* Error Info Codes */
#define FREERDP_ERROR_ERRINFO_CLASS (FREERDP_ERROR_BASE + 1)
#define FREERDP_ERROR_RPC_INITIATED_DISCONNECT \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_DISCONNECT)
#define FREERDP_ERROR_RPC_INITIATED_LOGOFF MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_LOGOFF)
#define FREERDP_ERROR_IDLE_TIMEOUT MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_IDLE_TIMEOUT)
#define FREERDP_ERROR_LOGON_TIMEOUT MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_LOGON_TIMEOUT)
#define FREERDP_ERROR_DISCONNECTED_BY_OTHER_CONNECTION \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION)
#define FREERDP_ERROR_OUT_OF_MEMORY MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_OUT_OF_MEMORY)
#define FREERDP_ERROR_SERVER_DENIED_CONNECTION \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_DENIED_CONNECTION)
#define FREERDP_ERROR_SERVER_INSUFFICIENT_PRIVILEGES \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES)
#define FREERDP_ERROR_SERVER_FRESH_CREDENTIALS_REQUIRED \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED)
#define FREERDP_ERROR_RPC_INITIATED_DISCONNECT_BY_USER \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER)
#define FREERDP_ERROR_LOGOFF_BY_USER MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_LOGOFF_BY_USER)
#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_NOT_READY \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_NOT_READY)
#define FREERDP_ERROR_SERVER_DWM_CRASH MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_DWM_CRASH)
#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_FAILURE \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE)
#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE)
#define FREERDP_ERROR_SERVER_WINLOGON_CRASH \
MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_WINLOGON_CRASH)
#define FREERDP_ERROR_SERVER_CSRSS_CRASH MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_CSRSS_CRASH)
/* Connection Error Codes */
#define ERRCONNECT_PRE_CONNECT_FAILED 0x00000001
#define ERRCONNECT_CONNECT_UNDEFINED 0x00000002
#define ERRCONNECT_POST_CONNECT_FAILED 0x00000003
#define ERRCONNECT_DNS_ERROR 0x00000004
#define ERRCONNECT_DNS_NAME_NOT_FOUND 0x00000005
#define ERRCONNECT_CONNECT_FAILED 0x00000006
#define ERRCONNECT_MCS_CONNECT_INITIAL_ERROR 0x00000007
#define ERRCONNECT_TLS_CONNECT_FAILED 0x00000008
#define ERRCONNECT_AUTHENTICATION_FAILED 0x00000009
#define ERRCONNECT_INSUFFICIENT_PRIVILEGES 0x0000000A
#define ERRCONNECT_CONNECT_CANCELLED 0x0000000B
#define ERRCONNECT_SECURITY_NEGO_CONNECT_FAILED 0x0000000C
#define ERRCONNECT_CONNECT_TRANSPORT_FAILED 0x0000000D
#define ERRCONNECT_PASSWORD_EXPIRED 0x0000000E
/* For non-domain workstation where we can't contact a kerberos server */
#define ERRCONNECT_PASSWORD_CERTAINLY_EXPIRED 0x0000000F
#define ERRCONNECT_CLIENT_REVOKED 0x00000010
#define ERRCONNECT_KDC_UNREACHABLE 0x00000011
#define ERRCONNECT_ACCOUNT_DISABLED 0x00000012
#define ERRCONNECT_PASSWORD_MUST_CHANGE 0x00000013
#define ERRCONNECT_LOGON_FAILURE 0x00000014
#define ERRCONNECT_WRONG_PASSWORD 0x00000015
#define ERRCONNECT_ACCESS_DENIED 0x00000016
#define ERRCONNECT_ACCOUNT_RESTRICTION 0x00000017
#define ERRCONNECT_ACCOUNT_LOCKED_OUT 0x00000018
#define ERRCONNECT_ACCOUNT_EXPIRED 0x00000019
#define ERRCONNECT_LOGON_TYPE_NOT_GRANTED 0x0000001A
#define ERRCONNECT_NO_OR_MISSING_CREDENTIALS 0x0000001B
#define ERRCONNECT_ACTIVATION_TIMEOUT 0x0000001C
#define ERRCONNECT_TARGET_BOOTING 0x0000001D
#define ERRCONNECT_SUCCESS ERRINFO_SUCCESS
#define ERRCONNECT_NONE ERRINFO_NONE
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_connect_string(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_connect_name(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_error_connect_category(UINT32 code);
#define FREERDP_ERROR_CONNECT_CLASS (FREERDP_ERROR_BASE + 2)
#define FREERDP_ERROR_PRE_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PRE_CONNECT_FAILED)
#define FREERDP_ERROR_CONNECT_UNDEFINED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_UNDEFINED)
#define FREERDP_ERROR_POST_CONNECT_FAILED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_POST_CONNECT_FAILED)
#define FREERDP_ERROR_DNS_ERROR MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_DNS_ERROR)
#define FREERDP_ERROR_DNS_NAME_NOT_FOUND MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_DNS_NAME_NOT_FOUND)
#define FREERDP_ERROR_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_FAILED)
#define FREERDP_ERROR_MCS_CONNECT_INITIAL_ERROR \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_MCS_CONNECT_INITIAL_ERROR)
#define FREERDP_ERROR_TLS_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_TLS_CONNECT_FAILED)
#define FREERDP_ERROR_AUTHENTICATION_FAILED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_AUTHENTICATION_FAILED)
#define FREERDP_ERROR_INSUFFICIENT_PRIVILEGES \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_INSUFFICIENT_PRIVILEGES)
#define FREERDP_ERROR_CONNECT_CANCELLED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_CANCELLED)
#define FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_SECURITY_NEGO_CONNECT_FAILED)
#define FREERDP_ERROR_CONNECT_TRANSPORT_FAILED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_TRANSPORT_FAILED)
#define FREERDP_ERROR_CONNECT_PASSWORD_EXPIRED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_EXPIRED)
#define FREERDP_ERROR_CONNECT_PASSWORD_MUST_CHANGE \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_MUST_CHANGE)
#define FREERDP_ERROR_CONNECT_KDC_UNREACHABLE \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_KDC_UNREACHABLE)
#define FREERDP_ERROR_CONNECT_ACCOUNT_DISABLED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_DISABLED)
#define FREERDP_ERROR_CONNECT_PASSWORD_CERTAINLY_EXPIRED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_CERTAINLY_EXPIRED)
#define FREERDP_ERROR_CONNECT_CLIENT_REVOKED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CLIENT_REVOKED)
#define FREERDP_ERROR_CONNECT_LOGON_FAILURE MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_LOGON_FAILURE)
#define FREERDP_ERROR_CONNECT_WRONG_PASSWORD MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_WRONG_PASSWORD)
#define FREERDP_ERROR_CONNECT_ACCESS_DENIED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCESS_DENIED)
#define FREERDP_ERROR_CONNECT_ACCOUNT_RESTRICTION \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_RESTRICTION)
#define FREERDP_ERROR_CONNECT_ACCOUNT_LOCKED_OUT \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_LOCKED_OUT)
#define FREERDP_ERROR_CONNECT_ACCOUNT_EXPIRED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_EXPIRED)
#define FREERDP_ERROR_CONNECT_LOGON_TYPE_NOT_GRANTED \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_LOGON_TYPE_NOT_GRANTED)
#define FREERDP_ERROR_CONNECT_NO_OR_MISSING_CREDENTIALS \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_NO_OR_MISSING_CREDENTIALS)
#define FREERDP_ERROR_CONNECT_ACTIVATION_TIMEOUT \
MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACTIVATION_TIMEOUT)
#define FREERDP_ERROR_CONNECT_TARGET_BOOTING MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_TARGET_BOOTING)
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_ERROR_H */

View File

@@ -0,0 +1,133 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Event Definitions
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_EVENT_H
#define FREERDP_EVENT_H
#include <freerdp/api.h>
#include <winpr/collections.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define FREERDP_WINDOW_STATE_NORMAL 0
#define FREERDP_WINDOW_STATE_MINIMIZED 1
#define FREERDP_WINDOW_STATE_MAXIMIZED 2
#define FREERDP_WINDOW_STATE_FULLSCREEN 3
#define FREERDP_WINDOW_STATE_ACTIVE 4
DEFINE_EVENT_BEGIN(WindowStateChange)
int state;
DEFINE_EVENT_END(WindowStateChange)
DEFINE_EVENT_BEGIN(ResizeWindow)
int width;
int height;
DEFINE_EVENT_END(ResizeWindow)
DEFINE_EVENT_BEGIN(PanningChange)
int dx;
int dy;
DEFINE_EVENT_END(PanningChange)
DEFINE_EVENT_BEGIN(ZoomingChange)
int dx;
int dy;
DEFINE_EVENT_END(ZoomingChange)
DEFINE_EVENT_BEGIN(LocalResizeWindow)
int width;
int height;
DEFINE_EVENT_END(LocalResizeWindow)
DEFINE_EVENT_BEGIN(EmbedWindow)
BOOL embed;
void* handle;
DEFINE_EVENT_END(EmbedWindow)
DEFINE_EVENT_BEGIN(ErrorInfo)
UINT32 code;
DEFINE_EVENT_END(ErrorInfo)
DEFINE_EVENT_BEGIN(Activated)
BOOL firstActivation;
DEFINE_EVENT_END(Activated)
DEFINE_EVENT_BEGIN(ConnectionStateChange)
int state;
BOOL active;
DEFINE_EVENT_END(ConnectionStateChange)
DEFINE_EVENT_BEGIN(Terminate)
int code;
DEFINE_EVENT_END(Terminate)
DEFINE_EVENT_BEGIN(ConnectionResult)
int result;
DEFINE_EVENT_END(ConnectionResult)
DEFINE_EVENT_BEGIN(ChannelConnected)
const char* name;
void* pInterface;
DEFINE_EVENT_END(ChannelConnected)
DEFINE_EVENT_BEGIN(ChannelDisconnected)
const char* name;
void* pInterface;
DEFINE_EVENT_END(ChannelDisconnected)
DEFINE_EVENT_BEGIN(ChannelAttached)
const char* name;
void* pInterface;
DEFINE_EVENT_END(ChannelAttached)
DEFINE_EVENT_BEGIN(ChannelDetached)
const char* name;
void* pInterface;
DEFINE_EVENT_END(ChannelDetached)
DEFINE_EVENT_BEGIN(MouseEvent)
UINT16 flags;
UINT16 x;
UINT16 y;
DEFINE_EVENT_END(MouseEvent)
DEFINE_EVENT_BEGIN(MouseEventEx)
UINT16 flags;
UINT16 x;
UINT16 y;
DEFINE_EVENT_END(MouseEventEx)
DEFINE_EVENT_BEGIN(Timer)
UINT64 now;
DEFINE_EVENT_END(Timer)
DEFINE_EVENT_BEGIN(GraphicsReset)
UINT32 width;
UINT32 height;
DEFINE_EVENT_END(GraphicsReset)
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_EVENT_H */

View File

@@ -0,0 +1,66 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP Extensions
*
* Copyright 2010-2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_EXTENSION_H
#define FREERDP_EXTENSION_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#define FREERDP_EXT_EXPORT_FUNC_NAME "FreeRDPExtensionEntry"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_ext_plugin rdpExtPlugin;
struct rdp_ext_plugin
{
void* ext;
WINPR_ATTR_NODISCARD int (*init)(rdpExtPlugin* plugin, freerdp* instance);
WINPR_ATTR_NODISCARD int (*uninit)(rdpExtPlugin* plugin, freerdp* instance);
};
typedef UINT32(FREERDP_CC* PFREERDP_EXTENSION_HOOK)(rdpExtPlugin* plugin, freerdp* instance);
typedef UINT32(FREERDP_CC* PREGISTEREXTENSION)(rdpExtPlugin* plugin);
typedef UINT32(FREERDP_CC* PREGISTERPRECONNECTHOOK)(rdpExtPlugin* plugin,
PFREERDP_EXTENSION_HOOK hook);
typedef UINT32(FREERDP_CC* PREGISTERPOSTCONNECTHOOK)(rdpExtPlugin* plugin,
PFREERDP_EXTENSION_HOOK hook);
typedef struct
{
void* ext; /* Reference to internal instance */
WINPR_ATTR_NODISCARD PREGISTEREXTENSION pRegisterExtension;
WINPR_ATTR_NODISCARD PREGISTERPRECONNECTHOOK pRegisterPreConnectHook;
WINPR_ATTR_NODISCARD PREGISTERPOSTCONNECTHOOK pRegisterPostConnectHook;
void* data;
} FREERDP_EXTENSION_ENTRY_POINTS;
typedef FREERDP_EXTENSION_ENTRY_POINTS* PFREERDP_EXTENSION_ENTRY_POINTS;
typedef int(FREERDP_CC* PFREERDP_EXTENSION_ENTRY)(PFREERDP_EXTENSION_ENTRY_POINTS pEntryPoints);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_EXTENSION_H */

View File

@@ -0,0 +1,948 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Interface
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_H
#define FREERDP_H
#include <winpr/stream.h>
#include <winpr/sspi.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/error.h>
#include <freerdp/event.h>
#include <freerdp/settings.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/codecs.h>
#include <freerdp/metrics.h>
#include <freerdp/extension.h>
#include <freerdp/heartbeat.h>
#include <freerdp/message.h>
#include <freerdp/autodetect.h>
#include <freerdp/streamdump.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_rdp rdpRdp;
typedef struct rdp_rail rdpRail;
typedef struct rdp_cache rdpCache;
typedef struct rdp_client_context rdpClientContext;
typedef struct rdp_client_entry_points_v1 RDP_CLIENT_ENTRY_POINTS_V1;
typedef RDP_CLIENT_ENTRY_POINTS_V1 RDP_CLIENT_ENTRY_POINTS;
#include <freerdp/utils/smartcardlogon.h>
#include <freerdp/update.h>
#include <freerdp/input.h>
#include <freerdp/graphics.h>
#define MCS_BASE_CHANNEL_ID 1001
#define MCS_GLOBAL_CHANNEL_ID 1003
/* Flags used by certificate callbacks */
#define VERIFY_CERT_FLAG_NONE 0x00
#define VERIFY_CERT_FLAG_LEGACY 0x02
#define VERIFY_CERT_FLAG_REDIRECT 0x10
#define VERIFY_CERT_FLAG_GATEWAY 0x20
#define VERIFY_CERT_FLAG_CHANGED 0x40
#define VERIFY_CERT_FLAG_MISMATCH 0x80
#define VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 0x100
#define VERIFY_CERT_FLAG_FP_IS_PEM 0x200
/* Message types used by gateway messaging callback */
#define GATEWAY_MESSAGE_CONSENT 1
#define GATEWAY_MESSAGE_SERVICE 2
typedef enum
{
AUTH_NLA,
AUTH_TLS,
AUTH_RDP,
GW_AUTH_HTTP,
GW_AUTH_RDG,
GW_AUTH_RPC,
AUTH_SMARTCARD_PIN,
AUTH_RDSTLS
} rdp_auth_reason;
typedef BOOL (*pContextNew)(freerdp* instance, rdpContext* context);
typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
typedef BOOL (*pConnectCallback)(freerdp* instance);
typedef void (*pPostDisconnect)(freerdp* instance);
/** \brief Authentication callback function pointer definition
*
* \param instance A pointer to the instance to work on
* \param username A pointer to the username string. On input the current username, on output
* the username that should be used. Must not be nullptr. \param password A pointer to the
* password string. On input the current password, on output the password that sohould be used.
* Must not be nullptr. \param domain A pointer to the domain string. On input the current
* domain, on output the domain that sohould be used. Must not be nullptr.
*
* \return \b FALSE no valid credentials supplied, continue without \b TRUE valid credentials
* should be available.
*/
typedef BOOL (*pAuthenticate)(freerdp* instance, char** username, char** password,
char** domain);
/** @brief Extended authentication callback function pointer definition
*
* This function is called whenever not all required credentials have been supplied or the
* supplied credentials were rejected.
*
* @param instance A pointer to the instance to work on
* @param username A pointer to the username string. On input the current username, on output
* the username that should be used instead. Must not be nullptr.
* @param password A pointer to the password string. On input the current password, on output
* the password that sohould be used. Must not be nullptr.
* @param domain A pointer to the domain string. On input the current domain, on output the
* domain that sohould be used. Must not be nullptr.
* @param reason The reason the callback was called. (e.g. NLA, TLS, RDP, GATEWAY, ...)
*
* @return \b FALSE to abort the connection, \b TRUE otherwise.
*
* @attention All strings are allocated (on input and output) and \ref free needs to be called
* before replacing the input with the output values.
* @note To not provide valid credentials and not abort the connection return \b TRUE and empty
* (as in empty string) credentials
*/
typedef BOOL (*pAuthenticateEx)(freerdp* instance, char** username, char** password,
char** domain, rdp_auth_reason reason);
/** @brief Callback to select a smartcard certificate from a list of detected ones.
*
* This function is called when smartcard authentication (NLA) is used and more than one
* smartcard certificate is detected that could be used. The purpose of this callback is to
* present the user with a list of available options and then return the selection.
*
* @param instance A pointer to the instance to work on
* @param cert_list A list of smartcard certificates
* @param count The number of smartcard certificates in the list
* @param choice A pointer to an integer that will represent the selected certificate index.
* Must not be \b nullptr
* @param gateway A indicator if the authentication is for a session (\b FALSE) or a gateway
* (\b TRUE)
*
* @return \b FALSE if the selection was aborted, \b TRUE if a selection was accepted.
*
* @since version 3.0.0
*/
typedef BOOL (*pChooseSmartcard)(freerdp* instance, SmartcardCertInfo** cert_list, DWORD count,
DWORD* choice, BOOL gateway);
typedef enum
{
ACCESS_TOKEN_TYPE_AAD, /**!< oauth2 access token for RDS AAD authentication */
ACCESS_TOKEN_TYPE_AVD /**!< oauth2 access token for Azure Virtual Desktop */
} AccessTokenType;
/** @brief A function to be implemented by a client. It is called whenever the connection
* requires an access token.
* @param instance The instance the function is called for
* @param tokenType The type of token requested
* @param token A pointer that will hold the (allocated) token string
* @param count The number of arguments following
*
* @return \b TRUE for success, \b FALSE otherwise
* @since version 3.0.0
*/
typedef BOOL (*pGetAccessToken)(freerdp* instance, AccessTokenType tokenType, char** token,
size_t count, ...);
/** @brief The function is called whenever the connection requires an access token.
* It differs from \ref pGetAccessToken and is not meant to be implemented by a client
* directly. The client-common library will use this to provide common means to retrieve a token
* and only if that fails the instanc->GetAccessToken callback will be called.
*
* @param context The context the function is called for
* @param tokenType The type of token requested
* @param token A pointer that will hold the (allocated) token string
* @param count The number of arguments following
*
* @return \b TRUE for success, \b FALSE otherwise
* @since version 3.16.0
*/
typedef BOOL (*pGetCommonAccessToken)(rdpContext* context, AccessTokenType tokenType,
char** token, size_t count, ...);
/** @brief Callback used to inform about a reconnection attempt
*
* @param instance The instance the information is for
* @param what A '\0' terminated string describing the module attempting to retry an operation
* @param current The current reconnection attempt, the first attempt will always have the
* value \b 0
* @param userarg An optional custom argument
*
* @return \b -1 in case of failure (attempts exceeded, ...) or a \b delay in [ms] to wait
* before the next attempt
*/
typedef SSIZE_T (*pRetryDialog)(freerdp* instance, const char* what, size_t current,
void* userarg);
/** @brief Callback used if user interaction is required to accept
* an unknown certificate.
*
* @deprecated Use pVerifyCertificateEx
* @param common_name The certificate registered hostname.
* @param subject The common name of the certificate.
* @param issuer The issuer of the certificate.
* @param fingerprint The fingerprint of the certificate (old) or the certificate in PEM
* format
* @param host_mismatch A flag indicating the certificate
* subject does not match the host connecting to.
*
* @return 1 to accept and store a certificate, 2 to accept
* a certificate only for this session, 0 otherwise.
*/
#if defined(WITH_FREERDP_DEPRECATED)
typedef WINPR_DEPRECATED_VAR(
"Use pVerifyCertificateEx",
DWORD (*pVerifyCertificate)(freerdp* instance, const char* common_name, const char* subject,
const char* issuer, const char* fingerprint,
BOOL host_mismatch));
#endif
/** @brief Callback used if user interaction is required to accept
* an unknown certificate.
*
* @param host The hostname connecting to.
* @param port The port connecting to.
* @param common_name The certificate registered hostname.
* @param subject The common name of the certificate.
* @param issuer The issuer of the certificate.
* @param fingerprint The fingerprint of the certificate (old) or the certificate in PEM
* format (VERIFY_CERT_FLAG_FP_IS_PEM set)
* @param flags Flags of type VERIFY_CERT_FLAG*
*
* @return 1 to accept and store a certificate, 2 to accept
* a certificate only for this session, 0 otherwise.
*/
typedef DWORD (*pVerifyCertificateEx)(freerdp* instance, const char* host, UINT16 port,
const char* common_name, const char* subject,
const char* issuer, const char* fingerprint, DWORD flags);
/** @brief Callback used if user interaction is required to accept
* a changed certificate.
*
* @deprecated Use pVerifyChangedCertificateEx
* @param common_name The certificate registered hostname.
* @param subject The common name of the new certificate.
* @param issuer The issuer of the new certificate.
* @param new_fingerprint The fingerprint of the new certificate.
* @param old_subject The common name of the old certificate.
* @param old_issuer The issuer of the new certificate.
* @param old_fingerprint The fingerprint of the old certificate.
*
* @return 1 to accept and store a certificate, 2 to accept
* a certificate only for this session, 0 otherwise.
*/
#if defined(WITH_FREERDP_DEPRECATED)
typedef WINPR_DEPRECATED_VAR(
"Use pVerifyChangedCertificateEx",
DWORD (*pVerifyChangedCertificate)(freerdp* instance, const char* common_name,
const char* subject, const char* issuer,
const char* new_fingerprint, const char* old_subject,
const char* old_issuer, const char* old_fingerprint));
#endif
/** @brief Callback used if user interaction is required to accept
* a changed certificate.
*
* @param host The hostname connecting to.
* @param port The port connecting to.
* @param common_name The certificate registered hostname.
* @param subject The common name of the new certificate.
* @param issuer The issuer of the new certificate.
* @param new_fingerprint The fingerprint of the new certificate (old) or the certificate in
* PEM format (VERIFY_CERT_FLAG_FP_IS_PEM set)
* @param old_subject The common name of the old certificate.
* @param old_issuer The issuer of the new certificate.
* @param old_fingerprint The fingerprint of the old certificate (old) or the certificate in
* PEM format (VERIFY_CERT_FLAG_FP_IS_PEM set)
* @param flags Flags of type VERIFY_CERT_FLAG*
*
* @return 1 to accept and store a certificate, 2 to accept
* a certificate only for this session, 0 otherwise.
*/
typedef DWORD (*pVerifyChangedCertificateEx)(freerdp* instance, const char* host, UINT16 port,
const char* common_name, const char* subject,
const char* issuer, const char* new_fingerprint,
const char* old_subject, const char* old_issuer,
const char* old_fingerprint, DWORD flags);
/** @brief Callback used if user interaction is required to accept
* a certificate.
*
* @param instance Pointer to the freerdp instance.
* @param data Pointer to certificate data (full chain) in PEM format.
* @param length The length of the certificate data.
* @param hostname The hostname connecting to.
* @param port The port connecting to.
* @param flags Flags of type VERIFY_CERT_FLAG*
*
* @return 1 to accept and store a certificate, 2 to accept
* a certificate only for this session, 0 otherwise.
*/
typedef int (*pVerifyX509Certificate)(freerdp* instance, const BYTE* data, size_t length,
const char* hostname, UINT16 port, DWORD flags);
typedef int (*pLogonErrorInfo)(freerdp* instance, UINT32 data, UINT32 type);
typedef BOOL (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
size_t size);
typedef BOOL (*pSendChannelPacket)(freerdp* instance, UINT16 channelId, size_t totalSize,
UINT32 flags, const BYTE* data, size_t chunkSize);
typedef BOOL (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
size_t size, UINT32 flags, size_t totalSize);
/* type can be one of the GATEWAY_MESSAGE_ type defines */
typedef BOOL (*pPresentGatewayMessage)(freerdp* instance, UINT32 type, BOOL isDisplayMandatory,
BOOL isConsentMandatory, size_t length,
const WCHAR* message);
/**
* Defines the context for a given instance of RDP connection.
* It is embedded in the rdp_freerdp structure, and allocated by a call to
* freerdp_context_new(). It is deallocated by a call to freerdp_context_free().
*/
struct rdp_context
{
ALIGN64 freerdp* instance; /**< (offset 0)
Pointer to a rdp_freerdp structure.
This is a back-link to retrieve the freerdp instance from the context.
It is set by the freerdp_context_new() function */
ALIGN64 freerdp_peer* peer; /**< (offset 1)
Pointer to the client peer.
This is set by a call to freerdp_peer_context_new() during peer
initialization. This field is used only on the server side. */
ALIGN64 BOOL ServerMode; /**< (offset 2) true when context is in server mode */
ALIGN64 UINT32 LastError; /* 3 */
UINT64 paddingA[16 - 4]; /* 4 */
ALIGN64 int argc; /**< (offset 16)
Number of arguments given to the program at launch time.
Used to keep this data available and used later on, typically just before
connection initialization.
@see freerdp_parse_args() */
ALIGN64 char** argv; /**< (offset 17)
List of arguments given to the program at launch time.
Used to keep this data available and used later on, typically just before
connection initialization.
@see freerdp_parse_args() */
ALIGN64 wPubSub* pubSub; /* (offset 18) */
ALIGN64 HANDLE channelErrorEvent; /* (offset 19)*/
ALIGN64 UINT channelErrorNum; /*(offset 20)*/
ALIGN64 char* errorDescription; /*(offset 21)*/
UINT64 paddingB[32 - 22]; /* 22 */
ALIGN64 rdpRdp*
rdp; /**< (offset 32)
Pointer to a rdp_rdp structure used to keep the connection's parameters.
It is allocated by freerdp_context_new() and deallocated by
freerdp_context_free(), at the same time that this rdp_context
structure - there is no need to specifically allocate/deallocate this. */
ALIGN64 rdpGdi* gdi; /**< (offset 33)
Pointer to a rdp_gdi structure used to keep the gdi settings.
It is allocated by gdi_init() and deallocated by gdi_free().
It must be deallocated before deallocating this rdp_context structure. */
ALIGN64 rdpRail* rail; /* 34 */
ALIGN64 rdpCache* cache; /* 35 */
ALIGN64 rdpChannels* channels; /* 36 */
ALIGN64 rdpGraphics* graphics; /* 37 */
ALIGN64 rdpInput* input; /* 38 owned by rdpRdp */
ALIGN64 rdpUpdate* update; /* 39 owned by rdpRdp */
ALIGN64 rdpSettings* settings; /* 40 owned by rdpRdp */
ALIGN64 rdpMetrics* metrics; /* 41 */
ALIGN64 rdpCodecs* codecs; /* 42 */
ALIGN64 rdpAutoDetect* autodetect; /* 43 owned by rdpRdp */
UINT64 paddingC1[45 - 44]; /* 44 */
ALIGN64 int disconnectUltimatum; /* 45 */
UINT64 paddingC[64 - 46]; /* 46 */
ALIGN64 rdpStreamDumpContext* dump; /* 64 */
ALIGN64 wLog* log; /* 65 */
UINT64 paddingD[96 - 66]; /* 66 */
UINT64 paddingE[128 - 96]; /* 96 */
};
/**
* Defines the possible disconnect reasons in the MCS Disconnect Provider
* Ultimatum PDU
*
* [T.125] 7 Structure of Version 2 MCSPDUs Reason ::= ENUMERATED
*/
enum Disconnect_Ultimatum
{
Disconnect_Ultimatum_domain_disconnected = 0,
Disconnect_Ultimatum_provider_initiated = 1,
Disconnect_Ultimatum_token_purged = 2,
Disconnect_Ultimatum_user_requested = 3,
Disconnect_Ultimatum_channel_purged = 4
};
#include <freerdp/client.h>
/** Defines the options for a given instance of RDP connection.
* This is built by the client and given to the FreeRDP library to create the connection
* with the expected options.
* It is allocated by a call to freerdp_new() and deallocated by a call to freerdp_free().
* Some of its content need specific allocation/deallocation - see field description for
* details.
*/
struct rdp_freerdp
{
ALIGN64
rdpContext* context; /**< (offset 0)
Pointer to a rdpContext structure.
Client applications can use the ContextSize field to register a
context bigger than the rdpContext structure. This allow clients to
use additional context information. When using this capability, client
application should ALWAYS declare their structure with the rdpContext
field first, and any additional content following it. Can be allocated
by a call to freerdp_context_new(). Must be deallocated by a call to
freerdp_context_free() before deallocating the current instance. */
ALIGN64 RDP_CLIENT_ENTRY_POINTS* pClientEntryPoints;
UINT64 paddingA[16 - 2]; /* 2 */
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("use rdpContext::input instead", ALIGN64 rdpInput* input;) /* (offset
16) Input handle for the connection. Will be initialized by a call
to freerdp_context_new() owned by rdpRdp */
WINPR_DEPRECATED_VAR("use rdpContext::update instead",
ALIGN64 rdpUpdate* update;) /* (offset 17)
Update display parameters. Used to register display events callbacks
and settings. Will be initialized by a call to freerdp_context_new() owned by rdpRdp */
WINPR_DEPRECATED_VAR("use rdpContext::settings instead",
ALIGN64 rdpSettings* settings;) /**< (offset 18)
Pointer to a rdpSettings structure. Will be used to maintain the
required RDP settings. Will be
initialized by a call to freerdp_context_new()
owned by rdpRdp
*/
WINPR_DEPRECATED_VAR("use rdpContext::autodetect instead",
ALIGN64 rdpAutoDetect* autodetect;) /* (offset 19)
Auto-Detect handle for the connection.
Will be initialized by a call to freerdp_context_new()
owned by rdpRdp */
#else
UINT64 paddingX[4];
#endif
ALIGN64 rdpHeartbeat* heartbeat; /* (offset 21) owned by rdpRdp*/
UINT64 paddingB[32 - 21]; /* 21 */
ALIGN64 size_t
ContextSize; /* (offset 32)
Specifies the size of the 'context' field. freerdp_context_new() will use this
size to allocate the context buffer. freerdp_new() sets it to
sizeof(rdpContext). If modifying it, there should always be a minimum of
sizeof(rdpContext), as the freerdp library will assume it can use the 'context'
field to set the required information in it. Clients will typically make it
bigger, and use a context structure embedding the rdpContext, and adding
additional information after that.
*/
WINPR_ATTR_NODISCARD ALIGN64 pContextNew
ContextNew; /**< (offset 33)
Callback for context allocation
Can be set before calling freerdp_context_new() to have it executed after
allocation and initialization. Must be set to nullptr if not needed. */
ALIGN64 pContextFree
ContextFree; /**< (offset 34)
Callback for context deallocation
Can be set before calling freerdp_context_free() to have it executed before
deallocation. Must be set to nullptr if not needed. */
UINT64 paddingC[47 - 35]; /* 35 */
ALIGN64 UINT ConnectionCallbackState; /* 47 */
WINPR_ATTR_NODISCARD ALIGN64 pConnectCallback
PreConnect; /**< (offset 48)
Callback for pre-connect operations.
Can be set before calling freerdp_connect() to have it executed before the
actual connection happens. Must be set to nullptr if not needed. */
WINPR_ATTR_NODISCARD ALIGN64 pConnectCallback
PostConnect; /**< (offset 49)
Callback for post-connect operations.
Can be set before calling freerdp_connect() to have it executed after the
actual connection has succeeded. Must be set to nullptr if not needed. */
WINPR_ATTR_NODISCARD ALIGN64 pAuthenticate Authenticate; /**< (offset 50)
Callback for authentication.
It is used to get the username/password when it was not
provided at connection time. */
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use VerifyCertificateEx or VerifyX509Certificate instead",
WINPR_ATTR_NODISCARD ALIGN64 pVerifyCertificate
VerifyCertificate;) /**< (offset 51) */
WINPR_DEPRECATED_VAR("Use VerifyChangedCertificateEx or VerifyX509Certificate instead",
WINPR_ATTR_NODISCARD ALIGN64 pVerifyChangedCertificate
VerifyChangedCertificate;) /**< (offset 52) */
#else
ALIGN64 UINT64 reserved[2];
#endif
WINPR_ATTR_NODISCARD ALIGN64 pVerifyX509Certificate
VerifyX509Certificate; /**< (offset 53) Callback for X509 certificate verification
(PEM format) */
WINPR_ATTR_NODISCARD ALIGN64 pLogonErrorInfo
LogonErrorInfo; /**< (offset 54) Callback for logon error info, important for logon
system messages with RemoteApp */
ALIGN64 pPostDisconnect
PostDisconnect; /**< (offset 55)
Callback for cleaning up
resources allocated by post connect callback.
This will be called before disconnecting and cleaning up the
channels.
*/
WINPR_ATTR_NODISCARD ALIGN64 pAuthenticate GatewayAuthenticate; /**< (offset 56)
Callback for gateway authentication.
It is used to get the username/password when it was not
provided at connection time. */
WINPR_ATTR_NODISCARD ALIGN64 pPresentGatewayMessage PresentGatewayMessage; /**< (offset 57)
Callback for gateway consent messages.
It is used to present consent messages to the user. */
WINPR_ATTR_NODISCARD ALIGN64 pConnectCallback Redirect; /**< (offset 58)
Callback for redirect operations.
Can be set after
rdp_client_disconnect_and_clear and applying redirection settings but before
rdp_client_connect() to have it executed after the actual connection has
succeeded. Must be set to nullptr if not needed. */
WINPR_ATTR_NODISCARD ALIGN64 pConnectCallback
LoadChannels; /**< (offset 59)
* callback for loading channel configuration. Might be called multiple
* times when redirection occurs. */
ALIGN64 pPostDisconnect
PostFinalDisconnect; /** < (offset 60)
* callback for cleaning up resources allocated in PreConnect
*
* This will be called after all instance related channels and
* threads have been stopped
*/
UINT64 paddingD[64 - 61]; /* 61 */
WINPR_ATTR_NODISCARD ALIGN64 pSendChannelData
SendChannelData; /* (offset 64)
Callback for sending data to a channel.
By default, it is set by freerdp_new() to freerdp_send_channel_data(), which
eventually calls freerdp_channel_send() */
WINPR_ATTR_NODISCARD ALIGN64 pReceiveChannelData
ReceiveChannelData; /* (offset 65)
Callback for receiving data from a channel.
This is called by freerdp_channel_process() (if not nullptr).
Clients will typically use a function that calls freerdp_channels_data()
to perform the needed tasks. */
WINPR_ATTR_NODISCARD ALIGN64 pVerifyCertificateEx
VerifyCertificateEx; /**< (offset 66)
Callback for certificate validation.
Used to verify that an unknown certificate is trusted. */
WINPR_ATTR_NODISCARD ALIGN64 pVerifyChangedCertificateEx
VerifyChangedCertificateEx; /**< (offset 67)
Callback for changed certificate validation.
Used when a certificate differs from stored fingerprint. */
WINPR_ATTR_NODISCARD ALIGN64 pSendChannelPacket
SendChannelPacket; /* (offset 68)
* Callback for sending RAW data to a channel. In contrast to
* SendChannelData data fragmentation is up to the user and this
* function sends data as is with the provided flags.
*/
WINPR_ATTR_NODISCARD ALIGN64 pAuthenticateEx AuthenticateEx; /**< (offset 69)
Callback for authentication.
It is used to get the username/password. The reason
argument tells why it was called. */
WINPR_ATTR_NODISCARD ALIGN64 pChooseSmartcard
ChooseSmartcard; /* (offset 70)
Callback for choosing a smartcard for logon.
Used when multiple smartcards are available. Returns an index into a list
of SmartcardCertInfo pointers */
WINPR_ATTR_NODISCARD ALIGN64 pGetAccessToken GetAccessToken; /* (offset 71)
Callback for obtaining an access token
for \b AccessTokenType authentication */
WINPR_ATTR_NODISCARD ALIGN64 pRetryDialog
RetryDialog; /* (offset 72) Callback for displaying a dialog in case of
something needs a retry */
UINT64 paddingE[80 - 73]; /* 73 */
};
struct rdp_channel_handles
{
wListDictionary* init;
wListDictionary* open;
};
typedef struct rdp_channel_handles rdpChannelHandles;
FREERDP_API void freerdp_context_free(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_context_new(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_context_reset(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_connect(freerdp* instance);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("use freerdp_abort_connect_context instead",
FREERDP_API BOOL freerdp_abort_connect(freerdp* instance));
#endif
FREERDP_API BOOL freerdp_abort_connect_context(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE freerdp_abort_event(rdpContext* context);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("use freerdp_shall_disconnect_context instead",
WINPR_ATTR_NODISCARD FREERDP_API BOOL
freerdp_shall_disconnect(const freerdp* instance));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_shall_disconnect_context(const rdpContext* context);
FREERDP_API BOOL freerdp_disconnect(freerdp* instance);
/** @brief stringify disconnect reason of type Disconnect_Ultimatum
*
* @param reason the reason of type \b Disconnect_Ultimatum
*
* @return a string representation of \b reason or rn-unknown
*
* @since version 3.13.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_disconnect_reason_string(int reason);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("use freerdp_disconnect_before_reconnect_context instead",
WINPR_ATTR_NODISCARD FREERDP_API BOOL
freerdp_disconnect_before_reconnect(freerdp* instance));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_disconnect_before_reconnect_context(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_reconnect(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API UINT freerdp_channels_attach(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API UINT freerdp_channels_detach(freerdp* instance);
#if defined(WITH_FREERDP_DEPRECATED)
WINPR_DEPRECATED_VAR("Use freerdp_get_event_handles",
WINPR_ATTR_NODISCARD FREERDP_API BOOL
freerdp_get_fds(freerdp* instance, void** rfds, int* rcount,
void** wfds, int* wcount));
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_check_fds(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_check_event_handles(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API wMessageQueue* freerdp_get_message_queue(freerdp* instance, DWORD id);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE freerdp_get_message_queue_event_handle(freerdp* instance, DWORD id);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_message_queue_process_message(freerdp* instance, DWORD id,
wMessage* message);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 freerdp_error_info(const freerdp* instance);
FREERDP_API void freerdp_set_error_info(rdpRdp* rdp, UINT32 error);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_send_error_info(rdpRdp* rdp);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_get_stats(const rdpRdp* rdp, UINT64* inBytes, UINT64* outBytes,
UINT64* inPackets, UINT64* outPackets);
FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_version_string(void);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_build_revision(void);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_build_config(void);
FREERDP_API void freerdp_free(freerdp* instance);
WINPR_ATTR_MALLOC(freerdp_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API freerdp* freerdp_new(void);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_focus_required(freerdp* instance);
FREERDP_API void freerdp_set_focus(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API int freerdp_get_disconnect_ultimatum(const rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 freerdp_get_last_error(const rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_last_error_name(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_last_error_string(UINT32 code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_last_error_category(UINT32 code);
#define freerdp_set_last_error(context, lastError) \
freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__)
#define freerdp_set_last_error_if_not(context, lastError) \
do \
{ \
if (freerdp_get_last_error(context) == FREERDP_ERROR_SUCCESS) \
freerdp_set_last_error_log(context, lastError); \
} while (0)
#define freerdp_set_last_error_log(context, lastError) \
freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__)
FREERDP_API void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError,
const char* fkt, const char* file, int line);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_logon_error_info_type(UINT32 type);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_logon_error_info_type_ex(UINT32 type, char* buffer,
size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_logon_error_info_data(UINT32 data);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_get_logon_error_info_data_ex(UINT32 data, char* buffer,
size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API ULONG freerdp_get_transport_sent(const rdpContext* context, BOOL resetCount);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_nla_impersonate(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_nla_revert_to_self(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 freerdp_get_nla_sspi_error(const rdpContext* context);
/** Encrypts the provided buffer using the NLA's GSSAPI context
*
* \param context the RDP context
* \param inBuffer the SecBuffer buffer to encrypt
* \param outBuffer a SecBuffer to hold the encrypted content
* \returns if the operation completed successfully
* \since version 3.9.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_nla_encrypt(rdpContext* context, const SecBuffer* inBuffer,
SecBuffer* outBuffer);
/** Decrypts the provided buffer using the NLA's GSSAPI context
*
* \param context the RDP context
* \param inBuffer the SecBuffer buffer to decrypt
* \param outBuffer a SecBuffer to hold the decrypted content
* \returns if the operation completed successfully
* \since version 3.9.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_nla_decrypt(rdpContext* context, const SecBuffer* inBuffer,
SecBuffer* outBuffer);
/** Calls QueryContextAttributes on the SSPI context associated with the NLA part of
* the RDP context
*
* \param context the RDP context
* \param ulAttr the attribute
* \param pBuffer an opaque pointer depending on ulAttr
* \returns a SECURITY_STATUS indicating if the operation completed successfully
* \since version 3.9.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API SECURITY_STATUS freerdp_nla_QueryContextAttributes(rdpContext* context,
DWORD ulAttr, PVOID pBuffer);
/** Calls FreeContextbuffer on the SSPI context associated with the NLA part of the RDP context
*
* \param context the RDP context
* \param pBuffer an opaque pointer to free
* \returns a SECURITY_STATUS indicating if the operation completed successfully
* \since version 3.22.0
*
* Supported buffers are ones retrieved from SECPKG_ATTR_PACKAGE_INFO.
*/
WINPR_ATTR_NODISCARD
FREERDP_API SECURITY_STATUS freerdp_nla_FreeContextBuffer(rdpContext* context, PVOID pBuffer);
FREERDP_API void clearChannelError(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT getChannelError(const rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API const char* getChannelErrorDescription(const rdpContext* context);
FREERDP_API void setChannelError(rdpContext* context, UINT errorNum, const char* format, ...);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL checkChannelErrorEvent(rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_nego_get_routing_token(const rdpContext* context,
DWORD* length);
/** \brief returns the current \b CONNECTION_STATE of the context.
*
* \param context A pointer to the context to query state
*
* \return A \b CONNECTION_STATE the context is currently in
*/
WINPR_ATTR_NODISCARD
FREERDP_API CONNECTION_STATE freerdp_get_state(const rdpContext* context);
/** \brief returns a string representation of a \b CONNECTION_STATE
*
* \param state the \b CONNECTION_STATE to stringify
*
* \return The string representation of the \b CONNECTION_STATE
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char* freerdp_state_string(CONNECTION_STATE state);
/** \brief Queries if the current \b CONNECTION_STATE of the context is an active connection.
*
* A connection is active, if the connection sequence has been passed, no disconnection requests
* have been received and no network or other errors have forced a disconnect.
*
* \param context A pointer to the context to query state
*
* \return \b TRUE if the connection state indicates an active connection, \b FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_is_active_state(const rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_channels_from_mcs(rdpSettings* settings, const rdpContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_is_valid_mcs_create_request(const BYTE* data, size_t size);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_is_valid_mcs_create_response(const BYTE* data, size_t size);
/** \brief Persist the current credentials (gateway, target server, ...)
*
* FreeRDP internally keeps a backup of connection settings to revert to whenever a reconnect
* is required. If a client modifies settings during runtime after pre-connect call this
* function or the credentials will be lost on any reconnect, redirect, ...
*
* \param context The RDP context to use, must not be \b nullptr
*
* \return \b TRUE if successful, \b FALSE if settings could not be applied (wrong session
* state, ...)
* \since version 3.12.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_persist_credentials(rdpContext* context);
/** @brief set a new function to be called when an access token is requested.
*
* @param context The rdp context to set the function for. Must not be \b nullptr
* @param GetCommonAccessToken The function pointer to set, \b nullptr to disable
*
* @return \b TRUE for success, \b FALSE otherwise
* @since version 3.16.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL freerdp_set_common_access_token(rdpContext* context,
pGetCommonAccessToken GetCommonAccessToken);
/** @brief get the current function pointer set as GetCommonAccessToken
*
* @param context The rdp context to set the function for. Must not be \b nullptr
* @return The current function pointer set or \b nullptr
* @since version 3.16.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API pGetCommonAccessToken freerdp_get_common_access_token(const rdpContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_H */

View File

@@ -0,0 +1,64 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Bitmap Functions
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_BITMAP_H
#define FREERDP_GDI_BITMAP_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos);
FREERDP_API UINT32 gdi_SetPixel(HGDI_DC hdc, UINT32 X, UINT32 Y, UINT32 crColor);
WINPR_ATTR_NODISCARD
FREERDP_API BYTE* gdi_GetPointer(HGDI_BITMAP hBmp, UINT32 X, UINT32 Y);
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_BITMAP gdi_CreateBitmap(UINT32 nWidth, UINT32 nHeight, UINT32 format,
BYTE* data);
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_BITMAP gdi_CreateBitmapEx(UINT32 nWidth, UINT32 nHeight, UINT32 format,
UINT32 stride, BYTE* data, void (*fkt_free)(void*));
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, UINT32 nWidth, UINT32 nHeight);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_BitBlt(HGDI_DC hdcDest, INT32 nXDest, INT32 nYDest, INT32 nWidth,
INT32 nHeight, HGDI_DC hdcSrc, INT32 nXSrc, INT32 nYSrc, DWORD rop,
const gdiPalette* palette);
typedef BOOL (*p_BitBlt)(HGDI_DC hdcDest, INT32 nXDest, INT32 nYDest, INT32 nWidth,
INT32 nHeight, HGDI_DC hdcSrc, INT32 nXSrc, INT32 nYSrc, DWORD rop);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_BITMAP_H */

View File

@@ -0,0 +1,52 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Device Context Functions
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_DC_H
#define FREERDP_GDI_DC_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_DC gdi_GetDC(void);
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_DC gdi_CreateDC(UINT32 format);
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc);
FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject);
FREERDP_API BOOL gdi_DeleteObject(HGDIOBJECT hgdiobject);
FREERDP_API BOOL gdi_DeleteDC(HGDI_DC hdc);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_DC_H */

View File

@@ -0,0 +1,563 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Library
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_H
#define FREERDP_GDI_H
#include <winpr/wlog.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/log.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <freerdp/client/rdpgfx.h>
#include <freerdp/client/geometry.h>
#include <freerdp/client/video.h>
/* For more information, see [MS-RDPEGDI] */
/* Binary Raster Operations (ROP2) */
#define GDI_R2_BLACK 0x01 /* D = 0 */
#define GDI_R2_NOTMERGEPEN 0x02 /* D = ~(D | P) */
#define GDI_R2_MASKNOTPEN 0x03 /* D = D & ~P */
#define GDI_R2_NOTCOPYPEN 0x04 /* D = ~P */
#define GDI_R2_MASKPENNOT 0x05 /* D = P & ~D */
#define GDI_R2_NOT 0x06 /* D = ~D */
#define GDI_R2_XORPEN 0x07 /* D = D ^ P */
#define GDI_R2_NOTMASKPEN 0x08 /* D = ~(D & P) */
#define GDI_R2_MASKPEN 0x09 /* D = D & P */
#define GDI_R2_NOTXORPEN 0x0A /* D = ~(D ^ P) */
#define GDI_R2_NOP 0x0B /* D = D */
#define GDI_R2_MERGENOTPEN 0x0C /* D = D | ~P */
#define GDI_R2_COPYPEN 0x0D /* D = P */
#define GDI_R2_MERGEPENNOT 0x0E /* D = P | ~D */
#define GDI_R2_MERGEPEN 0x0F /* D = P | D */
#define GDI_R2_WHITE 0x10 /* D = 1 */
/* Ternary Raster Operations (ROP3) */
#define GDI_BLACKNESS 0x00000042
#define GDI_DPSoon 0x00010289
#define GDI_DPSona 0x00020C89
#define GDI_PSon 0x000300AA
#define GDI_SDPona 0x00040C88
#define GDI_DPon 0x000500A9
#define GDI_PDSxnon 0x00060865
#define GDI_PDSaon 0x000702C5
#define GDI_SDPnaa 0x00080F08
#define GDI_PDSxon 0x00090245
#define GDI_DPna 0x000A0329
#define GDI_PSDnaon 0x000B0B2A
#define GDI_SPna 0x000C0324
#define GDI_PDSnaon 0x000D0B25
#define GDI_PDSonon 0x000E08A5
#define GDI_Pn 0x000F0001
#define GDI_PDSona 0x00100C85
#define GDI_NOTSRCERASE 0x001100A6
#define GDI_SDPxnon 0x00120868
#define GDI_SDPaon 0x001302C8
#define GDI_DPSxnon 0x00140869
#define GDI_DPSaon 0x001502C9
#define GDI_PSDPSanaxx 0x00165CCA
#define GDI_SSPxDSxaxn 0x00171D54
#define GDI_SPxPDxa 0x00180D59
#define GDI_SDPSanaxn 0x00191CC8
#define GDI_PDSPaox 0x001A06C5
#define GDI_SDPSxaxn 0x001B0768
#define GDI_PSDPaox 0x001C06CA
#define GDI_DSPDxaxn 0x001D0766
#define GDI_PDSox 0x001E01A5
#define GDI_PDSoan 0x001F0385
#define GDI_DPSnaa 0x00200F09
#define GDI_SDPxon 0x00210248
#define GDI_DSna 0x00220326
#define GDI_SPDnaon 0x00230B24
#define GDI_SPxDSxa 0x00240D55
#define GDI_PDSPanaxn 0x00251CC5
#define GDI_SDPSaox 0x002606C8
#define GDI_SDPSxnox 0x00271868
#define GDI_DPSxa 0x00280369
#define GDI_PSDPSaoxxn 0x002916CA
#define GDI_DPSana 0x002A0CC9
#define GDI_SSPxPDxaxn 0x002B1D58
#define GDI_SPDSoax 0x002C0784
#define GDI_PSDnox 0x002D060A
#define GDI_PSDPxox 0x002E064A
#define GDI_PSDnoan 0x002F0E2A
#define GDI_PSna 0x0030032A
#define GDI_SDPnaon 0x00310B28
#define GDI_SDPSoox 0x00320688
#define GDI_NOTSRCCOPY 0x00330008
#define GDI_SPDSaox 0x003406C4
#define GDI_SPDSxnox 0x00351864
#define GDI_SDPox 0x003601A8
#define GDI_SDPoan 0x00370388
#define GDI_PSDPoax 0x0038078A
#define GDI_SPDnox 0x00390604
#define GDI_SPDSxox 0x003A0644
#define GDI_SPDnoan 0x003B0E24
#define GDI_PSx 0x003C004A
#define GDI_SPDSonox 0x003D18A4
#define GDI_SPDSnaox 0x003E1B24
#define GDI_PSan 0x003F00EA
#define GDI_PSDnaa 0x00400F0A
#define GDI_DPSxon 0x00410249
#define GDI_SDxPDxa 0x00420D5D
#define GDI_SPDSanaxn 0x00431CC4
#define GDI_SRCERASE 0x00440328
#define GDI_DPSnaon 0x00450B29
#define GDI_DSPDaox 0x004606C6
#define GDI_PSDPxaxn 0x0047076A
#define GDI_SDPxa 0x00480368
#define GDI_PDSPDaoxxn 0x004916C5
#define GDI_DPSDoax 0x004A0789
#define GDI_PDSnox 0x004B0605
#define GDI_SDPana 0x004C0CC8
#define GDI_SSPxDSxoxn 0x004D1954
#define GDI_PDSPxox 0x004E0645
#define GDI_PDSnoan 0x004F0E25
#define GDI_PDna 0x00500325
#define GDI_DSPnaon 0x00510B26
#define GDI_DPSDaox 0x005206C9
#define GDI_SPDSxaxn 0x00530764
#define GDI_DPSonon 0x005408A9
#define GDI_DSTINVERT 0x00550009
#define GDI_DPSox 0x005601A9
#define GDI_DPSoan 0x00570389
#define GDI_PDSPoax 0x00580785
#define GDI_DPSnox 0x00590609
#define GDI_PATINVERT 0x005A0049
#define GDI_DPSDonox 0x005B18A9
#define GDI_DPSDxox 0x005C0649
#define GDI_DPSnoan 0x005D0E29
#define GDI_DPSDnaox 0x005E1B29
#define GDI_DPan 0x005F00E9
#define GDI_PDSxa 0x00600365
#define GDI_DSPDSaoxxn 0x006116C6
#define GDI_DSPDoax 0x00620786
#define GDI_SDPnox 0x00630608
#define GDI_SDPSoax 0x00640788
#define GDI_DSPnox 0x00650606
#define GDI_SRCINVERT 0x00660046
#define GDI_SDPSonox 0x006718A8
#define GDI_DSPDSonoxxn 0x006858A6
#define GDI_PDSxxn 0x00690145
#define GDI_DPSax 0x006A01E9
#define GDI_PSDPSoaxxn 0x006B178A
#define GDI_SDPax 0x006C01E8
#define GDI_PDSPDoaxxn 0x006D1785
#define GDI_SDPSnoax 0x006E1E28
#define GDI_PDSxnan 0x006F0C65
#define GDI_PDSana 0x00700CC5
#define GDI_SSDxPDxaxn 0x00711D5C
#define GDI_SDPSxox 0x00720648
#define GDI_SDPnoan 0x00730E28
#define GDI_DSPDxox 0x00740646
#define GDI_DSPnoan 0x00750E26
#define GDI_SDPSnaox 0x00761B28
#define GDI_DSan 0x007700E6
#define GDI_PDSax 0x007801E5
#define GDI_DSPDSoaxxn 0x00791786
#define GDI_DPSDnoax 0x007A1E29
#define GDI_SDPxnan 0x007B0C68
#define GDI_SPDSnoax 0x007C1E24
#define GDI_DPSxnan 0x007D0C69
#define GDI_SPxDSxo 0x007E0955
#define GDI_DPSaan 0x007F03C9
#define GDI_DPSaa 0x008003E9
#define GDI_SPxDSxon 0x00810975
#define GDI_DPSxna 0x00820C49
#define GDI_SPDSnoaxn 0x00831E04
#define GDI_SDPxna 0x00840C48
#define GDI_PDSPnoaxn 0x00851E05
#define GDI_DSPDSoaxx 0x008617A6
#define GDI_PDSaxn 0x008701C5
#define GDI_SRCAND 0x008800C6
#define GDI_SDPSnaoxn 0x00891B08
#define GDI_DSPnoa 0x008A0E06
#define GDI_DSPDxoxn 0x008B0666
#define GDI_SDPnoa 0x008C0E08
#define GDI_SDPSxoxn 0x008D0668
#define GDI_SSDxPDxax 0x008E1D7C
#define GDI_PDSanan 0x008F0CE5
#define GDI_PDSxna 0x00900C45
#define GDI_SDPSnoaxn 0x00911E08
#define GDI_DPSDPoaxx 0x009217A9
#define GDI_SPDaxn 0x009301C4
#define GDI_PSDPSoaxx 0x009417AA
#define GDI_DPSaxn 0x009501C9
#define GDI_DPSxx 0x00960169
#define GDI_PSDPSonoxx 0x0097588A
#define GDI_SDPSonoxn 0x00981888
#define GDI_DSxn 0x00990066
#define GDI_DPSnax 0x009A0709
#define GDI_SDPSoaxn 0x009B07A8
#define GDI_SPDnax 0x009C0704
#define GDI_DSPDoaxn 0x009D07A6
#define GDI_DSPDSaoxx 0x009E16E6
#define GDI_PDSxan 0x009F0345
#define GDI_DPa 0x00A000C9
#define GDI_PDSPnaoxn 0x00A11B05
#define GDI_DPSnoa 0x00A20E09
#define GDI_DPSDxoxn 0x00A30669
#define GDI_PDSPonoxn 0x00A41885
#define GDI_PDxn 0x00A50065
#define GDI_DSPnax 0x00A60706
#define GDI_PDSPoaxn 0x00A707A5
#define GDI_DPSoa 0x00A803A9
#define GDI_DPSoxn 0x00A90189
#define GDI_DSTCOPY 0x00AA0029
#define GDI_DPSono 0x00AB0889
#define GDI_SPDSxax 0x00AC0744
#define GDI_DPSDaoxn 0x00AD06E9
#define GDI_DSPnao 0x00AE0B06
#define GDI_DPno 0x00AF0229
#define GDI_PDSnoa 0x00B00E05
#define GDI_PDSPxoxn 0x00B10665
#define GDI_SSPxDSxox 0x00B21974
#define GDI_SDPanan 0x00B30CE8
#define GDI_PSDnax 0x00B4070A
#define GDI_DPSDoaxn 0x00B507A9
#define GDI_DPSDPaoxx 0x00B616E9
#define GDI_SDPxan 0x00B70348
#define GDI_PSDPxax 0x00B8074A
#define GDI_DSPDaoxn 0x00B906E6
#define GDI_DPSnao 0x00BA0B09
#define GDI_MERGEPAINT 0x00BB0226
#define GDI_SPDSanax 0x00BC1CE4
#define GDI_SDxPDxan 0x00BD0D7D
#define GDI_DPSxo 0x00BE0269
#define GDI_DPSano 0x00BF08C9
#define GDI_MERGECOPY 0x00C000CA
#define GDI_SPDSnaoxn 0x00C11B04
#define GDI_SPDSonoxn 0x00C21884
#define GDI_PSxn 0x00C3006A
#define GDI_SPDnoa 0x00C40E04
#define GDI_SPDSxoxn 0x00C50664
#define GDI_SDPnax 0x00C60708
#define GDI_PSDPoaxn 0x00C707AA
#define GDI_SDPoa 0x00C803A8
#define GDI_SPDoxn 0x00C90184
#define GDI_DPSDxax 0x00CA0749
#define GDI_SPDSaoxn 0x00CB06E4
#define GDI_SRCCOPY 0x00CC0020
#define GDI_SDPono 0x00CD0888
#define GDI_SDPnao 0x00CE0B08
#define GDI_SPno 0x00CF0224
#define GDI_PSDnoa 0x00D00E0A
#define GDI_PSDPxoxn 0x00D1066A
#define GDI_PDSnax 0x00D20705
#define GDI_SPDSoaxn 0x00D307A4
#define GDI_SSPxPDxax 0x00D41D78
#define GDI_DPSanan 0x00D50CE9
#define GDI_PSDPSaoxx 0x00D616EA
#define GDI_DPSxan 0x00D70349
#define GDI_PDSPxax 0x00D80745
#define GDI_SDPSaoxn 0x00D906E8
#define GDI_DPSDanax 0x00DA1CE9
#define GDI_SPxDSxan 0x00DB0D75
#define GDI_SPDnao 0x00DC0B04
#define GDI_SDno 0x00DD0228
#define GDI_SDPxo 0x00DE0268
#define GDI_SDPano 0x00DF08C8
#define GDI_PDSoa 0x00E003A5
#define GDI_PDSoxn 0x00E10185
#define GDI_DSPDxax 0x00E20746
#define GDI_PSDPaoxn 0x00E306EA
#define GDI_SDPSxax 0x00E40748
#define GDI_PDSPaoxn 0x00E506E5
#define GDI_SDPSanax 0x00E61CE8
#define GDI_SPxPDxan 0x00E70D79
#define GDI_SSPxDSxax 0x00E81D74
#define GDI_DSPDSanaxxn 0x00E95CE6
#define GDI_DPSao 0x00EA02E9
#define GDI_DPSxno 0x00EB0849
#define GDI_SDPao 0x00EC02E8
#define GDI_SDPxno 0x00ED0848
#define GDI_SRCPAINT 0x00EE0086
#define GDI_SDPnoo 0x00EF0A08
#define GDI_PATCOPY 0x00F00021
#define GDI_PDSono 0x00F10885
#define GDI_PDSnao 0x00F20B05
#define GDI_PSno 0x00F3022A
#define GDI_PSDnao 0x00F40B0A
#define GDI_PDno 0x00F50225
#define GDI_PDSxo 0x00F60265
#define GDI_PDSano 0x00F708C5
#define GDI_PDSao 0x00F802E5
#define GDI_PDSxno 0x00F90845
#define GDI_DPo 0x00FA0089
#define GDI_PATPAINT 0x00FB0A09
#define GDI_PSo 0x00FC008A
#define GDI_PSDnoo 0x00FD0A0A
#define GDI_DPSoo 0x00FE02A9
#define GDI_WHITENESS 0x00FF0062
#define GDI_GLYPH_ORDER 0xFFFFFFFF
/* Brush Styles */
#define GDI_BS_SOLID 0x00
#define GDI_BS_NULL 0x01
#define GDI_BS_HATCHED 0x02
#define GDI_BS_PATTERN 0x03
/* Hatch Patterns */
#define GDI_HS_HORIZONTAL 0x00
#define GDI_HS_VERTICAL 0x01
#define GDI_HS_FDIAGONAL 0x02
#define GDI_HS_BDIAGONAL 0x03
#define GDI_HS_CROSS 0x04
#define GDI_HS_DIAGCROSS 0x05
/* Pen Styles */
#define GDI_PS_SOLID 0x00
#define GDI_PS_DASH 0x01
#define GDI_PS_NULL 0x05
/* Background Modes */
#define GDI_OPAQUE 0x00000001
#define GDI_TRANSPARENT 0x00000002
/* Fill Modes */
#define GDI_FILL_ALTERNATE 0x01
#define GDI_FILL_WINDING 0x02
/* GDI Object Types */
#define GDIOBJECT_BITMAP 0x00
#define GDIOBJECT_PEN 0x01
#define GDIOBJECT_PALETTE 0x02
#define GDIOBJECT_BRUSH 0x03
#define GDIOBJECT_RECT 0x04
#define GDIOBJECT_REGION 0x05
/* Region return values */
#ifndef NULLREGION
#define NULLREGION 0x01
#define SIMPLEREGION 0x02
#define COMPLEXREGION 0x03
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
BYTE objectType;
} GDIOBJECT;
typedef GDIOBJECT* HGDIOBJECT;
typedef struct
{
BYTE objectType;
INT32 left;
INT32 top;
INT32 right;
INT32 bottom;
} GDI_RECT;
typedef GDI_RECT* HGDI_RECT;
typedef struct
{
BYTE objectType;
INT32 x; /* left */
INT32 y; /* top */
INT32 w; /* width */
INT32 h; /* height */
BOOL null; /* null region */
} GDI_RGN;
typedef GDI_RGN* HGDI_RGN;
typedef struct
{
BYTE objectType;
UINT32 format;
INT32 width;
INT32 height;
UINT32 scanline;
BYTE* data;
void (*free)(void*);
} GDI_BITMAP;
typedef GDI_BITMAP* HGDI_BITMAP;
typedef struct
{
BYTE objectType;
UINT32 style;
INT32 width;
INT32 posX;
INT32 posY;
UINT32 color;
UINT32 format;
const gdiPalette* palette;
} GDI_PEN;
typedef GDI_PEN* HGDI_PEN;
typedef struct
{
BYTE red;
BYTE green;
BYTE blue;
} GDI_PALETTEENTRY;
typedef struct
{
UINT16 count;
GDI_PALETTEENTRY* entries;
} GDI_PALETTE;
typedef GDI_PALETTE* HGDI_PALETTE;
typedef struct
{
INT32 x;
INT32 y;
} GDI_POINT;
typedef GDI_POINT* HGDI_POINT;
typedef struct
{
BYTE objectType;
int style;
HGDI_BITMAP pattern;
UINT32 color;
INT32 nXOrg;
INT32 nYOrg;
} GDI_BRUSH;
typedef GDI_BRUSH* HGDI_BRUSH;
typedef struct
{
UINT32 count;
INT32 ninvalid;
HGDI_RGN invalid;
HGDI_RGN cinvalid;
} GDI_WND;
typedef GDI_WND* HGDI_WND;
typedef struct
{
HGDIOBJECT selectedObject;
UINT32 format;
UINT32 bkColor;
UINT32 textColor;
HGDI_BRUSH brush;
HGDI_RGN clip;
HGDI_PEN pen;
HGDI_WND hwnd;
INT32 drawMode;
INT32 bkMode;
} GDI_DC;
typedef GDI_DC* HGDI_DC;
struct gdi_bitmap
{
rdpBitmap _p;
HGDI_DC hdc;
HGDI_BITMAP bitmap;
HGDI_BITMAP org_bitmap;
};
typedef struct gdi_bitmap gdiBitmap;
struct gdi_glyph
{
rdpBitmap _p;
HGDI_DC hdc;
HGDI_BITMAP bitmap;
HGDI_BITMAP org_bitmap;
};
typedef struct gdi_glyph gdiGlyph;
struct rdp_gdi
{
rdpContext* context;
INT32 width;
INT32 height;
UINT32 stride;
UINT32 dstFormat;
UINT32 cursor_x;
UINT32 cursor_y;
HGDI_DC hdc;
gdiBitmap* primary;
gdiBitmap* drawing;
UINT32 bitmap_size;
UINT32 bitmap_stride;
BYTE* primary_buffer;
gdiPalette palette;
gdiBitmap* image;
void (*free)(void*);
BOOL inGfxFrame;
BOOL graphicsReset; /* deprecated, remove with FreeRDP v3 */
BOOL suppressOutput;
UINT16 outputSurfaceId;
UINT32 frameId;
RdpgfxClientContext* gfx;
VideoClientContext* video;
GeometryClientContext* geometry;
wLog* log;
};
typedef struct rdp_gdi rdpGdi;
WINPR_ATTR_NODISCARD
FREERDP_API DWORD gdi_rop3_code(BYTE code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* gdi_rop3_code_string(BYTE code);
WINPR_ATTR_NODISCARD
FREERDP_API const char* gdi_rop3_string(DWORD rop);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_decode_color(rdpGdi* gdi, UINT32 srcColor, UINT32* color, UINT32* format);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height, UINT32 stride,
UINT32 format, BYTE* buffer, void (*pfree)(void*));
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_init(freerdp* instance, UINT32 format);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
void (*pfree)(void*));
FREERDP_API void gdi_free(freerdp* instance);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_send_suppress_output(rdpGdi* gdi, BOOL suppress);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_H */

View File

@@ -0,0 +1,78 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Graphics Pipeline
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_GFX_H
#define FREERDP_GDI_GFX_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct gdi_gfx_surface
{
UINT16 surfaceId;
rdpCodecs* codecs;
H264_CONTEXT* h264;
UINT32 width;
UINT32 height;
UINT32 mappedWidth;
UINT32 mappedHeight;
BYTE* data;
UINT32 scanline;
UINT32 format;
BOOL outputMapped;
UINT32 outputOriginX;
UINT32 outputOriginY;
REGION16 invalidRegion;
UINT64 windowId;
UINT32 outputTargetWidth;
UINT32 outputTargetHeight;
BOOL windowMapped;
BOOL handleInUpdateSurfaceArea;
};
typedef struct gdi_gfx_surface gdiGfxSurface;
struct gdi_gfx_cache_entry
{
UINT64 cacheKey;
UINT32 width;
UINT32 height;
BYTE* data;
UINT32 scanline;
UINT32 format;
};
typedef struct gdi_gfx_cache_entry gdiGfxCacheEntry;
FREERDP_API BOOL gdi_graphics_pipeline_init(rdpGdi* gdi, RdpgfxClientContext* gfx);
FREERDP_API BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
pcRdpgfxMapWindowForSurface map,
pcRdpgfxUnmapWindowForSurface unmap,
pcRdpgfxUpdateSurfaceArea update);
FREERDP_API void gdi_graphics_pipeline_uninit(rdpGdi* gdi, RdpgfxClientContext* gfx);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_GFX_H */

View File

@@ -0,0 +1,42 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Pen Functions
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_PEN_H
#define FREERDP_GDI_PEN_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_PEN gdi_CreatePen(UINT32 fnPenStyle, UINT32 nWidth, UINT32 crColor,
UINT32 format, const gdiPalette* palette);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 gdi_GetPenColor(HGDI_PEN pen, UINT32 format);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_PEN_H */

View File

@@ -0,0 +1,99 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Region Functions
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_REGION_H
#define FREERDP_GDI_REGION_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect,
INT32 nBottomRect);
WINPR_ATTR_NODISCARD
FREERDP_API GDI_RECT* gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_RectToRgn(const GDI_RECT* rect, HGDI_RGN rgn);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN rgn);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_RectToCRgn(const GDI_RECT* rect, INT32* x, INT32* y, INT32* w, INT32* h);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CRectToCRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, INT32* x,
INT32* y, INT32* w, INT32* h);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_RgnToRect(const GDI_RGN* rgn, GDI_RECT* rect);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, GDI_RECT* rect);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_RgnToCRect(const GDI_RGN* rgn, INT32* left, INT32* top, INT32* right,
INT32* bottom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CRgnToCRect(INT32 x, INT32 y, INT32 w, INT32 h, INT32* left, INT32* top,
INT32* right, INT32* bottom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CopyOverlap(INT32 x, INT32 y, INT32 width, INT32 height, INT32 srcx,
INT32 srcy);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_SetRect(GDI_RECT* rc, INT32 xLeft, INT32 yTop, INT32 xRight,
INT32 yBottom);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth,
INT32 nHeight);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_SetRectRgn(HGDI_RGN hRgn, INT32 nLeftRect, INT32 nTopRect,
INT32 nRightRect, INT32 nBottomRect);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_EqualRgn(const GDI_RGN* hSrcRgn1, const GDI_RGN* hSrcRgn2);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_CopyRect(GDI_RECT* dst, const GDI_RECT* src);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_PtInRect(const GDI_RECT* rc, INT32 x, INT32 y);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_REGION_H */

View File

@@ -0,0 +1,53 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* GDI Shape Functions
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_GDI_SHAPE_H
#define FREERDP_GDI_SHAPE_H
#include <freerdp/api.h>
#include <freerdp/gdi/gdi.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const GDI_RECT* rect, HGDI_BRUSH hbr);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT* lpPoints, int nCount);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT* lpPoints, int* lpPolyCounts,
int nCount);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL gdi_Rectangle(HGDI_DC hdc, INT32 nXDst, INT32 nYDst, INT32 nWidth,
INT32 nHeight);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_GDI_SHAPE_H */

Some files were not shown because too many files have changed in this diff Show More