#define SC_MCS_MSGCHANNEL 0x0C04
#define SC_MULTITRANSPORT 0x0C08
-/* RDP version */
-#define RDP_VERSION_4 0x00080001
-#define RDP_VERSION_5_PLUS 0x00080004
+/* RDP versions, see
+ * [MS-RDPBCGR] 2.2.1.3.2 Client Core Data (TS_UD_CS_CORE)
+ * [MS-RDPBCGR] 2.2.1.4.2 Server Core Data (TS_UD_SC_CORE)
+ */
+typedef enum
+{
+ RDP_VERSION_4 = 0x00080001,
+ RDP_VERSION_5_PLUS = 0x00080004,
+ RDP_VERSION_10_0 = 0x00800005,
+ RDP_VERSION_10_1 = 0x00800006,
+ RDP_VERSION_10_2 = 0x00800007,
+ RDP_VERSION_10_3 = 0x00800008,
+ RDP_VERSION_10_4 = 0x00800009,
+ RDP_VERSION_10_5 = 0x0080000a,
+ RDP_VERSION_10_6 = 0x0080000b,
+}
+RDP_VERSION;
/* Color depth */
#define RNS_UD_COLOR_4BPP 0xCA00
#define TAG FREERDP_TAG("core.gcc")
+static DWORD rdp_version_common(DWORD serverVersion, DWORD clientVersion)
+{
+ DWORD version = MIN(serverVersion, clientVersion);
+
+ switch (version)
+ {
+ case RDP_VERSION_4:
+ case RDP_VERSION_5_PLUS:
+ case RDP_VERSION_10_0:
+ case RDP_VERSION_10_1:
+ case RDP_VERSION_10_2:
+ case RDP_VERSION_10_3:
+ case RDP_VERSION_10_4:
+ case RDP_VERSION_10_5:
+ case RDP_VERSION_10_6:
+ return version;
+
+ default:
+ WLog_ERR(TAG, "Invalid client [%"PRId32"] and server [%"PRId32"] versions",
+ serverVersion, clientVersion);
+ return version;
+ }
+}
/**
* T.124 GCC is defined in:
return FALSE;
Stream_Read_UINT32(s, version); /* version (4 bytes) */
- settings->RdpVersion = (version == RDP_VERSION_4 ? 4 : 7);
+ settings->RdpVersion = rdp_version_common(version, settings->RdpVersion);
Stream_Read_UINT16(s, settings->DesktopWidth); /* DesktopWidth (2 bytes) */
Stream_Read_UINT16(s, settings->DesktopHeight); /* DesktopHeight (2 bytes) */
Stream_Read_UINT16(s, colorDepth); /* ColorDepth (2 bytes) */
void gcc_write_client_core_data(wStream* s, rdpMcs* mcs)
{
- UINT32 version;
WCHAR* clientName = NULL;
int clientNameLength;
BYTE connectionType;
int clientDigProductIdLength;
rdpSettings* settings = mcs->settings;
gcc_write_user_data_header(s, CS_CORE, 234);
- version = settings->RdpVersion >= 5 ? RDP_VERSION_5_PLUS : RDP_VERSION_4;
clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1,
&clientName, 0);
clientDigProductIdLength = ConvertToUnicode(CP_UTF8, 0,
settings->ClientProductId, -1, &clientDigProductId, 0);
- Stream_Write_UINT32(s, version); /* Version */
+ Stream_Write_UINT32(s, settings->RdpVersion); /* Version */
Stream_Write_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
Stream_Write_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
Stream_Write_UINT16(s,
BOOL gcc_read_server_core_data(wStream* s, rdpMcs* mcs)
{
- UINT32 version;
+ UINT32 serverVersion;
UINT32 clientRequestedProtocols;
UINT32 earlyCapabilityFlags;
rdpSettings* settings = mcs->settings;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
- Stream_Read_UINT32(s, version); /* version */
-
- if (version == RDP_VERSION_4 && settings->RdpVersion > 4)
- settings->RdpVersion = 4;
- else if (version == RDP_VERSION_5_PLUS && settings->RdpVersion < 5)
- settings->RdpVersion = 7;
+ Stream_Read_UINT32(s, serverVersion); /* version */
+ settings->RdpVersion = rdp_version_common(serverVersion, settings->RdpVersion);
if (Stream_GetRemainingLength(s) >= 4)
{
BOOL gcc_write_server_core_data(wStream* s, rdpMcs* mcs)
{
- UINT32 version;
UINT32 earlyCapabilityFlags = 0;
rdpSettings* settings = mcs->settings;
return FALSE;
gcc_write_user_data_header(s, SC_CORE, 16);
- version = settings->RdpVersion == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS;
if (settings->SupportDynamicTimeZone)
earlyCapabilityFlags |= RNS_UD_SC_DYNAMIC_DST_SUPPORTED;
- Stream_Write_UINT32(s, version); /* version (4 bytes) */
+ Stream_Write_UINT32(s, settings->RdpVersion); /* version (4 bytes) */
Stream_Write_UINT32(s,
settings->RequestedProtocols); /* clientRequestedProtocols (4 bytes) */
Stream_Write_UINT32(s,