diff options
Diffstat (limited to 'libxrdp')
| -rw-r--r-- | libxrdp/libxrdp.c | 6 | ||||
| -rw-r--r-- | libxrdp/xrdp_caps.c | 67 | ||||
| -rw-r--r-- | libxrdp/xrdp_jpeg_compress.c | 11 |
3 files changed, 59 insertions, 25 deletions
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); @@ -534,6 +534,18 @@ xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len) } /*****************************************************************************/ +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/libxrdp/xrdp_jpeg_compress.c b/libxrdp/xrdp_jpeg_compress.c index 385203a6..755c20bd 100644 --- a/libxrdp/xrdp_jpeg_compress.c +++ b/libxrdp/xrdp_jpeg_compress.c @@ -365,11 +365,14 @@ jpeg_compress(char *in_data, int width, int height, *(dst8++) = red; } - for (i = 0; i < e; i++) + if (width > 0) { - *(dst8++) = blue; - *(dst8++) = green; - *(dst8++) = red; + for (i = 0; i < e; i++) + { + *(dst8++) = blue; + *(dst8++) = green; + *(dst8++) = red; + } } } } |
