shithub: rd

Download patch

ref: e5fd621a64633b7fbbf84e32dc47d3c038269635
parent: af93e0054ff142c7867c7a7c73982d13735758f4
author: Yaroslav K <yarikos@gmail.com>
date: Thu Mar 5 12:52:07 EST 2026

Also include our Virtual Channel caps in the capability exchange.

--- a/cap.c
+++ b/cap.c
@@ -9,10 +9,11 @@
 	CapBitmap=	2,
 	CapOrder=	3,
 	CapPointer=	8,
-	CapBitcache2=	19,
-	CapInput=	13,
 	CapSound=	12,
+	CapInput=	13,
 	CapGlyph=	16,
+	CapBitcache2=	19,
+	CapVChan=	20,
 
 	/* 2.2.7.1.1 General Capability Set (TS_GENERAL_CAPABILITYSET) */
 	CanFastpath=	0x0001,
@@ -29,6 +30,7 @@
 static int	putinpcaps(uchar*,uint,Caps*);
 static int	putsndcaps(uchar*,uint,Caps*);
 static int	putglycaps(uchar*,uint,Caps*);
+static int	putvccaps(uchar*,uint,Caps*);
 
 static
 struct {
@@ -44,6 +46,7 @@
 	{ 8,	putptrcaps },
 	{ 88,	putinpcaps },
 	{ 8,	putsndcaps },
+	{ 8,	putvccaps },
 	{ 52,	putglycaps },
 };
 
@@ -369,5 +372,20 @@
 	PSHORT(p+2, 8);	// size
 	PSHORT(p+4, 0);	// soundFlags
 	PSHORT(p+6, 0);	// pad2octetsA
+	return 8;
+}
+
+/* 2.2.7.1.10 Virtual Channel Capability Set (TS_VIRTUALCHANNEL_CAPABILITYSET) */
+static int
+putvccaps(uchar *p, uint nb, Caps* caps)
+{
+	USED(caps);
+	if(nb<8){
+		werrstr(Eshort);
+		return -1;
+	}
+	PSHORT(p+0, CapVChan);
+	PSHORT(p+2, 8);	// size
+	PLONG(p+4, 0); 	// flags: 0=vchan compression not supported
 	return 8;
 }
--- a/efs_test.c
+++ b/efs_test.c
@@ -56,7 +56,7 @@
 	int n;
 	uchar buf[32];
 	Efsmsg m;
-	char *cann,*s;
+	char *targ,*s;
 
 	m.ctype = CTcore;
 	m.pakid = CCann;
@@ -68,12 +68,17 @@
 		sysfatal("testcann: unexpected errror: %r");
 	fmtinstall('H', encodefmt);
 	s = smprint("%.*H", n, buf);
-	cann = "7244434301000D0005000000";
-	if(strcmp(s, cann) != 0)
-		sysfatal("testcann: expected %s, got %s", cann, s);
-	if(n != strlen(cann)/2)
+	targ = 
+		"7244"	// Header->RDPDR_CTYP_CORE = 0x4472
+		"4343"	// Header->PAKID_CORE_CLIENTID_CONFIRM = 0x4343
+		"0100"	// VersionMajor = 0x0001
+		"0D00"	// VersionMinor = 0x000d
+		"05000000";	// ClientId = 0x00000005
+	if(strcmp(s, targ) != 0)
+		sysfatal("testcann: expected %s, got %s", targ, s);
+	if(n != strlen(targ)/2)
 		sysfatal("testcann: ret: expected %ld, got %d",
-			strlen(cann)/2, n);
+			strlen(targ)/2, n);
 }
 
 void
--- a/load.c
+++ b/load.c
@@ -82,17 +82,17 @@
 }
 
 void
-loadcmap(Rdp* c, Share* as)
+loadcmap(Rdp* c, Share* s)
 {
 	int i, n;
 	uchar *p,  *ep, *cmap;
 
-	if(as->type != ShUcmap){
+	if(s->type != ShUcmap){
 		fprint(2, "loadcmap: bad share type");
 		return;
 	}
-	p = as->data;
-	ep = as->data + as->ndata;
+	p = s->data;
+	ep = s->data + s->ndata;
 	cmap = c->cmap;
 
 	n = GSHORT(p+4);
--