/* Process a Licensing packet */ void licence_process(rdpLicence * licence, STREAM s) { uint8 tag; uint16 wMsgSize; uint8* license_start = s->p; /* Licensing Preamble */ in_uint8(s, tag); /* bMsgType */ in_uint8s(s, 1); /* Ignoring bVersion */ in_uint16_le(s, wMsgSize); /* Now pointing at LicensingMessage */ switch (tag) { case LICENSE_REQUEST: DEBUG("LICENSE_REQUEST\n"); licence_process_request(licence, s); ASSERT(s->p == license_start + wMsgSize); break; case LICENSE_PLATFORM_CHALLENGE: DEBUG("LICENCE PLATFORM_CHALLENGE\n"); licence_process_platform_challenge(licence, s); break; case NEW_LICENSE: DEBUG("NEW_LICENSE\n"); licence_process_new_license(licence, s); break; case UPGRADE_LICENSE: DEBUG("UPGRADE_LICENSE\n"); break; case LICENCE_ERROR_ALERT: DEBUG("LICENCE ERROR_ALERT - assuming it is a license grant\n"); { uint32 dwErrorCode, dwStateTransition; uint32 wBlobType, wBlobLen; in_uint32_le(s, dwErrorCode); in_uint32_le(s, dwStateTransition); DEBUG("dwErrorCode %x dwStateTransition %x\n", dwErrorCode, dwStateTransition); in_uint16_le(s, wBlobType); in_uint16_le(s, wBlobLen); DEBUG("bbErrorInfo: wBlobType %x wBlobLen %x\n", wBlobType, wBlobLen); /* hexdump(s->p, wBlobLen); */ } licence->licence_issued = True; /* TODO ... */ break; default: ui_unimpl(licence->sec->rdp->inst, "Unknown licence tag 0x%x\n", tag); } s->p = license_start + wMsgSize; /* FIXME: Shouldn't be necessary if parsed properly */ ASSERT(s->p <= s->end); }
void rdp5_process(rdpRdp * rdp, STREAM s) { uint16 length, count, x, y; uint8 type, ctype; uint8 *next; uint32 roff, rlen; struct stream *ns = &(rdp->mppc_dict.ns); struct stream *ts; ui_begin_update(rdp->inst); while (s->p < s->end) { in_uint8(s, type); if (type & RDP5_COMPRESSED) { in_uint8(s, ctype); in_uint16_le(s, length); type ^= RDP5_COMPRESSED; } else { ctype = 0; in_uint16_le(s, length); } rdp->next_packet = next = s->p + length; if (ctype & RDP_MPPC_COMPRESSED) { if (mppc_expand(rdp, s->p, length, ctype, &roff, &rlen) == -1) ui_error(rdp->inst, "error while decompressing packet\n"); /* allocate memory and copy the uncompressed data into the temporary stream */ ns->data = (uint8 *) xrealloc(ns->data, rlen); memcpy((ns->data), (unsigned char *) (rdp->mppc_dict.hist + roff), rlen); ns->size = rlen; ns->end = ns->data + ns->size; ns->p = ns->data; ns->rdp_hdr = ns->p; ts = ns; } else ts = s; switch (type) { case 0: /* update orders */ in_uint16_le(ts, count); process_orders(rdp->orders, ts, count); break; case 1: /* update bitmap */ in_uint8s(ts, 2); /* part length */ process_bitmap_updates(rdp, ts); break; case 2: /* update palette */ in_uint8s(ts, 2); /* uint16 = 2 */ process_palette(rdp, ts); break; case 3: /* update synchronize */ break; case 5: /* null pointer */ ui_set_null_cursor(rdp->inst); break; case 6: /* default pointer */ break; case 8: /* pointer position */ in_uint16_le(ts, x); in_uint16_le(ts, y); ui_move_pointer(rdp->inst, x, y); break; case 9: /* color pointer */ process_color_pointer_pdu(rdp, ts); break; case 10: /* cached pointer */ process_cached_pointer_pdu(rdp, ts); break; case 11: process_new_pointer_pdu(rdp, ts); break; default: ui_unimpl(rdp->inst, "RDP5 opcode %d\n", type); } s->p = next; } ui_end_update(rdp->inst); }