Merge remote branch 'matthortman/MBH' into raster
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Mon, 27 Feb 2012 18:34:51 +0000 (10:34 -0800)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Mon, 27 Feb 2012 18:34:51 +0000 (10:34 -0800)
src/client.c [changed mode: 0644->0755]
src/rdp_gdi.c [changed mode: 0644->0755]
src/rdp_glyph.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 4e2a98c..2aed214
 const char* GUAC_CLIENT_ARGS[] = {
     "hostname",
     "port",
+       "username",
+       "password",
+       "width",
+       "height",
+       "initial_program",
+       "color_depth",
     NULL
 };
 
+enum ARGS_IDX {
+       IDX_HOSTNAME,
+       IDX_PORT,
+       IDX_USERNAME,
+       IDX_PASSWORD,
+       IDX_WIDTH,
+       IDX_HEIGHT,
+       IDX_INITIAL_PROGRAM,
+       IDX_COLOR_DEPTH
+};
+
 boolean rdp_freerdp_pre_connect(freerdp* instance) {
 
     rdpContext* context = instance->context;
@@ -197,17 +214,17 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
     int port = RDP_DEFAULT_PORT;
     boolean bitmap_cache;
 
-    if (argc < 2) {
+    if (argc < 8) {
         guac_protocol_send_error(client->socket, "Wrong argument count received.");
         guac_socket_flush(client->socket);
         return 1;
     }
 
     /* If port specified, use it */
-    if (argv[1][0] != '\0')
-        port = atoi(argv[1]);
+    if (argv[IDX_PORT][0] != '\0')
+        port = atoi(argv[IDX_PORT]);
 
-    hostname = argv[0];
+    hostname = argv[IDX_HOSTNAME];
 
     /* Allocate client data */
     guac_client_data = malloc(sizeof(rdp_guac_client_data));
@@ -238,14 +255,38 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
     settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
     settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
 
-    /* Default size */
+    /* session width */
        settings->width = 1024;
+       if (argv[IDX_WIDTH][0] != '\0')
+               settings->width = atoi(argv[IDX_WIDTH]);
+       if (settings->width == 0)
+               settings->width = 1024;
+
+       /* session height */
        settings->height = 768;
+       if (argv[IDX_HEIGHT][0] != '\0')
+               settings->height = atoi(argv[IDX_HEIGHT]);
+       if (settings->height == 0)
+               settings->height = 768;
 
     /* Set hostname */
     settings->hostname = strdup(hostname);
        settings->window_title = strdup(hostname);
+
+       /* username */
        settings->username = "guest";
+       if (argv[IDX_USERNAME][0] != '\0')
+               settings->username = strdup (argv[IDX_USERNAME]);
+
+       /* password */
+       if (argv[IDX_PASSWORD][0] != '\0') {
+               settings->password = strdup (argv[IDX_PASSWORD]);
+               settings->autologon = 1;
+       }
+
+       /* initial program */
+       if (argv[IDX_INITIAL_PROGRAM][0] != '\0')
+               settings->shell = strdup (argv[IDX_INITIAL_PROGRAM]);
 
     /* Order support */
     bitmap_cache = settings->bitmap_cache;
old mode 100644 (file)
new mode 100755 (executable)
index 52f1966..a9ca292
@@ -97,11 +97,23 @@ void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) {
     guac_socket* socket = client->socket;
     guac_rdp_bitmap* bitmap = (guac_rdp_bitmap*) memblt->bitmap;
 
+       guac_composite_mode cmode = GUAC_COMP_OVER;
+
+       if (memblt->bRop == 204) cmode = GUAC_COMP_OVER;
+       else if (memblt->bRop == 238) cmode = GUAC_COMP_OR;
+       else if (memblt->bRop == 136) cmode = GUAC_COMP_AND;
+       else if (memblt->bRop == 102) cmode = GUAC_COMP_XOR2;
+       else if (memblt->bRop == 187) cmode = GUAC_COMP_NOR;
+       else
+       {
+               guac_client_log_info (client, "guac_rdp_gdi_memblt: UNSUPPORTED opcode = %d (0x%02X)", memblt->bRop, memblt->bRop);
+       }
+
     if (bitmap->layer != NULL)
         guac_protocol_send_copy(socket,
                 bitmap->layer,
                 memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
-                GUAC_COMP_OVER,
+                cmode,
                 current_layer, memblt->nLeftRect, memblt->nTopRect);
 
 }
old mode 100644 (file)
new mode 100755 (executable)