ReactOS 0.4.15-dev-7788-g1ad9096
proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

RD_BOOL bitmap_decompress (uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
 
void cache_rebuild_bmpcache_linked_list (uint8 id, sint16 *idx, int count)
 
void cache_bump_bitmap (uint8 id, uint16 idx, int bump)
 
void cache_evict_bitmap (uint8 id)
 
RD_HBITMAP cache_get_bitmap (uint8 id, uint16 idx)
 
void cache_put_bitmap (uint8 id, uint16 idx, RD_HBITMAP bitmap)
 
void cache_save_state (void)
 
FONTGLYPHcache_get_font (uint8 font, uint16 character)
 
void cache_put_font (uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width, uint16 height, RD_HGLYPH pixmap)
 
DATABLOBcache_get_text (uint8 cache_id)
 
void cache_put_text (uint8 cache_id, void *data, int length)
 
uint8cache_get_desktop (uint32 offset, int cx, int cy, int bytes_per_pixel)
 
void cache_put_desktop (uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 *data)
 
RD_HCURSOR cache_get_cursor (uint16 cache_idx)
 
void cache_put_cursor (uint16 cache_idx, RD_HCURSOR cursor)
 
BRUSHDATAcache_get_brush_data (uint8 colour_code, uint8 idx)
 
void cache_put_brush_data (uint8 colour_code, uint8 idx, BRUSHDATA *brush_data)
 
VCHANNELchannel_register (char *name, uint32 flags, void(*callback)(STREAM))
 
STREAM channel_init (VCHANNEL *channel, uint32 length)
 
void channel_send (STREAM s, VCHANNEL *channel)
 
void channel_process (STREAM s, uint16 mcs_channel)
 
void cliprdr_send_simple_native_format_announce (uint32 format)
 
void cliprdr_send_native_format_announce (uint8 *formats_data, uint32 formats_data_length)
 
void cliprdr_send_data_request (uint32 format)
 
void cliprdr_send_data (uint8 *data, uint32 length)
 
void cliprdr_set_mode (const char *optarg)
 
RD_BOOL cliprdr_init (void)
 
int ctrl_init (const char *user, const char *domain, const char *host)
 
void ctrl_cleanup ()
 
RD_BOOL ctrl_is_slave ()
 
int ctrl_send_command (const char *cmd, const char *args)
 
void ctrl_add_fds (int *n, fd_set *rfds)
 
void ctrl_check_fds (fd_set *rfds, fd_set *wfds)
 
int disk_enum_devices (uint32 *id, char *optarg)
 
RD_NTSTATUS disk_query_information (RD_NTHANDLE handle, uint32 info_class, STREAM out)
 
RD_NTSTATUS disk_set_information (RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
 
RD_NTSTATUS disk_check_notify (RD_NTHANDLE handle)
 
RD_NTSTATUS disk_create_notify (RD_NTHANDLE handle, uint32 info_class)
 
RD_NTSTATUS disk_query_volume_information (RD_NTHANDLE handle, uint32 info_class, STREAM out)
 
RD_NTSTATUS disk_query_directory (RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
 
int mppc_expand (uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
 
int get_current_workarea (uint32 *x, uint32 *y, uint32 *width, uint32 *height)
 
void ewmh_init (void)
 
STREAM iso_init (int length)
 
void iso_send (STREAM s)
 
STREAM iso_recv (uint8 *rdpver)
 
RD_BOOL iso_connect (char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
 
void iso_disconnect (void)
 
void iso_reset_state (void)
 
RD_BOOL cssp_connect (char *server, char *user, char *domain, char *password, STREAM s)
 
void licence_process (STREAM s)
 
STREAM mcs_init (int length)
 
void mcs_send_to_channel (STREAM s, uint16 channel)
 
void mcs_send (STREAM s)
 
STREAM mcs_recv (uint16 *channel, uint8 *rdpver)
 
RD_BOOL mcs_connect_start (char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
 
RD_BOOL mcs_connect_finalize (STREAM s)
 
void mcs_disconnect (void)
 
void mcs_reset_state (void)
 
void process_orders (STREAM s, uint16 num_orders)
 
void reset_order_state (void)
 
int parallel_enum_devices (uint32 *id, char *optarg)
 
int printer_enum_devices (uint32 *id, char *optarg)
 
int printercache_load_blob (char *printer_name, uint8 **data)
 
void printercache_process (STREAM s)
 
void pstcache_touch_bitmap (uint8 cache_id, uint16 cache_idx, uint32 stamp)
 
RD_BOOL pstcache_load_bitmap (uint8 cache_id, uint16 cache_idx)
 
RD_BOOL pstcache_save_bitmap (uint8 cache_id, uint16 cache_idx, uint8 *key, uint8 width, uint8 height, uint16 length, uint8 *data)
 
int pstcache_enumerate (uint8 id, HASH_KEY *keylist)
 
RD_BOOL pstcache_init (uint8 cache_id)
 
int main (int argc, char *argv[])
 
void generate_random (uint8 *random)
 
voidxmalloc (int size)
 
void exit_if_null (void *ptr)
 
charxstrdup (const char *s)
 
voidxrealloc (void *oldmem, size_t size)
 
void xfree (void *mem)
 
void error (char *format,...)
 
void warning (char *format,...)
 
void unimpl (char *format,...)
 
void hexdump (unsigned char *p, unsigned int len)
 
charnext_arg (char *src, char needle)
 
void toupper_str (char *p)
 
RD_BOOL str_startswith (const char *s, const char *prefix)
 
RD_BOOL str_handle_lines (const char *input, char **rest, str_handle_lines_t linehandler, void *data)
 
RD_BOOL subprocess (char *const argv[], str_handle_lines_t linehandler, void *data)
 
charl_to_a (long N, int base)
 
int load_licence (unsigned char **data)
 
void save_licence (unsigned char *data, int length)
 
void rd_create_ui (void)
 
RD_BOOL rd_pstcache_mkdir (void)
 
int rd_open_file (char *filename)
 
void rd_close_file (int fd)
 
int rd_read_file (int fd, void *ptr, int len)
 
int rd_write_file (int fd, void *ptr, int len)
 
int rd_lseek_file (int fd, int offset)
 
RD_BOOL rd_lock_file (int fd, int start, int len)
 
void rdp5_process (STREAM s)
 
void rdp_out_unistr (STREAM s, char *string, int len)
 
void rdp_in_unistr (STREAM s, int in_len, char **string, uint32 *str_size)
 
void rdp_send_input (uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
 
void rdp_send_client_window_status (int status)
 
void process_colour_pointer_pdu (STREAM s)
 
void process_new_pointer_pdu (STREAM s)
 
void process_cached_pointer_pdu (STREAM s)
 
void process_system_pointer_pdu (STREAM s)
 
void process_bitmap_updates (STREAM s)
 
void process_palette (STREAM s)
 
void process_disconnect_pdu (STREAM s, uint32 *ext_disc_reason)
 
void rdp_main_loop (RD_BOOL *deactivated, uint32 *ext_disc_reason)
 
RD_BOOL rdp_loop (RD_BOOL *deactivated, uint32 *ext_disc_reason)
 
RD_BOOL rdp_connect (char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
 
void rdp_reset_state (void)
 
void rdp_disconnect (void)
 
int get_device_index (RD_NTHANDLE handle)
 
void convert_to_unix_filename (char *filename)
 
void rdpdr_send_completion (uint32 device, uint32 id, uint32 status, uint32 result, uint8 *buffer, uint32 length)
 
RD_BOOL rdpdr_init ()
 
void rdpdr_add_fds (int *n, fd_set *rfds, fd_set *wfds, struct timeval *tv, RD_BOOL *timeout)
 
struct async_iorequest * rdpdr_remove_iorequest (struct async_iorequest *prev, struct async_iorequest *iorq)
 
void rdpdr_check_fds (fd_set *rfds, fd_set *wfds, RD_BOOL timed_out)
 
RD_BOOL rdpdr_abort_io (uint32 fd, uint32 major, RD_NTSTATUS status)
 
void rdpsnd_record (const void *data, unsigned int size)
 
RD_BOOL rdpsnd_init (char *optarg)
 
void rdpsnd_show_help (void)
 
void rdpsnd_add_fds (int *n, fd_set *rfds, fd_set *wfds, struct timeval *tv)
 
void rdpsnd_check_fds (fd_set *rfds, fd_set *wfds)
 
struct audio_packetrdpsnd_queue_current_packet (void)
 
RD_BOOL rdpsnd_queue_empty (void)
 
void rdpsnd_queue_next (unsigned long completed_in_us)
 
int rdpsnd_queue_next_tick (void)
 
void rdpsnd_reset_state (void)
 
void sec_hash_to_string (char *out, int out_size, uint8 *in, int in_size)
 
void sec_hash_sha1_16 (uint8 *out, uint8 *in, uint8 *salt1)
 
void sec_hash_48 (uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2, uint8 salt)
 
void sec_hash_16 (uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2)
 
void buf_out_uint32 (uint8 *buffer, uint32 value)
 
void sec_sign (uint8 *signature, int siglen, uint8 *session_key, int keylen, uint8 *data, int datalen)
 
void sec_decrypt (uint8 *data, int length)
 
STREAM sec_init (uint32 flags, int maxlen)
 
void sec_send_to_channel (STREAM s, uint32 flags, uint16 channel)
 
void sec_send (STREAM s, uint32 flags)
 
void sec_process_mcs_data (STREAM s)
 
STREAM sec_recv (uint8 *rdpver)
 
RD_BOOL sec_connect (char *server, char *username, char *domain, char *password, RD_BOOL reconnect)
 
void sec_disconnect (void)
 
void sec_reset_state (void)
 
int serial_enum_devices (uint32 *id, char *optarg)
 
RD_BOOL serial_get_event (RD_NTHANDLE handle, uint32 *result)
 
RD_BOOL serial_get_timeout (RD_NTHANDLE handle, uint32 length, uint32 *timeout, uint32 *itv_timeout)
 
STREAM tcp_init (uint32 maxlen)
 
void tcp_send (STREAM s)
 
STREAM tcp_recv (STREAM s, uint32 length)
 
RD_BOOL tcp_connect (char *server)
 
void tcp_disconnect (void)
 
chartcp_get_address (void)
 
RD_BOOL tcp_is_connected (void)
 
void tcp_reset_state (void)
 
RD_BOOL tcp_tls_connect (void)
 
RD_BOOL tcp_tls_get_server_pubkey (STREAM s)
 
void tcp_run_ui (RD_BOOL run)
 
RD_BOOL ber_in_header (STREAM s, int *tagval, int *length)
 
void ber_out_header (STREAM s, int tagval, int length)
 
RD_BOOL ber_parse_header (STREAM s, int tagval, int *length)
 
void ber_out_integer (STREAM s, int value)
 
void ui_clip_format_announce (uint8 *data, uint32 length)
 
void ui_clip_handle_data (uint8 *data, uint32 length)
 
void ui_clip_request_failed (void)
 
void ui_clip_request_data (uint32 format)
 
void ui_clip_sync (void)
 
void ui_clip_set_mode (const char *optarg)
 
void xclip_init (void)
 
void xclip_deinit (void)
 
RD_BOOL xkeymap_from_locale (const char *locale)
 
FILExkeymap_open (const char *filename)
 
void xkeymap_init (void)
 
RD_BOOL handle_special_keys (uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed)
 
key_translation xkeymap_translate_key (uint32 keysym, unsigned int keycode, unsigned int state)
 
void xkeymap_send_keys (uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time, RD_BOOL pressed, uint8 nesting)
 
uint16 xkeymap_translate_button (unsigned int button)
 
charget_ksname (uint32 keysym)
 
void save_remote_modifiers (uint8 scancode)
 
void restore_remote_modifiers (uint32 ev_time, uint8 scancode)
 
void ensure_remote_modifiers (uint32 ev_time, key_translation tr)
 
unsigned int read_keyboard_state (void)
 
uint16 ui_get_numlock_state (unsigned int state)
 
void reset_modifier_keys (void)
 
void rdp_send_scancode (uint32 time, uint16 flags, uint8 scancode)
 
RD_BOOL get_key_state (unsigned int state, uint32 keysym)
 
RD_BOOL ui_init (void)
 
void ui_init_connection (void)
 
void ui_deinit (void)
 
RD_BOOL ui_create_window (void)
 
void ui_resize_window (void)
 
void ui_destroy_window (void)
 
RD_BOOL ui_have_window (void)
 
void xwin_toggle_fullscreen (void)
 
int ui_select (int rdp_socket)
 
void ui_move_pointer (int x, int y)
 
RD_HBITMAP ui_create_bitmap (int width, int height, uint8 *data)
 
void ui_paint_bitmap (int x, int y, int cx, int cy, int width, int height, uint8 *data)
 
void ui_destroy_bitmap (RD_HBITMAP bmp)
 
RD_HGLYPH ui_create_glyph (int width, int height, uint8 *data)
 
void ui_destroy_glyph (RD_HGLYPH glyph)
 
RD_HCURSOR ui_create_cursor (unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
 
void ui_set_cursor (RD_HCURSOR cursor)
 
void ui_destroy_cursor (RD_HCURSOR cursor)
 
void ui_set_null_cursor (void)
 
RD_HCOLOURMAP ui_create_colourmap (COLOURMAP *colours)
 
void ui_destroy_colourmap (RD_HCOLOURMAP map)
 
void ui_set_colourmap (RD_HCOLOURMAP map)
 
void ui_set_clip (int x, int y, int cx, int cy)
 
void ui_reset_clip (void)
 
void ui_bell (void)
 
void ui_destblt (uint8 opcode, int x, int y, int cx, int cy)
 
void ui_patblt (uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_screenblt (uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
 
void ui_memblt (uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy)
 
void ui_triblt (uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_line (uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
 
void ui_rect (int x, int y, int cx, int cy, int colour)
 
void ui_polygon (uint8 opcode, uint8 fillmode, RD_POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_polyline (uint8 opcode, RD_POINT *points, int npoints, PEN *pen)
 
void ui_ellipse (uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_draw_glyph (int mixmode, int x, int y, int cx, int cy, RD_HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)
 
void ui_draw_text (uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
 
void ui_desktop_save (uint32 offset, int x, int y, int cx, int cy)
 
void ui_desktop_restore (uint32 offset, int x, int y, int cx, int cy)
 
void ui_begin_update (void)
 
void ui_end_update (void)
 
void ui_seamless_begin (RD_BOOL hidden)
 
void ui_seamless_end ()
 
void ui_seamless_hide_desktop (void)
 
void ui_seamless_unhide_desktop (void)
 
void ui_seamless_toggle (void)
 
void ui_seamless_create_window (unsigned long id, unsigned long group, unsigned long parent, unsigned long flags)
 
void ui_seamless_destroy_window (unsigned long id, unsigned long flags)
 
void ui_seamless_destroy_group (unsigned long id, unsigned long flags)
 
void ui_seamless_seticon (unsigned long id, const char *format, int width, int height, int chunk, const char *data, int chunk_len)
 
void ui_seamless_delicon (unsigned long id, const char *format, int width, int height)
 
void ui_seamless_move_window (unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void ui_seamless_restack_window (unsigned long id, unsigned long behind, unsigned long flags)
 
void ui_seamless_settitle (unsigned long id, const char *title, unsigned long flags)
 
void ui_seamless_setstate (unsigned long id, unsigned int state, unsigned long flags)
 
void ui_seamless_syncbegin (unsigned long flags)
 
void ui_seamless_ack (unsigned int serial)
 
RD_BOOL lspci_init (void)
 
RD_BOOL seamless_init (void)
 
void seamless_reset_state (void)
 
unsigned int seamless_send_sync (void)
 
unsigned int seamless_send_state (unsigned long id, unsigned int state, unsigned long flags)
 
unsigned int seamless_send_position (unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void seamless_select_timeout (struct timeval *tv)
 
unsigned int seamless_send_zchange (unsigned long id, unsigned long below, unsigned long flags)
 
unsigned int seamless_send_focus (unsigned long id, unsigned long flags)
 
unsigned int seamless_send_destroy (unsigned long id)
 
unsigned int seamless_send_spawn (char *cmd)
 
unsigned int seamless_send_persistent (RD_BOOL)
 
void scard_lock (int lock)
 
void scard_unlock (int lock)
 
int scard_enum_devices (uint32 *id, char *optarg)
 
void scardSetInfo (uint32 epoch, uint32 device, uint32 id, uint32 bytes_out)
 
void scard_reset_state ()
 

Function Documentation

◆ ber_in_header()

RD_BOOL ber_in_header ( STREAM  s,
int tagval,
int length 
)

Definition at line 90 of file asn.c.

91{
92 in_uint8(s, *tagval);
93 in_uint8(s, *decoded_len);
94
95 if (*decoded_len < 0x80)
96 return True;
97 else if (*decoded_len == 0x81)
98 {
99 in_uint8(s, *decoded_len);
100 return True;
101 }
102 else if (*decoded_len == 0x82)
103 {
104 in_uint16_be(s, *decoded_len);
105 return True;
106 }
107
108 return False;
109}
#define in_uint8(s, v)
Definition: parse.h:88
#define in_uint16_be(s, v)
Definition: parse.h:75
#define False
Definition: types.h:25
#define True
Definition: types.h:24
GLdouble s
Definition: gl.h:2039

◆ ber_out_header()

void ber_out_header ( STREAM  s,
int  tagval,
int  length 
)

Definition at line 61 of file asn.c.

62{
63 if (tagval > 0xff)
64 {
65 out_uint16_be(s, tagval);
66 }
67 else
68 {
69 out_uint8(s, tagval);
70 }
71
72 if (length >= 0x80)
73 {
74 out_uint8(s, 0x82);
76 }
77 else
79}
#define out_uint8(s, v)
Definition: parse.h:92
#define out_uint16_be(s, v)
Definition: parse.h:77
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Referenced by ber_out_integer(), mcs_out_domain_params(), and mcs_send_connect_initial().

◆ ber_out_integer()

void ber_out_integer ( STREAM  s,
int  value 
)

Definition at line 83 of file asn.c.

84{
87}
void ber_out_header(STREAM s, int tagval, int length)
Definition: asn.c:61
#define BER_TAG_INTEGER
Definition: constants.h:78
Definition: pdh_main.c:94

Referenced by mcs_out_domain_params().

◆ ber_parse_header()

RD_BOOL ber_parse_header ( STREAM  s,
int  tagval,
int length 
)

Definition at line 25 of file asn.c.

26{
27 int tag, len;
28
29 if (tagval > 0xff)
30 {
32 }
33 else
34 {
35 in_uint8(s, tag);
36 }
37
38 if (tag != tagval)
39 {
40 error("expected tag %d, got %d\n", tagval, tag);
41 return False;
42 }
43
44 in_uint8(s, len);
45
46 if (len & 0x80)
47 {
48 len &= ~0x80;
49 *length = 0;
50 while (len--)
51 next_be(s, *length);
52 }
53 else
54 *length = len;
55
56 return s_check(s);
57}
#define s_check(s)
Definition: parse.h:42
#define next_be(s, v)
Definition: parse.h:97
GLenum GLsizei len
Definition: glext.h:6722
#define error(str)
Definition: mkdosfs.c:1605
Definition: ecma_167.h:138

Referenced by mcs_parse_domain_params(), and mcs_recv_connect_response().

◆ bitmap_decompress()

RD_BOOL bitmap_decompress ( uint8 output,
int  width,
int  height,
uint8 input,
int  size,
int  Bpp 
)

Definition at line 884 of file bitmap.c.

885{
886 RD_BOOL rv = False;
887
888 switch (Bpp)
889 {
890 case 1:
891 rv = bitmap_decompress1(output, width, height, input, size);
892 break;
893 case 2:
894 rv = bitmap_decompress2(output, width, height, input, size);
895 break;
896 case 3:
897 rv = bitmap_decompress3(output, width, height, input, size);
898 break;
899 case 4:
900 rv = bitmap_decompress4(output, width, height, input, size);
901 break;
902 default:
903 unimpl("Bpp %d\n", Bpp);
904 break;
905 }
906 return rv;
907}
static RD_BOOL bitmap_decompress1(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:67
static RD_BOOL bitmap_decompress3(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:464
static RD_BOOL bitmap_decompress4(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:856
static RD_BOOL bitmap_decompress2(uint8 *output, int width, int height, uint8 *input, int size)
Definition: bitmap.c:265
void unimpl(char *format,...)
Definition: uimain.c:801
int RD_BOOL
Definition: types.h:21
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLenum input
Definition: glext.h:9031

◆ buf_out_uint32()

void buf_out_uint32 ( uint8 buffer,
uint32  value 
)

Definition at line 304 of file secure.c.

305{
306 buffer[0] = (value) & 0xff;
307 buffer[1] = (value >> 8) & 0xff;
308 buffer[2] = (value >> 16) & 0xff;
309 buffer[3] = (value >> 24) & 0xff;
310}
GLuint buffer
Definition: glext.h:5915

Referenced by cliprdr_send_data_request(), cliprdr_send_simple_native_format_announce(), and licence_generate_hwid().

◆ cache_bump_bitmap()

void cache_bump_bitmap ( uint8  id,
uint16  idx,
int  bump 
)

Definition at line 104 of file cache.c.

105{
106 int p_idx, n_idx, n;
107
108 if (!IS_PERSISTENT(id))
109 return;
110
111 if (g_bmpcache_mru[id] == idx)
112 return;
113
114 DEBUG_RDP5(("bump bitmap: id=%d, idx=%d, bump=%d\n", id, idx, bump));
115
116 n_idx = g_bmpcache[id][idx].next;
117 p_idx = g_bmpcache[id][idx].previous;
118
119 if (IS_SET(n_idx))
120 {
121 /* remove */
123 if (IS_SET(p_idx))
124 g_bmpcache[id][p_idx].next = n_idx;
125 else
126 g_bmpcache_lru[id] = n_idx;
127 if (IS_SET(n_idx))
128 g_bmpcache[id][n_idx].previous = p_idx;
129 else
130 g_bmpcache_mru[id] = p_idx;
131 }
132 else
133 {
134 p_idx = NOT_SET;
135 n_idx = g_bmpcache_lru[id];
136 }
137
138 if (bump >= 0)
139 {
140 for (n = 0; n < bump && IS_SET(n_idx); n++)
141 {
142 p_idx = n_idx;
143 n_idx = g_bmpcache[id][p_idx].next;
144 }
145 }
146 else
147 {
148 p_idx = g_bmpcache_mru[id];
149 n_idx = NOT_SET;
150 }
151
152 /* insert */
154 g_bmpcache[id][idx].previous = p_idx;
155 g_bmpcache[id][idx].next = n_idx;
156
157 if (p_idx >= 0)
158 g_bmpcache[id][p_idx].next = idx;
159 else
161
162 if (n_idx >= 0)
163 g_bmpcache[id][n_idx].previous = idx;
164 else
166}
#define IS_SET(idx)
Definition: cache.c:31
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
#define NOT_SET
Definition: cache.c:30
static int g_bmpcache_count[3]
Definition: cache.c:54
static int g_bmpcache_mru[3]
Definition: cache.c:52
static int g_bmpcache_lru[3]
Definition: cache.c:51
#define IS_PERSISTENT(id)
Definition: precomp.h:26
#define DEBUG_RDP5(args)
Definition: rdesktop.h:141
unsigned int idx
Definition: utils.c:41
GLdouble n
Definition: glext.h:7729
GLuint id
Definition: glext.h:5910

Referenced by cache_get_bitmap(), and cache_put_bitmap().

◆ cache_evict_bitmap()

void cache_evict_bitmap ( uint8  id)

Definition at line 170 of file cache.c.

171{
172 uint16 idx;
173 int n_idx;
174
175 if (!IS_PERSISTENT(id))
176 return;
177
179 n_idx = g_bmpcache[id][idx].next;
180 DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=%p\n", id, idx, n_idx,
181 g_bmpcache[id][idx].bitmap));
182
185 g_bmpcache[id][idx].bitmap = 0;
186
187 g_bmpcache_lru[id] = n_idx;
188 g_bmpcache[id][n_idx].previous = NOT_SET;
189
191}
void ui_destroy_bitmap(RD_HBITMAP bmp)
void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp)
Definition: pstcache.c:39
unsigned short uint16
Definition: types.h:30
Definition: uimain.c:89

Referenced by cache_put_bitmap().

◆ cache_get_bitmap()

RD_HBITMAP cache_get_bitmap ( uint8  id,
uint16  idx 
)

Definition at line 195 of file cache.c.

196{
197 if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
198 {
200 {
201 if (IS_PERSISTENT(id))
203
204 return g_bmpcache[id][idx].bitmap;
205 }
206 }
207 else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
208 {
209 return g_volatile_bc[id];
210 }
211
212 error("get bitmap %d:%d\n", id, idx);
213 return NULL;
214}
#define BUMP_COUNT
Definition: cache.c:39
static RD_HBITMAP g_volatile_bc[3]
Definition: cache.c:49
void cache_bump_bitmap(uint8 id, uint16 idx, int bump)
Definition: cache.c:104
#define NUM_ELEMENTS(array)
Definition: cache.c:27
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
#define NULL
Definition: types.h:112

Referenced by process_memblt(), and process_triblt().

◆ cache_get_brush_data()

BRUSHDATA * cache_get_brush_data ( uint8  colour_code,
uint8  idx 
)

Definition at line 441 of file cache.c.

442{
443 colour_code = colour_code == 1 ? 0 : 1;
444 if (idx < NUM_ELEMENTS(g_brushcache[0]))
445 {
446 return &g_brushcache[colour_code][idx];
447 }
448 error("get brush %d %d\n", colour_code, idx);
449 return NULL;
450}
static BRUSHDATA g_brushcache[2][64]
Definition: cache.c:437

Referenced by setup_brush().

◆ cache_get_cursor()

RD_HCURSOR cache_get_cursor ( uint16  cache_idx)

Definition at line 400 of file cache.c.

401{
403
404 if (cache_idx < NUM_ELEMENTS(g_cursorcache))
405 {
406 cursor = g_cursorcache[cache_idx];
407 if (cursor != NULL)
408 return cursor;
409 }
410
411 error("get cursor %d\n", cache_idx);
412 return NULL;
413}
static RD_HCURSOR g_cursorcache[0x20]
Definition: cache.c:396
const char cursor[]
Definition: icontest.c:13

Referenced by process_cached_pointer_pdu().

◆ cache_get_desktop()

uint8 * cache_get_desktop ( uint32  offset,
int  cx,
int  cy,
int  bytes_per_pixel 
)

Definition at line 353 of file cache.c.

354{
355 int length = cx * cy * bytes_per_pixel;
356
357 if (offset > sizeof(g_deskcache))
358 offset = 0;
359
360 if ((offset + length) <= sizeof(g_deskcache))
361 {
362 return &g_deskcache[offset];
363 }
364
365 error("get desktop %d:%d\n", offset, length);
366 return NULL;
367}
static uint8 g_deskcache[0x38400 *4]
Definition: cache.c:349
GLintptr offset
Definition: glext.h:5920
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

Referenced by RdpClientUI::Display_RestoreDesktop(), and ui_desktop_restore().

◆ cache_get_font()

FONTGLYPH * cache_get_font ( uint8  font,
uint16  character 
)

Definition at line 279 of file cache.c.

280{
281 FONTGLYPH *glyph;
282
283 if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0])))
284 {
285 glyph = &g_fontcache[font][character];
286 if (glyph->pixmap != NULL)
287 return glyph;
288 }
289
290 error("get font %d:%d\n", font, character);
291 return NULL;
292}
static FONTGLYPH g_fontcache[12][256]
Definition: cache.c:275
Definition: mk_font.cpp:20
RD_HBITMAP pixmap
Definition: types.h:116

Referenced by RdpClientUI::Display_DoGlyph().

◆ cache_get_text()

DATABLOB * cache_get_text ( uint8  cache_id)

Definition at line 325 of file cache.c.

326{
327 DATABLOB *text;
328
329 text = &g_textcache[cache_id];
330 return text;
331}
static DATABLOB g_textcache[256]
Definition: cache.c:321
const WCHAR * text
Definition: package.c:1799

Referenced by RdpClientUI::Display_DrawText(), and ui_draw_text().

◆ cache_put_bitmap()

void cache_put_bitmap ( uint8  id,
uint16  idx,
RD_HBITMAP  bitmap 
)

Definition at line 218 of file cache.c.

219{
220 RD_HBITMAP old;
221
222 if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
223 {
224 old = g_bmpcache[id][idx].bitmap;
225 if (old != NULL)
227 g_bmpcache[id][idx].bitmap = bitmap;
228
229 if (IS_PERSISTENT(id))
230 {
231 if (old == NULL)
232 g_bmpcache[id][idx].previous = g_bmpcache[id][idx].next = NOT_SET;
233
237 }
238 }
239 else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
240 {
241 old = g_volatile_bc[id];
242 if (old != NULL)
245 }
246 else
247 {
248 error("put bitmap %d:%d\n", id, idx);
249 }
250}
#define TO_TOP
Definition: cache.c:29
void cache_evict_bitmap(uint8 id)
Definition: cache.c:170
#define BMPCACHE2_C2_CELLS
Definition: constants.h:284

Referenced by process_bmpcache(), process_bmpcache2(), process_raw_bmpcache(), and pstcache_load_bitmap().

◆ cache_put_brush_data()

void cache_put_brush_data ( uint8  colour_code,
uint8  idx,
BRUSHDATA brush_data 
)

Definition at line 455 of file cache.c.

456{
457 BRUSHDATA *bd;
458
459 colour_code = colour_code == 1 ? 0 : 1;
460 if (idx < NUM_ELEMENTS(g_brushcache[0]))
461 {
462 bd = &g_brushcache[colour_code][idx];
463 if (bd->data != 0)
464 {
465 xfree(bd->data);
466 }
467 memcpy(bd, brush_data, sizeof(BRUSHDATA));
468 }
469 else
470 {
471 error("put brush %d %d\n", colour_code, idx);
472 }
473}
void xfree(void *mem)
Definition: uimain.c:758
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
uint8 * data
Definition: types.h:96

Referenced by process_brushcache().

◆ cache_put_cursor()

void cache_put_cursor ( uint16  cache_idx,
RD_HCURSOR  cursor 
)

Definition at line 417 of file cache.c.

418{
419 RD_HCURSOR old;
420
421 if (cache_idx < NUM_ELEMENTS(g_cursorcache))
422 {
423 old = g_cursorcache[cache_idx];
424 if (old != NULL)
426
427 g_cursorcache[cache_idx] = cursor;
428 }
429 else
430 {
431 error("put cursor %d\n", cache_idx);
432 }
433}
void ui_destroy_cursor(RD_HCURSOR cursor)

Referenced by process_colour_pointer_common(), and process_colour_pointer_pdu().

◆ cache_put_desktop()

void cache_put_desktop ( uint32  offset,
int  cx,
int  cy,
int  scanline,
int  bytes_per_pixel,
uint8 data 
)

Definition at line 371 of file cache.c.

372{
373 int length = cx * cy * bytes_per_pixel;
374
375 if (offset > sizeof(g_deskcache))
376 offset = 0;
377
378 if ((offset + length) <= sizeof(g_deskcache))
379 {
380 cx *= bytes_per_pixel;
381 while (cy--)
382 {
384 data += scanline;
385 offset += cx;
386 }
387 }
388 else
389 {
390 error("put desktop %d:%d\n", offset, length);
391 }
392}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by RdpClientUI::Display_SaveDesktop(), and ui_desktop_save().

◆ cache_put_font()

void cache_put_font ( uint8  font,
uint16  character,
uint16  offset,
uint16  baseline,
uint16  width,
uint16  height,
RD_HGLYPH  pixmap 
)

Definition at line 296 of file cache.c.

298{
299 FONTGLYPH *glyph;
300
301 if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0])))
302 {
303 glyph = &g_fontcache[font][character];
304 if (glyph->pixmap != NULL)
305 ui_destroy_glyph(glyph->pixmap);
306
307 glyph->offset = offset;
308 glyph->baseline = baseline;
309 glyph->width = width;
310 glyph->height = height;
311 glyph->pixmap = pixmap;
312 }
313 else
314 {
315 error("put font %d:%d\n", font, character);
316 }
317}
void ui_destroy_glyph(RD_HGLYPH glyph)
Definition: qtewin.cpp:1424
uint16 width
Definition: types.h:114
sint16 baseline
Definition: types.h:113
uint16 height
Definition: types.h:115
sint16 offset
Definition: types.h:112

Referenced by process_fontcache().

◆ cache_put_text()

void cache_put_text ( uint8  cache_id,
void data,
int  length 
)

Definition at line 335 of file cache.c.

336{
337 DATABLOB *text;
338
339 text = &g_textcache[cache_id];
340 if (text->data != NULL)
341 xfree(text->data);
342 text->data = xmalloc(length);
343 text->size = length;
344 memcpy(text->data, data, length);
345}
void * xmalloc(int size)
Definition: uimain.c:747

Referenced by RdpClientUI::Display_DrawText(), and ui_draw_text().

◆ cache_rebuild_bmpcache_linked_list()

void cache_rebuild_bmpcache_linked_list ( uint8  id,
sint16 idx,
int  count 
)

Definition at line 58 of file cache.c.

59{
60 int n = count, c = 0;
61 sint16 n_idx;
62
63 /* find top, skip evicted bitmaps */
64 while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
65 if (n < 0)
66 {
68 return;
69 }
70
72 g_bmpcache[id][idx[n]].next = NOT_SET;
73 n_idx = idx[n];
74 c++;
75
76 /* link list */
77 while (n >= 0)
78 {
79 /* skip evicted bitmaps */
80 while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
81
82 if (n < 0)
83 break;
84
85 g_bmpcache[id][n_idx].previous = idx[n];
86 g_bmpcache[id][idx[n]].next = n_idx;
87 n_idx = idx[n];
88 c++;
89 }
90
91 g_bmpcache[id][n_idx].previous = NOT_SET;
92 g_bmpcache_lru[id] = n_idx;
93
94 if (c != g_bmpcache_count[id])
95 {
96 error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
99 }
100}
#define EX_SOFTWARE
Definition: rdesktop.h:70
signed short sint16
Definition: types.h:31
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLubyte * c
Definition: glext.h:8905
#define exit(n)
Definition: config.h:202

Referenced by pstcache_enumerate().

◆ cache_save_state()

void cache_save_state ( void  )

Definition at line 254 of file cache.c.

255{
256 uint32 id = 0, t = 0;
257 int idx;
258
259 for (id = 0; id < NUM_ELEMENTS(g_bmpcache); id++)
260 if (IS_PERSISTENT(id))
261 {
262 DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id));
264 while (idx >= 0)
265 {
267 idx = g_bmpcache[id][idx].next;
268 }
269 DEBUG_RDP5((" %d stamps written.\n", t));
270 }
271}
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble t
Definition: gl.h:2047

Referenced by main().

◆ channel_init()

STREAM channel_init ( VCHANNEL channel,
uint32  length 
)

Definition at line 69 of file channels.c.

70{
71 STREAM s;
72
74 s_push_layer(s, channel_hdr, 8);
75 return s;
76}
RD_BOOL g_encryption
Definition: uimain.c:40
#define SEC_ENCRYPT
Definition: constants.h:101
#define s_push_layer(s, h, n)
Definition: parse.h:39
STREAM sec_init(uint32 flags, int maxlen)
Definition: secure.c:419
Definition: parse.h:23

Referenced by cliprdr_send_packet(), lspci_send(), rdpdr_send_available(), rdpdr_send_clientcapabilty(), rdpdr_send_completion(), rdpdr_send_connect(), rdpdr_send_name(), rdpsnd_init_packet(), and seamless_send().

◆ channel_process()

void channel_process ( STREAM  s,
uint16  mcs_channel 
)

Definition at line 138 of file channels.c.

139{
141 uint32 thislength;
142 VCHANNEL *channel = NULL;
143 unsigned int i;
144 STREAM in;
145
146 for (i = 0; i < g_num_channels; i++)
147 {
148 channel = &g_channels[i];
149 if (channel->mcs_id == mcs_channel)
150 break;
151 }
152
153 if (i >= g_num_channels)
154 return;
155
159 {
160 /* single fragment - pass straight up */
161 channel->process(s);
162 }
163 else
164 {
165 /* add fragment to defragmentation buffer */
166 in = &channel->in;
168 {
169 if (length > in->size)
170 {
171 in->data = (uint8 *) xrealloc(in->data, length);
172 in->size = length;
173 }
174 in->p = in->data;
175 }
176
177 thislength = MIN(s->end - s->p, in->data + in->size - in->p);
178 memcpy(in->p, s->p, thislength);
179 in->p += thislength;
180
182 {
183 in->end = in->p;
184 in->p = in->data;
185 channel->process(in);
186 }
187 }
188}
#define CHANNEL_FLAG_LAST
Definition: channels.c:26
#define CHANNEL_FLAG_FIRST
Definition: channels.c:25
unsigned int g_num_channels
Definition: channels.c:33
VCHANNEL g_channels[MAX_CHANNELS]
Definition: channels.c:32
#define in_uint32_le(s, v)
Definition: parse.h:56
void * xrealloc(void *oldmem, size_t size)
Definition: uimain.c:736
#define MIN(x, y)
Definition: rdesktop.h:171
unsigned char uint8
Definition: types.h:28
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
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
Definition: glfuncs.h:248
void(* process)(STREAM)
Definition: types.h:156
struct stream in
Definition: types.h:155
uint16 mcs_id
Definition: types.h:152

Referenced by sec_recv().

◆ channel_register()

VCHANNEL * channel_register ( char name,
uint32  flags,
void(*)(STREAM callback 
)

Definition at line 46 of file channels.c.

47{
48 VCHANNEL *channel;
49
51 return NULL;
52
54 {
55 error("Channel table full, increase MAX_CHANNELS\n");
56 return NULL;
57 }
58
59 channel = &g_channels[g_num_channels];
61 strncpy(channel->name, name, 8);
62 channel->flags = flags;
63 channel->process = callback;
65 return channel;
66}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
RDP_VERSION g_rdp_version
Definition: uimain.c:74
#define MAX_CHANNELS
Definition: channels.c:23
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
@ RDP_V5
Definition: types.h:44
static IPrintDialogCallback callback
Definition: printdlg.c:326
uint32 flags
Definition: types.h:154
char name[8]
Definition: types.h:153
Definition: name.c:39

Referenced by cliprdr_init(), lspci_init(), rdpdr_init(), rdpsnd_init(), and seamless_init().

◆ channel_send()

void channel_send ( STREAM  s,
VCHANNEL channel 
)

Definition at line 79 of file channels.c.

80{
82 uint32 thislength, remaining;
83 uint8 *data;
84
85#ifdef WITH_SCARD
87#endif
88
89 /* first fragment sent in-place */
90 s_pop_layer(s, channel_hdr);
91 length = s->end - s->p - 8;
92
93 DEBUG_CHANNEL(("channel_send, length = %d\n", length));
94
95 thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
96/* Note: In the original clipboard implementation, this number was
97 1592, not 1600. However, I don't remember the reason and 1600 seems
98 to work so.. This applies only to *this* length, not the length of
99 continuation or ending packets. */
100 remaining = length - thislength;
102 if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
104
107 data = s->end = s->p + thislength;
108 DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
110
111 /* subsequent segments copied (otherwise would have to generate headers backwards) */
112 while (remaining > 0)
113 {
114 thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
115 remaining -= thislength;
116 flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
117 if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
119
120 DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
121
122 s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
125 out_uint8p(s, data, thislength);
126 s_mark_end(s);
128
129 data += thislength;
130 }
131
132#ifdef WITH_SCARD
134#endif
135}
#define CHANNEL_CHUNK_LENGTH
Definition: channels.c:24
#define CHANNEL_FLAG_SHOW_PROTOCOL
Definition: channels.c:27
#define SCARD_LOCK_CHANNEL
Definition: constants.h:581
#define CHANNEL_OPTION_SHOW_PROTOCOL
Definition: constants.h:434
#define s_mark_end(s)
Definition: parse.h:41
#define out_uint32_le(s, v)
Definition: parse.h:59
#define s_pop_layer(s, h)
Definition: parse.h:40
#define out_uint8p(s, v, n)
Definition: parse.h:93
void scard_lock(int lock)
void sec_send_to_channel(STREAM s, uint32 flags, uint16 channel)
Definition: secure.c:436
void scard_unlock(int lock)
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159

Referenced by cliprdr_send_packet(), lspci_send(), rdpdr_send_available(), rdpdr_send_clientcapabilty(), rdpdr_send_completion(), rdpdr_send_connect(), rdpdr_send_name(), rdpsnd_send(), and seamless_send().

◆ cliprdr_init()

RD_BOOL cliprdr_init ( void  )

Referenced by xclip_init().

◆ cliprdr_send_data()

void cliprdr_send_data ( uint8 data,
uint32  length 
)

◆ cliprdr_send_data_request()

void cliprdr_send_data_request ( uint32  format)

◆ cliprdr_send_native_format_announce()

void cliprdr_send_native_format_announce ( uint8 formats_data,
uint32  formats_data_length 
)

◆ cliprdr_send_simple_native_format_announce()

void cliprdr_send_simple_native_format_announce ( uint32  format)

◆ cliprdr_set_mode()

void cliprdr_set_mode ( const char optarg)

Referenced by main().

◆ convert_to_unix_filename()

void convert_to_unix_filename ( char filename)

Definition at line 78 of file rdpdr.c.

79{
80 char *p;
81
82 while ((p = strchr(filename, '\\')))
83 {
84 *p = '/';
85 }
86}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GLfloat GLfloat p
Definition: glext.h:8902
const char * filename
Definition: ioapi.h:137

Referenced by disk_set_information(), and rdpdr_process_irp().

◆ cssp_connect()

RD_BOOL cssp_connect ( char server,
char user,
char domain,
char password,
STREAM  s 
)

Referenced by iso_connect().

◆ ctrl_add_fds()

void ctrl_add_fds ( int n,
fd_set rfds 
)

◆ ctrl_check_fds()

void ctrl_check_fds ( fd_set rfds,
fd_set wfds 
)

◆ ctrl_cleanup()

void ctrl_cleanup ( )

◆ ctrl_init()

int ctrl_init ( const char user,
const char domain,
const char host 
)

◆ ctrl_is_slave()

RD_BOOL ctrl_is_slave ( )

◆ ctrl_send_command()

int ctrl_send_command ( const char cmd,
const char args 
)

◆ disk_check_notify()

RD_NTSTATUS disk_check_notify ( RD_NTHANDLE  handle)

Referenced by _rdpdr_check_fds().

◆ disk_create_notify()

RD_NTSTATUS disk_create_notify ( RD_NTHANDLE  handle,
uint32  info_class 
)

Referenced by rdpdr_process_irp().

◆ disk_enum_devices()

int disk_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ disk_query_directory()

RD_NTSTATUS disk_query_directory ( RD_NTHANDLE  handle,
uint32  info_class,
char pattern,
STREAM  out 
)

Referenced by rdpdr_process_irp().

◆ disk_query_information()

RD_NTSTATUS disk_query_information ( RD_NTHANDLE  handle,
uint32  info_class,
STREAM  out 
)

Referenced by rdpdr_process_irp().

◆ disk_query_volume_information()

RD_NTSTATUS disk_query_volume_information ( RD_NTHANDLE  handle,
uint32  info_class,
STREAM  out 
)

Referenced by rdpdr_process_irp().

◆ disk_set_information()

RD_NTSTATUS disk_set_information ( RD_NTHANDLE  handle,
uint32  info_class,
STREAM  in,
STREAM  out 
)

Referenced by rdpdr_process_irp().

◆ ensure_remote_modifiers()

void ensure_remote_modifiers ( uint32  ev_time,
key_translation  tr 
)

Referenced by vncKey().

◆ error()

void error ( char format,
  ... 
)

Definition at line 817 of file uimain.c.

818{
819 va_list ap;
820 char text[512];
821 char text1[512];
822
823 sprintf(text1, "ERROR: ");
826 va_end(ap);
827 strcat(text1, text);
828 mi_error(text1);
829}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void mi_error(char *msg)
Definition: win32.c:131
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ ewmh_init()

void ewmh_init ( void  )

Referenced by ui_init().

◆ exit_if_null()

void exit_if_null ( void ptr)

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 709 of file uimain.c.

710{
711 int i;
712
713 rand();
714 rand();
715 for (i = 0; i < 32; i++)
716 {
717 random[i] = rand(); /* higher bits are more random */
718 }
719}
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define random
Definition: rosdhcp.h:81

Referenced by sec_process_crypt_info().

◆ get_current_workarea()

int get_current_workarea ( uint32 x,
uint32 y,
uint32 width,
uint32 height 
)

Referenced by ui_init().

◆ get_device_index()

◆ get_key_state()

RD_BOOL get_key_state ( unsigned int  state,
uint32  keysym 
)

Definition at line 146 of file vnc.c.

147{
148 if (keysym >= FIRST_MODIFIER && keysym <= LAST_MODIFIER)
149 return keystate[keysym - FIRST_MODIFIER];
150 return 0;
151}
#define FIRST_MODIFIER
Definition: vnc.c:130
#define LAST_MODIFIER
Definition: vnc.c:131
static BOOL keystate[LAST_MODIFIER - FIRST_MODIFIER]
Definition: vnc.c:133

Referenced by handle_special_keys(), reset_modifier_keys(), and ui_get_numlock_state().

◆ get_ksname()

char * get_ksname ( uint32  keysym)

Definition at line 734 of file xkeymap.c.

735{
736 char *ksname = NULL;
737
738 if (keysym == NoSymbol)
739 ksname = "NoSymbol";
740 else if (!(ksname = XKeysymToString(keysym)))
741 ksname = "(no name)";
742
743 return ksname;
744}
const char * XKeysymToString(KeySym keysym)
Definition: x11stubs.c:1391
#define NoSymbol
Definition: x11stubs.h:10

Referenced by xkeymap_translate_key(), and xwin_process_events().

◆ handle_special_keys()

RD_BOOL handle_special_keys ( uint32  keysym,
unsigned int  state,
uint32  ev_time,
RD_BOOL  pressed 
)

Referenced by vncKey(), and xwin_process_events().

◆ hexdump()

void hexdump ( unsigned char p,
unsigned int  len 
)

Definition at line 234 of file shimdbg.c.

235{
236 unsigned char *line = p;
237 unsigned int i, thisline, offset = 0;
238
239 while (offset < len)
240 {
241 xprintf("%04x ", offset);
242 thisline = len - offset;
243 if (thisline > 16)
244 thisline = 16;
245
246 for (i = 0; i < thisline; i++)
247 xprintf("%02x ", line[i]);
248
249 for (; i < 16; i++)
250 xprintf(" ");
251
252 for (i = 0; i < thisline; i++)
253 xprintf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
254
255 xprintf("\n");
256 offset += thisline;
257 line += thisline;
258 }
259}
void xprintf(const char *fmt,...)
Definition: shimdbg.c:16
Definition: parser.c:49

Referenced by lspci_process(), lspci_send(), rdp5_process(), rdp_recv(), rdpdr_process(), rdpsnd_process(), rdpsnd_send(), seamless_process(), seamless_send(), sec_recv(), sec_send_to_channel(), serial_device_control(), and serial_read().

◆ iso_connect()

RD_BOOL iso_connect ( char server,
char username,
char domain,
char password,
RD_BOOL  reconnect,
uint32 selected_protocol 
)

Definition at line 203 of file iso.c.

205{
206 STREAM s;
207 uint8 code;
208 uint32 neg_proto;
209
211
212 neg_proto = PROTOCOL_SSL;
213
214#ifdef WITH_CREDSSP
216 neg_proto |= PROTOCOL_HYBRID;
218 neg_proto |= PROTOCOL_HYBRID;
219 else
220 warning("Disables CredSSP due to missing smartcard information for SSO.\n");
221#endif
222
223 retry:
224 *selected_protocol = PROTOCOL_RDP;
225 code = 0;
226
227 if (!tcp_connect(server))
228 return False;
229
231
232 s = iso_recv_msg(&code, NULL);
233 if (s == NULL)
234 return False;
235
236 if (code != ISO_PDU_CC)
237 {
238 error("expected CC, got 0x%x\n", code);
240 return False;
241 }
242
243 if (g_rdp_version >= RDP_V5 && s_check_rem(s, 8))
244 {
245 /* handle RDP_NEG_REQ response */
246 const char *reason = NULL;
247
248 uint8 type = 0, flags = 0;
249 uint16 length = 0;
250 uint32 data = 0;
251
252 in_uint8(s, type);
253 in_uint8(s, flags);
255 in_uint32(s, data);
256
257 if (type == RDP_NEG_FAILURE)
258 {
259 RD_BOOL retry_without_neg = False;
260
261 switch (data)
262 {
264 reason = "SSL with user authentication required by server";
265 break;
267 reason = "SSL not allowed by server";
268 retry_without_neg = True;
269 break;
271 reason = "no valid authentication certificate on server";
272 retry_without_neg = True;
273 break;
275 reason = "inconsistent negotiation flags";
276 break;
278 reason = "SSL required by server";
279 break;
281 reason = "CredSSP required by server";
282 break;
283 default:
284 reason = "unknown reason";
285 }
286
288
289 if (retry_without_neg)
290 {
292 "Failed to negotiate protocol, retrying with plain RDP.\n");
294 goto retry;
295 }
296
297 fprintf(stderr, "Failed to connect, %s.\n", reason);
298 return False;
299 }
300
301 if (type != RDP_NEG_RSP)
302 {
304 error("Expected RDP_NEG_RSP, got type = 0x%x\n", type);
305 return False;
306 }
307
308 /* handle negotiation response */
309 if (data == PROTOCOL_SSL)
310 {
311#ifdef WITH_SSL
312 if (!tcp_tls_connect())
313 {
314 /* failed to connect using cssp, let retry with plain TLS */
316 neg_proto = PROTOCOL_RDP;
317 goto retry;
318 }
319 /* do not use encryption when using TLS */
321 fprintf(stderr, "Connection established using SSL.\n");
322#else /* WITH_SSL */
323 fprintf(stderr, "SSL not compiled in.\n");
324#endif /* WITH_SSL */
325 }
326#ifdef WITH_CREDSSP
327 else if (data == PROTOCOL_HYBRID)
328 {
330 {
331 /* failed to connect using cssp, let retry with plain TLS */
333 neg_proto = PROTOCOL_SSL;
334 goto retry;
335 }
336
337 /* do not use encryption when using TLS */
338 fprintf(stderr, "Connection established using CredSSP.\n");
340 }
341#endif
342 else if (data == PROTOCOL_RDP)
343 {
344 fprintf(stderr, "Connection established using plain RDP.\n");
345 }
346 else if (data != PROTOCOL_RDP)
347 {
349 error("Unexpected protocol in negotiation response, got data = 0x%x.\n",
350 data);
351 return False;
352 }
353 if (length || flags) {}
354
355 *selected_protocol = data;
356 }
357 return True;
358}
@ PROTOCOL_SSL
Definition: constants.h:47
@ PROTOCOL_HYBRID
Definition: constants.h:48
@ PROTOCOL_RDP
Definition: constants.h:46
@ RDP_NEG_FAILURE
Definition: constants.h:41
@ RDP_NEG_RSP
Definition: constants.h:40
@ SSL_CERT_NOT_ON_SERVER
Definition: constants.h:55
@ HYBRID_REQUIRED_BY_SERVER
Definition: constants.h:57
@ SSL_REQUIRED_BY_SERVER
Definition: constants.h:53
@ SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER
Definition: constants.h:58
@ INCONSISTENT_FLAGS
Definition: constants.h:56
@ SSL_NOT_ALLOWED_BY_SERVER
Definition: constants.h:54
@ ISO_PDU_CC
Definition: constants.h:30
char * g_sc_csp_name
static STREAM iso_recv_msg(uint8 *code, uint8 *rdpver)
Definition: iso.c:101
static void iso_send_connection_request(char *username, uint32 neg_proto)
Definition: iso.c:60
RD_BOOL g_encryption
Definition: uimain.c:40
char * g_sc_reader_name
RD_BOOL g_use_password_as_pin
static RD_BOOL g_negotiate_rdp_protocol
Definition: iso.c:29
RDP_VERSION g_rdp_version
Definition: uimain.c:74
char * g_sc_container_name
char * g_sc_card_name
#define in_uint32(s, v)
Definition: parse.h:83
#define s_check_rem(s, n)
Definition: parse.h:43
#define in_uint16(s, v)
Definition: parse.h:82
void tcp_disconnect(void)
Definition: tcp.c:832
RD_BOOL tcp_tls_connect(void)
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
RD_BOOL cssp_connect(char *server, char *user, char *domain, char *password, STREAM s)
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
#define warning(s)
Definition: debug.h:83
Definition: inflate.c:139
Definition: cookie.c:42
static rfbScreenInfoPtr server
Definition: vnc.c:74

Referenced by mcs_connect(), and mcs_connect_start().

◆ iso_disconnect()

void iso_disconnect ( void  )

Definition at line 362 of file iso.c.

363{
366}
@ ISO_PDU_DR
Definition: constants.h:31
static void iso_send_msg(uint8 code)
Definition: iso.c:39

Referenced by mcs_connect(), mcs_connect_finalize(), mcs_disconnect(), and mcs_reconnect().

◆ iso_init()

STREAM iso_init ( int  length)

Definition at line 150 of file iso.c.

151{
152 STREAM s;
153
154 s = tcp_init(length + 7);
155 s_push_layer(s, iso_hdr, 7);
156
157 return s;
158}
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82

Referenced by mcs_init(), mcs_send_aurq(), mcs_send_cjrq(), mcs_send_connect_initial(), and mcs_send_edrq().

◆ iso_recv()

STREAM iso_recv ( uint8 rdpver)

Definition at line 182 of file iso.c.

183{
184 STREAM s;
185 uint8 code = 0;
186
187 s = iso_recv_msg(&code, rdpver);
188 if (s == NULL)
189 return NULL;
190 if (rdpver != NULL)
191 if (*rdpver != 3)
192 return s;
193 if (code != ISO_PDU_DT)
194 {
195 error("expected DT, got 0x%x\n", code);
196 return NULL;
197 }
198 return s;
199}
@ ISO_PDU_DT
Definition: constants.h:32

Referenced by mcs_recv(), mcs_recv_aucf(), mcs_recv_cjcf(), and mcs_recv_connect_response().

◆ iso_reset_state()

void iso_reset_state ( void  )

Definition at line 370 of file iso.c.

371{
374}
RD_BOOL g_encryption_initial
Definition: uimain.c:75
void tcp_reset_state(void)
Definition: tcp.c:894

Referenced by mcs_reset_state().

◆ iso_send()

void iso_send ( STREAM  s)

Definition at line 162 of file iso.c.

163{
165
166 s_pop_layer(s, iso_hdr);
167 length = s->end - s->p;
168
169 out_uint8(s, 3); /* version */
170 out_uint8(s, 0); /* reserved */
172
173 out_uint8(s, 2); /* hdrlen */
174 out_uint8(s, ISO_PDU_DT); /* code */
175 out_uint8(s, 0x80); /* eot */
176
177 tcp_send(s);
178}
void tcp_send(STREAM s)
Definition: tcp.c:270

Referenced by mcs_send_aurq(), mcs_send_cjrq(), mcs_send_connect_initial(), mcs_send_edrq(), and mcs_send_to_channel().

◆ l_to_a()

char * l_to_a ( long  N,
int  base 
)

Definition at line 1356 of file rdesktop.c.

1357{
1358 static char ret[LTOA_BUFSIZE];
1359
1360 char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf);
1361
1362 register int divrem;
1363
1364 if (base < 36 || 2 > base)
1365 base = 10;
1366
1367 if (N < 0)
1368 {
1369 *head++ = '-';
1370 N = -N;
1371 }
1372
1373 tail = buf + sizeof(buf);
1374 *--tail = 0;
1375
1376 do
1377 {
1378 divrem = N % base;
1379 *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10;
1380 N /= base;
1381 }
1382 while (N);
1383
1384 strcpy(head, tail);
1385 return ret;
1386}
#define N
Definition: crc32.c:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
struct outqueuenode * tail
Definition: adnsresfilter.c:66
struct outqueuenode * head
Definition: adnsresfilter.c:66
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LTOA_BUFSIZE
Definition: rdesktop.c:1353
int ret

Referenced by printer_enum_devices().

◆ licence_process()

void licence_process ( STREAM  s)

Definition at line 378 of file licence.c.

379{
380 uint8 tag;
381
382 in_uint8(s, tag);
383 in_uint8s(s, 3); /* version, length */
384
385#if WITH_DEBUG
386 DEBUG(("Received licensing PDU (message type 0x%02x)\n", tag));
387#endif
388
389 switch (tag)
390 {
393 break;
394
397 break;
398
401 /* we can handle new and upgrades of licences the same way. */
403 break;
404
407 break;
408
409 default:
410 unimpl("licence tag 0x%02x\n", tag);
411 }
412}
#define LICENCE_TAG_ERROR_ALERT
Definition: constants.h:152
#define LICENCE_TAG_UPGRADE_LICENCE
Definition: constants.h:148
#define LICENCE_TAG_NEW_LICENCE
Definition: constants.h:147
#define LICENCE_TAG_REQUEST
Definition: constants.h:145
#define LICENCE_TAG_PLATFORM_CHALLANGE
Definition: constants.h:146
void licence_process_error_alert(STREAM s)
Definition: licence.c:324
static void licence_process_platform_challenge(STREAM s)
Definition: licence.c:253
static void licence_process_request(STREAM s)
Definition: licence.c:156
static void licence_process_new_license(STREAM s)
Definition: licence.c:288
#define in_uint8s(s, n)
Definition: parse.h:91
#define DEBUG(args)
Definition: rdesktop.h:129

Referenced by sec_recv().

◆ load_licence()

int load_licence ( unsigned char **  data)

◆ lspci_init()

RD_BOOL lspci_init ( void  )

Referenced by main().

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 1685 of file atactl.cpp.

1689{
1690 //ULONG Flags = 0;
1691 intptr_t i;
1692 uintptr_t j;
1693 char a;
1694 int bus_id = -1;
1695 int dev_id = -1;
1696 int cmd = 0;
1697 int lock = -1;
1698 int b_dev=-1, d_dev=-1, l_dev=0;
1699 int mode=-1;
1700 int list_bb=0;
1701 int persistent_hide=0;
1702 int power_mode=StartStop_Power_NoChg;
1703
1704 printf("Console ATA control utility for Windows NT3.51/NT4/2000/XP/2003\n"
1705 "Version 0." UNIATA_VER_STR ", Copyright (c) Alexander A. Telyatnikov, 2003-2012\n"
1706 "Home site: http://alter.org.ua\n");
1707
1708 for(i=1; i<argc; i++) {
1709 if(!argv[i])
1710 continue;
1711 if((a = argv[i][0]) != '-') {
1712 for(j=0; (a = argv[i][j]); j++) {
1713 switch(a) {
1714 case 'a' :
1715 case 's' :
1716 case 'c' :
1717 j++;
1718 bus_id = ata_num_to_x_dev(argv[i][j]);
1719 break;
1720 case 'b' :
1721 j++;
1722 b_dev = ata_num_to_x_dev(argv[i][j]);
1723 break;
1724 case 'd' :
1725 j++;
1726 d_dev = ata_num_to_x_dev(argv[i][j]);
1727 break;
1728 case 'l' :
1729 j++;
1730 l_dev = ata_num_to_x_dev(argv[i][j]);
1731 break;
1732 case ':' :
1733 break;
1734 default:
1735 print_help();
1736 }
1737 }
1738 continue;
1739 }
1740 j=1;
1741 while(argv[i] && (a = argv[i][j]) && (a != ' ') && (a != '\t')) {
1742 switch(a) {
1743 case 'l' :
1744 if(cmd || lock>0) {
1745 print_help();
1746 }
1747 cmd = CMD_ATA_LIST;
1748 break;
1749 case 'x' :
1750 g_extended = 1;
1751 break;
1752 case 'a' :
1753 g_adapter_info = 1;
1754 break;
1755 case 'S' :
1756 persistent_hide = 1;
1757 case 's' :
1758 if(cmd || lock>0) {
1759 print_help();
1760 }
1761 cmd = CMD_ATA_FIND;
1762 d_dev = 0;
1763 break;
1764 case 'H' :
1765 persistent_hide = 1;
1766 case 'h' :
1767 if(cmd) {
1768 print_help();
1769 }
1770 cmd = CMD_ATA_HIDE;
1771 d_dev = 0;
1772 break;
1773 case 'm' :
1774 if(cmd) {
1775 print_help();
1776 }
1777 cmd = CMD_ATA_MODE;
1778 i++;
1779 if(!argv[i]) {
1780 print_help();
1781 }
1783 if(mode == -1) {
1784 i--;
1785 } else {
1786 j = strlen(argv[i])-1;
1787 }
1788 break;
1789 case 'r' :
1790 if(cmd) {
1791 print_help();
1792 }
1794 break;
1795 case 'b' :
1796 if(cmd) {
1797 print_help();
1798 }
1799 switch(argv[i][j+1]) {
1800 case 'l':
1801 list_bb = 1;
1802 break;
1803 case 'a':
1804 list_bb = 0;
1805 break;
1806 case 'r':
1807 list_bb = -1;
1808 break;
1809 default:
1810 j--;
1811 }
1812 j++;
1813 cmd = CMD_ATA_BBLK;
1814 break;
1815 case 'f' :
1816 if(cmd != CMD_ATA_BBLK) {
1817 print_help();
1818 }
1819 i++;
1820 if(!argv[i]) {
1821 print_help();
1822 }
1823 g_bb_list=argv[i];
1824 j = strlen(argv[i])-1;
1825 break;
1826 case 'p' :
1827 if(cmd && (cmd != CMD_ATA_FIND) && (cmd != CMD_ATA_HIDE)) {
1828 print_help();
1829 }
1830 switch(argv[i][j+1]) {
1831 case '0':
1832 case 'a':
1833 // do nothing
1834 break;
1835 case '1':
1836 case 'i':
1837 power_mode = StartStop_Power_Idle;
1838 break;
1839 case '2':
1840 case 's':
1841 power_mode = StartStop_Power_Standby;
1842 break;
1843 case '3':
1844 case 'p':
1845 power_mode = StartStop_Power_Sleep;
1846 break;
1847 default:
1848 j--;
1849 }
1850 j++;
1851 if(power_mode && !cmd) {
1853 }
1854 break;
1855 case 'D' :
1856 power_mode = StartStop_Power_Sleep;
1857 if(cmd && (cmd != CMD_ATA_HIDE)) {
1858 print_help();
1859 }
1860 case 'd' :
1861 if(cmd && (cmd != CMD_ATA_FIND) && (cmd != CMD_ATA_HIDE) && (cmd != CMD_ATA_POWER)) {
1862 print_help();
1863 }
1864 if(!cmd) {
1865 cmd = CMD_ATA_HIDE;
1866 }
1867 i++;
1868 if(!argv[i]) {
1869 print_help();
1870 }
1871 if(!sscanf(argv[i], "%d", &lock)) {
1873 i--;
1874 }
1875 j = strlen(argv[i])-1;
1876 break;
1877 case 'n' :
1878 if(cmd != CMD_ATA_BBLK) {
1879 print_help();
1880 }
1881 i++;
1882 if(!argv[i]) {
1883 print_help();
1884 }
1885 if(!strcmp(argv[i], "hex") ||
1886 !strcmp(argv[i], "16")) {
1887 gRadix = 16;
1888 } else
1889 if(!strcmp(argv[i], "dec") ||
1890 !strcmp(argv[i], "10")) {
1891 gRadix = 10;
1892 } else {
1893 print_help();
1894 }
1895 j = strlen(argv[i])-1;
1896 break;
1897 case '?' :
1898 default:
1899 print_help();
1900 }
1901 j++;
1902 }
1903 }
1904
1905 if(g_adapter_info && !cmd) {
1906 cmd = CMD_ATA_LIST;
1907 b_dev = 127;
1908 d_dev = 127;
1909 l_dev = 127;
1910 } else
1911 if((d_dev == -1) && (b_dev != -1)) {
1912 d_dev = 127;
1913 l_dev = 127;
1914 }
1915
1916 if((d_dev != -1) && (b_dev != -1)) {
1917 dev_id = (b_dev << 16) | (d_dev << 8) | l_dev;
1918 }
1919 if(cmd == CMD_ATA_LIST) {
1920 ata_list(bus_id, dev_id);
1921 } else
1922 if(cmd == CMD_ATA_MODE) {
1923 ata_mode(bus_id, dev_id, mode);
1924 } else
1925 if(cmd == CMD_ATA_RESET) {
1926 ata_reset(bus_id, dev_id);
1927 } else
1928 if(cmd == CMD_ATA_FIND) {
1929 ata_scan(bus_id, dev_id, lock, persistent_hide);
1930 } else
1931 if(cmd == CMD_ATA_HIDE) {
1932 ata_hide(bus_id, dev_id, lock, persistent_hide, power_mode);
1933 } else
1934 if(cmd == CMD_ATA_BBLK) {
1935 ata_bblk(bus_id, dev_id, list_bb);
1936 } else
1937 if(cmd == CMD_ATA_POWER) {
1938 ata_power_mode(bus_id, dev_id, power_mode);
1939 } else {
1940 print_help();
1941 }
1942 exit(0);
1943}
static int argc
Definition: ServiceArgs.c:12
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOLEAN ata_scan(int bus_id, int dev_id, int lock, int unhide)
Definition: atactl.cpp:1249
int g_adapter_info
Definition: atactl.cpp:40
#define DEFAULT_REMOVAL_LOCK_TIMEOUT
Definition: atactl.cpp:18
int g_extended
Definition: atactl.cpp:39
BOOLEAN ata_list(int bus_id, int dev_id)
Definition: atactl.cpp:1064
BOOLEAN ata_power_mode(int bus_id, int dev_id, int power_mode)
Definition: atactl.cpp:1629
BOOLEAN ata_hide(int bus_id, int dev_id, int lock, int persistent_hide, int power_mode)
Definition: atactl.cpp:1191
#define CMD_ATA_RESET
Definition: atactl.cpp:134
BOOLEAN ata_bblk(int bus_id, int dev_id, int list_bb)
Definition: atactl.cpp:1348
BOOLEAN ata_reset(int bus_id, int dev_id)
Definition: atactl.cpp:1144
#define CMD_ATA_BBLK
Definition: atactl.cpp:135
void print_help()
Definition: atactl.cpp:52
int gRadix
Definition: atactl.cpp:42
#define CMD_ATA_POWER
Definition: atactl.cpp:136
#define CMD_ATA_MODE
Definition: atactl.cpp:133
#define CMD_ATA_HIDE
Definition: atactl.cpp:132
#define CMD_ATA_LIST
Definition: atactl.cpp:130
BOOLEAN ata_mode(int bus_id, int dev_id, int mode)
Definition: atactl.cpp:1097
int ata_num_to_x_dev(char a)
Definition: atactl.cpp:1675
#define CMD_ATA_FIND
Definition: atactl.cpp:131
char * g_bb_list
Definition: atactl.cpp:41
int ata_str_to_mode(char *str)
Definition: atactl.cpp:443
int intptr_t
Definition: crtdefs.h:304
unsigned int uintptr_t
Definition: crtdefs.h:321
#define StartStop_Power_NoChg
Definition: scsi.h:406
#define StartStop_Power_Sleep
Definition: scsi.h:409
#define StartStop_Power_Idle
Definition: scsi.h:407
#define StartStop_Power_Standby
Definition: scsi.h:408
#define printf
Definition: freeldr.h:93
GLenum mode
Definition: glext.h:6217
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
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
Definition: glfuncs.h:250
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define a
Definition: ke_i.h:78
#define argv
Definition: mplay32.c:18
Definition: ftp_var.h:139
rwlock_t lock
Definition: tcpcore.h:0
#define UNIATA_VER_STR
Definition: uniata_ver.h:1

◆ mcs_connect_finalize()

RD_BOOL mcs_connect_finalize ( STREAM  s)

Definition at line 318 of file mcs.c.

319{
320 unsigned int i;
321
322 mcs_send_connect_initial(mcs_data);
323 if (!mcs_recv_connect_response(mcs_data))
324 goto error;
325
327
330 goto error;
331
333
334 if (!mcs_recv_cjcf())
335 goto error;
336
338 if (!mcs_recv_cjcf())
339 goto error;
340
341 for (i = 0; i < g_num_channels; i++)
342 {
343 mcs_send_cjrq(g_channels[i].mcs_id);
344 if (!mcs_recv_cjcf())
345 goto error;
346 }
347 return True;
348
349 error:
351 return False;
352}
#define MCS_USERCHANNEL_BASE
Definition: constants.h:88
void iso_disconnect(void)
Definition: iso.c:362
static void mcs_send_cjrq(uint16 chanid)
Definition: mcs.c:192
static void mcs_send_edrq(void)
Definition: mcs.c:131
static RD_BOOL mcs_recv_aucf(uint16 *mcs_userid)
Definition: mcs.c:161
static void mcs_send_aurq(void)
Definition: mcs.c:147
static RD_BOOL mcs_recv_connect_response(STREAM mcs_data)
Definition: mcs.c:87
static RD_BOOL mcs_recv_cjcf(void)
Definition: mcs.c:210
unsigned int g_num_channels
Definition: channels.c:33
static void mcs_send_connect_initial(STREAM mcs_data)
Definition: mcs.c:57
uint16 g_mcs_userid
Definition: mcs.c:23
VCHANNEL g_channels[]
Definition: channels.c:32

Referenced by sec_connect().

◆ mcs_connect_start()

RD_BOOL mcs_connect_start ( char server,
char username,
char domain,
char password,
RD_BOOL  reconnect,
uint32 selected_protocol 
)

Definition at line 311 of file mcs.c.

313{
314 return iso_connect(server, username, domain, password, reconnect, selected_protocol);
315}
RD_BOOL iso_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: iso.c:203

Referenced by sec_connect().

◆ mcs_disconnect()

void mcs_disconnect ( void  )

Definition at line 356 of file mcs.c.

357{
359}

Referenced by sec_disconnect().

◆ mcs_init()

STREAM mcs_init ( int  length)

Definition at line 242 of file mcs.c.

243{
244 STREAM s;
245
246 s = iso_init(length + 8);
247 s_push_layer(s, mcs_hdr, 8);
248
249 return s;
250}
STREAM iso_init(int length)
Definition: iso.c:150

Referenced by sec_init().

◆ mcs_recv()

STREAM mcs_recv ( uint16 channel,
uint8 rdpver 
)

Definition at line 280 of file mcs.c.

281{
282 uint8 opcode, appid, length;
283 STREAM s;
284
285 s = iso_recv(rdpver);
286 if (s == NULL)
287 return NULL;
288 if (rdpver != NULL)
289 if (*rdpver != 3)
290 return s;
291 in_uint8(s, opcode);
292 appid = opcode >> 2;
293 if (appid != MCS_SDIN)
294 {
295 if (appid != MCS_DPUM)
296 {
297 error("expected data, got %d\n", opcode);
298 }
299 return NULL;
300 }
301 in_uint8s(s, 2); /* userid */
302 in_uint16_be(s, *channel);
303 in_uint8s(s, 1); /* flags */
304 in_uint8(s, length);
305 if (length & 0x80)
306 in_uint8s(s, 1); /* second byte of length */
307 return s;
308}
@ MCS_SDIN
Definition: constants.h:71
@ MCS_DPUM
Definition: constants.h:65
STREAM iso_recv(uint8 *rdpver)
Definition: iso.c:182
char * appid
Definition: mkisofs.c:161

Referenced by sec_recv().

◆ mcs_reset_state()

void mcs_reset_state ( void  )

Definition at line 363 of file mcs.c.

364{
365 g_mcs_userid = 0;
367}
void iso_reset_state(void)
Definition: iso.c:370

Referenced by sec_reset_state().

◆ mcs_send()

void mcs_send ( STREAM  s)

Definition at line 273 of file mcs.c.

274{
276}
void mcs_send_to_channel(STREAM s, uint16 channel)
Definition: mcs.c:254

◆ mcs_send_to_channel()

void mcs_send_to_channel ( STREAM  s,
uint16  channel 
)

Definition at line 254 of file mcs.c.

255{
257
258 s_pop_layer(s, mcs_hdr);
259 length = s->end - s->p - 8;
260 length |= 0x8000;
261
262 out_uint8(s, (MCS_SDRQ << 2));
264 out_uint16_be(s, channel);
265 out_uint8(s, 0x70); /* flags */
267
268 iso_send(s);
269}
@ MCS_SDRQ
Definition: constants.h:70
void iso_send(STREAM s)
Definition: iso.c:162

Referenced by mcs_send(), and sec_send_to_channel().

◆ mppc_expand()

int mppc_expand ( uint8 data,
uint32  clen,
uint8  ctype,
uint32 roff,
uint32 rlen 
)

Definition at line 58 of file mppc.c.

59{
60 int k, walker_len = 0, walker;
61 uint32 i = 0;
62 int next_offset, match_off;
63 int match_len;
64 int old_offset, match_bits;
66
67 uint8 *dict = g_mppc_dict.hist;
68
69 if ((ctype & RDP_MPPC_COMPRESSED) == 0)
70 {
71 *roff = 0;
72 *rlen = clen;
73 return 0;
74 }
75
76 if ((ctype & RDP_MPPC_RESET) != 0)
77 {
78 g_mppc_dict.roff = 0;
79 }
80
81 if ((ctype & RDP_MPPC_FLUSH) != 0)
82 {
83 memset(dict, 0, RDP_MPPC_DICT_SIZE);
84 g_mppc_dict.roff = 0;
85 }
86
87 *roff = 0;
88 *rlen = 0;
89
90 walker = g_mppc_dict.roff;
91
92 next_offset = walker;
93 old_offset = next_offset;
94 *roff = old_offset;
95 if (clen == 0)
96 return 0;
97 clen += i;
98
99 do
100 {
101 if (walker_len == 0)
102 {
103 if (i >= clen)
104 break;
105 walker = data[i++] << 24;
106 walker_len = 8;
107 }
108 if (walker >= 0)
109 {
110 if (walker_len < 8)
111 {
112 if (i >= clen)
113 {
114 if (walker != 0)
115 return -1;
116 break;
117 }
118 walker |= (data[i++] & 0xff) << (24 - walker_len);
119 walker_len += 8;
120 }
121 if (next_offset >= RDP_MPPC_DICT_SIZE)
122 return -1;
123 dict[next_offset++] = (((uint32) walker) >> ((uint32) 24));
124 walker <<= 8;
125 walker_len -= 8;
126 continue;
127 }
128 walker <<= 1;
129 /* fetch next 8-bits */
130 if (--walker_len == 0)
131 {
132 if (i >= clen)
133 return -1;
134 walker = data[i++] << 24;
135 walker_len = 8;
136 }
137 /* literal decoding */
138 if (walker >= 0)
139 {
140 if (walker_len < 8)
141 {
142 if (i >= clen)
143 return -1;
144 walker |= (data[i++] & 0xff) << (24 - walker_len);
145 walker_len += 8;
146 }
147 if (next_offset >= RDP_MPPC_DICT_SIZE)
148 return -1;
149 dict[next_offset++] = (uint8) (walker >> 24 | 0x80);
150 walker <<= 8;
151 walker_len -= 8;
152 continue;
153 }
154
155 /* decode offset */
156 /* length pair */
157 walker <<= 1;
158 if (--walker_len < (big ? 3 : 2))
159 {
160 if (i >= clen)
161 return -1;
162 walker |= (data[i++] & 0xff) << (24 - walker_len);
163 walker_len += 8;
164 }
165
166 if (big)
167 {
168 /* offset decoding where offset len is:
169 -63: 11111 followed by the lower 6 bits of the value
170 64-319: 11110 followed by the lower 8 bits of the value ( value - 64 )
171 320-2367: 1110 followed by lower 11 bits of the value ( value - 320 )
172 2368-65535: 110 followed by lower 16 bits of the value ( value - 2368 )
173 */
174 switch (((uint32) walker) >> ((uint32) 29))
175 {
176 case 7: /* - 63 */
177 for (; walker_len < 9; walker_len += 8)
178 {
179 if (i >= clen)
180 return -1;
181 walker |= (data[i++] & 0xff) << (24 - walker_len);
182 }
183 walker <<= 3;
184 match_off = ((uint32) walker) >> ((uint32) 26);
185 walker <<= 6;
186 walker_len -= 9;
187 break;
188
189 case 6: /* 64 - 319 */
190 for (; walker_len < 11; walker_len += 8)
191 {
192 if (i >= clen)
193 return -1;
194 walker |= (data[i++] & 0xff) << (24 - walker_len);
195 }
196
197 walker <<= 3;
198 match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
199 walker <<= 8;
200 walker_len -= 11;
201 break;
202
203 case 5:
204 case 4: /* 320 - 2367 */
205 for (; walker_len < 13; walker_len += 8)
206 {
207 if (i >= clen)
208 return -1;
209 walker |= (data[i++] & 0xff) << (24 - walker_len);
210 }
211
212 walker <<= 2;
213 match_off = (((uint32) walker) >> ((uint32) 21)) + 320;
214 walker <<= 11;
215 walker_len -= 13;
216 break;
217
218 default: /* 2368 - 65535 */
219 for (; walker_len < 17; walker_len += 8)
220 {
221 if (i >= clen)
222 return -1;
223 walker |= (data[i++] & 0xff) << (24 - walker_len);
224 }
225
226 walker <<= 1;
227 match_off = (((uint32) walker) >> ((uint32) 16)) + 2368;
228 walker <<= 16;
229 walker_len -= 17;
230 break;
231 }
232 }
233 else
234 {
235 /* offset decoding where offset len is:
236 -63: 1111 followed by the lower 6 bits of the value
237 64-319: 1110 followed by the lower 8 bits of the value ( value - 64 )
238 320-8191: 110 followed by the lower 13 bits of the value ( value - 320 )
239 */
240 switch (((uint32) walker) >> ((uint32) 30))
241 {
242 case 3: /* - 63 */
243 if (walker_len < 8)
244 {
245 if (i >= clen)
246 return -1;
247 walker |= (data[i++] & 0xff) << (24 - walker_len);
248 walker_len += 8;
249 }
250 walker <<= 2;
251 match_off = ((uint32) walker) >> ((uint32) 26);
252 walker <<= 6;
253 walker_len -= 8;
254 break;
255
256 case 2: /* 64 - 319 */
257 for (; walker_len < 10; walker_len += 8)
258 {
259 if (i >= clen)
260 return -1;
261 walker |= (data[i++] & 0xff) << (24 - walker_len);
262 }
263
264 walker <<= 2;
265 match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
266 walker <<= 8;
267 walker_len -= 10;
268 break;
269
270 default: /* 320 - 8191 */
271 for (; walker_len < 14; walker_len += 8)
272 {
273 if (i >= clen)
274 return -1;
275 walker |= (data[i++] & 0xff) << (24 - walker_len);
276 }
277
278 match_off = (walker >> 18) + 320;
279 walker <<= 14;
280 walker_len -= 14;
281 break;
282 }
283 }
284 if (walker_len == 0)
285 {
286 if (i >= clen)
287 return -1;
288 walker = data[i++] << 24;
289 walker_len = 8;
290 }
291
292 /* decode length of match */
293 match_len = 0;
294 if (walker >= 0)
295 { /* special case - length of 3 is in bit 0 */
296 match_len = 3;
297 walker <<= 1;
298 walker_len--;
299 }
300 else
301 {
302 /* this is how it works len of:
303 4-7: 10 followed by 2 bits of the value
304 8-15: 110 followed by 3 bits of the value
305 16-31: 1110 followed by 4 bits of the value
306 32-63: .... and so forth
307 64-127:
308 128-255:
309 256-511:
310 512-1023:
311 1024-2047:
312 2048-4095:
313 4096-8191:
314
315 i.e. 4097 is encoded as: 111111111110 000000000001
316 meaning 4096 + 1...
317 */
318 match_bits = big ? 14 : 11; /* 11 or 14 bits of value at most */
319 do
320 {
321 walker <<= 1;
322 if (--walker_len == 0)
323 {
324 if (i >= clen)
325 return -1;
326 walker = data[i++] << 24;
327 walker_len = 8;
328 }
329 if (walker >= 0)
330 break;
331 if (--match_bits == 0)
332 {
333 return -1;
334 }
335 }
336 while (1);
337 match_len = (big ? 16 : 13) - match_bits;
338 walker <<= 1;
339 if (--walker_len < match_len)
340 {
341 for (; walker_len < match_len; walker_len += 8)
342 {
343 if (i >= clen)
344 {
345 return -1;
346 }
347 walker |= (data[i++] & 0xff) << (24 - walker_len);
348 }
349 }
350
351 match_bits = match_len;
352 match_len =
353 ((walker >> (32 - match_bits)) & (~(-1 << match_bits))) | (1 <<
354 match_bits);
355 walker <<= match_bits;
356 walker_len -= match_bits;
357 }
358 if (next_offset + match_len >= RDP_MPPC_DICT_SIZE)
359 {
360 return -1;
361 }
362 /* memory areas can overlap - meaning we can't use memXXX functions */
363 k = (next_offset - match_off) & (big ? 65535 : 8191);
364 do
365 {
366 dict[next_offset++] = dict[k++];
367 }
368 while (--match_len != 0);
369 }
370 while (1);
371
372 /* store history offset */
373 g_mppc_dict.roff = next_offset;
374
375 *roff = old_offset;
376 *rlen = next_offset - old_offset;
377
378 return 0;
379}
#define RDP_MPPC_RESET
Definition: constants.h:356
#define RDP_MPPC_DICT_SIZE
Definition: constants.h:358
#define RDP_MPPC_COMPRESSED
Definition: constants.h:355
#define RDP_MPPC_BIG
Definition: constants.h:354
#define RDP_MPPC_FLUSH
Definition: constants.h:357
RDPCOMP g_mppc_dict
Definition: mppc.c:55
Definition: _ctype.h:58
int k
Definition: mpi.c:3369
#define memset(x, y, z)
Definition: compat.h:39
uint32 roff
Definition: types.h:190
uint8 hist[RDP_MPPC_DICT_SIZE]
Definition: types.h:191

Referenced by process_data_pdu(), and rdp5_process().

◆ next_arg()

char * next_arg ( char src,
char  needle 
)

Definition at line 1174 of file rdesktop.c.

1175{
1176 char *nextval;
1177 char *p;
1178 char *mvp = 0;
1179
1180 /* EOS */
1181 if (*src == (char) 0x00)
1182 return 0;
1183
1184 p = src;
1185 /* skip escaped needles */
1186 while ((nextval = strchr(p, needle)))
1187 {
1188 mvp = nextval - 1;
1189 /* found backslashed needle */
1190 if (*mvp == '\\' && (mvp > src))
1191 {
1192 /* move string one to the left */
1193 while (*(mvp + 1) != (char) 0x00)
1194 {
1195 *mvp = *(mvp + 1);
1196 mvp++;
1197 }
1198 *mvp = (char) 0x00;
1199 p = nextval;
1200 }
1201 else
1202 {
1203 p = nextval + 1;
1204 break;
1205 }
1206
1207 }
1208
1209 /* more args available */
1210 if (nextval)
1211 {
1212 *nextval = (char) 0x00;
1213 return ++nextval;
1214 }
1215
1216 /* no more args after this, jump to EOS */
1217 nextval = src + strlen(src);
1218 return nextval;
1219}
unsigned char
Definition: typeof.h:29
GLenum src
Definition: glext.h:6340

Referenced by disk_enum_devices(), parallel_enum_devices(), printer_enum_devices(), serial_enum_devices(), service_mainA(), and service_mainW().

◆ parallel_enum_devices()

int parallel_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ printer_enum_devices()

int printer_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ printercache_load_blob()

int printercache_load_blob ( char printer_name,
uint8 **  data 
)

Definition at line 154 of file printercache.c.

155{
156 char *home, *path;
157 struct stat st;
158 int fd, length;
159
160 if (printer_name == NULL)
161 return 0;
162
163 *data = NULL;
164
165 home = getenv("HOME");
166 if (home == NULL)
167 return 0;
168
169 path = (char *) xmalloc(strlen(home) + sizeof("/.rdesktop/rdpdr/") + strlen(printer_name) +
170 sizeof("/AutoPrinterCacheData") + 1);
171 sprintf(path, "%s/.rdesktop/rdpdr/%s/AutoPrinterCacheData", home, printer_name);
172
173 fd = open(path, O_RDONLY);
174 if (fd == -1)
175 {
176 xfree(path);
177 return 0;
178 }
179
180 if (fstat(fd, &st))
181 {
182 xfree(path);
183 close(fd);
184 return 0;
185 }
186
187 *data = (uint8 *) xmalloc(st.st_size);
188 length = read(fd, *data, st.st_size);
189 close(fd);
190 xfree(path);
191 return length;
192}
#define read
Definition: acwin.h:96
#define O_RDONLY
Definition: acwin.h:108
#define open
Definition: acwin.h:95
#define close
Definition: acwin.h:98
#define fstat
Definition: acwin.h:100
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static int fd
Definition: io.c:51
Definition: tftpd.h:38
Definition: stat.h:55

Referenced by announcedata_size().

◆ printercache_process()

void printercache_process ( STREAM  s)

Referenced by rdpdr_process().

◆ process_bitmap_updates()

void process_bitmap_updates ( STREAM  s)

Definition at line 1224 of file rdp.c.

1225{
1226 uint16 num_updates;
1228 uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
1229 uint8 *data, *bmpdata;
1230 int i;
1231
1232 in_uint16_le(s, num_updates);
1233
1234 for (i = 0; i < num_updates; i++)
1235 {
1237 in_uint16_le(s, top);
1242 in_uint16_le(s, bpp);
1243 Bpp = (bpp + 7) / 8;
1246
1247 cx = right - left + 1;
1248 cy = bottom - top + 1;
1249
1250 DEBUG(("BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1251 left, top, right, bottom, width, height, Bpp, compress));
1252
1253 if (!compress)
1254 {
1255 int y;
1256 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1257 for (y = 0; y < height; y++)
1258 {
1259 in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)],
1260 width * Bpp);
1261 }
1262 ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
1263 xfree(bmpdata);
1264 continue;
1265 }
1266
1267
1268 if (compress & 0x400)
1269 {
1270 size = bufsize;
1271 }
1272 else
1273 {
1274 in_uint8s(s, 2); /* pad */
1276 in_uint8s(s, 4); /* line_size, final_size */
1277 }
1278 in_uint8p(s, data, size);
1279 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1280 if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
1281 {
1282 ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata);
1283 }
1284 else
1285 {
1286 DEBUG_RDP5(("Failed to decompress data\n"));
1287 }
1288
1289 xfree(bmpdata);
1290 }
1291}
RD_BOOL bitmap_decompress(uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
Definition: bitmap.c:884
#define in_uint16_le(s, v)
Definition: parse.h:55
#define in_uint8p(s, v, n)
Definition: parse.h:89
#define in_uint8a(s, v, n)
Definition: parse.h:90
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
Definition: uimain.c:307
DWORD bpp
Definition: surface.c:185
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: compress.c:68

Referenced by process_update_pdu(), and rdp5_process().

◆ process_cached_pointer_pdu()

void process_cached_pointer_pdu ( STREAM  s)

Definition at line 1156 of file rdp.c.

1157{
1158 uint16 cache_idx;
1159
1160 in_uint16_le(s, cache_idx);
1161 ui_set_cursor(cache_get_cursor(cache_idx));
1162}
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
Definition: cache.c:400
void ui_set_cursor(RD_HCURSOR cursor)

Referenced by process_pointer_pdu(), and rdp5_process().

◆ process_colour_pointer_pdu()

void process_colour_pointer_pdu ( STREAM  s)

Definition at line 1139 of file rdp.c.

1140{
1142}
static void process_colour_pointer_common(STREAM s, int bpp)
Definition: rdp.c:1107

Referenced by process_pointer_pdu(), and rdp5_process().

◆ process_disconnect_pdu()

void process_disconnect_pdu ( STREAM  s,
uint32 ext_disc_reason 
)

Definition at line 1407 of file rdp.c.

1408{
1410
1411 DEBUG(("Received disconnect PDU\n"));
1412}
uint32 ext_disc_reason
Definition: svgawin.c:64

◆ process_new_pointer_pdu()

void process_new_pointer_pdu ( STREAM  s)

Definition at line 1146 of file rdp.c.

1147{
1148 int xor_bpp;
1149
1150 in_uint16_le(s, xor_bpp);
1152}

Referenced by process_pointer_pdu(), and rdp5_process().

◆ process_orders()

void process_orders ( STREAM  s,
uint16  num_orders 
)

Definition at line 1311 of file orders.c.

1312{
1314 uint32 present;
1315 uint8 order_flags;
1316 int size, processed = 0;
1317 RD_BOOL delta;
1318
1319 while (processed < num_orders)
1320 {
1321 in_uint8(s, order_flags);
1322
1323 if (!(order_flags & RDP_ORDER_STANDARD))
1324 {
1325 error("order parsing failed\n");
1326 break;
1327 }
1328
1329 if (order_flags & RDP_ORDER_SECONDARY)
1330 {
1332 }
1333 else
1334 {
1335 if (order_flags & RDP_ORDER_CHANGE)
1336 {
1337 in_uint8(s, os->order_type);
1338 }
1339
1340 switch (os->order_type)
1341 {
1342 case RDP_ORDER_TRIBLT:
1343 case RDP_ORDER_TEXT2:
1344 size = 3;
1345 break;
1346
1347 case RDP_ORDER_PATBLT:
1348 case RDP_ORDER_MEMBLT:
1349 case RDP_ORDER_LINE:
1350 case RDP_ORDER_POLYGON2:
1351 case RDP_ORDER_ELLIPSE2:
1352 size = 2;
1353 break;
1354
1355 default:
1356 size = 1;
1357 }
1358
1359 rdp_in_present(s, &present, order_flags, size);
1360
1361 if (order_flags & RDP_ORDER_BOUNDS)
1362 {
1363 if (!(order_flags & RDP_ORDER_LASTBOUNDS))
1364 rdp_parse_bounds(s, &os->bounds);
1365
1367 os->bounds.top,
1368 os->bounds.right -
1369 os->bounds.left + 1,
1370 os->bounds.bottom - os->bounds.top + 1);
1371 }
1372
1373 delta = order_flags & RDP_ORDER_DELTA;
1374
1375 switch (os->order_type)
1376 {
1377 case RDP_ORDER_DESTBLT:
1378 process_destblt(s, &os->destblt, present, delta);
1379 break;
1380
1381 case RDP_ORDER_PATBLT:
1382 process_patblt(s, &os->patblt, present, delta);
1383 break;
1384
1386 process_screenblt(s, &os->screenblt, present, delta);
1387 break;
1388
1389 case RDP_ORDER_LINE:
1390 process_line(s, &os->line, present, delta);
1391 break;
1392
1393 case RDP_ORDER_RECT:
1394 process_rect(s, &os->rect, present, delta);
1395 break;
1396
1397 case RDP_ORDER_DESKSAVE:
1398 process_desksave(s, &os->desksave, present, delta);
1399 break;
1400
1401 case RDP_ORDER_MEMBLT:
1402 process_memblt(s, &os->memblt, present, delta);
1403 break;
1404
1405 case RDP_ORDER_TRIBLT:
1406 process_triblt(s, &os->triblt, present, delta);
1407 break;
1408
1409 case RDP_ORDER_POLYGON:
1410 process_polygon(s, &os->polygon, present, delta);
1411 break;
1412
1413 case RDP_ORDER_POLYGON2:
1414 process_polygon2(s, &os->polygon2, present, delta);
1415 break;
1416
1417 case RDP_ORDER_POLYLINE:
1418 process_polyline(s, &os->polyline, present, delta);
1419 break;
1420
1421 case RDP_ORDER_ELLIPSE:
1422 process_ellipse(s, &os->ellipse, present, delta);
1423 break;
1424
1425 case RDP_ORDER_ELLIPSE2:
1426 process_ellipse2(s, &os->ellipse2, present, delta);
1427 break;
1428
1429 case RDP_ORDER_TEXT2:
1430 process_text2(s, &os->text2, present, delta);
1431 break;
1432
1433 default:
1434 unimpl("order %d\n", os->order_type);
1435 return;
1436 }
1437
1438 if (order_flags & RDP_ORDER_BOUNDS)
1439 ui_reset_clip();
1440 }
1441
1442 processed++;
1443 }
1444#if 0
1445 /* not true when RDP_COMPRESSION is set */
1446 if (s->p != g_next_packet)
1447 error("%d bytes remaining\n", (int) (g_next_packet - s->p));
1448#endif
1449
1450}
static void process_rect(STREAM s, RECT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:334
static void process_polygon2(STREAM s, POLYGON2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:597
static void process_desksave(STREAM s, DESKSAVE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:374
static void process_triblt(STREAM s, TRIBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:456
static void process_ellipse2(STREAM s, ELLIPSE2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:795
static void process_destblt(STREAM s, DESTBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:201
static void process_polygon(STREAM s, POLYGON_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:518
uint8 * g_next_packet
Definition: rdp.c:45
static void process_ellipse(STREAM s, ELLIPSE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:763
static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
Definition: orders.c:29
static RDP_ORDER_STATE g_order_state
Definition: orders.c:24
static void process_screenblt(STREAM s, SCREENBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:264
static void process_memblt(STREAM s, MEMBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:410
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:837
static void process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:685
static RD_BOOL rdp_parse_bounds(STREAM s, BOUNDS *bounds)
Definition: orders.c:105
static void process_secondary_order(STREAM s)
Definition: orders.c:1256
static void process_patblt(STREAM s, PATBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:226
static void process_line(STREAM s, LINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:295
#define RDP_ORDER_BOUNDS
Definition: orders.h:22
@ RDP_ORDER_POLYLINE
Definition: orders.h:41
@ RDP_ORDER_RECT
Definition: orders.h:35
@ RDP_ORDER_ELLIPSE
Definition: orders.h:42
@ RDP_ORDER_LINE
Definition: orders.h:34
@ RDP_ORDER_TRIBLT
Definition: orders.h:38
@ RDP_ORDER_DESTBLT
Definition: orders.h:31
@ RDP_ORDER_ELLIPSE2
Definition: orders.h:43
@ RDP_ORDER_TEXT2
Definition: orders.h:44
@ RDP_ORDER_PATBLT
Definition: orders.h:32
@ RDP_ORDER_MEMBLT
Definition: orders.h:37
@ RDP_ORDER_DESKSAVE
Definition: orders.h:36
@ RDP_ORDER_SCREENBLT
Definition: orders.h:33
@ RDP_ORDER_POLYGON2
Definition: orders.h:40
@ RDP_ORDER_POLYGON
Definition: orders.h:39
#define RDP_ORDER_CHANGE
Definition: orders.h:23
#define RDP_ORDER_SECONDARY
Definition: orders.h:21
#define RDP_ORDER_STANDARD
Definition: orders.h:20
#define RDP_ORDER_LASTBOUNDS
Definition: orders.h:25
#define RDP_ORDER_DELTA
Definition: orders.h:24
void ui_set_clip(int x, int y, int cx, int cy)
Definition: uimain.c:320
void ui_reset_clip(void)
Definition: uimain.c:328
sint16 left
Definition: types.h:74
sint16 top
Definition: types.h:75
sint16 right
Definition: types.h:76
sint16 bottom
Definition: types.h:77
ELLIPSE2_ORDER ellipse2
Definition: orders.h:286
DESKSAVE_ORDER desksave
Definition: orders.h:279
BOUNDS bounds
Definition: orders.h:272
POLYGON_ORDER polygon
Definition: orders.h:282
DESTBLT_ORDER destblt
Definition: orders.h:274
RECT_ORDER rect
Definition: orders.h:278
MEMBLT_ORDER memblt
Definition: orders.h:280
LINE_ORDER line
Definition: orders.h:277
TRIBLT_ORDER triblt
Definition: orders.h:281
POLYGON2_ORDER polygon2
Definition: orders.h:283
PATBLT_ORDER patblt
Definition: orders.h:275
POLYLINE_ORDER polyline
Definition: orders.h:284
SCREENBLT_ORDER screenblt
Definition: orders.h:276
ELLIPSE_ORDER ellipse
Definition: orders.h:285
TEXT2_ORDER text2
Definition: orders.h:287
uint8 order_type
Definition: orders.h:271
static int processed(const type_t *type)
Definition: typegen.c:2254

Referenced by process_update_pdu(), and rdp5_process().

◆ process_palette()

void process_palette ( STREAM  s)

Definition at line 1295 of file rdp.c.

1296{
1298 COLOURMAP map;
1299 RD_HCOLOURMAP hmap;
1300 int i;
1301
1302 in_uint8s(s, 2); /* pad */
1303 in_uint16_le(s, map.ncolours);
1304 in_uint8s(s, 2); /* pad */
1305
1306 map.colours = (COLOURENTRY *) xmalloc(sizeof(COLOURENTRY) * map.ncolours);
1307
1308 DEBUG(("PALETTE(c=%d)\n", map.ncolours));
1309
1310 for (i = 0; i < map.ncolours; i++)
1311 {
1312 entry = &map.colours[i];
1313 in_uint8(s, entry->red);
1314 in_uint8(s, entry->green);
1315 in_uint8(s, entry->blue);
1316 }
1317
1318 hmap = ui_create_colourmap(&map);
1319 ui_set_colourmap(hmap);
1320
1321 xfree(map.colours);
1322}
void ui_set_colourmap(RD_HCOLOURMAP map)
Definition: qtewin.cpp:1527
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
Definition: uimain.c:336
Definition: _map.h:48
uint32_t entry
Definition: isohybrid.c:63

Referenced by process_update_pdu(), and rdp5_process().

◆ process_system_pointer_pdu()

void process_system_pointer_pdu ( STREAM  s)

Definition at line 1166 of file rdp.c.

1167{
1168 uint16 system_pointer_type;
1169
1170 in_uint16_le(s, system_pointer_type);
1171 switch (system_pointer_type)
1172 {
1173 case RDP_NULL_POINTER:
1175 break;
1176
1177 default:
1178 unimpl("System pointer message 0x%x\n", system_pointer_type);
1179 }
1180}
@ RDP_NULL_POINTER
Definition: constants.h:225
void ui_set_null_cursor(void)
Definition: uimain.c:227

Referenced by process_pointer_pdu().

◆ pstcache_enumerate()

int pstcache_enumerate ( uint8  id,
HASH_KEY keylist 
)

Definition at line 107 of file pstcache.c.

108{
109 int fd, n;
110 uint16 idx;
111 sint16 mru_idx[0xa00];
112 uint32 mru_stamp[0xa00];
113 CELLHEADER cellhdr;
114
116 return 0;
117
118 /* The server disconnects if the bitmap cache content is sent more than once */
120 return 0;
121
122 DEBUG_RDP5(("Persistent bitmap cache enumeration... "));
123 for (idx = 0; idx < BMPCACHE2_NUM_PSTCELLS; idx++)
124 {
127 if (rd_read_file(fd, &cellhdr, sizeof(CELLHEADER)) <= 0)
128 break;
129
130 if (memcmp(cellhdr.key, zero_key, sizeof(HASH_KEY)) != 0)
131 {
132 memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY));
133
134 /* Pre-cache (not possible for 8 bit colour depth cause it needs a colourmap) */
135 if (g_bitmap_cache_precache && cellhdr.stamp && g_server_depth > 8)
137
138 /* Sort by stamp */
139 for (n = idx; n > 0 && cellhdr.stamp < mru_stamp[n - 1]; n--)
140 {
141 mru_idx[n] = mru_idx[n - 1];
142 mru_stamp[n] = mru_stamp[n - 1];
143 }
144
145 mru_idx[n] = idx;
146 mru_stamp[n] = cellhdr.stamp;
147 }
148 else
149 {
150 break;
151 }
152 }
153
154 DEBUG_RDP5(("%d cached bitmaps.\n", idx));
155
158 return idx;
159}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
void cache_rebuild_bmpcache_linked_list(uint8 id, sint16 *idx, int count)
Definition: cache.c:58
#define BMPCACHE2_NUM_PSTCELLS
Definition: constants.h:285
int rd_read_file(int fd, void *ptr, int len)
Definition: uimain.c:854
int rd_lseek_file(int fd, int offset)
Definition: uimain.c:868
int g_server_depth
Definition: uimain.c:41
RD_BOOL g_bitmap_cache_precache
Definition: uimain.c:38
int g_pstcache_Bpp
Definition: pstcache.c:32
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
uint8 zero_key[]
Definition: pstcache.c:34
RD_BOOL g_pstcache_enumerated
Definition: pstcache.c:33
int g_pstcache_fd[8]
Definition: pstcache.c:31
RD_BOOL g_bitmap_cache_persist_enable
Definition: uimain.c:37
#define IS_PERSISTENT(id)
Definition: pstcache.c:24
RD_BOOL g_bitmap_cache
Definition: uimain.c:39
#define MAX_CELL_SIZE
Definition: pstcache.c:22
uint8 HASH_KEY[8]
Definition: types.h:161
HASH_KEY key
Definition: types.h:166
Definition: path.c:35

Referenced by rdp_enum_bmpcache2().

◆ pstcache_init()

RD_BOOL pstcache_init ( uint8  cache_id)

Definition at line 163 of file pstcache.c.

164{
165 int fd;
166 char filename[256];
167
169 return True;
170
171 g_pstcache_fd[cache_id] = 0;
172
174 return False;
175
176 if (!rd_pstcache_mkdir())
177 {
178 DEBUG(("failed to get/make cache directory!\n"));
179 return False;
180 }
181
182 g_pstcache_Bpp = (g_server_depth + 7) / 8;
183 sprintf(filename, "cache/pstcache_%d_%d", cache_id, g_pstcache_Bpp);
184 DEBUG(("persistent bitmap cache file: %s\n", filename));
185
187 if (fd == -1)
188 return False;
189
190 if (!rd_lock_file(fd, 0, 0))
191 {
192 warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
194 return False;
195 }
196
197 g_pstcache_fd[cache_id] = fd;
198 return True;
199}
void rd_close_file(int fd)
Definition: uimain.c:847
RD_BOOL rd_lock_file(int fd, int start, int len)
Definition: uimain.c:875
RD_BOOL rd_pstcache_mkdir(void)
Definition: uimain.c:833
int rd_open_file(char *filename)
Definition: uimain.c:840

Referenced by rdp_out_bmpcache2_caps().

◆ pstcache_load_bitmap()

RD_BOOL pstcache_load_bitmap ( uint8  cache_id,
uint16  cache_idx 
)

Definition at line 53 of file pstcache.c.

54{
55 uint8 *celldata;
56 int fd;
57 CELLHEADER cellhdr;
59
61 return False;
62
63 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
64 return False;
65
66 fd = g_pstcache_fd[cache_id];
67 rd_lseek_file(fd, cache_idx * (g_pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
68 rd_read_file(fd, &cellhdr, sizeof(CELLHEADER));
69 celldata = (uint8 *) xmalloc(cellhdr.length);
70 rd_read_file(fd, celldata, cellhdr.length);
71
72 bitmap = ui_create_bitmap(cellhdr.width, cellhdr.height, celldata);
73 DEBUG(("Load bitmap from disk: id=%d, idx=%d, bmp=%p)\n", cache_id, cache_idx, bitmap));
74 cache_put_bitmap(cache_id, cache_idx, bitmap);
75
76 xfree(celldata);
77 return True;
78}
void cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
Definition: cache.c:218
RD_HBITMAP ui_create_bitmap(int width, int height, uint8 *data)
Definition: uimain.c:277

Referenced by cache_get_bitmap(), and pstcache_enumerate().

◆ pstcache_save_bitmap()

RD_BOOL pstcache_save_bitmap ( uint8  cache_id,
uint16  cache_idx,
uint8 key,
uint8  width,
uint8  height,
uint16  length,
uint8 data 
)

Definition at line 82 of file pstcache.c.

84{
85 int fd;
86 CELLHEADER cellhdr;
87
88 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
89 return False;
90
91 memcpy(cellhdr.key, key, sizeof(HASH_KEY));
92 cellhdr.width = width;
93 cellhdr.height = height;
94 cellhdr.length = length;
95 cellhdr.stamp = 0;
96
97 fd = g_pstcache_fd[cache_id];
98 rd_lseek_file(fd, cache_idx * (g_pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
99 rd_write_file(fd, &cellhdr, sizeof(CELLHEADER));
101
102 return True;
103}
int rd_write_file(int fd, void *ptr, int len)
Definition: uimain.c:861
Definition: copy.c:22

Referenced by process_bmpcache2().

◆ pstcache_touch_bitmap()

void pstcache_touch_bitmap ( uint8  cache_id,
uint16  cache_idx,
uint32  stamp 
)

Definition at line 39 of file pstcache.c.

40{
41 int fd;
42
43 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
44 return;
45
46 fd = g_pstcache_fd[cache_id];
47 rd_lseek_file(fd, 12 + cache_idx * (g_pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
48 rd_write_file(fd, &stamp, sizeof(stamp));
49}

Referenced by cache_evict_bitmap(), and cache_save_state().

◆ rd_close_file()

void rd_close_file ( int  fd)

Definition at line 847 of file uimain.c.

848{
849 return;
850}

Referenced by pstcache_init().

◆ rd_create_ui()

void rd_create_ui ( void  )

◆ rd_lock_file()

RD_BOOL rd_lock_file ( int  fd,
int  start,
int  len 
)

Definition at line 875 of file uimain.c.

876{
877 return False;
878}

Referenced by pstcache_init().

◆ rd_lseek_file()

int rd_lseek_file ( int  fd,
int  offset 
)

Definition at line 868 of file uimain.c.

869{
870 return 0;
871}

Referenced by pstcache_enumerate(), pstcache_load_bitmap(), pstcache_save_bitmap(), and pstcache_touch_bitmap().

◆ rd_open_file()

int rd_open_file ( char filename)

Definition at line 840 of file uimain.c.

841{
842 return 0;
843}

Referenced by pstcache_init().

◆ rd_pstcache_mkdir()

RD_BOOL rd_pstcache_mkdir ( void  )

Definition at line 833 of file uimain.c.

834{
835 return 0;
836}

Referenced by pstcache_init().

◆ rd_read_file()

int rd_read_file ( int  fd,
void ptr,
int  len 
)

Definition at line 854 of file uimain.c.

855{
856 return 0;
857}

Referenced by pstcache_enumerate(), and pstcache_load_bitmap().

◆ rd_write_file()

int rd_write_file ( int  fd,
void ptr,
int  len 
)

Definition at line 861 of file uimain.c.

862{
863 return 0;
864}

Referenced by pstcache_save_bitmap(), and pstcache_touch_bitmap().

◆ rdp5_process()

void rdp5_process ( STREAM  s)

Definition at line 28 of file rdp5.c.

29{
32 uint8 *next;
33
34 uint32 roff, rlen;
35 struct stream *ns = &(g_mppc_dict.ns);
36 struct stream *ts;
37
38#if 0
39 printf("RDP5 data:\n");
40 hexdump(s->p, s->end - s->p);
41#endif
42
44 while (s->p < s->end)
45 {
46 in_uint8(s, type);
48 {
52 }
53 else
54 {
55 ctype = 0;
57 }
58 g_next_packet = next = s->p + length;
59
61 {
62 if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
63 error("error while decompressing packet\n");
64
65 /* allocate memory and copy the uncompressed data into the temporary stream */
66 ns->data = (uint8 *) xrealloc(ns->data, rlen);
67
68 memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen);
69
70 ns->size = rlen;
71 ns->end = (ns->data + ns->size);
72 ns->p = ns->data;
73 ns->rdp_hdr = ns->p;
74
75 ts = ns;
76 }
77 else
78 ts = s;
79
80 switch (type)
81 {
82 case 0: /* update orders */
85 break;
86 case 1: /* update bitmap */
87 in_uint8s(ts, 2); /* part length */
89 break;
90 case 2: /* update palette */
91 in_uint8s(ts, 2); /* uint16 = 2 */
93 break;
94 case 3: /* update synchronize */
95 break;
96 case 5: /* null pointer */
98 break;
99 case 6: /* default pointer */
100 break;
101 case 8: /* pointer position */
102 in_uint16_le(ts, x);
103 in_uint16_le(ts, y);
104 if (s_check(ts))
106 break;
107 case 9: /* color pointer */
109 break;
110 case 10: /* cached pointer */
112 break;
113 case 11:
115 break;
116 default:
117 unimpl("RDP5 opcode %d\n", type);
118 }
119
120 s->p = next;
121 }
123}
#define RDP5_COMPRESSED
Definition: constants.h:360
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
Definition: mppc.c:58
void process_orders(STREAM s, uint16 num_orders)
Definition: orders.c:1311
void process_bitmap_updates(STREAM s)
Definition: rdp.c:1224
void process_cached_pointer_pdu(STREAM s)
Definition: rdp.c:1156
void process_palette(STREAM s)
Definition: rdp.c:1295
void hexdump(unsigned char *p, unsigned int len)
Definition: shimdbg.c:234
void process_colour_pointer_pdu(STREAM s)
Definition: rdp.c:1139
void ui_begin_update(void)
Definition: uimain.c:657
void ui_move_pointer(int x, int y)
Definition: uimain.c:616
void ui_end_update(void)
Definition: uimain.c:664
void process_new_pointer_pdu(STREAM s)
Definition: rdp.c:1146
uint8 * g_next_packet
Definition: rdp.c:45
RDPCOMP g_mppc_dict
Definition: mppc.c:55
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static unsigned __int64 next
Definition: rand_nt.c:6
struct stream ns
Definition: types.h:192
Definition: mxnamespace.c:45

Referenced by rdp_recv().

◆ rdp_connect()

RD_BOOL rdp_connect ( char server,
uint32  flags,
char domain,
char password,
char command,
char directory,
RD_BOOL  reconnect 
)

Definition at line 1742 of file rdp.c.

1744{
1747
1748 if (!sec_connect(server, g_username, domain, password, reconnect))
1749 return False;
1750
1752
1753 /* run RDP loop until first licence demand active PDU */
1754 while (!g_rdp_shareid)
1755 {
1756 if (g_network_error)
1757 return False;
1758
1760 return False;
1761
1762 if (g_redirect)
1763 return True;
1764 }
1765 return True;
1766}
RD_BOOL sec_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect)
Definition: secure.c:1005
static void rdp_send_logon_info(uint32 flags, char *domain, char *user, char *password, char *program, char *directory)
Definition: rdp.c:343
RD_BOOL g_redirect
Definition: uimain.c:55
RD_BOOL g_network_error
Definition: uimain.c:77
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
Definition: rdp.c:1695
uint32 g_rdp_shareid
Definition: rdp.c:46
char g_username[256]
Definition: uimain.c:25
int deactivated
Definition: svgawin.c:63

Referenced by main(), mstsc_ProtocolIOThread(), param_connect(), SEALED_::ProtocolLoop(), rdp2vnc_connect(), QMyScrollView::timerEvent(), ui_main(), and ui_main_loop().

◆ rdp_disconnect()

void rdp_disconnect ( void  )

Definition at line 1779 of file rdp.c.

1780{
1782}
void sec_disconnect(void)
Definition: secure.c:1032

Referenced by main(), SEALED_::ProtocolLoop(), and rdp2vnc_connect().

◆ rdp_in_unistr()

void rdp_in_unistr ( STREAM  s,
int  in_len,
char **  string,
uint32 str_size 
)

Definition at line 265 of file rdp.c.

266{
267 /* Dynamic allocate of destination string if not provided */
268 *string = xmalloc(in_len * 2);
269 *str_size = in_len * 2;
270
271#ifdef HAVE_ICONV
272 size_t ibl = in_len, obl = *str_size - 1;
273 char *pin = (char *) s->p, *pout = *string;
274 static iconv_t iconv_h = (iconv_t) - 1;
275
276 if (g_iconv_works)
277 {
278 if (iconv_h == (iconv_t) - 1)
279 {
280 if ((iconv_h = iconv_open(g_codepage, WINDOWS_CODEPAGE)) == (iconv_t) - 1)
281 {
282 warning("rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
283 WINDOWS_CODEPAGE, g_codepage, (int) iconv_h);
284
285 g_iconv_works = False;
286 return rdp_in_unistr(s, in_len, string, str_size);
287 }
288 }
289
290 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
291 {
292 if (errno == E2BIG)
293 {
294 warning("server sent an unexpectedly long string, truncating\n");
295 }
296 else
297 {
298 warning("rdp_in_unistr: iconv fail, errno %d\n", errno);
299
300 free(*string);
301 *string = NULL;
302 *str_size = 0;
303 }
304 }
305
306 /* we must update the location of the current STREAM for future reads of s->p */
307 s->p += in_len;
308
309 *pout = 0;
310
311 if (*string)
312 *str_size = pout - *string;
313 }
314 else
315#endif
316 {
317 int i = 0;
318 int rem = 0;
319 uint32 len = in_len / 2;
320
321 if (len > *str_size - 1)
322 {
323 warning("server sent an unexpectedly long string, truncating\n");
324 len = *str_size - 1;
325 rem = in_len - 2 * len;
326 }
327
328 while (i < len)
329 {
330 in_uint8a(s, &string[i++], 1);
331 in_uint8s(s, 1);
332 }
333
334 in_uint8s(s, rem);
335 string[len] = 0;
336 *str_size = len;
337 }
338}
#define WINDOWS_CODEPAGE
Definition: constants.h:24
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
Definition: rdp.c:265
char g_codepage[16]
Definition: rdp.c:27
#define free
Definition: debug_ros.c:5
#define E2BIG
Definition: errno.h:13
iconv_t iconv_open(const char *tocode, const char *fromcode)
Definition: win_iconv.c:730
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: win_iconv.c:771
char string[160]
Definition: util.h:11
#define errno
Definition: errno.h:18
Definition: regsvr.c:104
#define iconv_t
Definition: iconv.h:68

Referenced by disk_set_information(), printercache_process(), process_redirect_pdu(), rdp_in_unistr(), and rdpdr_process_irp().

◆ rdp_loop()

RD_BOOL rdp_loop ( RD_BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1695 of file rdp.c.

1696{
1697 uint8 type;
1698 RD_BOOL cont = True;
1699 STREAM s;
1700
1701 while (cont)
1702 {
1703 s = rdp_recv(&type);
1704 if (s == NULL)
1705 return False;
1706 switch (type)
1707 {
1710 *deactivated = False;
1711 break;
1712 case RDP_PDU_DEACTIVATE:
1713 DEBUG(("RDP_PDU_DEACTIVATE\n"));
1714 *deactivated = True;
1715 break;
1716 case RDP_PDU_REDIRECT:
1717 return process_redirect_pdu(s, False);
1718 break;
1720 return process_redirect_pdu(s, True);
1721 break;
1722 case RDP_PDU_DATA:
1723 /* If we got a data PDU, we don't need to keep the password in memory
1724 anymore and therefor we should clear it for security reasons. */
1725 if (g_password[0] != '\0')
1726 memset(g_password, 0, sizeof(g_password));
1727
1729 break;
1730 case 0:
1731 break;
1732 default:
1733 unimpl("PDU %d\n", type);
1734 }
1735 cont = g_next_packet < s->end;
1736 }
1737 return True;
1738}
@ RDP_PDU_DEMAND_ACTIVE
Definition: constants.h:160
@ RDP_PDU_DEACTIVATE
Definition: constants.h:163
@ RDP_PDU_ENHANCED_REDIRECT
Definition: constants.h:165
@ RDP_PDU_REDIRECT
Definition: constants.h:162
@ RDP_PDU_DATA
Definition: constants.h:164
static void process_demand_active(STREAM s)
Definition: rdp.c:1067
uint8 * g_next_packet
Definition: rdp.c:45
static STREAM rdp_recv(uint8 *type)
Definition: rdp.c:85
char g_password[256]
Definition: uimain.c:28
static RD_BOOL process_data_pdu(STREAM s, uint32 *ext_disc_reason)
Definition: rdp.c:1416
static RD_BOOL process_redirect_pdu(STREAM s, RD_BOOL enhanced_redirect)
Definition: rdp.c:1506

Referenced by QMyMainWindow::dataReceived(), nanox_event(), rdp_connect(), rdp_main_loop(), ui_main_loop(), and ui_read_wire().

◆ rdp_main_loop()

void rdp_main_loop ( RD_BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1682 of file rdp.c.

1683{
1685 {
1687 {
1688 return;
1689 }
1690 }
1691}
RD_BOOL g_pending_resize
Definition: uimain.c:79

Referenced by main(), mstsc_ProtocolIOThread(), SEALED_::ProtocolLoop(), and rdp2vnc_connect().

◆ rdp_out_unistr()

void rdp_out_unistr ( STREAM  s,
char string,
int  len 
)

Definition at line 188 of file rdp.c.

189{
190 if (string == NULL || len == 0)
191 return;
192
193#ifdef HAVE_ICONV
194 size_t ibl = strlen(string), obl = len + 2;
195 static iconv_t iconv_h = (iconv_t) - 1;
196 char *pin = string, *pout = (char *) s->p;
197
198 memset(pout, 0, len + 4);
199
200 if (g_iconv_works)
201 {
202 if (iconv_h == (iconv_t) - 1)
203 {
204 size_t i = 1, o = 4;
205 if ((iconv_h = iconv_open(WINDOWS_CODEPAGE, g_codepage)) == (iconv_t) - 1)
206 {
207 warning("rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
208 g_codepage, WINDOWS_CODEPAGE, (int) iconv_h);
209
210 g_iconv_works = False;
211 rdp_out_unistr(s, string, len);
212 return;
213 }
214 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &i, &pout, &o) ==
215 (size_t) - 1)
216 {
217 iconv_close(iconv_h);
218 iconv_h = (iconv_t) - 1;
219 warning("rdp_out_unistr: iconv(1) fail, errno %d\n", errno);
220
221 g_iconv_works = False;
222 rdp_out_unistr(s, string, len);
223 return;
224 }
225 pin = string;
226 pout = (char *) s->p;
227 }
228
229 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
230 {
231 iconv_close(iconv_h);
232 iconv_h = (iconv_t) - 1;
233 warning("rdp_out_unistr: iconv(2) fail, errno %d\n", errno);
234
235 g_iconv_works = False;
236 rdp_out_unistr(s, string, len);
237 return;
238 }
239
240 s->p += len + 2;
241
242 }
243 else
244#endif
245 {
246 int i = 0, j = 0;
247
248 len += 2;
249
250 while (i < len)
251 {
252 s->p[i++] = string[j++];
253 s->p[i++] = 0;
254 }
255
256 s->p += len;
257 }
258}
void rdp_out_unistr(STREAM s, char *string, int len)
Definition: rdp.c:188
__kernel_size_t size_t
Definition: linux.h:237
int iconv_close(iconv_t cd)
Definition: win_iconv.c:756

Referenced by disk_query_directory(), disk_query_volume_information(), rdp_out_unistr(), rdp_out_unistr_mandatory_null(), rdp_send_logon_info(), rdpdr_send_available(), rdpdr_send_name(), and sec_out_mcs_data().

◆ rdp_reset_state()

void rdp_reset_state ( void  )

Definition at line 1770 of file rdp.c.

1771{
1772 g_next_packet = NULL; /* reset the packet information */
1773 g_rdp_shareid = 0;
1775}
void sec_reset_state(void)
Definition: secure.c:1039

Referenced by SEALED_::ProtocolLoop(), and rdesktop_reset_state().

◆ rdp_send_client_window_status()

void rdp_send_client_window_status ( int  status)

Definition at line 572 of file rdp.c.

573{
574 STREAM s;
575 static int current_status = 1;
576
577 if (current_status == status)
578 return;
579
580 s = rdp_init_data(12);
581
583
584 switch (status)
585 {
586 case 0: /* shut the server up */
587 break;
588
589 case 1: /* receive data again */
590 out_uint32_le(s, 0); /* unknown */
593 break;
594 }
595
596 s_mark_end(s);
598 current_status = status;
599}
@ RDP_DATA_PDU_CLIENT_WINDOW_STATUS
Definition: constants.h:176
#define out_uint16_le(s, v)
Definition: parse.h:58
int g_width
Definition: uimain.c:42
int g_height
Definition: uimain.c:43
static STREAM rdp_init_data(int maxlen)
Definition: rdp.c:140
static void rdp_send_data(STREAM s, uint8 data_pdu_type)
Definition: rdp.c:152
Definition: ps.c:97

Referenced by xwin_process_events().

◆ rdp_send_input()

◆ rdp_send_scancode()

void rdp_send_scancode ( uint32  time,
uint16  flags,
uint8  scancode 
)

Referenced by vncKey().

◆ rdpdr_abort_io()

RD_BOOL rdpdr_abort_io ( uint32  fd,
uint32  major,
RD_NTSTATUS  status 
)

◆ rdpdr_add_fds()

void rdpdr_add_fds ( int n,
fd_set rfds,
fd_set wfds,
struct timeval tv,
RD_BOOL timeout 
)

Referenced by ui_select().

◆ rdpdr_check_fds()

void rdpdr_check_fds ( fd_set rfds,
fd_set wfds,
RD_BOOL  timed_out 
)

Referenced by ui_select().

◆ rdpdr_init()

RD_BOOL rdpdr_init ( )

Referenced by main().

◆ rdpdr_remove_iorequest()

struct async_iorequest * rdpdr_remove_iorequest ( struct async_iorequest *  prev,
struct async_iorequest *  iorq 
)

◆ rdpdr_send_completion()

void rdpdr_send_completion ( uint32  device,
uint32  id,
uint32  status,
uint32  result,
uint8 buffer,
uint32  length 
)

◆ rdpsnd_add_fds()

void rdpsnd_add_fds ( int n,
fd_set rfds,
fd_set wfds,
struct timeval tv 
)

◆ rdpsnd_check_fds()

void rdpsnd_check_fds ( fd_set rfds,
fd_set wfds 
)

◆ rdpsnd_init()

RD_BOOL rdpsnd_init ( char optarg)

◆ rdpsnd_queue_current_packet()

struct audio_packet * rdpsnd_queue_current_packet ( void  )

◆ rdpsnd_queue_empty()

RD_BOOL rdpsnd_queue_empty ( void  )

◆ rdpsnd_queue_next()

void rdpsnd_queue_next ( unsigned long  completed_in_us)

◆ rdpsnd_queue_next_tick()

int rdpsnd_queue_next_tick ( void  )

◆ rdpsnd_record()

void rdpsnd_record ( const void data,
unsigned int  size 
)

◆ rdpsnd_reset_state()

void rdpsnd_reset_state ( void  )

◆ rdpsnd_show_help()

void rdpsnd_show_help ( void  )

◆ read_keyboard_state()

unsigned int read_keyboard_state ( void  )

Definition at line 632 of file uimain.c.

633{
635}
int mi_read_keyboard_state(void)
Definition: win32.c:232

Referenced by handle_special_keys(), process_demand_active(), and reset_modifier_keys().

◆ reset_modifier_keys()

void reset_modifier_keys ( void  )

Referenced by xwin_process_events().

◆ reset_order_state()

void reset_order_state ( void  )

Definition at line 1454 of file orders.c.

Referenced by process_demand_active().

◆ restore_remote_modifiers()

void restore_remote_modifiers ( uint32  ev_time,
uint8  scancode 
)

◆ save_licence()

void save_licence ( unsigned char data,
int  length 
)

◆ save_remote_modifiers()

void save_remote_modifiers ( uint8  scancode)

◆ scard_enum_devices()

int scard_enum_devices ( uint32 id,
char optarg 
)

◆ scard_lock()

void scard_lock ( int  lock)

◆ scard_reset_state()

void scard_reset_state ( )

◆ scard_unlock()

void scard_unlock ( int  lock)

◆ scardSetInfo()

void scardSetInfo ( uint32  epoch,
uint32  device,
uint32  id,
uint32  bytes_out 
)

◆ seamless_init()

RD_BOOL seamless_init ( void  )

Referenced by ui_init().

◆ seamless_reset_state()

void seamless_reset_state ( void  )

◆ seamless_select_timeout()

void seamless_select_timeout ( struct timeval tv)

Referenced by ui_select().

◆ seamless_send_destroy()

unsigned int seamless_send_destroy ( unsigned long  id)

◆ seamless_send_focus()

unsigned int seamless_send_focus ( unsigned long  id,
unsigned long  flags 
)

Referenced by xwin_process_events().

◆ seamless_send_persistent()

unsigned int seamless_send_persistent ( RD_BOOL  )

◆ seamless_send_position()

unsigned int seamless_send_position ( unsigned long  id,
int  x,
int  y,
int  width,
int  height,
unsigned long  flags 
)

Referenced by sw_update_position().

◆ seamless_send_spawn()

unsigned int seamless_send_spawn ( char cmd)

◆ seamless_send_state()

unsigned int seamless_send_state ( unsigned long  id,
unsigned int  state,
unsigned long  flags 
)

Referenced by xwin_process_events().

◆ seamless_send_sync()

unsigned int seamless_send_sync ( void  )

Referenced by ui_seamless_toggle().

◆ seamless_send_zchange()

unsigned int seamless_send_zchange ( unsigned long  id,
unsigned long  below,
unsigned long  flags 
)

Referenced by sw_handle_restack().

◆ sec_connect()

RD_BOOL sec_connect ( char server,
char username,
char domain,
char password,
RD_BOOL  reconnect 
)

Definition at line 1005 of file secure.c.

1006{
1007 uint32 selected_proto;
1008 struct stream mcs_data;
1009
1010 /* Start a MCS connect sequence */
1011 if (!mcs_connect_start(server, username, domain, password, reconnect, &selected_proto))
1012 return False;
1013
1014 /* We exchange some RDP data during the MCS-Connect */
1015 mcs_data.size = 512;
1016 mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size);
1017 sec_out_mcs_data(&mcs_data, selected_proto);
1018
1019 /* finalize the MCS connect sequence */
1020 if (!mcs_connect_finalize(&mcs_data))
1021 return False;
1022
1023 /* sec_process_mcs_data(&mcs_data); */
1024 if (g_encryption)
1026 xfree(mcs_data.data);
1027 return True;
1028}
RD_BOOL mcs_connect_start(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: mcs.c:311
RD_BOOL mcs_connect_finalize(STREAM mcs_data)
Definition: mcs.c:318
static void sec_out_mcs_data(STREAM s, uint32 selected_protocol)
Definition: secure.c:498
RD_BOOL g_encryption
Definition: uimain.c:40
static void sec_establish_key(void)
Definition: secure.c:480

Referenced by rdp_connect().

◆ sec_decrypt()

void sec_decrypt ( uint8 data,
int  length 
)

Definition at line 396 of file secure.c.

397{
398 if (g_sec_decrypt_use_count == 4096)
399 {
403 }
404
407}
static int g_rc4_key_len
Definition: secure.c:93
void rdssl_rc4_crypt(void *rc4_info, char *in_data, char *out_data, int len)
Definition: ssl_calls.c:173
static void * g_rc4_decrypt_key
Definition: secure.c:94
void rdssl_rc4_set_key(void *rc4_info, char *key, int len)
Definition: ssl_calls.c:123
static uint8 g_sec_decrypt_key[16]
Definition: secure.c:99
static int g_sec_decrypt_use_count
Definition: secure.c:109
static uint8 g_sec_decrypt_update_key[16]
Definition: secure.c:101
static void sec_update(uint8 *key, uint8 *update_key)
Definition: secure.c:346

Referenced by sec_recv().

◆ sec_disconnect()

void sec_disconnect ( void  )

Definition at line 1032 of file secure.c.

1033{
1035}
void mcs_disconnect(void)
Definition: mcs.c:356

Referenced by rdp_disconnect().

◆ sec_hash_16()

void sec_hash_16 ( uint8 out,
uint8 in,
uint8 salt1,
uint8 salt2 
)

Definition at line 187 of file secure.c.

188{
189 void * md5;
190
193 rdssl_md5_transform(md5, (char *)in, 16);
194 rdssl_md5_transform(md5, (char *)salt1, 32);
195 rdssl_md5_transform(md5, (char *)salt2, 32);
196 rdssl_md5_complete(md5, (char *)out);
198}
void rdssl_md5_clear(void *md5_info)
Definition: ssl_calls.c:428
void rdssl_md5_transform(void *md5_info, char *data, int len)
Definition: ssl_calls.c:435
void rdssl_md5_complete(void *md5_info, char *data)
Definition: ssl_calls.c:442
void rdssl_md5_info_delete(void *md5_info)
Definition: ssl_calls.c:421
void * rdssl_md5_info_create(void)
Definition: ssl_calls.c:414
#define md5
Definition: compat-1.3.h:2034
static FILE * out
Definition: regtests2xml.c:44

Referenced by licence_generate_keys().

◆ sec_hash_48()

void sec_hash_48 ( uint8 out,
uint8 in,
uint8 salt1,
uint8 salt2,
uint8  salt 
)

Definition at line 155 of file secure.c.

156{
157 uint8 shasig[20];
158 uint8 pad[4];
159 void * sha;
160 void * md5;
161 int i;
162
163 for (i = 0; i < 3; i++)
164 {
165 memset(pad, salt + i, i + 1);
168 rdssl_sha1_transform(sha, (char *)pad, i + 1);
169 rdssl_sha1_transform(sha, (char *)in, 48);
170 rdssl_sha1_transform(sha, (char *)salt1, 32);
171 rdssl_sha1_transform(sha, (char *)salt2, 32);
172 rdssl_sha1_complete(sha, (char *)shasig);
176 rdssl_md5_transform(md5, (char *)in, 48);
177 rdssl_md5_transform(md5, (char *)shasig, 20);
178 rdssl_md5_complete(md5, (char *)out + i * 16);
180 }
181}
void rdssl_sha1_clear(void *sha1_info)
Definition: ssl_calls.c:393
void rdssl_sha1_transform(void *sha1_info, char *data, int len)
Definition: ssl_calls.c:400
void rdssl_sha1_info_delete(void *sha1_info)
Definition: ssl_calls.c:386
void rdssl_sha1_complete(void *sha1_info, char *data)
Definition: ssl_calls.c:407
void * rdssl_sha1_info_create(void)
Definition: ssl_calls.c:379
static const WCHAR sha[]
Definition: oid.c:1218

Referenced by licence_generate_keys().

◆ sec_hash_sha1_16()

void sec_hash_sha1_16 ( uint8 out,
uint8 in,
uint8 salt1 
)

Definition at line 204 of file secure.c.

205{
206 void * sha;
209 rdssl_sha1_transform(&sha, (char *)in, 16);
210 rdssl_sha1_transform(&sha, (char *)salt1, 16);
211 rdssl_sha1_complete(&sha, (char *)out);
213}

◆ sec_hash_to_string()

void sec_hash_to_string ( char out,
int  out_size,
uint8 in,
int  in_size 
)

Definition at line 217 of file secure.c.

218{
219 int k;
220 memset(out, 0, out_size);
221 for (k = 0; k < in_size; k++, out += 2)
222 {
223 sprintf(out, "%.2x", in[k]);
224 }
225}
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG in_size
Definition: file.c:100

◆ sec_init()

STREAM sec_init ( uint32  flags,
int  maxlen 
)

Definition at line 419 of file secure.c.

420{
421 int hdrlen;
422 STREAM s;
423
425 hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4;
426 else
427 hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0;
428 s = mcs_init(maxlen + hdrlen);
429 s_push_layer(s, sec_hdr, hdrlen);
430
431 return s;
432}
STREAM mcs_init(int length)
Definition: mcs.c:242
RD_BOOL g_licence_issued
Definition: licence.c:44
RD_BOOL g_licence_error_result
Definition: licence.c:45

Referenced by channel_init(), channel_send(), licence_info(), licence_present(), licence_send_authresp(), licence_send_new_licence_request(), licence_send_platform_challenge_response(), licence_send_request(), rdp_init_data(), rdp_send_confirm_active(), rdp_send_logon_info(), and sec_establish_key().

◆ sec_process_mcs_data()

void sec_process_mcs_data ( STREAM  s)

Definition at line 856 of file secure.c.

857{
859 uint8 *next_tag;
860 uint8 len;
861
862 in_uint8s(s, 21); /* header (T.124 ConferenceCreateResponse) */
863 in_uint8(s, len);
864 if (len & 0x80)
865 in_uint8(s, len);
866
867 while (s->p < s->end)
868 {
871
872 if (length <= 4)
873 return;
874
875 next_tag = s->p + length - 4;
876
877 switch (tag)
878 {
879 case SEC_TAG_SRV_INFO:
881 break;
882
885 break;
886
888 /* FIXME: We should parse this information and
889 use it to map RDP5 channels to MCS
890 channels */
891 break;
892
893 default:
894 unimpl("response tag 0x%x\n", tag);
895 }
896
897 s->p = next_tag;
898 }
899}
#define SEC_TAG_SRV_INFO
Definition: constants.h:115
#define SEC_TAG_SRV_CRYPT
Definition: constants.h:116
#define SEC_TAG_SRV_CHANNELS
Definition: constants.h:117
static void sec_process_srv_info(STREAM s)
Definition: secure.c:842
static void sec_process_crypt_info(STREAM s)
Definition: secure.c:818

Referenced by mcs_recv_connect_response().

◆ sec_recv()

STREAM sec_recv ( uint8 rdpver)

Definition at line 903 of file secure.c.

904{
905 uint16 sec_flags;
906 /* uint16 sec_flags_hi; */
907 uint16 channel;
908 STREAM s;
909
910 while ((s = mcs_recv(&channel, rdpver)) != NULL)
911 {
912 if (rdpver != NULL)
913 {
914 if (*rdpver != 3)
915 {
916 if (*rdpver & 0x80)
917 {
918 in_uint8s(s, 8); /* signature */
919 sec_decrypt(s->p, s->end - s->p);
920 }
921 return s;
922 }
923 }
925 {
926 /* TS_SECURITY_HEADER */
927 in_uint16_le(s, sec_flags);
928 in_uint8s(s, 2); /* sec_flags_hi */
929
930 if (g_encryption)
931 {
932 if (sec_flags & SEC_ENCRYPT)
933 {
934 in_uint8s(s, 8); /* signature */
935 sec_decrypt(s->p, s->end - s->p);
936 }
937
938 if (sec_flags & SEC_LICENSE_PKT)
939 {
941 continue;
942 }
943
944 if (sec_flags & SEC_REDIRECTION_PKT) /* SEC_REDIRECT_ENCRYPT */
945 {
946 uint8 swapbyte;
947
948 in_uint8s(s, 8); /* signature */
949 sec_decrypt(s->p, s->end - s->p);
950
951 /* Check for a redirect packet, starts with 00 04 */
952 if (s->p[0] == 0 && s->p[1] == 4)
953 {
954 /* for some reason the PDU and the length seem to be swapped.
955 This isn't good, but we're going to do a byte for byte
956 swap. So the first four values appear as: 00 04 XX YY,
957 where XX YY is the little endian length. We're going to
958 use 04 00 as the PDU type, so after our swap this will look
959 like: XX YY 04 00 */
960 swapbyte = s->p[0];
961 s->p[0] = s->p[2];
962 s->p[2] = swapbyte;
963
964 swapbyte = s->p[1];
965 s->p[1] = s->p[3];
966 s->p[3] = swapbyte;
967
968 swapbyte = s->p[2];
969 s->p[2] = s->p[3];
970 s->p[3] = swapbyte;
971 }
972#ifdef WITH_DEBUG
973 /* warning! this debug statement will show passwords in the clear! */
974 hexdump(s->p, s->end - s->p);
975#endif
976 }
977 }
978 else
979 {
980 if (sec_flags & SEC_LICENSE_PKT)
981 {
983 continue;
984 }
985 s->p -= 4;
986 }
987 }
988
989 if (channel != MCS_GLOBAL_CHANNEL)
990 {
991 channel_process(s, channel);
992 if (rdpver != NULL)
993 *rdpver = 0xff;
994 return s;
995 }
996
997 return s;
998 }
999
1000 return NULL;
1001}
void channel_process(STREAM s, uint16 mcs_channel)
Definition: channels.c:138
#define SEC_LICENSE_PKT
Definition: constants.h:105
#define SEC_REDIRECTION_PKT
Definition: constants.h:108
void licence_process(STREAM s)
Definition: licence.c:378
STREAM mcs_recv(uint16 *channel, uint8 *rdpver)
Definition: mcs.c:280
void sec_decrypt(uint8 *data, int length)
Definition: secure.c:396

Referenced by rdp_recv().

◆ sec_reset_state()

void sec_reset_state ( void  )

Definition at line 1039 of file secure.c.

1040{
1044 g_licence_issued = 0;
1047}
void mcs_reset_state(void)
Definition: mcs.c:363
static int g_sec_encrypt_use_count
Definition: secure.c:108
uint16 g_server_rdp_version
Definition: secure.c:105

Referenced by rdp_reset_state().

◆ sec_send()

◆ sec_send_to_channel()

void sec_send_to_channel ( STREAM  s,
uint32  flags,
uint16  channel 
)

Definition at line 436 of file secure.c.

437{
438 int datalen;
439
440#ifdef WITH_SCARD
442#endif
443
444 s_pop_layer(s, sec_hdr);
447
448 if (flags & SEC_ENCRYPT)
449 {
450 flags &= ~SEC_ENCRYPT;
451 datalen = s->end - s->p - 8;
452
453#ifdef WITH_DEBUG
454 DEBUG(("Sending encrypted packet:\n"));
455 hexdump(s->p + 8, datalen);
456#endif
457
459 sec_encrypt(s->p + 8, datalen);
460 }
461
462 mcs_send_to_channel(s, channel);
463
464#ifdef WITH_SCARD
466#endif
467}
#define SCARD_LOCK_SEC
Definition: constants.h:580
static uint8 g_sec_sign_key[16]
Definition: secure.c:98
static void sec_encrypt(uint8 *data, int length)
Definition: secure.c:381
void sec_sign(uint8 *signature, int siglen, uint8 *session_key, int keylen, uint8 *data, int datalen)
Definition: secure.c:314
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031

Referenced by channel_send(), and sec_send().

◆ sec_sign()

void sec_sign ( uint8 signature,
int  siglen,
uint8 session_key,
int  keylen,
uint8 data,
int  datalen 
)

Definition at line 314 of file secure.c.

315{
316 uint8 shasig[20];
317 uint8 md5sig[16];
318 uint8 lenhdr[4];
319 void * sha;
320 void * md5;
321
322 buf_out_uint32(lenhdr, datalen);
323
326 rdssl_sha1_transform(sha, (char *)session_key, keylen);
327 rdssl_sha1_transform(sha, (char *)pad_54, 40);
328 rdssl_sha1_transform(sha, (char *)lenhdr, 4);
330 rdssl_sha1_complete(sha, (char *)shasig);
332
335 rdssl_md5_transform(md5, (char *)session_key, keylen);
336 rdssl_md5_transform(md5, (char *)pad_92, 48);
337 rdssl_md5_transform(md5, (char *)shasig, 20);
338 rdssl_md5_complete(md5, (char *)md5sig);
340
341 memcpy(signature, md5sig, siglen);
342}
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
static uint8 pad_54[40]
Definition: secure.c:288
static uint8 pad_92[48]
Definition: secure.c:295

Referenced by licence_process_authreq(), licence_process_demand(), licence_process_platform_challenge(), and licence_process_request().

◆ serial_enum_devices()

int serial_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ serial_get_event()

RD_BOOL serial_get_event ( RD_NTHANDLE  handle,
uint32 result 
)

Referenced by _rdpdr_check_fds().

◆ serial_get_timeout()

RD_BOOL serial_get_timeout ( RD_NTHANDLE  handle,
uint32  length,
uint32 timeout,
uint32 itv_timeout 
)

Referenced by rdpdr_process_irp().

◆ str_handle_lines()

RD_BOOL str_handle_lines ( const char input,
char **  rest,
str_handle_lines_t  linehandler,
void data 
)

Referenced by lspci_process(), and seamless_process().

◆ str_startswith()

RD_BOOL str_startswith ( const char s,
const char prefix 
)

Definition at line 1235 of file rdesktop.c.

1236{
1237 return (strncmp(s, prefix, strlen(prefix)) == 0);
1238}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534

Referenced by FsVolumeInfo(), handle_child_line(), ui_clip_set_mode(), and xkeymap_read().

◆ subprocess()

RD_BOOL subprocess ( char *const  argv[],
str_handle_lines_t  linehandler,
void data 
)

Referenced by lspci_process_line().

◆ tcp_connect()

RD_BOOL tcp_connect ( char server)

Definition at line 717 of file tcp.c.

718{
719 socklen_t option_len;
720 uint32 option_value;
721 int i;
722
723#ifdef IPv6
724
725 int n;
726 struct addrinfo hints, *res, *ressave;
727 char tcp_port_rdp_s[10];
728
729 snprintf(tcp_port_rdp_s, 10, "%d", g_tcp_port_rdp);
730
731 memset(&hints, 0, sizeof(struct addrinfo));
732 hints.ai_family = AF_UNSPEC;
733 hints.ai_socktype = SOCK_STREAM;
734
735 if ((n = getaddrinfo(server, tcp_port_rdp_s, &hints, &res)))
736 {
737 error("getaddrinfo: %s\n", gai_strerror(n));
738 return False;
739 }
740
741 ressave = res;
742 g_sock = -1;
743 while (res)
744 {
745 g_sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
746 if (!(g_sock < 0))
747 {
748 if (connect(g_sock, res->ai_addr, res->ai_addrlen) == 0)
749 break;
751 g_sock = -1;
752 }
753 res = res->ai_next;
754 }
755 freeaddrinfo(ressave);
756
757 if (g_sock == -1)
758 {
759 error("%s: unable to connect\n", server);
760 return False;
761 }
762
763#else /* no IPv6 support */
764
765 struct hostent *nslookup;
766 struct sockaddr_in servaddr;
767
768 if ((nslookup = gethostbyname(server)) != NULL)
769 {
770 memcpy(&servaddr.sin_addr, nslookup->h_addr, sizeof(servaddr.sin_addr));
771 }
772 else if ((servaddr.sin_addr.s_addr = inet_addr(server)) == INADDR_NONE)
773 {
774 error("%s: unable to resolve host\n", server);
775 return False;
776 }
777
778 if ((g_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
779 {
780 error("socket: %s\n", TCP_STRERROR);
781 return False;
782 }
783
784 servaddr.sin_family = AF_INET;
785 servaddr.sin_port = htons((uint16) g_tcp_port_rdp);
786
787 if (connect(g_sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0)
788 {
789 if (!g_reconnect_loop)
790 error("connect: %s\n", TCP_STRERROR);
791
793 g_sock = -1;
794 return False;
795 }
796
797#endif /* IPv6 */
798
799 option_value = 1;
800 option_len = sizeof(option_value);
801 setsockopt(g_sock, IPPROTO_TCP, TCP_NODELAY, (void *) &option_value, option_len);
802 /* receive buffer must be a least 16 K */
803 if (getsockopt(g_sock, SOL_SOCKET, SO_RCVBUF, (void *) &option_value, &option_len) == 0)
804 {
805 if (option_value < (1024 * 16))
806 {
807 option_value = 1024 * 16;
808 option_len = sizeof(option_value);
809 setsockopt(g_sock, SOL_SOCKET, SO_RCVBUF, (void *) &option_value,
810 option_len);
811 }
812 }
813
814 g_in.size = 4096;
815 g_in.data = (uint8 *) xmalloc(g_in.size);
816
817 for (i = 0; i < STREAM_COUNT; i++)
818 {
819 g_out[i].size = 4096;
820 g_out[i].data = (uint8 *) xmalloc(g_out[i].size);
821 }
822
823#ifdef WITH_SSL
824 g_ssl_server = xmalloc(strlen(server)+1);
825#endif /* WITH_SSL */
826
827 return True;
828}
#define TCP_CLOSE(_sck)
Definition: tcp.c:35
static struct stream g_out[STREAM_COUNT]
Definition: tcp.c:74
int g_tcp_port_rdp
Definition: tcp.c:75
static struct stream g_in
Definition: tcp.c:73
#define STREAM_COUNT
Definition: tcp.c:48
#define INADDR_NONE
Definition: tcp.c:42
#define TCP_STRERROR
Definition: tcp.c:36
RD_BOOL g_reconnect_loop
Definition: uimain.c:86
static int g_sock
Definition: tcp.c:72
#define IPPROTO_TCP
Definition: ip.h:196
#define SOCK_STREAM
Definition: tcpip.h:118
#define AF_INET
Definition: tcpip.h:117
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
GLuint res
Definition: glext.h:9613
#define inet_addr(cp)
Definition: inet.h:98
#define htons(x)
Definition: module.h:215
int socklen_t
Definition: tcp.c:35
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
INT WSAAPI getsockopt(IN SOCKET s, IN INT level, IN INT optname, OUT CHAR FAR *optval, IN OUT INT FAR *optlen)
Definition: sockctrl.c:271
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
#define TCP_NODELAY
Definition: tcpdef.h:117
#define SO_RCVBUF
Definition: winsock.h:189
#define SOL_SOCKET
Definition: winsock.h:398
#define AF_UNSPEC
Definition: winsock.h:344
#define snprintf
Definition: wintirpc.h:48
#define getaddrinfo
Definition: wspiapi.h:44
#define freeaddrinfo
Definition: wspiapi.h:46

Referenced by iso_connect(), iso_reconnect(), and LibTCPConnectCallback().

◆ tcp_disconnect()

void tcp_disconnect ( void  )

Definition at line 832 of file tcp.c.

833{
834#ifdef WITH_SSL
835 if (g_ssl)
836 {
837 xfree(g_ssl->peek_msg_mem);
838 g_ssl->peek_msg_mem = NULL;
839 g_ssl->peek_msg = NULL;
840 g_ssl->peek_len = 0;
841 xfree(g_ssl->ssl_buf);
842 g_ssl->ssl_buf = NULL;
843 xfree(g_ssl->extra_buf);
844 g_ssl->extra_buf = NULL;
845 g_ssl->extra_len = 0;
846 if (SecIsValidHandle(&g_ssl->ssl_ctx))
847 DeleteSecurityContext(&g_ssl->ssl_ctx);
852 if (g_ssl_server)
853 {
854 xfree(g_ssl_server);
855 g_ssl_server = NULL;
856 }
857 g_ssl = NULL;
858 g_ssl_initialized = False;
859 }
860#endif /* WITH_SSL */
862 g_sock = -1;
863}
static SecHandle compat_cred_handle
static BOOL cred_handle_initialized
static BOOL have_compat_cred_handle
static SecHandle cred_handle
#define SecIsValidHandle(x)
Definition: sspi.h:63
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151

Referenced by iso_connect(), iso_disconnect(), and iso_reconnect().

◆ tcp_get_address()

char * tcp_get_address ( void  )

Definition at line 866 of file tcp.c.

867{
868 static char ipaddr[32];
869 struct sockaddr_in sockaddr;
870 socklen_t len = sizeof(sockaddr);
871 if (getsockname(g_sock, (struct sockaddr *) &sockaddr, &len) == 0)
872 {
873 uint8 *ip = (uint8 *) & sockaddr.sin_addr;
874 sprintf(ipaddr, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
875 }
876 else
877 strcpy(ipaddr, "127.0.0.1");
878 return ipaddr;
879}
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
Definition: dhcpd.h:62

Referenced by rdp_send_logon_info(), and wWinMain().

◆ tcp_init()

STREAM tcp_init ( uint32  maxlen)

Definition at line 82 of file tcp.c.

83{
84 static int cur_stream_id = 0;
86
87#ifdef WITH_SCARD
89#endif
90 result = &g_out[cur_stream_id];
91 cur_stream_id = (cur_stream_id + 1) % STREAM_COUNT;
92
93 if (maxlen > result->size)
94 {
95 result->data = (uint8 *) xrealloc(result->data, maxlen);
96 result->size = maxlen;
97 }
98
99 result->p = result->data;
100 result->end = result->data + result->size;
101#ifdef WITH_SCARD
103#endif
104 return result;
105}
#define SCARD_LOCK_TCP
Definition: constants.h:579
GLuint64EXT * result
Definition: glext.h:11304

Referenced by iso_init(), iso_send_connection_request(), iso_send_msg(), and lwip_init().

◆ tcp_is_connected()

RD_BOOL tcp_is_connected ( void  )

Definition at line 882 of file tcp.c.

883{
884 struct sockaddr_in sockaddr;
885 socklen_t len = sizeof(sockaddr);
886 if (getpeername(g_sock, (struct sockaddr *) &sockaddr, &len))
887 return True;
888 return False;
889}
INT WSAAPI getpeername(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:167

◆ tcp_recv()

STREAM tcp_recv ( STREAM  s,
uint32  length 
)

Definition at line 344 of file tcp.c.

345{
346 uint32 new_length, end_offset, p_offset;
347 int rcvd = 0;
348
349 if (g_network_error == True)
350 return NULL;
351
352 if (s == NULL)
353 {
354 /* read into "new" stream */
355 if (length > g_in.size)
356 {
357 g_in.data = (uint8 *) xrealloc(g_in.data, length);
358 g_in.size = length;
359 }
360 g_in.end = g_in.p = g_in.data;
361 s = &g_in;
362 }
363 else
364 {
365 /* append to existing stream */
366 new_length = (s->end - s->data) + length;
367 if (new_length > s->size)
368 {
369 p_offset = s->p - s->data;
370 end_offset = s->end - s->data;
371 s->data = (uint8 *) xrealloc(s->data, new_length);
372 s->size = new_length;
373 s->p = s->data + p_offset;
374 s->end = s->data + end_offset;
375 }
376 }
377
378 while (length > 0)
379 {
380#ifdef WITH_SSL
381 if (!g_ssl)
382#endif /* WITH_SSL */
383 {
384 if (!ui_select(g_sock))
385 {
386 /* User quit */
388 return NULL;
389 }
390 }
391
392#ifdef WITH_SSL
393 if (g_ssl)
394 {
395 SIZE_T size = 0;
396 BOOL eof;
397 DWORD res;
398
399 if (g_ssl->peek_msg)
400 {
401 size = min(length, g_ssl->peek_len);
402 memcpy(s->end, g_ssl->peek_msg, size);
403 g_ssl->peek_len -= size;
404 g_ssl->peek_msg += size;
405 s->end += size;
406
407 if (!g_ssl->peek_len)
408 {
409 xfree(g_ssl->peek_msg_mem);
410 g_ssl->peek_msg_mem = g_ssl->peek_msg = NULL;
411 }
412
413 return s;
414 }
415
416 do
417 {
418 res = read_ssl_chunk((BYTE*)s->end, length, TRUE, &size, &eof);
419 if (res != ERROR_SUCCESS)
420 {
421 if (res == WSAEWOULDBLOCK)
422 {
423 if (size)
424 {
426 }
427 }
428 else
429 {
430 error("read_ssl_chunk: %d (%s)\n", res, TCP_STRERROR);
432 return NULL;
433 }
434 break;
435 }
436 }
437 while (!size && !eof);
438 rcvd = size;
439 }
440 else
441 {
442#endif /* WITH_SSL */
443 rcvd = recv(g_sock, (char *)s->end, length, 0);
444 if (rcvd < 0)
445 {
446 if (rcvd == -1 && TCP_BLOCKS)
447 {
448 rcvd = 0;
449 }
450 else
451 {
452 error("recv: %d (%s)\n", rcvd, TCP_STRERROR);
454 return NULL;
455 }
456 }
457 else if (rcvd == 0)
458 {
459 error("Connection closed\n");
460 return NULL;
461 }
462#ifdef WITH_SSL
463 }
464#endif /* WITH_SSL */
465
466 s->end += rcvd;
467 length -= rcvd;
468 }
469
470 return s;
471}
int ui_select(int rdp_socket)
Definition: uimain.c:164
RD_BOOL g_network_error
Definition: uimain.c:77
#define TCP_BLOCKS
Definition: tcp.c:38
RD_BOOL g_user_quit
Definition: uimain.c:76
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
static BOOL read_ssl_chunk(struct netconn *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof)
Definition: net.c:448
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define min(a, b)
Definition: monoChain.cc:55
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
unsigned char BYTE
Definition: xxhash.c:193

Referenced by iso_recv_msg(), LibTCPAccept(), LibTCPConnectCallback(), and test_tcp_new_counters_pcb().

◆ tcp_reset_state()

void tcp_reset_state ( void  )

Definition at line 894 of file tcp.c.

895{
896 int i;
897
898 /* Clear the incoming stream */
899 if (g_in.data != NULL)
900 xfree(g_in.data);
901 g_in.p = NULL;
902 g_in.end = NULL;
903 g_in.data = NULL;
904 g_in.size = 0;
905 g_in.iso_hdr = NULL;
906 g_in.mcs_hdr = NULL;
907 g_in.sec_hdr = NULL;
908 g_in.rdp_hdr = NULL;
909 g_in.channel_hdr = NULL;
910
911 /* Clear the outgoing stream(s) */
912 for (i = 0; i < STREAM_COUNT; i++)
913 {
914 if (g_out[i].data != NULL)
915 xfree(g_out[i].data);
916 g_out[i].p = NULL;
917 g_out[i].end = NULL;
918 g_out[i].data = NULL;
919 g_out[i].size = 0;
920 g_out[i].iso_hdr = NULL;
921 g_out[i].mcs_hdr = NULL;
922 g_out[i].sec_hdr = NULL;
923 g_out[i].rdp_hdr = NULL;
924 g_out[i].channel_hdr = NULL;
925 }
926}

Referenced by iso_reset_state().

◆ tcp_run_ui()

void tcp_run_ui ( RD_BOOL  run)

◆ tcp_send()

void tcp_send ( STREAM  s)

Definition at line 270 of file tcp.c.

271{
272 int length = s->end - s->data;
273 int sent, total = 0;
274
275 if (g_network_error == True)
276 return;
277
278#ifdef WITH_SCARD
280#endif
281 while (total < length)
282 {
283#ifdef WITH_SSL
284 if (g_ssl)
285 {
286 const BYTE *ptr = s->data + total;
287 size_t chunk_size;
288
289 sent = 0;
290
291 while (length - total)
292 {
293 chunk_size = min(length - total, g_ssl->ssl_sizes.cbMaximumMessage);
294 if (!send_ssl_chunk(ptr, chunk_size))
295 {
296#ifdef WITH_SCARD
298#endif
299
300 //error("send_ssl_chunk: %d (%s)\n", sent, TCP_STRERROR);
302 return;
303 }
304
305 sent += chunk_size;
306 ptr += chunk_size;
307 length -= chunk_size;
308 }
309 }
310 else
311 {
312#endif /* WITH_SSL */
313 sent = send(g_sock, (const char *)s->data + total, length - total, 0);
314 if (sent <= 0)
315 {
316 if (sent == -1 && TCP_BLOCKS)
317 {
318 TCP_SLEEP(0);
319 sent = 0;
320 }
321 else
322 {
323#ifdef WITH_SCARD
325#endif
326
327 error("send: %d (%s)\n", sent, TCP_STRERROR);
329 return;
330 }
331 }
332#ifdef WITH_SSL
333 }
334#endif /* WITH_SSL */
335 total += sent;
336 }
337#ifdef WITH_SCARD
339#endif
340}
@ sent
Definition: SystemMenu.c:27
#define TCP_SLEEP(_n)
Definition: tcp.c:37
static BOOL send_ssl_chunk(struct netconn *conn, const void *msg, size_t size)
Definition: net.c:398
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
size_t total
static PVOID ptr
Definition: dispmode.c:27

Referenced by iso_send(), iso_send_connection_request(), and iso_send_msg().

◆ tcp_tls_connect()

RD_BOOL tcp_tls_connect ( void  )

Referenced by iso_connect().

◆ tcp_tls_get_server_pubkey()

RD_BOOL tcp_tls_get_server_pubkey ( STREAM  s)

◆ toupper_str()

void toupper_str ( char p)

Definition at line 1223 of file rdesktop.c.

1224{
1225 while (*p)
1226 {
1227 if ((*p >= 'a') && (*p <= 'z'))
1228 *p = toupper((int) *p);
1229 p++;
1230 }
1231}
int toupper(int c)
Definition: utclib.c:881

Referenced by parallel_enum_devices(), and serial_enum_devices().

◆ ui_begin_update()

void ui_begin_update ( void  )

Definition at line 657 of file uimain.c.

658{
660}
void mi_begin_update(void)
Definition: win32.c:1182

Referenced by process_update_pdu(), and rdp5_process().

◆ ui_bell()

void ui_bell ( void  )

Definition at line 158 of file uimain.c.

159{
160}

Referenced by process_data_pdu().

◆ ui_clip_format_announce()

void ui_clip_format_announce ( uint8 data,
uint32  length 
)

Referenced by cliprdr_process().

◆ ui_clip_handle_data()

void ui_clip_handle_data ( uint8 data,
uint32  length 
)

Referenced by cliprdr_process().

◆ ui_clip_request_data()

void ui_clip_request_data ( uint32  format)

Referenced by cliprdr_process().

◆ ui_clip_request_failed()

void ui_clip_request_failed ( void  )

Referenced by cliprdr_process().

◆ ui_clip_set_mode()

void ui_clip_set_mode ( const char optarg)

Referenced by cliprdr_set_mode().

◆ ui_clip_sync()

void ui_clip_sync ( void  )

Referenced by cliprdr_process().

◆ ui_create_bitmap()

RD_HBITMAP ui_create_bitmap ( int  width,
int  height,
uint8 data 
)

Definition at line 277 of file uimain.c.

278{
279 struct bitmap * b;
280 int size;
281
282 size = width * height * ((g_server_depth + 7) / 8);
283 b = (struct bitmap *) xmalloc(sizeof(struct bitmap));
284 b->data = (uint8 *) xmalloc(size);
285 memcpy(b->data, data, size);
286 b->width = width;
287 b->height = height;
288 return b;
289}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
int g_server_depth
Definition: uimain.c:41
void * xmalloc(int size)
Definition: uimain.c:747

Referenced by process_bmpcache(), process_bmpcache2(), process_raw_bmpcache(), pstcache_load_bitmap(), and ui_paint_bitmap().

◆ ui_create_colourmap()

RD_HCOLOURMAP ui_create_colourmap ( COLOURMAP colours)

Definition at line 336 of file uimain.c.

337{
338 int i;
339 int n;
340
341 n = MIN(256, colours->ncolours);
342 memset(pal_entries, 0, sizeof(pal_entries));
343 for (i = 0; i < n; i++)
344 {
345 pal_entries[i] = (colours->colours[i].red << 16) |
346 (colours->colours[i].green << 8) |
347 colours->colours[i].blue;
348 }
349 return 0;
350}
uint8 red
Definition: types.h:57
uint8 blue
Definition: types.h:59
uint8 green
Definition: types.h:58
uint16 ncolours
Definition: types.h:66
COLOURENTRY * colours
Definition: types.h:67
int pal_entries[256]
Definition: uimain.c:52

Referenced by process_colcache(), and process_palette().

◆ ui_create_cursor()

RD_HCURSOR ui_create_cursor ( unsigned int  x,
unsigned int  y,
int  width,
int  height,
uint8 andmask,
uint8 xormask,
int  bpp 
)

Definition at line 175 of file uimain.c.

178{
179 int i;
180 int j;
181 char am[32 * 4];
182 char xm[32 * 4];
183
184 if (width != 32 || height != 32)
185 {
186 return NULL;
187 }
188 if (xor_bpp==1)
189 {
190 return (void *) mi_create_cursor(x, y, width, height, (unsigned char *)andmask, (unsigned char *)xormask);
191 }
192 memset(am, 0, 32 * 4);
193 memset(xm, 0, 32 * 4);
194 for (i = 0; i < 32; i++)
195 {
196 for (j = 0; j < 32; j++)
197 {
198 if (bs_is_pixel_on((char *)andmask, j, i, 32, 1))
199 {
200 bs_set_pixel_on(am, j, 31 - i, 32, 1, 1);
201 }
202 if (bs_is_pixel_on((char *)xormask, j, i, 32, xor_bpp))
203 {
204 bs_set_pixel_on(xm, j, 31 - i, 32, 1, 1);
205 }
206 }
207 }
208 return (void *) mi_create_cursor(x, y, width, height, (unsigned char *)am, (unsigned char *)xm);
209}
int bs_is_pixel_on(char *data, int x, int y, int width, int bpp)
Definition: bsops.c:210
void bs_set_pixel_on(char *data, int x, int y, int width, int bpp, int pixel)
Definition: bsops.c:246
void * mi_create_cursor(unsigned int x, unsigned int y, int width, int height, unsigned char *andmask, unsigned char *xormask)
Definition: win32.c:1345

Referenced by process_colour_pointer_common(), and process_colour_pointer_pdu().

◆ ui_create_glyph()

RD_HGLYPH ui_create_glyph ( int  width,
int  height,
uint8 data 
)

Definition at line 234 of file uimain.c.

235{
236 int i;
237 int j;
238 char * glyph_data;
239 struct bitmap * the_glyph;
240
241 glyph_data = (char *) xmalloc(width * height);
242 memset(glyph_data, 0, width * height);
243 the_glyph = (struct bitmap *) xmalloc(sizeof(struct bitmap));
244 memset(the_glyph, 0, sizeof(struct bitmap));
245 the_glyph->width = width;
246 the_glyph->height = height;
247 the_glyph->data = (uint8 *)glyph_data;
248 for (i = 0; i < height; i++)
249 {
250 for (j = 0; j < width; j++)
251 {
252 if (bs_is_pixel_on((char *)data, j, i, width, 1))
253 {
254 bs_set_pixel_on(glyph_data, j, i, width, 8, 255);
255 }
256 }
257 }
258 return the_glyph;
259}
uint8 * data
Definition: uimain.c:90
uint32 width
Definition: uimain.c:91
uint32 height
Definition: uimain.c:92

Referenced by process_fontcache(), ui_create_cursor(), and ui_patblt().

◆ ui_create_window()

RD_BOOL ui_create_window ( void  )

Definition at line 559 of file qtwin.cpp.

560{
561 int w, h;
562 QPainter * painter;
563 QWidget * desktop;
564
565 g_MW = new QMyMainWindow();
566 g_SV = new QMyScrollView();
567 g_SV->addChild(g_MW);
568 g_BS = new QPixmap(g_width, g_height);
569 painter = new QPainter(g_BS);
570 painter->fillRect(0, 0, g_width, g_height, QBrush(QColor("white")));
571 painter->fillRect(0, 0, g_width, g_height, QBrush(QBrush::CrossPattern));
572 delete painter;
573 g_DS = new QPixmap(480, 480);
574 g_P1 = new QPainter();
575 g_P2 = new QPainter();
576 g_ClipRect = new QRegion(0, 0, g_width, g_height);
577 desktop = QApplication::desktop();
578 w = desktop->width(); // returns screen width
579 h = desktop->height(); // returns screen height
580 g_MW->resize(g_width, g_height);
581 if (w < g_width || h < g_height)
582 {
583 g_SV->resize(w, h);
584 }
585 else
586 {
587 g_SV->resize(g_width + 4, g_height + 4);
588 }
589 g_SV->setMaximumWidth(g_width + 4);
590 g_SV->setMaximumHeight(g_height + 4);
591 g_App->setMainWidget(g_SV);
592 g_SV->show();
593 g_MW->setMouseTracking(true);
594 if (g_title[0] != 0)
595 {
596 g_SV->setCaption(g_title);
597 }
598
599/* XGrayKey(0, 64, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
600 XGrayKey(0, 113, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
601 XGrayKey(0, 37, AnyModifie, SV-winId(), 0, GrabModeAsync, GrabModeAsync);
602 XGrayKey(0, 109, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
603 XGrayKey(0, 115, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
604 XGrayKey(0, 116, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
605 XGrayKey(0, 117, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
606 XGrayKey(0, 62, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
607 XGrayKey(0, 50, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);*/
608
609 return 1;
610}
void show()
Definition: qtewin.cpp:738
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
int g_width
Definition: qtwin.cpp:51
static QPainter * g_P2
Definition: qtwin.cpp:93
int g_height
Definition: qtwin.cpp:50
static char g_title[128]
Definition: qtwin.cpp:75
static QPixmap * g_BS
Definition: qtwin.cpp:90
static QApplication * g_App
Definition: qtwin.cpp:87
static QRegion * g_ClipRect
Definition: qtwin.cpp:103
static QMyScrollView * g_SV
Definition: qtwin.cpp:89
static QPixmap * g_DS
Definition: qtwin.cpp:91
static QMyMainWindow * g_MW
Definition: qtwin.cpp:88
static QPainter * g_P1
Definition: qtwin.cpp:92

Referenced by main(), rdp2vnc_connect(), and xwin_toggle_fullscreen().

◆ ui_deinit()

void ui_deinit ( void  )

Definition at line 553 of file qtwin.cpp.

554{
555 delete g_App;
556}

Referenced by main().

◆ ui_desktop_restore()

void ui_desktop_restore ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 561 of file uimain.c.

562{
563}

Referenced by process_desksave().

◆ ui_desktop_save()

void ui_desktop_save ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 567 of file uimain.c.

568{
569}

Referenced by process_desksave().

◆ ui_destblt()

void ui_destblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 607 of file uimain.c.

608{
609 bs_rect(x, y, cx, cy, 0, opcode);
610 ui_invalidate(x, y, cx, cy);
611 /* todo */
612}
void bs_rect(int x, int y, int cx, int cy, int colour, int rop)
Definition: bsops.c:386
void ui_invalidate(int x, int y, int cx, int cy)
Definition: uimain.c:138

Referenced by process_destblt().

◆ ui_destroy_bitmap()

void ui_destroy_bitmap ( RD_HBITMAP  bmp)

◆ ui_destroy_colourmap()

void ui_destroy_colourmap ( RD_HCOLOURMAP  map)

Definition at line 1532 of file qtewin.cpp.

1533{
1534}

Referenced by ui_set_colourmap().

◆ ui_destroy_cursor()

void ui_destroy_cursor ( RD_HCURSOR  cursor)

Referenced by cache_put_cursor().

◆ ui_destroy_glyph()

void ui_destroy_glyph ( RD_HGLYPH  glyph)

Definition at line 1424 of file qtewin.cpp.

1425{
1426 struct bitmap* the_glyph;
1427
1428 the_glyph = (struct bitmap*)glyph;
1429 if (the_glyph != NULL)
1430 {
1431 if (the_glyph->data != NULL)
1432 xfree(the_glyph->data);
1433 xfree(the_glyph);
1434 }
1435}
void xfree(void *in_val)
Definition: qtewin.cpp:2161

Referenced by cache_put_font(), and ui_patblt().

◆ ui_destroy_window()

void ui_destroy_window ( void  )

Definition at line 637 of file qtwin.cpp.

638{
639 delete g_MW;
640 delete g_SV;
641 delete g_BS;
642 delete g_DS;
643 delete g_P1;
644 delete g_P2;
645 delete g_ClipRect;
646}

Referenced by main(), rdp2vnc_connect(), and xwin_toggle_fullscreen().

◆ ui_draw_glyph()

void ui_draw_glyph ( int  mixmode,
int  x,
int  y,
int  cx,
int  cy,
RD_HGLYPH  glyph,
int  srcx,
int  srcy,
int  bgcolour,
int  fgcolour 
)

Definition at line 782 of file vnc.c.

786{
787 int xx, yy;
788 int ox, oy;
789 vncBuffer *buf = vncDupBuffer(glyph);
790
791 x &= 0xffff;
792 y &= 0xffff;
793
794 /* yes, sometimes same fgcolour and bgcolour are sent, but because
795 * of transparency, we have to change that! */
796 if (mixmode == MIX_TRANSPARENT && fgcolour == bgcolour)
797 bgcolour = fgcolour ^ 0xff;
798
799 ox = x;
800 oy = y;
801
802 for (yy = srcy; yy < srcy + cy; yy++)
803 {
804 for (xx = srcx; xx < srcx + cx; xx++)
805 {
806 vncSetPixel(buf, xx, yy, vncGetPixel(buf, xx, yy) ? fgcolour : bgcolour);
807 }
808 }
809
810 switch (mixmode)
811 {
812 case MIX_TRANSPARENT:
813 if (vncwinClipRect(&x, &y, &cx, &cy))
814 {
815 //if we clipped top or left, we have to adjust srcx,srcy;
816 srcx += x - ox;
817 srcy += y - oy;
818 vncTransBlitFrom(server, x, y, cx, cy, buf, srcx, srcy, bgcolour);
819 }
820 break;
821 case MIX_OPAQUE:
822 if (vncwinClipRect(&x, &y, &cx, &cy))
823 {
824 //if we clipped top or left, we have to adjust srcx,srcy;
825 srcx += x - ox;
826 srcy += y - oy;
827 vncCopyBlitFrom(server, x, y, cx, cy, buf, srcx, srcy);
828 }
829 break;
830
831 default:
832 unimpl("mix %d\n", mixmode);
833 }
835}
#define MIX_TRANSPARENT
Definition: constants.h:272
#define MIX_OPAQUE
Definition: constants.h:273
int xx
Definition: npserver.c:29
Definition: vnc.h:11
void vncTransBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *src, int srcx, int srcy, int bg)
Definition: vnc.c:1082
BOOL vncwinClipRect(int *x, int *y, int *cx, int *cy)
Definition: vnc.c:102
vncPixel vncGetPixel(vncBuffer *b, int x, int y)
Definition: vnc.c:1218
vncBuffer * vncDupBuffer(vncBuffer *b)
Definition: vnc.c:1003
void vncCopyBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer *src, int srcx, int srcy)
Definition: vnc.c:1075
void vncDeleteBuffer(vncBuffer *b)
Definition: vnc.c:1170
void vncSetPixel(vncBuffer *b, int x, int y, vncPixel c)
Definition: vnc.c:1225

◆ ui_draw_text()

void ui_draw_text ( uint8  font,
uint8  flags,
uint8  opcode,
int  mixmode,
int  x,
int  y,
int  clipx,
int  clipy,
int  clipcx,
int  clipcy,
int  boxx,
int  boxy,
int  boxcx,
int  boxcy,
BRUSH brush,
int  bgcolour,
int  fgcolour,
uint8 text,
uint8  length 
)

Definition at line 412 of file uimain.c.

417{
418 int i;
419 int j;
420 int xyoffset;
421 DATABLOB * entry;
422 FONTGLYPH * glyph;
423
424 if (boxx + boxcx > g_width)
425 {
426 boxcx = g_width - boxx;
427 }
428 if (boxcx > 1)
429 {
430 bs_rect(boxx, boxy, boxcx, boxcy, bgcolour, 0xc);
431 }
432 else
433 {
434 if (mixmode == MIX_OPAQUE)
435 {
436 bs_rect(clipx, clipy, clipcx, clipcy, bgcolour, 0xc);
437 }
438 }
439 /* Paint text, character by character */
440 for (i = 0; i < length;)
441 {
442 switch (text[i])
443 {
444 case 0xff:
445 if (i + 2 < length)
446 {
447 cache_put_text(text[i + 1], text, text[i + 2]);
448 }
449 else
450 {
451 error("this shouldn't be happening\n");
452 exit(1);
453 }
454 /* this will move pointer from start to first character after */
455 /* FF command */
456 length -= i + 3;
457 text = &(text[i + 3]);
458 i = 0;
459 break;
460 case 0xfe:
461 entry = cache_get_text(text[i + 1]);
462 if (entry != NULL)
463 {
464 if ((((uint8 *) (entry->data))[1] == 0) &&
465 (!(flags & TEXT2_IMPLICIT_X)))
466 {
467 if (flags & TEXT2_VERTICAL)
468 {
469 y += text[i + 2];
470 }
471 else
472 {
473 x += text[i + 2];
474 }
475 }
476 for (j = 0; j < entry->size; j++)
477 {
478 DO_GLYPH(((uint8 *) (entry->data)), j);
479 }
480 }
481 if (i + 2 < length)
482 {
483 i += 3;
484 }
485 else
486 {
487 i += 2;
488 }
489 length -= i;
490 /* this will move pointer from start to first character after */
491 /* FE command */
492 text = &(text[i]);
493 i = 0;
494 break;
495 default:
496 DO_GLYPH(text, i);
497 i++;
498 break;
499 }
500 }
501 if (boxcx > 1)
502 {
503 ui_invalidate(boxx, boxy, boxcx, boxcy);
504 }
505 else
506 {
507 ui_invalidate(clipx, clipy, clipcx, clipcy);
508 }
509}
void cache_put_text(uint8 cache_id, void *data, int length)
Definition: cache.c:335
DATABLOB * cache_get_text(uint8 cache_id)
Definition: cache.c:325
#define TEXT2_IMPLICIT_X
Definition: constants.h:276
#define TEXT2_VERTICAL
Definition: constants.h:275
int g_width
Definition: uimain.c:42
#define DO_GLYPH(ttext, idx)
Definition: uimain.c:369

Referenced by process_text2().

◆ ui_ellipse()

void ui_ellipse ( uint8  opcode,
uint8  fillmode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 699 of file uimain.c.

702{
703 /* not used */
704}

Referenced by process_ellipse(), and process_ellipse2().

◆ ui_end_update()

void ui_end_update ( void  )

Definition at line 664 of file uimain.c.

665{
667}
void mi_end_update(void)
Definition: win32.c:1188

Referenced by process_update_pdu(), and rdp5_process().

◆ ui_get_numlock_state()

uint16 ui_get_numlock_state ( unsigned int  state)

Definition at line 1620 of file svgawin.c.

1621{
1622 return 0;
1623}

Referenced by process_demand_active().

◆ ui_have_window()

RD_BOOL ui_have_window ( void  )

◆ ui_init()

RD_BOOL ui_init ( void  )

Definition at line 546 of file qtwin.cpp.

547{
548 g_App = new QApplication(g_argc, g_argv);
549 return 1;
550}
static char ** g_argv
Definition: qtwin.cpp:69
static int g_argc
Definition: qtwin.cpp:68

Referenced by main().

◆ ui_init_connection()

void ui_init_connection ( void  )

◆ ui_line()

void ui_line ( uint8  opcode,
int  startx,
int  starty,
int  endx,
int  endy,
PEN pen 
)

Definition at line 513 of file uimain.c.

515{
516 int x;
517 int y;
518 int cx;
519 int cy;
520
521 bs_line(opcode, startx, starty, endx, endy, pen->width, pen->style,
522 pen->colour);
523 if (pen->style == 0 && pen->width < 2 && opcode == 12)
524 {
525 mi_line(startx, starty, endx, endy, pen->colour);
526 }
527 else
528 {
529 x = MIN(startx, endx);
530 y = MIN(starty, endy);
531 cx = (MAX(startx, endx) + 1) - x;
532 cy = (MAX(starty, endy) + 1) - y;
533 ui_invalidate(x, y, cx, cy);
534 }
535}
#define MAX(x, y)
Definition: rdesktop.h:175
void bs_line(int opcode, int startx, int starty, int endx, int endy, int pen_width, int pen_style, int pen_colour)
Definition: bsops.c:661
uint8 style
Definition: types.h:84
uint8 width
Definition: types.h:85
uint32 colour
Definition: types.h:86
void mi_line(int x1, int y1, int x2, int y2, int colour)
Definition: win32.c:1239

Referenced by process_line(), and ui_polyline().

◆ ui_memblt()

void ui_memblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
RD_HBITMAP  src,
int  srcx,
int  srcy 
)

Referenced by process_memblt().

◆ ui_move_pointer()

void ui_move_pointer ( int  x,
int  y 
)

Definition at line 616 of file uimain.c.

617{
618}

Referenced by process_pointer_pdu(), and rdp5_process().

◆ ui_paint_bitmap()

void ui_paint_bitmap ( int  x,
int  y,
int  cx,
int  cy,
int  width,
int  height,
uint8 data 
)

Definition at line 307 of file uimain.c.

309{
310 struct bitmap b;
311
312 b.width = width;
313 b.height = height;
314 b.data = data;
315 ui_memblt(12, x, y, cx, cy, &b, 0, 0);
316}
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, void *src, int srcx, int srcy)
Definition: uimain.c:548

Referenced by process_bitmap_updates(), and ui_desktop_restore().

◆ ui_patblt()

void ui_patblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 597 of file uimain.c.

599{
600 bs_patblt(opcode, x, y, cx, cy, brush->style, (char *)brush->pattern,
601 brush->xorigin, brush->yorigin, bgcolour, fgcolour);
602 ui_invalidate(x, y, cx, cy);
603}
void bs_patblt(int opcode, int x, int y, int cx, int cy, int brush_style, char *brush_pattern, int brush_x_org, int brush_y_org, int bgcolour, int fgcolour)
Definition: bsops.c:744

Referenced by process_patblt(), and ui_triblt().

◆ ui_polygon()

void ui_polygon ( uint8  opcode,
uint8  fillmode,
RD_POINT point,
int  npoints,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 671 of file uimain.c.

673{
674 /* not used */
675}

Referenced by process_polygon(), and process_polygon2().

◆ ui_polyline()

void ui_polyline ( uint8  opcode,
RD_POINT points,
int  npoints,
PEN pen 
)

Definition at line 679 of file uimain.c.

680{
681 int i, x, y, dx, dy;
682 if (npoints > 0)
683 {
684 x = points[0].x;
685 y = points[0].y;
686 for (i = 1; i < npoints; i++)
687 {
688 dx = points[i].x;
689 dy = points[i].y;
690 ui_line(opcode, x, y, x + dx, y + dy, pen);
691 x = x + dx;
692 y = y + dy;
693 }
694 }
695}
GLsizei const GLfloat * points
Definition: glext.h:8112
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
Definition: uimain.c:513

Referenced by process_polyline().

◆ ui_rect()

void ui_rect ( int  x,
int  y,
int  cx,
int  cy,
int  colour 
)

Definition at line 573 of file uimain.c.

574{
575 bs_rect(x, y, cx, cy, colour, 12);
576 mi_fill_rect(x, y, cx, cy, colour);
577}
void mi_fill_rect(int x, int y, int cx, int cy, int colour)
Definition: win32.c:1194

Referenced by process_rect(), ui_destblt(), and ui_draw_text().

◆ ui_reset_clip()

void ui_reset_clip ( void  )

Definition at line 328 of file uimain.c.

329{
332}
void bs_reset_clip(void)
Definition: bsops.c:199
void mi_reset_clip(void)
Definition: win32.c:1335

Referenced by process_orders(), and ui_create_window().

◆ ui_resize_window()

void ui_resize_window ( void  )

Definition at line 651 of file uimain.c.

652{
653}

Referenced by rdp_process_bitmap_caps().

◆ ui_screenblt()

void ui_screenblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
int  srcx,
int  srcy 
)

Definition at line 581 of file uimain.c.

583{
584 bs_screenblt(opcode, x, y, cx, cy, srcx, srcy);
585 if (opcode == 12)
586 {
587 mi_screen_copy(x, y, cx, cy, srcx, srcy);
588 }
589 else
590 {
591 ui_invalidate(x, y, cx, cy);
592 }
593}
void bs_screenblt(int rop, int x, int y, int cx, int cy, int srcx, int srcy)
Definition: bsops.c:469
void mi_screen_copy(int x, int y, int cx, int cy, int srcx, int srcy)
Definition: win32.c:1283

Referenced by process_screenblt().

◆ ui_seamless_ack()

void ui_seamless_ack ( unsigned int  serial)

Referenced by seamless_process_line().

◆ ui_seamless_begin()

void ui_seamless_begin ( RD_BOOL  hidden)

Referenced by seamless_process_line().

◆ ui_seamless_create_window()

void ui_seamless_create_window ( unsigned long  id,
unsigned long  group,
unsigned long  parent,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_delicon()

void ui_seamless_delicon ( unsigned long  id,
const char format,
int  width,
int  height 
)

◆ ui_seamless_destroy_group()

void ui_seamless_destroy_group ( unsigned long  id,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_destroy_window()

void ui_seamless_destroy_window ( unsigned long  id,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_end()

void ui_seamless_end ( )

◆ ui_seamless_hide_desktop()

void ui_seamless_hide_desktop ( void  )

Referenced by seamless_process_line().

◆ ui_seamless_move_window()

void ui_seamless_move_window ( unsigned long  id,
int  x,
int  y,
int  width,
int  height,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_restack_window()

void ui_seamless_restack_window ( unsigned long  id,
unsigned long  behind,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_seticon()

void ui_seamless_seticon ( unsigned long  id,
const char format,
int  width,
int  height,
int  chunk,
const char data,
int  chunk_len 
)

◆ ui_seamless_setstate()

void ui_seamless_setstate ( unsigned long  id,
unsigned int  state,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_settitle()

void ui_seamless_settitle ( unsigned long  id,
const char title,
unsigned long  flags 
)

Referenced by seamless_process_line().

◆ ui_seamless_syncbegin()

void ui_seamless_syncbegin ( unsigned long  flags)

Referenced by seamless_process_line().

◆ ui_seamless_toggle()

◆ ui_seamless_unhide_desktop()

void ui_seamless_unhide_desktop ( void  )

Referenced by seamless_process_line().

◆ ui_select()

int ui_select ( int  rdp_socket)

Definition at line 164 of file uimain.c.

165{
166 if (g_tcp_sck == 0)
167 {
168 g_tcp_sck = in;
169 }
170 return 1;
171}
int g_tcp_sck
Definition: uimain.c:51

Referenced by tcp_recv().

◆ ui_set_clip()

void ui_set_clip ( int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 320 of file uimain.c.

321{
322 bs_set_clip(x, y, cx, cy);
323 mi_set_clip(x, y, cx, cy);
324}
void bs_set_clip(int x, int y, int cx, int cy)
Definition: bsops.c:189
void mi_set_clip(int x, int y, int cx, int cy)
Definition: win32.c:1325

Referenced by process_orders(), and ui_create_window().

◆ ui_set_colourmap()

void ui_set_colourmap ( RD_HCOLOURMAP  map)

Definition at line 1527 of file qtewin.cpp.

1528{
1529}

Referenced by process_colcache(), and process_palette().

◆ ui_set_cursor()

◆ ui_set_null_cursor()

void ui_set_null_cursor ( void  )

Definition at line 227 of file uimain.c.

228{
230}
void mi_set_null_cursor(void)
Definition: win32.c:1380

Referenced by process_system_pointer_pdu(), and rdp5_process().

◆ ui_triblt()

void ui_triblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
RD_HBITMAP  src,
int  srcx,
int  srcy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Referenced by process_triblt().

◆ unimpl()

◆ warning()

void warning ( char format,
  ... 
)

Definition at line 785 of file uimain.c.

786{
787 va_list ap;
788 char text[512];
789 char text1[512];
790
791 sprintf(text1, "WARNING: ");
794 va_end(ap);
795 strcat(text1, text);
796 mi_warning(text1);
797}

◆ xclip_deinit()

void xclip_deinit ( void  )

Referenced by ui_deinit().

◆ xclip_init()

void xclip_init ( void  )

Referenced by ui_init().

◆ xfree()

◆ xkeymap_from_locale()

RD_BOOL xkeymap_from_locale ( const char locale)

Referenced by main().

◆ xkeymap_init()

void xkeymap_init ( void  )

Referenced by init_keyboard(), and ui_init().

◆ xkeymap_open()

FILE * xkeymap_open ( const char filename)

Definition at line 222 of file xkeymap.c.

223{
224 char *path1, *path2;
225 char *home;
226 FILE *fp;
227
228 /* Try ~/.rdesktop/keymaps */
229 home = getenv("HOME");
230 if (home)
231 {
232 path1 = pathjoin(home, ".rdesktop/keymaps");
234 xfree(path1);
235 fp = fopen(path2, "r");
236 xfree(path2);
237 if (fp)
238 return fp;
239 }
240
241 /* Try KEYMAP_PATH */
242 path1 = pathjoin(KEYMAP_PATH, filename);
243 fp = fopen(path1, "r");
244 xfree(path1);
245 if (fp)
246 return fp;
247
248 /* Try current directory, in case we are running from the source
249 tree */
250 path1 = pathjoin("keymaps", filename);
251 fp = fopen(path1, "r");
252 xfree(path1);
253 if (fp)
254 return fp;
255
256 return NULL;
257}
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path2[]
Definition: path.c:29
static char * pathjoin(const char *a, const char *b)
Definition: xkeymap.c:202

Referenced by xkeymap_from_locale(), and xkeymap_read().

◆ xkeymap_send_keys()

void xkeymap_send_keys ( uint32  keysym,
unsigned int  keycode,
unsigned int  state,
uint32  ev_time,
RD_BOOL  pressed,
uint8  nesting 
)

Referenced by xwin_process_events().

◆ xkeymap_translate_button()

uint16 xkeymap_translate_button ( unsigned int  button)

Definition at line 714 of file xkeymap.c.

715{
716 switch (button)
717 {
718 case Button1: /* left */
719 return MOUSE_FLAG_BUTTON1;
720 case Button2: /* middle */
721 return MOUSE_FLAG_BUTTON3;
722 case Button3: /* right */
723 return MOUSE_FLAG_BUTTON2;
724 case Button4: /* wheel up */
725 return MOUSE_FLAG_BUTTON4;
726 case Button5: /* wheel down */
727 return MOUSE_FLAG_BUTTON5;
728 }
729
730 return 0;
731}
#define MOUSE_FLAG_BUTTON5
Definition: constants.h:259
#define MOUSE_FLAG_BUTTON1
Definition: constants.h:255
#define MOUSE_FLAG_BUTTON2
Definition: constants.h:256
#define MOUSE_FLAG_BUTTON4
Definition: constants.h:258
#define MOUSE_FLAG_BUTTON3
Definition: constants.h:257
DWORD button
Definition: button.c:166
#define Button1
Definition: x11stubs.h:19
#define Button3
Definition: x11stubs.h:21
#define Button2
Definition: x11stubs.h:20
#define Button5
Definition: x11stubs.h:23
#define Button4
Definition: x11stubs.h:22

Referenced by handle_button_event().

◆ xkeymap_translate_key()

key_translation xkeymap_translate_key ( uint32  keysym,
unsigned int  keycode,
unsigned int  state 
)

Referenced by vncKey().

◆ xmalloc()

void * xmalloc ( int  size)

Definition at line 747 of file uimain.c.

748{
749 if (size < 1)
750 {
751 size = 1;
752 }
753 return malloc(size);
754}
#define malloc
Definition: debug_ros.c:4

Referenced by accel_fill_rect(), accel_screen_copy(), add_async_iorequest(), add_block(), add_block_index(), add_filename_node(), add_func_desc(), add_importlib(), add_sequence(), add_structure_typeinfo(), add_to_keymap(), add_typeinfo_block(), add_var_desc(), AskTagProc(), cache_put_text(), cache_rect(), check_for_additional_prototype_types(), cliprdr_send_native_format_announce(), create_library_block(), create_msft_typeinfo(), create_msft_typelib(), ctl2_alloc_segment(), disk_enum_devices(), format_namespace(), get_file_version(), get_subtests(), init_sltg_data(), lf2crlf(), load_licence(), local_href(), lspci_process(), main(), make_expr(), make_expr1(), make_expr2(), make_expr3(), make_exprd(), make_exprl(), make_exprs(), make_exprt(), new_index_name(), NotifyInfo(), of_reverse(), output_typelib_regscript(), QMyMainWindow::paintEvent(), parallel_enum_devices(), param_connect(), pathjoin(), printer_enum_devices(), printercache_load_blob(), printercache_mkdir(), printercache_rename_blob(), printercache_save_blob(), printercache_unlink_blob(), process_bitmap_updates(), process_bmpcache(), process_bmpcache2(), process_brushcache(), process_colcache(), process_palette(), process_polygon(), process_polygon2(), process_polyline(), process_raw_bmpcache(), process_redirect_pdu(), pstcache_load_bitmap(), rdp_in_unistr(), rdpdr_process_irp(), rdssl_sign_ok(), read_importlib(), read_msft_importlib(), run_tests(), save_licence(), seamless_process(), sec_connect(), serial_enum_devices(), sltg_add_typeinfo(), str_handle_lines(), sw_find_group(), tcp_connect(), QMyScrollView::timerEvent(), translate_image(), type_dispinterface_define(), type_dispinterface_define_from_iface(), type_interface_define(), type_module_define(), type_new_encapsulated_union(), type_new_enum(), type_new_function(), type_new_nonencapsulated_union(), type_new_struct(), ui_clip_format_announce(), ui_create_bitmap(), ui_create_colourmap(), ui_create_cursor(), ui_create_glyph(), ui_create_window(), ui_desktop_save(), ui_init(), ui_invalidate(), ui_memblt(), ui_patblt(), ui_screenblt(), ui_seamless_create_window(), vncNewBuffer(), vncNewColourMap(), vncNewCursor(), write_conf_or_var_desc(), write_var_desc(), xclip_send_data_with_convert(), and xstrdup().

◆ xrealloc()

◆ xstrdup()

char * xstrdup ( const char s)

Definition at line 768 of file uimain.c.

769{
770 int len;
771 char * p;
772
773 if (s == 0)
774 {
775 return 0;
776 }
777 len = strlen(s);
778 p = (char *) xmalloc(len + 1);
779 strcpy(p, s);
780 return p;
781}

Referenced by add_importlib(), check_for_additional_prototype_types(), duptype(), extract_test(), main(), make_token(), seamless_process_line(), set_target(), type_new_alias(), type_new_array(), type_new_encapsulated_union(), type_new_function(), wave_out_open(), write_conf_or_var_desc(), and xkeymap_from_locale().

◆ xwin_toggle_fullscreen()

void xwin_toggle_fullscreen ( void  )

Definition at line 124 of file vnc.c.

125{
126}

Referenced by handle_special_keys().