/* Send a client window information PDU */ void rdp_send_client_window_status(int status) { STREAM s; static int current_status = 1; if (current_status == status) return; s = rdp_init_data(12); out_uint32_le(s, status); switch (status) { case 0: /* shut the server up */ break; case 1: /* receive data again */ out_uint32_le(s, 0); /* unknown */ out_uint16_le(s, g_width); out_uint16_le(s, g_height); break; } s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_CLIENT_WINDOW_STATUS); current_status = status; }
/* Send a client window information PDU */ BOOL rdp_send_client_window_status(RDPCLIENT * This, int status) { STREAM s; if (This->rdp.current_status == status) return True; s = rdp_init_data(This, 12); if(s == NULL) return False; out_uint32_le(s, status); switch (status) { case 0: /* shut the server up */ break; case 1: /* receive data again */ out_uint32_le(s, 0); /* unknown */ out_uint16_le(s, This->width); out_uint16_le(s, This->height); break; } s_mark_end(s); This->rdp.current_status = status; return rdp_send_data(This, s, RDP_DATA_PDU_CLIENT_WINDOW_STATUS); }
/* Send a synchronisation PDU */ static void rdp_send_synchronise(void) { STREAM s; s = rdp_init_data(4); out_uint16_le(s, 1); /* type */ out_uint16_le(s, 1002); s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_SYNCHRONISE); }
/* Send a control PDU */ static void rdp_send_control(uint16 action) { STREAM s; s = rdp_init_data(8); out_uint16_le(s, action); out_uint16(s, 0); /* userid */ out_uint32(s, 0); /* control id */ s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_CONTROL); }
/* Send an (empty) font information PDU */ static void rdp_send_fonts(uint16 seq) { STREAM s; s = rdp_init_data(8); out_uint16(s, 0); /* number of fonts */ out_uint16_le(s, 0); /* pad? */ out_uint16_le(s, seq); /* unknown */ out_uint16_le(s, 0x32); /* entry size */ s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_FONT2); }
/* Send persistent bitmap cache enumeration PDU's */ static BOOL rdp_enum_bmpcache2(RDPCLIENT * This) // THIS { STREAM s; HASH_KEY keylist[BMPCACHE2_NUM_PSTCELLS]; uint32 num_keys, offset, count, flags; offset = 0; num_keys = pstcache_enumerate(This, 2, keylist); while (offset < num_keys) { count = MIN(num_keys - offset, 169); s = rdp_init_data(This, 24 + count * sizeof(HASH_KEY)); if(s == NULL) return False; flags = 0; if (offset == 0) flags |= PDU_FLAG_FIRST; if (num_keys - offset <= 169) flags |= PDU_FLAG_LAST; /* header */ out_uint32_le(s, 0); out_uint16_le(s, count); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, num_keys); out_uint32_le(s, 0); out_uint32_le(s, flags); /* list */ out_uint8a(s, keylist[offset], count * sizeof(HASH_KEY)); s_mark_end(s); if(!rdp_send_data(This, s, 0x2b)) return False; offset += 169; } return True; }
/* Send a synchronisation PDU */ static BOOL rdp_send_synchronise(RDPCLIENT * This) { STREAM s; s = rdp_init_data(This, 4); if(s == NULL) return False; out_uint16_le(s, 1); /* type */ out_uint16_le(s, 1002); s_mark_end(s); return rdp_send_data(This, s, RDP_DATA_PDU_SYNCHRONISE); }
/* Send a control PDU */ static BOOL rdp_send_control(RDPCLIENT * This, uint16 action) { STREAM s; s = rdp_init_data(This, 8); if(s == NULL) return False; out_uint16_le(s, action); out_uint16(s, 0); /* userid */ out_uint32(s, 0); /* control id */ s_mark_end(s); return rdp_send_data(This, s, RDP_DATA_PDU_CONTROL); }
/* Send an (empty) font information PDU */ static BOOL rdp_send_fonts(RDPCLIENT * This, uint16 seq) { STREAM s; s = rdp_init_data(This, 8); if(s == NULL) return False; out_uint16(s, 0); /* number of fonts */ out_uint16_le(s, 0); /* pad? */ out_uint16_le(s, seq); /* unknown */ out_uint16_le(s, 0x32); /* entry size */ s_mark_end(s); return rdp_send_data(This, s, RDP_DATA_PDU_FONT2); }
/* Send a single input event */ void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2) { STREAM s; s = rdp_init_data(16); out_uint16_le(s, 1); /* number of events */ out_uint16(s, 0); /* pad */ out_uint32_le(s, time); out_uint16_le(s, message_type); out_uint16_le(s, device_flags); out_uint16_le(s, param1); out_uint16_le(s, param2); s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_INPUT); }
/* Send persistent bitmap cache enumeration PDU's */ static void rdp_enum_bmpcache2(void) { STREAM s; HASH_KEY keylist[BMPCACHE2_NUM_PSTCELLS]; uint32 num_keys, offset, count, flags; offset = 0; num_keys = pstcache_enumerate(2, keylist); while (offset < num_keys) { count = MIN(num_keys - offset, 169); s = rdp_init_data(24 + count * sizeof(HASH_KEY)); flags = 0; if (offset == 0) flags |= PDU_FLAG_FIRST; if (num_keys - offset <= 169) flags |= PDU_FLAG_LAST; /* header */ out_uint32_le(s, 0); out_uint16_le(s, count); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, 0); out_uint16_le(s, num_keys); out_uint32_le(s, 0); out_uint32_le(s, flags); /* list */ out_uint8a(s, keylist[offset], count * sizeof(HASH_KEY)); s_mark_end(s); rdp_send_data(s, 0x2b); offset += 169; } }
/* Send a single input event */ BOOL rdp_send_input(RDPCLIENT * This, uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2) { STREAM s; s = rdp_init_data(This, 16); if(s == NULL) return False; out_uint16_le(s, 1); /* number of events */ out_uint16(s, 0); /* pad */ out_uint32_le(s, time); out_uint16_le(s, message_type); out_uint16_le(s, device_flags); out_uint16_le(s, param1); out_uint16_le(s, param2); s_mark_end(s); return rdp_send_data(This, s, RDP_DATA_PDU_INPUT); }