diff --git a/common/xrdp_constants.h b/common/xrdp_constants.h index 98bd8371..fb5a0da7 100644 --- a/common/xrdp_constants.h +++ b/common/xrdp_constants.h @@ -201,6 +201,11 @@ #define OSMINORTYPE_PSEUDO_XSERVER 0x0008 #define OSMINORTYPE_WINDOWS_RT 0x0009 +/* Window List Capability Set: WndSupportLevel (MS-RDPERP 2.2.1.1.2) */ +#define TS_WINDOW_LEVEL_NOT_SUPPORTED 0x00000000 +#define TS_WINDOW_LEVEL_SUPPORTED 0x00000001 +#define TS_WINDOW_LEVEL_SUPPORTED_EX 0x00000002 + /* Extended Info Packet: performanceFlags (MS-RDPBCGR 2.2.1.11.1.1.1) */ /* TODO: to be renamed */ #define RDP5_DISABLE_NOTHING 0x00 @@ -417,85 +422,82 @@ /* Maps to generalCapabilitySet in T.128 page 138 */ /* Capability Set: capabilitySetType (MS-RDPBCGR 2.2.1.13.1.1.1) */ -/* TODO: to be renamed */ -#define RDP_CAPSET_GENERAL 0x0001 -#define RDP_CAPLEN_GENERAL 0x18 - -#define RDP_CAPSET_BITMAP 0x0002 -#define RDP_CAPLEN_BITMAP 0x1C - -#define RDP_CAPSET_ORDER 0x0003 -#define RDP_CAPLEN_ORDER 0x58 -#define ORDER_CAP_NEGOTIATE 2 -#define ORDER_CAP_NOSUPPORT 4 +#define CAPSTYPE_GENERAL 0x0001 +#define CAPSTYPE_GENERAL_LEN 0x18 -#define RDP_CAPSET_BMPCACHE 0x0004 -#define RDP_CAPLEN_BMPCACHE 0x28 +#define CAPSTYPE_BITMAP 0x0002 +#define CAPSTYPE_BITMAP_LEN 0x1C -#define RDP_CAPSET_CONTROL 0x0005 -#define RDP_CAPLEN_CONTROL 0x0C +#define CAPSTYPE_ORDER 0x0003 +#define CAPSTYPE_ORDER_LEN 0x58 +#define ORDER_CAP_NEGOTIATE 2 /* NEGOTIATEORDERSUPPORT? not used */ +#define ORDER_CAP_NOSUPPORT 4 /* not used */ -#define RDP_CAPSET_ACTIVATE 0x0007 -#define RDP_CAPLEN_ACTIVATE 0x0C +#define CAPSTYPE_BITMACACHE 0x0004 +#define CAPSTYPE_BITMAPCACHE_LEN 0x28 -#define RDP_CAPSET_POINTER 0x0008 -#define RDP_CAPLEN_POINTER 0x0a -#define RDP_CAPLEN_POINTER_MONO 0x08 +#define CAPSTYPE_CONTROL 0x0005 +#define CAPSTYPE_CONTROL_LEN 0x0C -#define RDP_CAPSET_SHARE 0x0009 -#define RDP_CAPLEN_SHARE 0x08 +#define CAPSTYPE_ACTIVATION 0x0007 +#define CAPSTYPE_ACTIVATION_LEN 0x0C -#define RDP_CAPSET_COLCACHE 0x000A -#define RDP_CAPLEN_COLCACHE 0x08 +#define CAPSTYPE_POINTER 0x0008 +#define CAPSTYPE_POINTER_LEN 0x0a +#define CAPSTYPE_POINTER_MONO_LEN 0x08 -#define RDP_CAPSET_SOUND 0x000C +#define CAPSTYPE_SHARE 0x0009 +#define CAPSTYPE_SHARE_LEN 0x08 -#define RDP_CAPSET_INPUT 0x000D -#define RDP_CAPLEN_INPUT 0x58 +#define CAPSTYPE_COLORCACHE 0x000A +#define CAPSTYPE_COLORCACHE_LEN 0x08 -#define RDP_CAPSET_FONT 0x000E -#define RDP_CAPLEN_FONT 0x04 +#define CAPSTYPE_SOUND 0x000C -#define RDP_CAPSET_BRUSHCACHE 0x000F -#define RDP_CAPLEN_BRUSHCACHE 0x08 +#define CAPSTYPE_INPUT 0x000D +#define CAPSTYPE_INPUT_LEN 0x58 -#define RDP_CAPSET_GLYPHCACHE 0x0010 -#define RDP_CAPSET_OFFSCREENCACHE 0x0011 +#define CAPSTYPE_FONT 0x000E +#define CAPSTYPE_FONT_LEN 0x04 -#define RDP_CAPSET_BITMAP_OFFSCREEN 0x0012 -#define RDP_CAPLEN_BITMAP_OFFSCREEN 0x08 +#define CAPSTYPE_BRUSH 0x000F +#define CAPSTYPE_BRUSH_LEN 0x08 -#define RDP_CAPSET_BMPCACHE2 0x0013 -#define RDP_CAPLEN_BMPCACHE2 0x28 -#define BMPCACHE2_FLAG_PERSIST ((long)1<<31) +#define CAPSTYPE_GLYPHCACHE 0x0010 +#define CAPSTYPE_OFFSCREENCACHE 0x0011 -#define RDP_CAPSET_VIRCHAN 0x0014 -#define RDP_CAPLEN_VIRCHAN 0x08 +#define CAPSTYPE_BITMAPCACHE_HOSTSUPPORT 0x0012 +#define CAPSTYPE_BITMAPCACHE_HOSTSUPPORT_LEN 0x08 -#define RDP_CAPSET_DRAWNINEGRIDCACHE 0x0015 -#define RDP_CAPSET_DRAWGDIPLUS 0x0016 -#define RDP_CAPSET_RAIL 0x0017 -#define RDP_CAPSET_WINDOW 0x0018 +#define CAPSTYPE_BITMAPCACHE_REV2 0x0013 +#define CAPSTYPE_BITMAPCACHE_REV2_LEN 0x28 +#define BMPCACHE2_FLAG_PERSIST ((long)1<<31) -#define RDP_CAPSET_COMPDESK 0x0019 -#define RDP_CAPLEN_COMPDESK 0x06 +#define CAPSTYPE_VIRTUALCHANNEL 0x0014 +#define CAPSTYPE_VIRTUALCHANNEL_LEN 0x08 -#define RDP_CAPSET_MULTIFRAGMENT 0x001A -#define RDP_CAPLEN_MULTIFRAGMENT 0x08 +#define CAPSTYPE_DRAWNINGRIDCACHE 0x0015 +#define CAPSTYPE_DRAWGDIPLUS 0x0016 +#define CAPSTYPE_RAIL 0x0017 +#define CAPSTYPE_WINDOW 0x0018 -#define RDP_CAPSET_LPOINTER 0x001B -#define RDP_CAPLEN_LPOINTER 0x06 +#define CAPSSETTYPE_COMPDESK 0x0019 +#define CAPSSETTYPE_COMPDESK_LEN 0x06 -#define RDP_CAPSET_FRAME_ACKNOWLEDGE 0x001E -#define RDP_CAPLEN_FRAME_ACKNOWLEDGE 0x08 +#define CAPSSETTYPE_MULTIFRAGMENTUPDATE 0x001A +#define CAPSSETTYPE_MULTIFRAGMENTUPDATE_LEN 0x08 -#define RDP_CAPSET_SURFCMDS 0x001C -#define RDP_CAPLEN_SURFCMDS 0x0C +#define CAPSETTYPE_LARGE_POINTER 0x001B +#define CAPSETTYPE_LARGE_POINTER_LEN 0x06 -#define RDP_CAPSET_BMPCODECS 0x001D -#define RDP_CAPLEN_BMPCODECS 0x1C +#define CAPSETTYPE_SURFACE_COMMANDS 0x001C +#define CAPSETTYPE_SURFACE_COMMANDS_LEN 0x0C +#define CAPSSETTYPE_BITMAP_CODECS 0x001D +#define CAPSSETTYPE_BITMAP_CODECS_LEN 0x1C +#define CAPSTYPE_FRAME_ACKNOWLEDGE 0x001E +#define CAPSTYPE_FRAME_ACKNOWLEDGE_LEN 0x08 /* TS_SECURITY_HEADER: flags (MS-RDPBCGR 2.2.8.1.1.2.1) */ /* TODO: to be renamed */ diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index e47c4a63..f1983421 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -637,89 +637,89 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) len -= 4; switch (type) { - case RDP_CAPSET_GENERAL: + case CAPSTYPE_GENERAL: DEBUG(("RDP_CAPSET_GENERAL")); xrdp_caps_process_general(self, s, len); break; - case RDP_CAPSET_BITMAP: + case CAPSTYPE_BITMAP: DEBUG(("RDP_CAPSET_BITMAP")); break; - case RDP_CAPSET_ORDER: + case CAPSTYPE_ORDER: DEBUG(("RDP_CAPSET_ORDER")); xrdp_caps_process_order(self, s, len); break; - case RDP_CAPSET_BMPCACHE: + case CAPSTYPE_BITMACACHE: DEBUG(("RDP_CAPSET_BMPCACHE")); xrdp_caps_process_bmpcache(self, s, len); break; - case RDP_CAPSET_CONTROL: + case CAPSTYPE_CONTROL: DEBUG(("RDP_CAPSET_CONTROL")); break; case 6: xrdp_caps_process_cache_v3_codec_id(self, s, len); break; - case RDP_CAPSET_ACTIVATE: + case CAPSTYPE_ACTIVATION: DEBUG(("RDP_CAPSET_ACTIVATE")); break; - case RDP_CAPSET_POINTER: + case CAPSTYPE_POINTER: DEBUG(("RDP_CAPSET_POINTER")); xrdp_caps_process_pointer(self, s, len); break; - case RDP_CAPSET_SHARE: + case CAPSTYPE_SHARE: DEBUG(("RDP_CAPSET_SHARE")); break; - case RDP_CAPSET_COLCACHE: + case CAPSTYPE_COLORCACHE: DEBUG(("RDP_CAPSET_COLCACHE")); break; - case RDP_CAPSET_SOUND: + case CAPSTYPE_SOUND: DEBUG(("--0x0C")); break; - case RDP_CAPSET_INPUT: + case CAPSTYPE_INPUT: xrdp_caps_process_input(self, s, len); break; - case RDP_CAPSET_FONT: + case CAPSTYPE_FONT: DEBUG(("--0x0D")); break; - case RDP_CAPSET_BRUSHCACHE: + case CAPSTYPE_BRUSH: xrdp_caps_process_brushcache(self, s, len); break; - case RDP_CAPSET_GLYPHCACHE: + case CAPSTYPE_GLYPHCACHE: DEBUG(("RDP_CAPSET_GLYPHCACHE")); xrdp_caps_process_glyphcache(self, s, len); break; - case RDP_CAPSET_OFFSCREENCACHE: + case CAPSTYPE_BITMAPCACHE_HOSTSUPPORT: DEBUG(("CAPSET_TYPE_OFFSCREEN_CACHE")); xrdp_caps_process_offscreen_bmpcache(self, s, len); break; - case RDP_CAPSET_BMPCACHE2: + case CAPSTYPE_BITMAPCACHE_REV2: DEBUG(("RDP_CAPSET_BMPCACHE2")); xrdp_caps_process_bmpcache2(self, s, len); break; - case RDP_CAPSET_VIRCHAN: + case CAPSTYPE_VIRTUALCHANNEL: DEBUG(("--0x14")); break; - case RDP_CAPSET_DRAWNINEGRIDCACHE: + case CAPSTYPE_DRAWNINGRIDCACHE: DEBUG(("--0x15")); break; - case RDP_CAPSET_DRAWGDIPLUS: + case CAPSTYPE_DRAWGDIPLUS: DEBUG(("--0x16")); break; - case RDP_CAPSET_RAIL: + case CAPSTYPE_RAIL: xrdp_caps_process_rail(self, s, len); break; - case RDP_CAPSET_WINDOW: + case CAPSTYPE_WINDOW: xrdp_caps_process_window(self, s, len); break; - case RDP_CAPSET_MULTIFRAGMENT: + case CAPSSETTYPE_MULTIFRAGMENTUPDATE: xrdp_caps_process_multifragmentupdate(self, s, len); break; - case RDP_CAPSET_SURFCMDS: + case CAPSETTYPE_SURFACE_COMMANDS: xrdp_caps_process_surface_cmds(self, s, len); break; - case RDP_CAPSET_BMPCODECS: + case CAPSSETTYPE_BITMAP_CODECS: xrdp_caps_process_codecs(self, s, len); break; - case RDP_CAPSET_FRAME_ACKNOWLEDGE: + case CAPSTYPE_FRAME_ACKNOWLEDGE: xrdp_caps_process_frame_ack(self, s, len); break; default: @@ -785,29 +785,27 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) /* Output share capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_SHARE); - out_uint16_le(s, RDP_CAPLEN_SHARE); + out_uint16_le(s, CAPSTYPE_SHARE); + out_uint16_le(s, CAPSTYPE_SHARE_LEN); out_uint16_le(s, self->mcs_channel); out_uint16_be(s, 0xb5e2); /* 0x73e1 */ /* Output general capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_GENERAL); /* 1 */ - out_uint16_le(s, RDP_CAPLEN_GENERAL); /* 24(0x18) */ - out_uint16_le(s, 1); /* OS major type */ - out_uint16_le(s, 3); /* OS minor type */ + out_uint16_le(s, CAPSTYPE_GENERAL); + out_uint16_le(s, CAPSTYPE_GENERAL_LEN); + out_uint16_le(s, OSMAJORTYPE_WINDOWS); + out_uint16_le(s, OSMINORTYPE_WINDOWS_NT); out_uint16_le(s, 0x200); /* Protocol version */ out_uint16_le(s, 0); /* pad */ out_uint16_le(s, 0); /* Compression types */ - /* NO_BITMAP_COMPRESSION_HDR 0x0400 - FASTPATH_OUTPUT_SUPPORTED 0x0001 */ if (self->client_info.use_fast_path & 1) { - out_uint16_le(s, 0x401); + out_uint16_le(s, NO_BITMAP_COMPRESSION_HDR | FASTPATH_OUTPUT_SUPPORTED); } else { - out_uint16_le(s, 0x400); + out_uint16_le(s, NO_BITMAP_COMPRESSION_HDR); } out_uint16_le(s, 0); /* Update capability */ out_uint16_le(s, 0); /* Remote unshare capability */ @@ -816,8 +814,8 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) /* Output bitmap capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_BITMAP); /* 2 */ - out_uint16_le(s, RDP_CAPLEN_BITMAP); /* 28(0x1c) */ + out_uint16_le(s, CAPSTYPE_BITMAP); + out_uint16_le(s, CAPSTYPE_BITMAP_LEN); out_uint16_le(s, self->client_info.bpp); /* Preferred BPP */ out_uint16_le(s, 1); /* Receive 1 BPP */ out_uint16_le(s, 1); /* Receive 4 BPP */ @@ -833,13 +831,13 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) /* Output font capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_FONT); /* 14 */ - out_uint16_le(s, RDP_CAPLEN_FONT); /* 4 */ + out_uint16_le(s, CAPSTYPE_FONT); + out_uint16_le(s, CAPSTYPE_FONT_LEN); /* Output order capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_ORDER); /* 3 */ - out_uint16_le(s, RDP_CAPLEN_ORDER); /* 88(0x58) */ + out_uint16_le(s, CAPSTYPE_ORDER); + out_uint16_le(s, CAPSTYPE_ORDER_LEN); out_uint8s(s, 16); out_uint32_be(s, 0x40420f00); out_uint16_le(s, 1); /* Cache X granularity */ @@ -891,7 +889,7 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) /* Output bmpcodecs capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_BMPCODECS); + out_uint16_le(s, CAPSSETTYPE_BITMAP_CODECS); codec_caps_size_ptr = s->p; out_uint8s(s, 2); /* cap len set later */ codec_caps_count = 0; @@ -934,23 +932,23 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) /* Output color cache capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_COLCACHE); - out_uint16_le(s, RDP_CAPLEN_COLCACHE); + out_uint16_le(s, CAPSTYPE_COLORCACHE); + out_uint16_le(s, CAPSTYPE_COLORCACHE_LEN); out_uint16_le(s, 6); /* cache size */ out_uint16_le(s, 0); /* pad */ /* Output pointer capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_POINTER); - out_uint16_le(s, RDP_CAPLEN_POINTER); + out_uint16_le(s, CAPSTYPE_POINTER); + out_uint16_le(s, CAPSTYPE_POINTER_LEN); out_uint16_le(s, 1); /* Colour pointer */ out_uint16_le(s, 0x19); /* Cache size */ out_uint16_le(s, 0x19); /* Cache size */ /* Output input capability set */ caps_count++; - out_uint16_le(s, RDP_CAPSET_INPUT); /* 13(0xd) */ - out_uint16_le(s, RDP_CAPLEN_INPUT); /* 88(0x58) */ + out_uint16_le(s, CAPSTYPE_INPUT); + out_uint16_le(s, CAPSTYPE_INPUT_LEN); flags = INPUT_FLAG_SCANCODES | INPUT_FLAG_MOUSEX | @@ -968,16 +966,17 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) { /* Remote Programs Capability Set */ caps_count++; - out_uint16_le(s, 0x0017); /* CAPSETTYPE_RAIL */ - out_uint16_le(s, 8); - out_uint32_le(s, 3); /* TS_RAIL_LEVEL_SUPPORTED - TS_RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED */ + out_uint16_le(s, CAPSTYPE_RAIL); + out_uint16_le(s, 8); /* LengthCapability: MS-RDPERP 2.2.1.1.1 */ + out_uint32_le(s, 3); /* See: https://msdn.microsoft.com/en-us/library/cc242518.aspx + TS_RAIL_LEVEL_SUPPORTED + TS_RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED */ /* Window List Capability Set */ caps_count++; - out_uint16_le(s, 0x0018); /* CAPSETTYPE_WINDOW */ - out_uint16_le(s, 11); - out_uint32_le(s, 2); /* TS_WINDOW_LEVEL_SUPPORTED_EX */ + out_uint16_le(s, CAPSTYPE_WINDOW); + out_uint16_le(s, 11); /* LengthCapability: MS-RDPERP 2.2.1.1.2 */ + out_uint32_le(s, TS_WINDOW_LEVEL_SUPPORTED_EX); out_uint8(s, 3); /* NumIconCaches */ out_uint16_le(s, 12); /* NumIconCacheEntries */ } @@ -992,20 +991,20 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) { /* multifragment update */ caps_count++; - out_uint16_le(s, RDP_CAPSET_MULTIFRAGMENT); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */ - out_uint16_le(s, RDP_CAPLEN_MULTIFRAGMENT); + out_uint16_le(s, CAPSSETTYPE_MULTIFRAGMENTUPDATE); + out_uint16_le(s, CAPSSETTYPE_MULTIFRAGMENTUPDATE_LEN); out_uint32_le(s, 3 * 1024 * 1024); /* 3MB */ /* frame acks */ caps_count++; - out_uint16_le(s, RDP_CAPSET_FRAME_ACKNOWLEDGE); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */ - out_uint16_le(s, RDP_CAPLEN_FRAME_ACKNOWLEDGE); + out_uint16_le(s, CAPSTYPE_FRAME_ACKNOWLEDGE); + out_uint16_le(s, CAPSTYPE_FRAME_ACKNOWLEDGE_LEN); 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_uint16_le(s, CAPSETTYPE_SURFACE_COMMANDS); + out_uint16_le(s, CAPSETTYPE_SURFACE_COMMANDS_LEN); out_uint32_le(s, (SURFCMDS_SETSURFACEBITS | SURFCMDS_FRAMEMARKER | SURFCMDS_STREAMSUFRACEBITS)); /* cmdFlags */