102 else if (rdpver != 3)
127 *
type = pdu_type & 0xf;
130 DEBUG((
"RDP packet #%d, (type %x)\n", ++g_packetno, *
type));
180 if (
string &&
len > 0)
190 if (
string ==
NULL ||
len == 0)
194 size_t ibl =
strlen(
string), obl =
len + 2;
207 warning(
"rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
210 g_iconv_works =
False;
214 if (
iconv(iconv_h, (ICONV_CONST
char **) &
pin, &
i, &pout, &o) ==
219 warning(
"rdp_out_unistr: iconv(1) fail, errno %d\n",
errno);
221 g_iconv_works =
False;
226 pout = (
char *)
s->p;
229 if (
iconv(iconv_h, (ICONV_CONST
char **) &
pin, &ibl, &pout, &obl) == (
size_t) - 1)
233 warning(
"rdp_out_unistr: iconv(2) fail, errno %d\n",
errno);
235 g_iconv_works =
False;
252 s->p[
i++] =
string[
j++];
269 *str_size = in_len * 2;
272 size_t ibl = in_len, obl = *str_size - 1;
273 char *
pin = (
char *)
s->p, *pout = *
string;
282 warning(
"rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
285 g_iconv_works =
False;
290 if (
iconv(iconv_h, (ICONV_CONST
char **) &
pin, &ibl, &pout, &obl) == (
size_t) - 1)
294 warning(
"server sent an unexpectedly long string, truncating\n");
298 warning(
"rdp_in_unistr: iconv fail, errno %d\n",
errno);
312 *str_size = pout - *
string;
321 if (
len > *str_size - 1)
323 warning(
"server sent an unexpectedly long string, truncating\n");
325 rem = in_len - 2 *
len;
356 int len_ip = 2 *
strlen(ipaddr) + 2;
364 uint8 security_verifier[16];
367 len_dll = 2 *
strlen(dllName) + 2;
371 DEBUG_RDP5((
"Sending RDP4-style Logon packet\n"));
373 s =
sec_init(sec_flags, 18 + len_domain + len_user + len_password
374 + len_program + len_directory + 10);
392 DEBUG_RDP5((
"Sending RDP5-style Logon packet\n"));
437 DEBUG_RDP5((
"Called sec_init with packetlen %d\n", packetlen));
503 out_uint8a(
s, security_verifier,
sizeof(security_verifier));
575 static int current_status = 1;
577 if (current_status ==
status)
621 if (num_keys -
offset <= 169)
713 uint8 order_caps[32];
715 memset(order_caps, 0, 32);
875 0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00,
876 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
877 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
881 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
882 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
883 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
884 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 0x00, 0x00, 0x00, 0x00
893 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00,
894 0xFE, 0x00, 0x08, 0x00, 0xFE, 0x00, 0x08, 0x00,
895 0xFE, 0x00, 0x10, 0x00, 0xFE, 0x00, 0x20, 0x00,
896 0xFE, 0x00, 0x40, 0x00, 0xFE, 0x00, 0x80, 0x00,
897 0xFE, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08,
898 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00
911#define RDP5_FLAG 0x0030
1013 warning(
"Remote desktop does not support colour depth %d; falling back to %d\n",
1033 uint16 ncapsets, capset_type, capset_length;
1040 for (
n = 0;
n < ncapsets;
n++)
1048 next =
s->p + capset_length - 4;
1050 switch (capset_type)
1070 uint16 len_src_descriptor, len_combined_caps;
1168 uint16 system_pointer_type;
1171 switch (system_pointer_type)
1178 unimpl(
"System pointer message 0x%x\n", system_pointer_type);
1192 switch (message_type)
1218 unimpl(
"Pointer message 0x%x\n", message_type);
1234 for (
i = 0;
i < num_updates;
i++)
1243 Bpp = (
bpp + 7) / 8;
1250 DEBUG((
"BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1308 DEBUG((
"PALETTE(c=%d)\n",
map.ncolours));
1310 for (
i = 0;
i <
map.ncolours;
i++)
1333 switch (update_type)
1354 unimpl(
"update %d\n", update_type);
1384 warning(
"Invalid length in Auto-Reconnect packet\n");
1391 warning(
"Unsupported version of Auto-Reconnect packet\n");
1411 DEBUG((
"Received disconnect PDU\n"));
1418 uint8 data_pdu_type;
1437 error(
"error decompressed packet size exceeds max\n");
1439 error(
"error while decompressing packet\n");
1449 ns->end = (
ns->data +
ns->size);
1451 ns->rdp_hdr =
ns->p;
1456 switch (data_pdu_type)
1463 DEBUG((
"Received Control PDU\n"));
1467 DEBUG((
"Received Sync PDU\n"));
1479 DEBUG((
"Received Logon PDU\n"));
1495 warning(
"Automatic reconnect using cookie, failed.\n");
1499 unimpl(
"data PDU %d\n", data_pdu_type);
1509 uint16 redirect_identifier;
1533 if (enhanced_redirect)
1537 if (redirect_identifier != 0x0400)
1538 error(
"Protocol error in server redirection, unexpected data.");
1612 warning(
"LB_DONTSTOREUSERNAME set\n");
1617 warning(
"LB_SMARTCARD_LOGON set\n");
1644 warning(
"LB_TARGET_NETBIOS set\n");
1649 warning(
"LB_TARGET_NET_ADDRESSES set\n");
1654 warning(
"LB_CLIENT_TSV_URL set\n");
1659 warning(
"LB_SERVER_TSV_CAPABLE set\n");
1664 warning(
"LB_PASSWORD_IS_PK_ENCRYPTED set\n");
1669 warning(
"LB_REDIRECTION_GUID set\n");
1674 warning(
"LB_TARGET_CERTIFICATE set\n");
1713 DEBUG((
"RDP_PDU_DEACTIVATE\n"));
ACPI_SIZE strlen(const char *String)
RD_BOOL bitmap_decompress(uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
#define RDP_CAPSET_BMPCACHE2
#define BMPCACHE2_FLAG_PERSIST
#define RDP_CAPSET_BRUSHCACHE
#define RDP_CAPSET_BITMAP
#define RDP_CAPLEN_BITMAP
#define BMPCACHE2_NUM_PSTCELLS
#define RDP_CAPLEN_BRUSHCACHE
#define RDP_CAPLEN_CONTROL
#define RDP_CAPLEN_COLCACHE
#define RDP_CAPSET_ACTIVATE
#define RDP_CAPSET_CONTROL
#define RDP_CAPLEN_BMPCACHE2
@ LB_PASSWORD_IS_PK_ENCRYPTED
@ LB_TARGET_NET_ADDRESSES
#define RDP_MPPC_DICT_SIZE
#define RDP_MPPC_COMPRESSED
#define RDP_CAPSET_COLCACHE
#define BMPCACHE2_C0_CELLS
@ INFOTYPE_LOGON_EXTENDED_INF
#define RDP_CAPLEN_POINTER
@ RDP_CTL_REQUEST_CONTROL
#define RDP_CAPLEN_NEWPOINTER
#define RDP_CAPLEN_GENERAL
#define RDP_INFO_AUTOLOGON
#define RDP_CAPLEN_ACTIVATE
#define RDP_CAPSET_BMPCACHE
#define BMPCACHE2_C1_CELLS
#define RDP_CAPLEN_BMPCACHE
@ RDP_DATA_PDU_CLIENT_WINDOW_STATUS
@ RDP_DATA_PDU_SYNCHRONISE
@ RDP_DATA_PDU_AUTORECONNECT_STATUS
@ RDP_DATA_PDU_DISCONNECT
@ LOGON_EX_AUTORECONNECTCOOKIE
#define RDP_CAPSET_POINTER
@ RDP_PDU_ENHANCED_REDIRECT
#define RDP_CAPSET_GENERAL
#define BMPCACHE2_C2_CELLS
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
void process_orders(STREAM s, uint16 num_orders)
void reset_order_state(void)
#define out_uint32_le(s, v)
#define s_pop_layer(s, h)
#define s_push_layer(s, h, n)
#define in_uint16_le(s, v)
#define out_uint16_be(s, v)
#define in_uint8p(s, v, n)
#define in_uint8a(s, v, n)
#define out_uint16_le(s, v)
#define out_uint8p(s, v, n)
#define in_uint32_le(s, v)
#define out_uint8a(s, v, n)
RD_BOOL pstcache_init(uint8 cache_id)
void ui_set_cursor(RD_HCURSOR cursor)
uint16 ui_get_numlock_state(unsigned int state)
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
char * tcp_get_address(void)
void rdp5_process(STREAM s)
void ui_set_null_cursor(void)
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
unsigned int read_keyboard_state(void)
void sec_send(STREAM s, uint32 flags)
void ui_set_colourmap(RD_HCOLOURMAP map)
RD_BOOL sec_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect)
void unimpl(char *format,...)
void sec_reset_state(void)
void ui_resize_window(void)
void sec_disconnect(void)
void hexdump(unsigned char *p, unsigned int len)
void ui_begin_update(void)
STREAM sec_recv(uint8 *rdpver)
void ui_move_pointer(int x, int y)
STREAM sec_init(uint32 flags, int maxlen)
int pstcache_enumerate(uint8 id, HASH_KEY *keylist)
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
void * xrealloc(void *oldmem, size_t size)
static void rdp_out_bmpcache_caps(STREAM s)
static void rdp_send_control(uint16 action)
void process_bitmap_updates(STREAM s)
void process_pdu_logon(STREAM s)
static void rdp_process_bitmap_caps(STREAM s)
static void process_demand_active(STREAM s)
static void rdp_send_logon_info(uint32 flags, char *domain, char *user, char *password, char *program, char *directory)
static void rdp_out_unknown_caps(STREAM s, uint16 id, uint16 length, uint8 *caps)
void process_cached_pointer_pdu(STREAM s)
static void process_colour_pointer_common(STREAM s, int bpp)
void rdp_disconnect(void)
uint8 * g_redirect_cookie
static void rdp_out_activate_caps(STREAM s)
static void rdp_enum_bmpcache2(void)
static void rdp_out_bitmap_caps(STREAM s)
void rdssl_hmac_md5(char *key, int keylen, char *data, int len, char *output)
static STREAM rdp_init_data(int maxlen)
static void rdp_out_order_caps(STREAM s)
void rdp_send_client_window_status(int status)
void process_palette(STREAM s)
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
void process_system_pointer_pdu(STREAM s)
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
static void process_update_pdu(STREAM s)
static void rdp_out_control_caps(STREAM s)
void process_disconnect_pdu(STREAM s, uint32 *ext_disc_reason)
static void rdp_out_general_caps(STREAM s)
static void rdp_send_fonts(uint16 seq)
static void rdp_send_confirm_active(void)
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
uint16 g_server_rdp_version
static void rdp_out_pointer_caps(STREAM s)
uint32 g_redirect_domain_len
uint32 g_redirect_cookie_len
RDP_VERSION g_rdp_version
uint32 g_rdp5_performanceflags
static void rdp_out_share_caps(STREAM s)
time_t g_reconnect_random_ts
uint32 g_redirect_server_len
RD_BOOL g_bitmap_cache_persist_enable
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
uint32 g_redirect_lb_info_len
static STREAM rdp_recv(uint8 *type)
void rdp_out_unistr_mandatory_null(STREAM s, char *string, int len)
static void rdp_out_brushcache_caps(STREAM s)
static void rdp_out_newpointer_caps(STREAM s)
uint32 g_reconnect_logonid
static void rdp_out_bmpcache2_caps(STREAM s)
void rdp_reset_state(void)
uint8 * g_redirect_lb_info
uint32 g_redirect_username_len
void process_colour_pointer_pdu(STREAM s)
uint8 g_client_random[SEC_RANDOM_SIZE]
uint32 g_redirect_session_id
static RD_BOOL process_data_pdu(STREAM s, uint32 *ext_disc_reason)
void rdp_out_unistr(STREAM s, char *string, int len)
RD_BOOL g_has_reconnect_random
static void rdp_process_general_caps(STREAM s)
static void rdp_process_server_caps(STREAM s, uint16 length)
static void rdp_send_synchronise(void)
void rdp_main_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
static RD_BOOL process_redirect_pdu(STREAM s, RD_BOOL enhanced_redirect)
void process_new_pointer_pdu(STREAM s)
static void rdp_out_colcache_caps(STREAM s)
char g_reconnect_random[16]
static void process_pointer_pdu(STREAM s)
RD_BOOL g_polygon_ellipse_orders
static void rdp_send_data(STREAM s, uint8 data_pdu_type)
RD_BOOL g_bitmap_compression
char * g_redirect_username
enum _RDP_VERSION RDP_VERSION
void user(int argc, const char *argv[])
static const WCHAR version[]
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble top
GLuint GLsizei GLsizei * length
GLenum GLuint GLsizei bufsize
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
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
int const JOCTET unsigned int datalen
int iconv_close(iconv_t cd)
iconv_t iconv_open(const char *tocode, const char *fromcode)
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
#define memcpy(s1, s2, n)
_Out_opt_ int _Out_opt_ int * cy
static unsigned __int64 next
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
uint8 hist[RDP_MPPC_DICT_SIZE]
static rfbScreenInfoPtr server