static void rdpdr_process(RDPCLIENT * This, STREAM s) { uint32 handle; uint8 *magic; #if WITH_DEBUG_RDP5 printf("--- rdpdr_process ---\n"); hexdump(s->p, s->end - s->p); #endif in_uint8p(s, magic, 4); if ((magic[0] == 'r') && (magic[1] == 'D')) { if ((magic[2] == 'R') && (magic[3] == 'I')) { rdpdr_process_irp(This, s); return; } if ((magic[2] == 'n') && (magic[3] == 'I')) { rdpdr_send_connect(This); rdpdr_send_name(This); return; } if ((magic[2] == 'C') && (magic[3] == 'C')) { /* connect from server */ rdpdr_send_clientcapabilty(This); rdpdr_send_available(This); return; } if ((magic[2] == 'r') && (magic[3] == 'd')) { /* connect to a specific resource */ in_uint32(s, handle); #if WITH_DEBUG_RDP5 DEBUG(("RDPDR: Server connected to resource %d\n", handle)); #endif return; } if ((magic[2] == 'P') && (magic[3] == 'S')) { /* server capability */ return; } } if ((magic[0] == 'R') && (magic[1] == 'P')) { if ((magic[2] == 'C') && (magic[3] == 'P')) { printercache_process(This, s); return; } } unimpl("RDPDR packet type %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]); }
static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) { UINT16 component; UINT16 packetID; UINT32 deviceID; UINT32 status; rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin; stream_read_UINT16(data_in, component); stream_read_UINT16(data_in, packetID); if (component == RDPDR_CTYP_CORE) { switch (packetID) { case PAKID_CORE_SERVER_ANNOUNCE: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_SERVER_ANNOUNCE"); rdpdr_process_server_announce_request(rdpdr, data_in); rdpdr_send_client_announce_reply(rdpdr); rdpdr_send_client_name_request(rdpdr); break; case PAKID_CORE_SERVER_CAPABILITY: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_SERVER_CAPABILITY"); rdpdr_process_capability_request(rdpdr, data_in); rdpdr_send_capability_response(rdpdr); break; case PAKID_CORE_CLIENTID_CONFIRM: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_CLIENTID_CONFIRM"); rdpdr_process_server_clientid_confirm(rdpdr, data_in); rdpdr_send_device_list_announce_request(rdpdr, FALSE); break; case PAKID_CORE_USER_LOGGEDON: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_USER_LOGGEDON"); rdpdr_send_device_list_announce_request(rdpdr, TRUE); break; case PAKID_CORE_DEVICE_REPLY: /* connect to a specific resource */ stream_read_UINT32(data_in, deviceID); stream_read_UINT32(data_in, status); DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_REPLY (deviceID=%d status=0x%08X)", deviceID, status); break; case PAKID_CORE_DEVICE_IOREQUEST: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_IOREQUEST"); if (rdpdr_process_irp(rdpdr, data_in)) data_in = NULL; break; default: DEBUG_WARN("RDPDR_CTYP_CORE / unknown packetID: 0x%02X", packetID); break; } } else if (component == RDPDR_CTYP_PRN) { DEBUG_SVC("RDPDR_CTYP_PRN"); } else { DEBUG_WARN("RDPDR component: 0x%02X packetID: 0x%02X", component, packetID); } stream_free(data_in); }