diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h index 3ac8504f..41c4a5ee 100644 --- a/common/xrdp_constants.h +++ b/common/xrdp_constants.h @@ -284,6 +284,24 @@ #define RDP_CAPSET_VIRCHAN 20 #define RDP_CAPLEN_VIRCHAN 0x08 +#define RDP_CAPSET_MULTIFRAGMENT 0x001A +#define RDP_CAPLEN_MULTIFRAGMENT 0x08 + +#define RDP_CAPSET_FRAME_ACKNOWLEDGE 0x001E +#define RDP_CAPLEN_FRAME_ACKNOWLEDGE 0x08 + +#define RDP_CAPSET_SURFCMDS 0x1C +#define RDP_CAPLEN_SURFCMDS 0x0C + +#define RDP_CAPSET_BMPCODECS 0x1D +#define RDP_CAPLEN_BMPCODECS 0x1C + +#define RDP_CAPSET_COMPDESK 0x19 +#define RDP_CAPLEN_COMPDESK 0x06 + +#define RDP_CAPSET_LPOINTER 0x1B +#define RDP_CAPLEN_LPOINTER 0x06 + #define RDP_SOURCE "MSTSC" /* Logon flags */ @@ -539,9 +557,9 @@ #define COMPDESK_NOT_SUPPORTED 0x0000 #define COMPDESK_SUPPORTED 0x0001 -#define SURCMDS_SETSURFACEBITS 0x00000002 -#define SURCMDS_FRAMEMARKER 0x00000010 -#define SURCMDS_STREAMSUFRACEBITS 0x00000040 +#define SURFCMDS_SETSURFACEBITS 0x00000002 +#define SURFCMDS_FRAMEMARKER 0x00000010 +#define SURFCMDS_STREAMSUFRACEBITS 0x00000040 /* CODEC_GUID_NSCODEC CA8D1BB9-000F-154F-589FAE2D1A87E2D6 */ #define XR_CODEC_GUID_NSCODEC \ @@ -551,6 +569,10 @@ #define XR_CODEC_GUID_REMOTEFX \ "\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86" +/* CODEC_GUID_IMAGE_REMOTEFX 2744CCD4-9D8A-4E74-803C-0ECBEEA19C54 */ +#define XR_CODEC_GUID_IMAGE_REMOTEFX \ + "\xD4\xCC\x44\x27\x8A\x9D\x74\x4E\x80\x3C\x0E\xCB\xEE\xA1\x9C\x54" + /* CODEC_GUID_JPEG 1BAF4CE6-9EED-430C-869ACB8B37B66237 */ #define XR_CODEC_GUID_JPEG \ "\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37" @@ -563,15 +585,6 @@ #define XR_CODEC_GUID_H264 \ "\x48\x32\x36\x34\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71" -#define RDP_CAPSET_SURFCMDS 0x1c -#define RDP_CAPLEN_SURFCMDS 0x0c -#define RDP_CAPSET_BMPCODECS 0x1d -#define RDP_CAPLEN_BMPCODECS 0x1c -#define RDP_CAPSET_COMPDESK 0x19 -#define RDP_CAPLEN_COMPDESK 0x06 -#define RDP_CAPSET_LPOINTER 0x27 -#define RDP_CAPLEN_LPOINTER 0x06 - /* fastpath input */ #define FASTPATH_INPUT_SECURE_CHECKSUM 0x1 #define FASTPATH_INPUT_ENCRYPTED 0x2 diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index c3763bf5..2d59621a 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -1332,13 +1332,13 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session, s->rdp_hdr = s->sec_hdr + sec_bytes; s->end = data_pad + pad_bytes + data_bytes; s->p = s->data + (rdp_bytes + sec_bytes); - /* TS_SURFCMD_SET_SURF_BITS */ - out_uint16_le(s, 0x0001); /* CMDTYPE_SET_SURFACE_BITS */ + /* TS_SURFCMD_STREAM_SURF_BITS */ + out_uint16_le(s, CMDTYPE_STREAM_SURFACE_BITS); out_uint16_le(s, destLeft); out_uint16_le(s, destTop); out_uint16_le(s, destRight); out_uint16_le(s, destBottom); - /* TS_ BITMAP_DATA_EX */ + /* TS_BITMAP_DATA_EX */ out_uint8(s, bpp); out_uint8(s, 0); out_uint8(s, 0); diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index e8c32e7d..a8b9344f 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -457,7 +457,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len) if (g_memcmp(codec_guid, XR_CODEC_GUID_NSCODEC, 16) == 0) { - g_writeln("xrdp_caps_process_codecs: nscodec codec id %d prop len %d", + g_writeln("xrdp_caps_process_codecs: nscodec, codec id %d, properties len %d", codec_id, codec_properties_length); self->client_info.ns_codec_id = codec_id; i1 = MIN(64, codec_properties_length); @@ -466,7 +466,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len) } else if (g_memcmp(codec_guid, XR_CODEC_GUID_REMOTEFX, 16) == 0) { - g_writeln("xrdp_caps_process_codecs: rfx codec id %d prop len %d", + g_writeln("xrdp_caps_process_codecs: RemoteFX, codec id %d, properties len %d", codec_id, codec_properties_length); self->client_info.rfx_codec_id = codec_id; i1 = MIN(64, codec_properties_length); @@ -475,7 +475,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len) } else if (g_memcmp(codec_guid, XR_CODEC_GUID_JPEG, 16) == 0) { - g_writeln("xrdp_caps_process_codecs: jpeg codec id %d prop len %d", + g_writeln("xrdp_caps_process_codecs: jpeg, codec id %d, properties len %d", codec_id, codec_properties_length); self->client_info.jpeg_codec_id = codec_id; i1 = MIN(64, codec_properties_length); @@ -492,7 +492,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len) } else if (g_memcmp(codec_guid, XR_CODEC_GUID_H264, 16) == 0) { - g_writeln("xrdp_caps_process_codecs: h264 codec id %d prop len %d", + g_writeln("xrdp_caps_process_codecs: h264, codec id %d, properties len %d", codec_id, codec_properties_length); self->client_info.h264_codec_id = codec_id; i1 = MIN(64, codec_properties_length); @@ -533,6 +533,18 @@ xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len) return 0; } +/*****************************************************************************/ +static int APP_CC +xrdp_caps_process_surface_cmds(struct xrdp_rdp *self, struct stream *s, int len) +{ + int cmdFlags; + g_writeln("xrdp_caps_process_surface_cmds:"); + in_uint32_le(s, cmdFlags); + in_uint8s(s, 4); /* reserved */ + g_writeln(" cmdFlags 0x%08x", cmdFlags); + return 0; +} + /*****************************************************************************/ int APP_CC xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) @@ -659,6 +671,9 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) case 0x001E: /* CAPSSETTYPE_FRAME_ACKNOWLEDGE */ xrdp_caps_process_frame_ack(self, s, len); break; + case RDP_CAPSET_SURFCMDS: /* CAPSETTYPE_SURFACE_COMMANDS */ + xrdp_caps_process_surface_cmds(self, s, len); + break; default: g_writeln("unknown in xrdp_caps_process_confirm_active %d", type); break; @@ -827,7 +842,7 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) codec_caps_count++; out_uint8a(s, XR_CODEC_GUID_NSCODEC, 16); out_uint8(s, 1); /* codec id, must be 1 */ - out_uint16_le(s, 3); + out_uint16_le(s, 3); /* codecPropertiesLength */ out_uint8(s, 0x01); /* fAllowDynamicFidelity */ out_uint8(s, 0x01); /* fAllowSubsampling */ out_uint8(s, 0x03); /* colorLossLevel */ @@ -836,15 +851,21 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) codec_caps_count++; out_uint8a(s, XR_CODEC_GUID_REMOTEFX, 16); out_uint8(s, 0); /* codec id, client sets */ - out_uint16_le(s, 256); - out_uint8s(s, 256); + out_uint16_le(s, 4); /* codecPropertiesLength */ + out_uint32_le(s, 0); /* reserved */ + /* image remotefx */ + codec_caps_count++; + out_uint8a(s, XR_CODEC_GUID_IMAGE_REMOTEFX, 16); + out_uint8(s, 0); /* codec id, client sets */ + out_uint16_le(s, 4); /* codecPropertiesLength */ + out_uint32_le(s, 0); /* reserved */ #endif /* jpeg */ codec_caps_count++; out_uint8a(s, XR_CODEC_GUID_JPEG, 16); out_uint8(s, 0); /* codec id, client sets */ - out_uint16_le(s, 1); /* ext length */ - out_uint8(s, 75); + out_uint16_le(s, 1); /* codecPropertiesLength */ + out_uint8(s, 75); /* jpeg compression ratio */ /* calculate and set size and count */ codec_caps_size = (int)(s->p - codec_caps_size_ptr); codec_caps_size += 2; /* 2 bytes for RDP_CAPSET_BMPCODECS above */ @@ -901,19 +922,29 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) out_uint16_le(s, 5); out_uint8(s, 0); /* client sets */ - if (self->client_info.use_fast_path & 1) /* fastpath output on */ + if (self->client_info.use_fast_path & FASTPATH_OUTPUT_SUPPORTED) /* fastpath output on */ { + /* multifragment update */ caps_count++; - out_uint16_le(s, 0x001A); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */ - out_uint16_le(s, 8); + out_uint16_le(s, RDP_CAPSET_MULTIFRAGMENT); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */ + out_uint16_le(s, RDP_CAPLEN_MULTIFRAGMENT); out_uint32_le(s, 3 * 1024 * 1024); /* 3MB */ - } - /* frame acks */ - caps_count++; - out_uint16_le(s, 0x001E); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */ - out_uint16_le(s, 8); - out_uint32_le(s, 2); /* 2 frames in flight */ + /* frame acks */ + caps_count++; + out_uint16_le(s, RDP_CAPSET_FRAME_ACKNOWLEDGE); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */ + out_uint16_le(s, RDP_CAPLEN_FRAME_ACKNOWLEDGE); + out_uint32_le(s, 2); /* 2 frames in flight */ + + /* surface commands */ + caps_count++; + out_uint16_le(s, RDP_CAPSET_SURFCMDS); /* CAPSETTYPE_SURFACE_COMMANDS */ + out_uint16_le(s, RDP_CAPLEN_SURFCMDS); /* lengthCapability */ + out_uint32_le(s, (SURFCMDS_SETSURFACEBITS | + SURFCMDS_FRAMEMARKER | + SURFCMDS_STREAMSUFRACEBITS)); /* cmdFlags */ + out_uint32_le(s, 0); /* reserved */ + } out_uint8s(s, 4); /* pad */ diff --git a/xrdp/xrdp_encoder.c b/xrdp/xrdp_encoder.c index 5c9832ee..0af0b85e 100644 --- a/xrdp/xrdp_encoder.c +++ b/xrdp/xrdp_encoder.c @@ -60,11 +60,6 @@ xrdp_encoder_create(struct xrdp_mm *mm) client_info = mm->wm->client_info; - if (client_info->client_os_major != OSMAJORTYPE_UNIX) - { - /* temp workaround to avoid black screen in non-supported clients */ - return 0; - } if (client_info->mcs_connection_type != 6) /* LAN */ { return 0; diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 715a18fc..07c69327 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -2291,7 +2291,7 @@ xrdp_mm_frame_ack(struct xrdp_mm *self, int frame_id) { int ex; - LLOGLN(0, ("xrdp_mm_frame_ack:")); + LLOGLN(10, ("xrdp_mm_frame_ack:")); self->encoder->frame_id_client = frame_id; if (self->wm->client_info->use_frame_acks == 0) {