32 #define ICONV_CONST "" 64 This->next_packet = rdp_s->
p;
68 rdp_s->
p =
This->next_packet;
75 This->next_packet += 8;
81 *
type = pdu_type & 0xf;
84 DEBUG((
"RDP packet #%d, (type %x)\n", ++
This->rdp.packetno, *
type));
137 size_t ibl =
strlen(
string), obl =
len + 2;
143 if (
This->rdp.iconv_works)
150 warning(
"rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
162 warning(
"rdp_out_unistr: iconv(1) fail, errno %d\n",
errno);
169 pout = (
char *)
s->p;
176 warning(
"rdp_out_unistr: iconv(2) fail, errno %d\n",
errno);
197 s->p[
i++] = (
c >> 0) & 0xFF;
198 s->p[
i++] = (
c >> 8) & 0xFF;
213 size_t ibl = uni_len, obl = uni_len;
214 char *
pin = (
char *)
s->p, *pout =
string;
217 if (
This->rdp.iconv_works)
223 warning(
"rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
235 warning(
"rdp_in_unistr: iconv fail, errno %d\n",
errno);
252 while (
i < uni_len / 2)
275 int len_dll = 2 * (
int)
wcslen(
L"C:\\WINNT\\System32\\mstscax.dll");
282 if (!
This->use_rdp5 || 1 ==
This->server_rdp_version)
284 DEBUG_RDP5((
"Sending RDP4-style Logon packet\n"));
286 s =
sec_init(
This, sec_flags, 18 + len_domain + len_user + len_password
287 + len_program + len_directory + 10);
309 DEBUG_RDP5((
"Sending RDP5-style Logon packet\n"));
318 (0 < len_domain ? len_domain : 2) +
321 (0 < len_program ? len_program : 2) + (0 < len_directory ? len_directory : 2) + 2 +
334 DEBUG_RDP5((
"Called sec_init with packetlen %d\n", packetlen));
376 if (0 < len_directory)
537 if (num_keys -
offset <= 169)
635 uint8 order_caps[32];
637 memset(order_caps, 0, 32);
641 order_caps[3] = (
This->bitmap_cache ? 1 : 0);
646 order_caps[11] = (
This->desktop_save ? 1 : 0);
649 order_caps[20] = (
This->polygon_ellipse_orders ? 1 : 0);
650 order_caps[21] = (
This->polygon_ellipse_orders ? 1 : 0);
652 order_caps[25] = (
This->polygon_ellipse_orders ? 1 : 0);
653 order_caps[26] = (
This->polygon_ellipse_orders ? 1 : 0);
681 Bpp = (
This->server_depth + 7) / 8;
776 0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00,
777 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
778 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
779 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
780 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
781 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
782 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
783 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
784 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
785 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
786 0x00, 0x00, 0x00, 0x00
794 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00,
795 0xFE, 0x00, 0x08, 0x00, 0xFE, 0x00, 0x08, 0x00,
796 0xFE, 0x00, 0x10, 0x00, 0xFE, 0x00, 0x20, 0x00,
797 0xFE, 0x00, 0x40, 0x00, 0xFE, 0x00, 0x80, 0x00,
798 0xFE, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08,
799 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00
812 #define RDP5_FLAG 0x0030 824 0x58 + 0x08 + 0x08 + 0x34 +
897 warning(
"Remote desktop does not support colour depth %d; falling back to %d\n",
903 warning(
"Remote desktop changed from %dx%d to %dx%d.\n",
This->width,
This->height,
917 uint16 ncapsets, capset_type, capset_length;
924 for (
n = 0;
n < ncapsets;
n++)
932 next =
s->p + capset_length - 4;
954 uint16 len_src_descriptor, len_combined_caps;
961 DEBUG((
"DEMAND_ACTIVE(id=0x%x)\n",
This->rdp_shareid));
1032 uint16 system_pointer_type;
1035 switch (system_pointer_type)
1042 unimpl(
"System pointer message 0x%x\n", system_pointer_type);
1056 switch (message_type)
1078 unimpl(
"Pointer message 0x%x\n", message_type);
1094 for (
i = 0;
i < num_updates;
i++)
1103 Bpp = (
bpp + 7) / 8;
1110 DEBUG((
"BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1183 DEBUG((
"PALETTE(c=%d)\n",
map.ncolours));
1185 for (
i = 0;
i <
map.ncolours;
i++)
1208 switch (update_type)
1229 unimpl(
"update %d\n", update_type);
1240 DEBUG((
"Received disconnect PDU\n"));
1247 uint8 data_pdu_type;
1268 error(
"error decompressed packet size exceeds max\n");
1270 error(
"error while decompressing packet\n");
1279 This->disconnect_reason = 262;
1285 memcpy((
ns->data), (
unsigned char *) (
This->mppc_dict.hist + roff), rlen);
1288 ns->end = (
ns->data +
ns->size);
1290 ns->rdp_hdr =
ns->p;
1295 switch (data_pdu_type)
1302 DEBUG((
"Received Control PDU\n"));
1306 DEBUG((
"Received Sync PDU\n"));
1318 DEBUG((
"Received Logon PDU\n"));
1334 unimpl(
"data PDU %d\n", data_pdu_type);
1451 DEBUG((
"RDP_PDU_DEACTIVATE\n"));
1467 cont =
This->next_packet <
s->end;
1501 This->rdp_shareid = 0;
void ui_set_cursor(RD_HCURSOR cursor)
static void rdp_out_bitmap_caps(RDPCLIENT *This, STREAM s)
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
#define out_uint16_le(s, v)
static BOOL rdp_send_data(RDPCLIENT *This, STREAM s, uint8 data_pdu_type)
#define out_uint8p(s, v, n)
GLint GLint GLsizei width
void ui_set_colourmap(RD_HCOLOURMAP map)
void process_palette(STREAM s)
void ui_begin_update(void)
#define RDP_CAPSET_GENERAL
static const uint8 caps_0x10[]
#define BMPCACHE2_C2_CELLS
void rdp_out_unistr(STREAM s, char *string, int len)
void ui_resize_window(void)
#define RDP_MPPC_COMPRESSED
RD_BOOL pstcache_init(uint8 cache_id)
static rfbScreenInfoPtr server
#define RDP_CAPSET_BMPCACHE
void rdp_disconnect(void)
void process_orders(STREAM s, uint16 num_orders)
ACPI_SIZE strlen(const char *String)
static void rdp_out_control_caps(STREAM s)
#define out_uint8a(s, v, n)
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
#define RDP_CAPLEN_BMPCACHE2
GLuint GLuint GLsizei count
STREAM sec_init(uint32 flags, int maxlen)
#define RDP_CAPSET_ACTIVATE
#define out_uint32_le(s, v)
static void rdp_out_unknown_caps(STREAM s, uint16 id, uint16 length, const uint8 *caps)
static BOOL rdp_send_control(RDPCLIENT *This, uint16 action)
GLint GLint GLint GLint GLint x
GLenum GLuint GLsizei bufsize
int const JOCTET unsigned int datalen
#define RDP_CAPLEN_CONTROL
#define in_uint8p(s, v, n)
#define BMPCACHE2_C1_CELLS
static const uint8 caps_0x0d[]
void process_disconnect_pdu(STREAM s, uint32 *ext_disc_reason)
RD_BOOL sec_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect)
static BOOL process_redirect_pdu(RDPCLIENT *This, STREAM s)
#define RDP_CAPSET_BITMAP
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
void ui_move_pointer(int x, int y)
#define RDP_MPPC_DICT_SIZE
#define RDP_CAPLEN_ACTIVATE
void ui_set_null_cursor(void)
#define RDP_CAPSET_CONTROL
char * tcp_get_address(void)
static BOOL rdp_send_confirm_active(RDPCLIENT *This)
static void rdp_process_general_caps(RDPCLIENT *This, STREAM s)
#define BMPCACHE2_C0_CELLS
RD_BOOL bitmap_decompress(uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
GLenum GLuint GLenum GLsizei length
BOOL sec_reconnect(RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
#define s_pop_layer(s, h)
_Out_opt_ int _Out_opt_ int * cy
static BOOL process_data_pdu(RDPCLIENT *This, STREAM s, uint32 *ext_disc_reason)
void process_bitmap_updates(STREAM s)
#define RDP_CAPLEN_BMPCACHE
static STREAM rdp_recv(RDPCLIENT *This, uint8 *type)
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
void process_system_pointer_pdu(STREAM s)
#define RDP_CAPLEN_POINTER
static void rdp_out_order_caps(RDPCLIENT *This, STREAM s)
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
static void process_pointer_pdu(RDPCLIENT *This, STREAM s)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static STREAM rdp_init_data(RDPCLIENT *This, int maxlen)
void rdp_main_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
static BOOL rdp_send_synchronise(RDPCLIENT *This)
static BOOL rdp_enum_bmpcache2(RDPCLIENT *This)
static void rdp_process_server_caps(RDPCLIENT *This, STREAM s, uint16 length)
static void rdp_out_pointer_caps(STREAM s)
void sec_reset_state(void)
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
#define RDP_CAPLEN_GENERAL
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
static void rdp_out_bmpcache_caps(RDPCLIENT *This, STREAM s)
void sec_disconnect(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void reset_order_state(void)
#define BMPCACHE2_FLAG_PERSIST
GLint GLint GLsizei GLsizei GLsizei depth
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
T1_FIELD_DICT_PRIVATE password
void rdp_reset_state(void)
#define memcpy(s1, s2, n)
static void process_update_pdu(RDPCLIENT *This, STREAM s)
iconv_t iconv_open(const char *tocode, const char *fromcode)
static BOOL process_demand_active(RDPCLIENT *This, STREAM s)
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
#define RDP_CAPSET_BMPCACHE2
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
#define RDP_CAPLEN_BITMAP
static BOOL rdp_send_logon_info(RDPCLIENT *This, uint32 flags, wchar_t *domain, wchar_t *user, wchar_t *password, wchar_t *program, wchar_t *directory)
GLint GLint GLsizei GLsizei height
void sec_send(STREAM s, uint32 flags)
BOOL event_redirect(RDPCLIENT *This, uint32 flags, uint32 server_len, wchar_t *server, uint32 cookie_len, char *cookie, uint32 username_len, wchar_t *username, uint32 domain_len, wchar_t *domain, uint32 password_len, wchar_t *password)
#define in_uint8a(s, v, n)
#define s_push_layer(s, h, n)
void hexdump(unsigned char *p, unsigned int len)
static void rdp_out_share_caps(STREAM s)
static void rdp_out_bmpcache2_caps(RDPCLIENT *This, STREAM s)
static unsigned __int64 next
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define RDP_CAPLEN_COLCACHE
void event_logon(RDPCLIENT *This)
#define BMPCACHE2_NUM_PSTCELLS
STREAM sec_recv(uint8 *rdpver)
void rdp5_process(STREAM s)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
static void rdp_out_general_caps(RDPCLIENT *This, STREAM s)
void process_cached_pointer_pdu(STREAM s)
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
#define RDP_CAPSET_POINTER
GLint GLint GLint GLint GLint GLint y
#define out_uint16_be(s, v)
int pstcache_enumerate(uint8 id, HASH_KEY *keylist)
static void rdp_process_bitmap_caps(RDPCLIENT *This, STREAM s)
#define RDP_CAPSET_COLCACHE
static void rdp_out_activate_caps(STREAM s)
static const uint8 caps_0x0e[]
void unimpl(char *format,...)
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
static void rdp_out_colcache_caps(STREAM s)
int iconv_close(iconv_t cd)
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
GLdouble GLdouble GLdouble GLdouble top
GLuint GLuint GLsizei GLenum type
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
#define in_uint32_le(s, v)
static SERVICE_STATUS status
void rdp_send_client_window_status(int status)
void process_colour_pointer_pdu(STREAM s)
BOOL rdp_reconnect(RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
void user(int argc, const char *argv[])
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static BOOL rdp_send_fonts(RDPCLIENT *This, uint16 seq)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
#define in_uint16_le(s, v)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static const uint8 caps_0x0c[]