buf[3] = 0;
buf[4] = 0; // ypos
buf[5] = 0;
- buf[6] = 640 >> 8; // width
+ buf[6] = 0; // width
buf[7] = 640 % 0xff;
- buf[8] = 480 >> 8; // height
+ buf[8] = 0; // height
buf[9] = 480 % 0xff;
write(vnc_sock, buf, 10);
data_left -= ret;
}
- rdp_send_bitmap_update(ntohs(rect.x), ntohs(rect.y), ntohs(rect.width), ntohs(rect.height), data);
+// rdp_send_bitmap_update(ntohs(rect.x), ntohs(rect.y), ntohs(rect.width), ntohs(rect.height), data);
xfree(data);
}
}
int serve_client()
{
int vnc_sock = vnc_init();
+ int listen_on_vnc = 0;
if (!mcs_recv_connect_initial())
error("MCS_CONNECT_INITIAL recv failed");
case RDP_DATA_PDU_INPUT:
printf("Input PDU\n");
handle_input_pdu(s);
+ listen_on_vnc = 1;
break;
default:
printf("Unknown data PDU type %u\n", data_pdu_type);
}
// activity on VNC socket?
- if (FD_ISSET(vnc_sock, &readfs)) {
+ if (FD_ISSET(vnc_sock, &readfs) && listen_on_vnc) {
unsigned char buf[256];
printf("Activity on VNC socket!\n");
- read(vnc_sock, buf, 2);
+ if (read(vnc_sock, buf, 2) != 2)
+ error("short read on vnc_sock\n");
+
switch (buf[0]) {
case 0:
// frame buffer update!
handle_vnc_fbupdate(vnc_sock);
break;
default:
- printf("Unknown server message %x\n", buf[0]);
- exit(1);
+ printf("Unknown VNC server message %x\n", buf[0]);
+// exit(1);
}
}
}