Various hacks to try to make stuff work (still failing).
authorSteinar H. Gunderson <sesse@samfundet.no>
Fri, 4 Feb 2005 16:31:10 +0000 (16:31 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Fri, 4 Feb 2005 16:31:10 +0000 (16:31 +0000)
rdpsrv.c

index edb6299..432147b 100644 (file)
--- a/rdpsrv.c
+++ b/rdpsrv.c
@@ -159,9 +159,9 @@ int vnc_init()
        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);
@@ -208,7 +208,7 @@ void handle_vnc_fbupdate(int vnc_sock)
                        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);
        }
 }
@@ -216,6 +216,7 @@ void handle_vnc_fbupdate(int vnc_sock)
 int serve_client()
 {
        int vnc_sock = vnc_init();
+       int listen_on_vnc = 0;
        
        if (!mcs_recv_connect_initial())
                error("MCS_CONNECT_INITIAL recv failed");
@@ -248,6 +249,7 @@ int serve_client()
                                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);
@@ -256,20 +258,22 @@ int serve_client()
                }
 
                // 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);
                        }
                }
        }