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

Go to the source code of this file.

Functions

BOOL bitmap_decompress (uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
 
void cache_rebuild_bmpcache_linked_list (RDPCLIENT *This, uint8 id, sint16 *idx, int count)
 
void cache_bump_bitmap (RDPCLIENT *This, uint8 id, uint16 idx, int bump)
 
void cache_evict_bitmap (RDPCLIENT *This, uint8 id)
 
HBITMAP cache_get_bitmap (RDPCLIENT *This, uint8 id, uint16 idx)
 
void cache_put_bitmap (RDPCLIENT *This, uint8 id, uint16 idx, HBITMAP bitmap)
 
void cache_save_state (RDPCLIENT *This)
 
FONTGLYPHcache_get_font (RDPCLIENT *This, uint8 font, uint16 character)
 
void cache_put_font (RDPCLIENT *This, uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap)
 
DATABLOBcache_get_text (RDPCLIENT *This, uint8 cache_id)
 
void cache_put_text (RDPCLIENT *This, uint8 cache_id, void *data, int length)
 
uint8cache_get_desktop (RDPCLIENT *This, uint32 offset, int cx, int cy, int bytes_per_pixel)
 
void cache_put_desktop (RDPCLIENT *This, uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 *data)
 
HCURSOR cache_get_cursor (RDPCLIENT *This, uint16 cache_idx)
 
void cache_put_cursor (RDPCLIENT *This, uint16 cache_idx, HCURSOR cursor)
 
VCHANNELchannel_register (RDPCLIENT *This, char *name, uint32 flags, void(*callback)(RDPCLIENT *, STREAM))
 
STREAM channel_init (RDPCLIENT *This, VCHANNEL *channel, uint32 length)
 
void channel_send (RDPCLIENT *This, STREAM s, VCHANNEL *channel)
 
void channel_process (RDPCLIENT *This, STREAM s, uint16 mcs_channel)
 
void cliprdr_send_simple_native_format_announce (RDPCLIENT *This, uint32 format)
 
void cliprdr_send_native_format_announce (RDPCLIENT *This, uint8 *formats_data, uint32 formats_data_length)
 
void cliprdr_send_data_request (RDPCLIENT *This, uint32 format)
 
void cliprdr_send_data (RDPCLIENT *This, uint8 *data, uint32 length)
 
void cliprdr_set_mode (RDPCLIENT *This, const char *optarg)
 
BOOL cliprdr_init (RDPCLIENT *This)
 
int mppc_expand (RDPCLIENT *This, uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
 
int get_current_workarea (RDPCLIENT *This, uint32 *x, uint32 *y, uint32 *width, uint32 *height)
 
void ewmh_init (RDPCLIENT *This)
 
STREAM iso_init (RDPCLIENT *This, int length)
 
BOOL iso_send (RDPCLIENT *This, STREAM s)
 
STREAM iso_recv (RDPCLIENT *This, uint8 *rdpver)
 
BOOL iso_connect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_reconnect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_disconnect (RDPCLIENT *This)
 
void iso_reset_state (RDPCLIENT *This)
 
void licence_process (RDPCLIENT *This, STREAM s)
 
STREAM mcs_init (RDPCLIENT *This, int length)
 
BOOL mcs_send_to_channel (RDPCLIENT *This, STREAM s, uint16 channel)
 
BOOL mcs_send (RDPCLIENT *This, STREAM s)
 
STREAM mcs_recv (RDPCLIENT *This, uint16 *channel, uint8 *rdpver)
 
BOOL mcs_connect (RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
 
BOOL mcs_reconnect (RDPCLIENT *This, char *server, char *cookie, STREAM mcs_data)
 
void mcs_disconnect (RDPCLIENT *This)
 
void mcs_reset_state (RDPCLIENT *This)
 
void process_orders (RDPCLIENT *This, STREAM s, uint16 num_orders)
 
void reset_order_state (RDPCLIENT *This)
 
int parallel_enum_devices (RDPCLIENT *This, uint32 *id, char *optarg)
 
int printer_enum_devices (RDPCLIENT *This, uint32 *id, char *optarg)
 
int printercache_load_blob (char *printer_name, uint8 **data)
 
void printercache_process (RDPCLIENT *This, STREAM s)
 
void pstcache_touch_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx, uint32 stamp)
 
BOOL pstcache_load_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx)
 
BOOL pstcache_save_bitmap (RDPCLIENT *This, uint8 cache_id, uint16 cache_idx, uint8 *key, uint8 width, uint8 height, uint16 length, uint8 *data)
 
int pstcache_enumerate (RDPCLIENT *This, uint8 id, HASH_KEY *keylist)
 
BOOL pstcache_init (RDPCLIENT *This, uint8 cache_id)
 
int main (int argc, char *argv[])
 
void generate_random (uint8 *random)
 
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)
 
BOOL str_startswith (const char *s, const char *prefix)
 
BOOL str_handle_lines (RDPCLIENT *This, const char *input, char **rest, str_handle_lines_t linehandler, void *data)
 
BOOL subprocess (RDPCLIENT *This, char *const argv[], str_handle_lines_t linehandler, void *data)
 
charl_to_a (long N, int base)
 
int load_licence (RDPCLIENT *This, unsigned char **data)
 
void save_licence (RDPCLIENT *This, unsigned char *data, int length)
 
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)
 
BOOL rd_lock_file (int fd, int start, int len)
 
BOOL rdp5_process (RDPCLIENT *This, STREAM s)
 
void rdp_out_unistr (RDPCLIENT *This, STREAM s, wchar_t *string, int len)
 
int rdp_in_unistr (RDPCLIENT *This, STREAM s, wchar_t *string, int uni_len)
 
BOOL rdp_send_input (RDPCLIENT *This, uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
 
BOOL rdp_send_client_window_status (RDPCLIENT *This, int status)
 
void process_colour_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_cached_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_system_pointer_pdu (RDPCLIENT *This, STREAM s)
 
void process_bitmap_updates (RDPCLIENT *This, STREAM s)
 
void process_palette (RDPCLIENT *This, STREAM s)
 
void process_disconnect_pdu (STREAM s, uint32 *ext_disc_reason)
 
void rdp_main_loop (RDPCLIENT *This, BOOL *deactivated, uint32 *ext_disc_reason)
 
BOOL rdp_loop (RDPCLIENT *This, BOOL *deactivated, uint32 *ext_disc_reason)
 
BOOL rdp_connect (RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
 
BOOL rdp_reconnect (RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
 
void rdp_reset_state (RDPCLIENT *This)
 
void rdp_disconnect (RDPCLIENT *This)
 
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 (RDPCLIENT *This, uint8 *data, int length)
 
STREAM sec_init (RDPCLIENT *This, uint32 flags, int maxlen)
 
BOOL sec_send_to_channel (RDPCLIENT *This, STREAM s, uint32 flags, uint16 channel)
 
BOOL sec_send (RDPCLIENT *This, STREAM s, uint32 flags)
 
void sec_process_mcs_data (RDPCLIENT *This, STREAM s)
 
STREAM sec_recv (RDPCLIENT *This, uint8 *rdpver)
 
BOOL sec_connect (RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
 
BOOL sec_reconnect (RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
 
void sec_disconnect (RDPCLIENT *This)
 
void sec_reset_state (RDPCLIENT *This)
 
STREAM tcp_init (RDPCLIENT *This, uint32 maxlen)
 
BOOL tcp_send (RDPCLIENT *This, STREAM s)
 
STREAM tcp_recv (RDPCLIENT *This, STREAM s, uint32 length)
 
BOOL tcp_connect (RDPCLIENT *This, char *server)
 
BOOL tcp_disconnect (RDPCLIENT *This)
 
wchar_ttcp_get_address (RDPCLIENT *This)
 
void tcp_reset_state (RDPCLIENT *This)
 
void ui_clip_format_announce (RDPCLIENT *This, uint8 *data, uint32 length)
 
void ui_clip_handle_data (RDPCLIENT *This, uint8 *data, uint32 length)
 
void ui_clip_request_failed (RDPCLIENT *This)
 
void ui_clip_request_data (RDPCLIENT *This, uint32 format)
 
void ui_clip_sync (RDPCLIENT *This)
 
void ui_clip_set_mode (RDPCLIENT *This, const char *optarg)
 
void xclip_init (RDPCLIENT *This)
 
void xclip_deinit (RDPCLIENT *This)
 
BOOL get_key_state (RDPCLIENT *This, unsigned int state, uint32 keysym)
 
BOOL ui_init (RDPCLIENT *This)
 
void ui_deinit (RDPCLIENT *This)
 
BOOL ui_create_window (RDPCLIENT *This)
 
void ui_resize_window (RDPCLIENT *This)
 
void ui_destroy_window (RDPCLIENT *This)
 
void xwin_toggle_fullscreen (RDPCLIENT *This)
 
int ui_select (RDPCLIENT *This, SOCKET rdp_socket)
 
void ui_move_pointer (RDPCLIENT *This, int x, int y)
 
HBITMAP ui_create_bitmap (RDPCLIENT *This, int width, int height, uint8 *data)
 
void ui_paint_bitmap (RDPCLIENT *This, int x, int y, int cx, int cy, int width, int height, uint8 *data)
 
void ui_destroy_bitmap (RDPCLIENT *This, HBITMAP bmp)
 
HGLYPH ui_create_glyph (RDPCLIENT *This, int width, int height, const uint8 *data)
 
void ui_destroy_glyph (RDPCLIENT *This, HGLYPH glyph)
 
HCURSOR ui_create_cursor (RDPCLIENT *This, unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
 
void ui_set_cursor (RDPCLIENT *This, HCURSOR cursor)
 
void ui_destroy_cursor (RDPCLIENT *This, HCURSOR cursor)
 
void ui_set_null_cursor (RDPCLIENT *This)
 
HCOLOURMAP ui_create_colourmap (RDPCLIENT *This, COLOURMAP *colours)
 
void ui_destroy_colourmap (RDPCLIENT *This, HCOLOURMAP map)
 
void ui_set_colourmap (RDPCLIENT *This, HCOLOURMAP map)
 
void ui_set_clip (RDPCLIENT *This, int x, int y, int cx, int cy)
 
void ui_reset_clip (RDPCLIENT *This)
 
void ui_bell (RDPCLIENT *This)
 
void ui_destblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy)
 
void ui_patblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_screenblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
 
void ui_memblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
 
void ui_triblt (RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_line (RDPCLIENT *This, uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
 
void ui_rect (RDPCLIENT *This, int x, int y, int cx, int cy, int colour)
 
void ui_polygon (RDPCLIENT *This, uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_polyline (RDPCLIENT *This, uint8 opcode, POINT *points, int npoints, PEN *pen)
 
void ui_ellipse (RDPCLIENT *This, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_draw_glyph (RDPCLIENT *This, int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)
 
void ui_draw_text (RDPCLIENT *This, 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 (RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
 
void ui_desktop_restore (RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
 
void ui_begin_update (RDPCLIENT *This)
 
void ui_end_update (RDPCLIENT *This)
 
void ui_seamless_begin (RDPCLIENT *This, BOOL hidden)
 
void ui_seamless_hide_desktop (RDPCLIENT *This)
 
void ui_seamless_unhide_desktop (RDPCLIENT *This)
 
void ui_seamless_toggle (RDPCLIENT *This)
 
void ui_seamless_create_window (RDPCLIENT *This, unsigned long id, unsigned long group, unsigned long parent, unsigned long flags)
 
void ui_seamless_destroy_window (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
void ui_seamless_destroy_group (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
void ui_seamless_move_window (RDPCLIENT *This, unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void ui_seamless_restack_window (RDPCLIENT *This, unsigned long id, unsigned long behind, unsigned long flags)
 
void ui_seamless_settitle (RDPCLIENT *This, unsigned long id, const char *title, unsigned long flags)
 
void ui_seamless_setstate (RDPCLIENT *This, unsigned long id, unsigned int state, unsigned long flags)
 
void ui_seamless_syncbegin (RDPCLIENT *This, unsigned long flags)
 
void ui_seamless_ack (RDPCLIENT *This, unsigned int serial)
 
BOOL lspci_init (RDPCLIENT *This)
 
BOOL seamless_init (RDPCLIENT *This)
 
unsigned int seamless_send_sync (RDPCLIENT *This)
 
unsigned int seamless_send_state (RDPCLIENT *This, unsigned long id, unsigned int state, unsigned long flags)
 
unsigned int seamless_send_position (RDPCLIENT *This, unsigned long id, int x, int y, int width, int height, unsigned long flags)
 
void seamless_select_timeout (RDPCLIENT *This, struct timeval *tv)
 
unsigned int seamless_send_zchange (RDPCLIENT *This, unsigned long id, unsigned long below, unsigned long flags)
 
unsigned int seamless_send_focus (RDPCLIENT *This, unsigned long id, unsigned long flags)
 
BOOL event_pubkey (RDPCLIENT *This, unsigned char *key, unsigned int key_size)
 
void event_logon (RDPCLIENT *This)
 
BOOL event_redirect (RDPCLIENT *This, uint32 flags, uint32 server_len, wchar_t *server, uint32 cookie_len, char *cookie, uint32 username_len, wchar_t *username, uint32 domain_len, wchar_t *domain, uint32 password_len, wchar_t *password)
 

Function Documentation

◆ bitmap_decompress()

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
#define False
Definition: types.h:25
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

Referenced by process_bitmap_updates(), process_bmpcache(), and process_bmpcache2().

◆ 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
Definition: pdh_main.c:94

Referenced by sec_sign().

◆ cache_bump_bitmap()

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

Definition at line 89 of file cache.c.

90{
91 int p_idx, n_idx, n;
92
93 if (!IS_PERSISTENT(id))
94 return;
95
96 if (This->cache.bmpcache_mru[id] == idx)
97 return;
98
99 DEBUG_RDP5(("bump bitmap: id=%d, idx=%d, bump=%d\n", id, idx, bump));
100
101 n_idx = This->cache.bmpcache[id][idx].next;
102 p_idx = This->cache.bmpcache[id][idx].previous;
103
104 if (IS_SET(n_idx))
105 {
106 /* remove */
107 --This->cache.bmpcache_count[id];
108 if (IS_SET(p_idx))
109 This->cache.bmpcache[id][p_idx].next = n_idx;
110 else
111 This->cache.bmpcache_lru[id] = n_idx;
112 if (IS_SET(n_idx))
113 This->cache.bmpcache[id][n_idx].previous = p_idx;
114 else
115 This->cache.bmpcache_mru[id] = p_idx;
116 }
117 else
118 {
119 p_idx = NOT_SET;
120 n_idx = This->cache.bmpcache_lru[id];
121 }
122
123 if (bump >= 0)
124 {
125 for (n = 0; n < bump && IS_SET(n_idx); n++)
126 {
127 p_idx = n_idx;
128 n_idx = This->cache.bmpcache[id][p_idx].next;
129 }
130 }
131 else
132 {
133 p_idx = This->cache.bmpcache_mru[id];
134 n_idx = NOT_SET;
135 }
136
137 /* insert */
138 ++This->cache.bmpcache_count[id];
139 This->cache.bmpcache[id][idx].previous = p_idx;
140 This->cache.bmpcache[id][idx].next = n_idx;
141
142 if (p_idx >= 0)
143 This->cache.bmpcache[id][p_idx].next = idx;
144 else
145 This->cache.bmpcache_lru[id] = idx;
146
147 if (n_idx >= 0)
148 This->cache.bmpcache[id][n_idx].previous = idx;
149 else
150 This->cache.bmpcache_mru[id] = idx;
151}
#define IS_SET(idx)
Definition: cache.c:31
#define NOT_SET
Definition: cache.c:30
#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

◆ cache_evict_bitmap()

void cache_evict_bitmap ( RDPCLIENT This,
uint8  id 
)

Definition at line 155 of file cache.c.

156{
157 uint16 idx;
158 int n_idx;
159
160 if (!IS_PERSISTENT(id))
161 return;
162
163 idx = This->cache.bmpcache_lru[id];
164 n_idx = This->cache.bmpcache[id][idx].next;
165 DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=0x%x\n", id, idx, n_idx,
166 This->cache.bmpcache[id][idx].bitmap));
167
168 ui_destroy_bitmap(This, This->cache.bmpcache[id][idx].bitmap);
169 --This->cache.bmpcache_count[id];
170 This->cache.bmpcache[id][idx].bitmap = 0;
171
172 This->cache.bmpcache_lru[id] = n_idx;
173 This->cache.bmpcache[id][n_idx].previous = NOT_SET;
174
176}
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

◆ cache_get_bitmap()

HBITMAP cache_get_bitmap ( RDPCLIENT This,
uint8  id,
uint16  idx 
)

Definition at line 180 of file cache.c.

181{
182 if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
183 {
184 if (This->cache.bmpcache[id][idx].bitmap || pstcache_load_bitmap(This, id, idx))
185 {
186 if (IS_PERSISTENT(id))
188
189 return This->cache.bmpcache[id][idx].bitmap;
190 }
191 }
192 else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
193 {
194 return This->cache.volatile_bc[id];
195 }
196
197 error("get bitmap %d:%d\n", id, idx);
198 return NULL;
199}
#define BUMP_COUNT
Definition: cache.c:39
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
#define error(str)
Definition: mkdosfs.c:1605

◆ cache_get_cursor()

HCURSOR cache_get_cursor ( RDPCLIENT This,
uint16  cache_idx 
)

Definition at line 381 of file cache.c.

382{
384
385 if (cache_idx < NUM_ELEMENTS(This->cache.cursorcache))
386 {
387 cursor = This->cache.cursorcache[cache_idx];
388 if (cursor != NULL)
389 return cursor;
390 }
391
392 error("get cursor %d\n", cache_idx);
393 return NULL;
394}
const char cursor[]
Definition: icontest.c:13
HICON HCURSOR
Definition: windef.h:299

◆ cache_get_desktop()

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

Definition at line 336 of file cache.c.

337{
338 int length = cx * cy * bytes_per_pixel;
339
340 if (offset > sizeof(This->cache.deskcache))
341 offset = 0;
342
343 if ((offset + length) <= sizeof(This->cache.deskcache))
344 {
345 return &This->cache.deskcache[offset];
346 }
347
348 error("get desktop %d:%d\n", offset, length);
349 return NULL;
350}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
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

◆ cache_get_font()

FONTGLYPH * cache_get_font ( RDPCLIENT This,
uint8  font,
uint16  character 
)

Definition at line 262 of file cache.c.

263{
264 FONTGLYPH *glyph;
265
266 if ((font < NUM_ELEMENTS(This->cache.fontcache)) && (character < NUM_ELEMENTS(This->cache.fontcache[0])))
267 {
268 glyph = &This->cache.fontcache[font][character];
269 if (glyph->pixmap != NULL)
270 return glyph;
271 }
272
273 error("get font %d:%d\n", font, character);
274 return NULL;
275}
Definition: mk_font.cpp:20
RD_HBITMAP pixmap
Definition: types.h:116

◆ cache_get_text()

DATABLOB * cache_get_text ( RDPCLIENT This,
uint8  cache_id 
)

Definition at line 306 of file cache.c.

307{
308 DATABLOB *text;
309
310 text = &This->cache.textcache[cache_id];
311 return text;
312}
const WCHAR * text
Definition: package.c:1799

◆ cache_put_bitmap()

void cache_put_bitmap ( RDPCLIENT This,
uint8  id,
uint16  idx,
HBITMAP  bitmap 
)

Definition at line 203 of file cache.c.

204{
205 HBITMAP old;
206
207 if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
208 {
209 old = This->cache.bmpcache[id][idx].bitmap;
210 if (old != NULL)
212 This->cache.bmpcache[id][idx].bitmap = bitmap;
213
214 if (IS_PERSISTENT(id))
215 {
216 if (old == NULL)
217 This->cache.bmpcache[id][idx].previous = This->cache.bmpcache[id][idx].next = NOT_SET;
218
220 if (This->cache.bmpcache_count[id] > BMPCACHE2_C2_CELLS)
222 }
223 }
224 else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
225 {
226 old = This->cache.volatile_bc[id];
227 if (old != NULL)
229 This->cache.volatile_bc[id] = bitmap;
230 }
231 else
232 {
233 error("put bitmap %d:%d\n", id, idx);
234 }
235}
#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
static HBITMAP
Definition: button.c:44
Definition: uimain.c:89

◆ cache_put_cursor()

void cache_put_cursor ( RDPCLIENT This,
uint16  cache_idx,
HCURSOR  cursor 
)

Definition at line 398 of file cache.c.

399{
400 HCURSOR old;
401
402 if (cache_idx < NUM_ELEMENTS(This->cache.cursorcache))
403 {
404 old = This->cache.cursorcache[cache_idx];
405 if (old != NULL)
407
408 This->cache.cursorcache[cache_idx] = cursor;
409 }
410 else
411 {
412 error("put cursor %d\n", cache_idx);
413 }
414}
void ui_destroy_cursor(RD_HCURSOR cursor)

◆ cache_put_desktop()

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

Definition at line 354 of file cache.c.

355{
356 int length = cx * cy * bytes_per_pixel;
357
358 if (offset > sizeof(This->cache.deskcache))
359 offset = 0;
360
361 if ((offset + length) <= sizeof(This->cache.deskcache))
362 {
363 cx *= bytes_per_pixel;
364 while (cy--)
365 {
366 memcpy(&This->cache.deskcache[offset], data, cx);
367 data += scanline;
368 offset += cx;
369 }
370 }
371 else
372 {
373 error("put desktop %d:%d\n", offset, length);
374 }
375}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ cache_put_font()

void cache_put_font ( RDPCLIENT This,
uint8  font,
uint16  character,
uint16  offset,
uint16  baseline,
uint16  width,
uint16  height,
HGLYPH  pixmap 
)

Definition at line 279 of file cache.c.

281{
282 FONTGLYPH *glyph;
283
284 if ((font < NUM_ELEMENTS(This->cache.fontcache)) && (character < NUM_ELEMENTS(This->cache.fontcache[0])))
285 {
286 glyph = &This->cache.fontcache[font][character];
287 if (glyph->pixmap != NULL)
289
290 glyph->offset = offset;
291 glyph->baseline = baseline;
292 glyph->width = width;
293 glyph->height = height;
294 glyph->pixmap = pixmap;
295 }
296 else
297 {
298 error("put font %d:%d\n", font, character);
299 }
300}
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

◆ cache_put_text()

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

Definition at line 316 of file cache.c.

317{
318 DATABLOB *text;
319 void * p = malloc(length);
320
321 if(p == NULL)
322 return;
323
324 text = &This->cache.textcache[cache_id];
325 if (text->data != NULL)
326 free(text->data);
327 text->data = p;
328 text->size = length;
329 memcpy(text->data, data, length);
330}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLfloat GLfloat p
Definition: glext.h:8902

◆ cache_rebuild_bmpcache_linked_list()

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

Definition at line 43 of file cache.c.

44{
45 int n = count, c = 0;
46 sint16 n_idx;
47
48 /* find top, skip evicted bitmaps */
49 while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
50 if (n < 0)
51 {
52 This->cache.bmpcache_mru[id] = This->cache.bmpcache_lru[id] = NOT_SET;
53 return;
54 }
55
56 This->cache.bmpcache_mru[id] = idx[n];
57 This->cache.bmpcache[id][idx[n]].next = NOT_SET;
58 n_idx = idx[n];
59 c++;
60
61 /* link list */
62 while (n >= 0)
63 {
64 /* skip evicted bitmaps */
65 while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
66
67 if (n < 0)
68 break;
69
70 This->cache.bmpcache[id][n_idx].previous = idx[n];
71 This->cache.bmpcache[id][idx[n]].next = n_idx;
72 n_idx = idx[n];
73 c++;
74 }
75
76 This->cache.bmpcache[id][n_idx].previous = NOT_SET;
77 This->cache.bmpcache_lru[id] = n_idx;
78
79 if (c != This->cache.bmpcache_count[id])
80 {
81 error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
82 This->cache.bmpcache_count[id]);
83 exit(1);
84 }
85}
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

◆ cache_save_state()

void cache_save_state ( RDPCLIENT This)

Definition at line 239 of file cache.c.

240{
241 uint32 id = 0, t = 0;
242 int idx;
243
244 for (id = 0; id < NUM_ELEMENTS(This->cache.bmpcache); id++)
245 if (IS_PERSISTENT(id))
246 {
247 DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id));
248 idx = This->cache.bmpcache_lru[id];
249 while (idx >= 0)
250 {
252 idx = This->cache.bmpcache[id][idx].next;
253 }
254 DEBUG_RDP5((" %d stamps written.\n", t));
255 }
256}
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble t
Definition: gl.h:2047

◆ channel_init()

STREAM channel_init ( RDPCLIENT This,
VCHANNEL channel,
uint32  length 
)

Definition at line 66 of file channels.c.

67{
68 STREAM s;
69
70 s = sec_init(This, This->encryption ? SEC_ENCRYPT : 0, length + 8);
71 s_push_layer(s, channel_hdr, 8);
72 return s;
73}
#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
GLdouble s
Definition: gl.h:2039
Definition: parse.h:23

◆ channel_process()

void channel_process ( RDPCLIENT This,
STREAM  s,
uint16  mcs_channel 
)

Definition at line 413 of file rdesktop-core-tester.cpp.

414{
415}

◆ channel_register()

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

Definition at line 43 of file channels.c.

44{
45 VCHANNEL *channel;
46
47 if (!This->use_rdp5)
48 return NULL;
49
50 if (This->num_channels >= MAX_CHANNELS)
51 {
52 error("Channel table full, increase MAX_CHANNELS\n");
53 return NULL;
54 }
55
56 channel = &This->channels[This->num_channels];
57 channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + This->num_channels;
58 strncpy(channel->name, name, 8);
59 channel->flags = flags;
60 channel->process = callback;
61 This->num_channels++;
62 return channel;
63}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define MAX_CHANNELS
Definition: channels.c:23
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
GLbitfield flags
Definition: glext.h:7161
static IPrintDialogCallback callback
Definition: printdlg.c:326
void(* process)(STREAM)
Definition: types.h:156
uint32 flags
Definition: types.h:154
char name[8]
Definition: types.h:153
uint16 mcs_id
Definition: types.h:152
Definition: name.c:39

◆ channel_send()

void channel_send ( RDPCLIENT This,
STREAM  s,
VCHANNEL channel 
)

Definition at line 76 of file channels.c.

77{
79 uint32 thislength, remaining;
80 uint8 *data;
81
82 /* first fragment sent in-place */
83 s_pop_layer(s, channel_hdr);
84 length = s->end - s->p - sizeof(CHANNEL_PDU_HEADER);
85
86 DEBUG_CHANNEL(("channel_send, length = %d\n", length));
87
88 thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
89/* Note: In the original clipboard implementation, this number was
90 1592, not 1600. However, I don't remember the reason and 1600 seems
91 to work so.. This applies only to *this* length, not the length of
92 continuation or ending packets. */
93 remaining = length - thislength;
97
100 data = s->end = s->p + thislength;
101 DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
102 sec_send_to_channel(This, s, This->encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
103
104 /* subsequent segments copied (otherwise would have to generate headers backwards) */
105 while (remaining > 0)
106 {
107 thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
108 remaining -= thislength;
109 flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
110 if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
112
113 DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
114
115 s = sec_init(This, This->encryption ? SEC_ENCRYPT : 0, thislength + 8);
118 out_uint8p(s, data, thislength);
119 s_mark_end(s);
120 sec_send_to_channel(This, s, This->encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
121
122 data += thislength;
123 }
124}
#define CHANNEL_FLAG_LAST
Definition: channels.c:26
#define CHANNEL_CHUNK_LENGTH
Definition: channels.c:24
#define CHANNEL_FLAG_FIRST
Definition: channels.c:25
#define CHANNEL_FLAG_SHOW_PROTOCOL
Definition: channels.c:27
#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 sec_send_to_channel(STREAM s, uint32 flags, uint16 channel)
Definition: secure.c:436
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
#define MIN(x, y)
Definition: rdesktop.h:171
unsigned char uint8
Definition: types.h:28

◆ cliprdr_init()

BOOL cliprdr_init ( RDPCLIENT This)

Definition at line 174 of file cliprdr.c.

175{
176 This->cliprdr.channel =
177 channel_register(This, "cliprdr",
181 return (This->cliprdr.channel != NULL);
182}
VCHANNEL * channel_register(char *name, uint32 flags, void(*callback)(STREAM))
Definition: channels.c:46
#define CHANNEL_OPTION_ENCRYPT_RDP
Definition: constants.h:432
#define CHANNEL_OPTION_INITIALIZED
Definition: constants.h:431
#define CHANNEL_OPTION_COMPRESS_RDP
Definition: constants.h:433
static void cliprdr_process(RDPCLIENT *This, STREAM s)
Definition: cliprdr.c:109

◆ cliprdr_send_data()

void cliprdr_send_data ( RDPCLIENT This,
uint8 data,
uint32  length 
)

Definition at line 102 of file cliprdr.c.

103{
104 DEBUG_CLIPBOARD(("cliprdr_send_data\n"));
106}
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
static void cliprdr_send_packet(RDPCLIENT *This, uint16 type, uint16 status, uint8 *data, uint32 length)
Definition: cliprdr.c:35
#define CLIPRDR_DATA_RESPONSE
Definition: cliprdr.c:28
#define CLIPRDR_RESPONSE
Definition: cliprdr.c:31

◆ cliprdr_send_data_request()

void cliprdr_send_data_request ( RDPCLIENT This,
uint32  format 
)

Definition at line 92 of file cliprdr.c.

93{
94 uint8 buffer[4];
95
96 DEBUG_CLIPBOARD(("cliprdr_send_data_request\n"));
99}
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
#define CLIPRDR_DATA_REQUEST
Definition: cliprdr.c:27
#define CLIPRDR_REQUEST
Definition: cliprdr.c:30
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

◆ cliprdr_send_native_format_announce()

void cliprdr_send_native_format_announce ( RDPCLIENT This,
uint8 formats_data,
uint32  formats_data_length 
)

Definition at line 73 of file cliprdr.c.

74{
75 DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));
76
78 formats_data_length);
79
80 if (formats_data != This->cliprdr.last_formats)
81 {
82 if (This->cliprdr.last_formats)
83 xfree(This->cliprdr.last_formats);
84
85 This->cliprdr.last_formats = xmalloc(formats_data_length);
86 memcpy(This->cliprdr.last_formats, formats_data, formats_data_length);
87 This->cliprdr.last_formats_length = formats_data_length;
88 }
89}
void xfree(void *mem)
Definition: uimain.c:758
void * xmalloc(int size)
Definition: uimain.c:747
#define CLIPRDR_FORMAT_ANNOUNCE
Definition: cliprdr.c:25

Referenced by cliprdr_process(), and cliprdr_send_simple_native_format_announce().

◆ cliprdr_send_simple_native_format_announce()

void cliprdr_send_simple_native_format_announce ( RDPCLIENT This,
uint32  format 
)

Definition at line 57 of file cliprdr.c.

58{
59 uint8 buffer[36];
60
61 DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n"));
62
64 memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */
66}
void cliprdr_send_native_format_announce(RDPCLIENT *This, uint8 *formats_data, uint32 formats_data_length)
Definition: cliprdr.c:73
#define memset(x, y, z)
Definition: compat.h:39

◆ cliprdr_set_mode()

void cliprdr_set_mode ( RDPCLIENT This,
const char optarg 
)

Definition at line 168 of file cliprdr.c.

169{
171}
void ui_clip_set_mode(const char *optarg)
const char * optarg
Definition: getopt.c:49

◆ 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
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

◆ event_logon()

void event_logon ( RDPCLIENT This)

Definition at line 5908 of file activex.cpp.

5909{
5910 RdpClient::OnLogon(This);
5911}

Referenced by process_data_pdu().

◆ event_pubkey()

BOOL event_pubkey ( RDPCLIENT This,
unsigned char key,
unsigned int  key_size 
)

Definition at line 5900 of file activex.cpp.

5901{
5902 if(!RdpClient::OnPublicKey(This, key, key_size))
5903 return FALSE;
5904 else
5905 return TRUE;
5906}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
Definition: copy.c:22

◆ event_redirect()

BOOL event_redirect ( RDPCLIENT This,
uint32  flags,
uint32  server_len,
wchar_t server,
uint32  cookie_len,
char cookie,
uint32  username_len,
wchar_t username,
uint32  domain_len,
wchar_t domain,
uint32  password_len,
wchar_t password 
)

Definition at line 5913 of file activex.cpp.

5914{
5915 if
5916 (
5917 !RdpClient::OnRedirect
5918 (
5919 This,
5920 flags,
5921 server_len,
5922 server,
5923 cookie_len,
5924 cookie,
5925 username_len,
5926 username,
5927 domain_len,
5928 domain,
5929 password_len,
5930 password
5931 )
5932 )
5933 return FALSE;
5934 else
5935 return TRUE;
5936}
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
Definition: cookie.c:34
Definition: cookie.c:42
static rfbScreenInfoPtr server
Definition: vnc.c:74

Referenced by process_redirect_pdu().

◆ ewmh_init()

void ewmh_init ( RDPCLIENT This)

Definition at line 167 of file ewmhints.c.

168{
169 /* FIXME: Use XInternAtoms */
170 This->ewmhints.state_maximized_vert_atom =
171 XInternAtom(This->display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
172 This->ewmhints.state_maximized_horz_atom =
173 XInternAtom(This->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
174 This->ewmhints.state_hidden_atom = XInternAtom(This->display, "_NET_WM_STATE_HIDDEN", False);
175 This->ewmhints.state_skip_taskbar_atom =
176 XInternAtom(This->display, "_NET_WM_STATE_SKIP_TASKBAR", False);
177 This->ewmhints.state_skip_pager_atom = XInternAtom(This->display, "_NET_WM_STATE_SKIP_PAGER", False);
178 This->ewmhints.state_modal_atom = XInternAtom(This->display, "_NET_WM_STATE_MODAL", False);
179 This->net_wm_state_atom = XInternAtom(This->display, "_NET_WM_STATE", False);
180 This->net_wm_desktop_atom = XInternAtom(This->display, "_NET_WM_DESKTOP", False);
181 This->ewmhints.name_atom = XInternAtom(This->display, "_NET_WM_NAME", False);
182 This->ewmhints.utf8_string_atom = XInternAtom(This->display, "UTF8_STRING", False);
183}

◆ 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}
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
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define random
Definition: rosdhcp.h:81

◆ get_current_workarea()

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

Definition at line 123 of file ewmhints.c.

124{
125 int current_desktop;
126 unsigned long nitems_return;
127 unsigned char *prop_return;
128 uint32 *return_words;
129 const uint32 net_workarea_x_offset = 0;
130 const uint32 net_workarea_y_offset = 1;
131 const uint32 net_workarea_width_offset = 2;
132 const uint32 net_workarea_height_offset = 3;
133 const uint32 max_prop_length = 32 * 4; /* Max 32 desktops */
134
136 (This, DefaultRootWindow(This->display), "_NET_WORKAREA", max_prop_length, &nitems_return,
137 &prop_return, 0) < 0)
138 return (-1);
139
140 if (nitems_return % 4)
141 {
142 fprintf(stderr, "_NET_WORKAREA has odd length\n");
143 return (-1);
144 }
145
146 current_desktop = get_current_desktop(This);
147
148 if (current_desktop < 0)
149 return -1;
150
151 return_words = (uint32 *) prop_return;
152
153 *x = return_words[current_desktop * 4 + net_workarea_x_offset];
154 *y = return_words[current_desktop * 4 + net_workarea_y_offset];
155 *width = return_words[current_desktop * 4 + net_workarea_width_offset];
156 *height = return_words[current_desktop * 4 + net_workarea_height_offset];
157
158 XFree(prop_return);
159
160 return (0);
161
162}
static int get_property_value(RDPCLIENT *This, Window wnd, char *propname, long max_length, unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
Definition: ewmhints.c:38
static int get_current_desktop(RDPCLIENT *This)
Definition: ewmhints.c:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

◆ get_key_state()

BOOL get_key_state ( RDPCLIENT This,
unsigned int  state,
uint32  keysym 
)

Definition at line 1143 of file xwin.c.

1144{
1145 int modifierpos, key, keysymMask = 0;
1146 int offset;
1147
1148 KeyCode keycode = XKeysymToKeycode(This->display, keysym);
1149
1150 if (keycode == NoSymbol)
1151 return False;
1152
1153 for (modifierpos = 0; modifierpos < 8; modifierpos++)
1154 {
1155 offset = This->xwin.mod_map->max_keypermod * modifierpos;
1156
1157 for (key = 0; key < This->xwin.mod_map->max_keypermod; key++)
1158 {
1159 if (This->xwin.mod_map->modifiermap[offset + key] == keycode)
1160 keysymMask |= 1 << modifierpos;
1161 }
1162 }
1163
1164 return (state & keysymMask) ? True : False;
1165}
static int state
Definition: maze.c:121
#define True
Definition: types.h:24
#define NoSymbol
Definition: x11stubs.h:10

◆ 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}
GLenum GLsizei len
Definition: glext.h:6722
void xprintf(const char *fmt,...)
Definition: shimdbg.c:16
Definition: parser.c:49

Referenced by DumpRegistryData().

◆ iso_connect()

BOOL iso_connect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 179 of file iso.c.

180{
181 uint8 code = 0;
182
183 if (!tcp_connect(This, server))
184 return False;
185
187 return False;
188
189 if (iso_recv_msg(This, &code, NULL) == NULL)
190 return False;
191
192 if (code != ISO_PDU_CC)
193 {
194 error("expected CC, got 0x%x\n", code);
196 return False;
197 }
198
199 return True;
200}
@ ISO_PDU_CC
Definition: constants.h:30
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
void tcp_disconnect(void)
Definition: tcp.c:832
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
Definition: inflate.c:139

◆ iso_disconnect()

BOOL iso_disconnect ( RDPCLIENT This)

Definition at line 229 of file iso.c.

230{
232 return tcp_disconnect(This);
233}
@ ISO_PDU_DR
Definition: constants.h:31
static void iso_send_msg(uint8 code)
Definition: iso.c:39

◆ iso_init()

STREAM iso_init ( RDPCLIENT This,
int  length 
)

Definition at line 122 of file iso.c.

123{
124 STREAM s;
125
126 s = tcp_init(This, length + 7);
127
128 if(s == NULL)
129 return NULL;
130
131 s_push_layer(s, iso_hdr, 7);
132
133 return s;
134}
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82

◆ iso_reconnect()

BOOL iso_reconnect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 204 of file iso.c.

205{
206 uint8 code = 0;
207
208 if (!tcp_connect(This, server))
209 return False;
210
211 if (!iso_send_connection_request(This, cookie)) // BUGBUG should we really pass the cookie here?
212 return False;
213
214 if (iso_recv_msg(This, &code, NULL) == NULL)
215 return False;
216
217 if (code != ISO_PDU_CC)
218 {
219 error("expected CC, got 0x%x\n", code);
221 return False;
222 }
223
224 return True;
225}

Referenced by mcs_reconnect().

◆ iso_recv()

STREAM iso_recv ( RDPCLIENT This,
uint8 rdpver 
)

Definition at line 158 of file iso.c.

159{
160 STREAM s;
161 uint8 code = 0;
162
163 s = iso_recv_msg(This, &code, rdpver);
164 if (s == NULL)
165 return NULL;
166 if (rdpver != NULL)
167 if (*rdpver != 3)
168 return s;
169 if (code != ISO_PDU_DT)
170 {
171 error("expected DT, got 0x%x\n", code);
172 return NULL;
173 }
174 return s;
175}
@ ISO_PDU_DT
Definition: constants.h:32

◆ iso_reset_state()

void iso_reset_state ( RDPCLIENT This)

Definition at line 237 of file iso.c.

238{
240}
void tcp_reset_state(void)
Definition: tcp.c:894

◆ iso_send()

BOOL iso_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 138 of file iso.c.

139{
141
142 s_pop_layer(s, iso_hdr);
143 length = (uint16)(s->end - s->p);
144
145 out_uint8(s, 3); /* version */
146 out_uint8(s, 0); /* reserved */
148
149 out_uint8(s, 2); /* hdrlen */
150 out_uint8(s, ISO_PDU_DT); /* code */
151 out_uint8(s, 0x80); /* eot */
152
153 return tcp_send(This, s);
154}
#define out_uint8(s, v)
Definition: parse.h:92
#define out_uint16_be(s, v)
Definition: parse.h:77
void tcp_send(STREAM s)
Definition: tcp.c:270

◆ 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

◆ licence_process()

void licence_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 300 of file licence.c.

301{
302 uint8 tag;
303
304 in_uint8(s, tag);
305 in_uint8s(s, 3); /* version, length */
306
307 switch (tag)
308 {
311 break;
312
315 break;
316
319 break;
320
323 break;
324
325 default:
326 unimpl("licence tag 0x%x\n", tag);
327 }
328}
#define in_uint8s(s, n)
Definition: parse.h:91
#define in_uint8(s, v)
Definition: parse.h:88
#define LICENCE_TAG_DEMAND
Definition: constants.h:94
#define LICENCE_TAG_AUTHREQ
Definition: constants.h:95
#define LICENCE_TAG_ISSUE
Definition: constants.h:96
#define LICENCE_TAG_REISSUE
Definition: constants.h:97
#define LICENCE_TAG_RESULT
Definition: constants.h:101
static void licence_process_issue(RDPCLIENT *This, STREAM s)
Definition: licence.c:261
static BOOL licence_process_demand(RDPCLIENT *This, STREAM s)
Definition: licence.c:136
static void licence_process_authreq(RDPCLIENT *This, STREAM s)
Definition: licence.c:229
Definition: ecma_167.h:138

◆ load_licence()

int load_licence ( RDPCLIENT This,
unsigned char **  data 
)

Definition at line 172 of file rdesktop-core-tester.cpp.

173 {
174 return -1;
175 }

◆ lspci_init()

BOOL lspci_init ( RDPCLIENT This)

Definition at line 152 of file lspci.c.

153{
157 return (lspci_channel != NULL);
158}
static void lspci_process(RDPCLIENT *This, STREAM s)
Definition: lspci.c:131
static VCHANNEL * lspci_channel
Definition: lspci.c:25

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 31 of file evtmsggen.c.

32{
33 FILE* outFile;
34 unsigned int id_min, id_max;
35 unsigned int i;
36
37 /* Validate the arguments */
38 if (argc != 4)
39 {
40 usage(argv[0]);
41 return -1;
42 }
43
44 id_min = (unsigned int)atoi(argv[1]);
45 id_max = (unsigned int)atoi(argv[2]);
46 if (id_min > id_max)
47 {
48 fprintf(stderr, "ERROR: Min ID %u cannot be strictly greater than Max ID %u !\n", id_min, id_max);
49 return -1;
50 }
51
52 /* Open the file */
53 outFile = fopen(argv[3], "wb");
54 if (!outFile)
55 {
56 fprintf(stderr, "ERROR: Could not create output file '%s'.\n", argv[3]);
57 return -1;
58 }
59
60 /* Generate the file */
61
62 /* Write the header */
63 fprintf(outFile,
64 ";/*" EOL
65 "; * %s" EOL
66 "; * Contains event message string templates for the EventCreate Command." EOL
67 "; *" EOL
68 "; * This file is autogenerated, do not edit." EOL
69 "; * Generated with:" EOL
70 "; * %s %u %u %s" EOL
71 "; */" EOL
72 EOL
73#ifdef ENGLISH
74 "LanguageNames=(English=0x409:MSG00409)" EOL
75#else
76 "LanguageNames=(Neutral=0x0000:MSG00000)" EOL
77#endif
78 "MessageIdTypedef=DWORD" EOL
79 EOL,
80 argv[3],
81 argv[0], id_min /* argv[1] */, id_max /* argv[2] */, argv[3]);
82
83 /* Write the message string templates */
84 for (i = id_min; i <= id_max; ++i)
85 {
86 fprintf(outFile,
87 "MessageId=0x%X" EOL
88#ifdef ENGLISH
89 "Language=English" EOL
90#else
91 "Language=Neutral" EOL
92#endif
93 "%%1" EOL
94 "." EOL
95 EOL,
96 i);
97 }
98
99 /* Close the file */
100 fclose(outFile);
101
102 return 0;
103}
static int argc
Definition: ServiceArgs.c:12
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define EOL
Definition: evtmsggen.c:23
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define argv
Definition: mplay32.c:18

◆ mcs_connect()

BOOL mcs_connect ( RDPCLIENT This,
char server,
char cookie,
STREAM  mcs_data 
)

Definition at line 388 of file mcs.c.

389{
390 unsigned int i;
391
393 return False;
394
395 if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
396 goto error;
397
399 goto error;
400
401 if (!mcs_recv_aucf(This, &This->mcs_userid))
402 goto error;
403
405 goto error;
406
408 goto error;
409
410 for (i = 0; i < This->num_channels; i++)
411 {
413 goto error;
414 }
415 return True;
416
417 error:
419 return False;
420}
#define MCS_USERCHANNEL_BASE
Definition: constants.h:88
RD_BOOL iso_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: iso.c:203
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
static void mcs_send_connect_initial(STREAM mcs_data)
Definition: mcs.c:57

Referenced by sec_connect().

◆ mcs_disconnect()

void mcs_disconnect ( RDPCLIENT This)

Definition at line 460 of file mcs.c.

461{
463}

◆ mcs_init()

STREAM mcs_init ( RDPCLIENT This,
int  length 
)

Definition at line 314 of file mcs.c.

315{
316 STREAM s;
317
318 s = iso_init(This, length + 8);
319
320 if(s == NULL)
321 return NULL;
322
323 s_push_layer(s, mcs_hdr, 8);
324
325 return s;
326}
STREAM iso_init(int length)
Definition: iso.c:150

◆ mcs_reconnect()

BOOL mcs_reconnect ( RDPCLIENT This,
char server,
char cookie,
STREAM  mcs_data 
)

Definition at line 424 of file mcs.c.

425{
426 unsigned int i;
427
429 return False;
430
431 if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
432 goto error;
433
435 goto error;
436
437 if (!mcs_recv_aucf(This, &This->mcs_userid))
438 goto error;
439
441 goto error;
442
444 goto error;
445
446 for (i = 0; i < This->num_channels; i++)
447 {
449 goto error;
450 }
451 return True;
452
453 error:
455 return False;
456}
BOOL iso_reconnect(RDPCLIENT *This, char *server, char *cookie)
Definition: iso.c:204

Referenced by sec_reconnect().

◆ mcs_recv()

STREAM mcs_recv ( RDPCLIENT This,
uint16 channel,
uint8 rdpver 
)

Definition at line 356 of file mcs.c.

357{
358 uint8 opcode, appid, length;
359 STREAM s;
360
361 s = iso_recv(This, rdpver);
362 if (s == NULL)
363 return NULL;
364 if (rdpver != NULL)
365 if (*rdpver != 3)
366 return s;
367 in_uint8(s, opcode);
368 appid = opcode >> 2;
369 if (appid != MCS_SDIN)
370 {
371 if (appid != MCS_DPUM)
372 {
373 error("expected data, got %d\n", opcode);
374 }
375 return NULL;
376 }
377 in_uint8s(s, 2); /* userid */
378 in_uint16_be(s, *channel);
379 in_uint8s(s, 1); /* flags */
380 in_uint8(s, length);
381 if (length & 0x80)
382 in_uint8s(s, 1); /* second byte of length */
383 return s;
384}
@ MCS_SDIN
Definition: constants.h:71
@ MCS_DPUM
Definition: constants.h:65
STREAM iso_recv(uint8 *rdpver)
Definition: iso.c:182
#define in_uint16_be(s, v)
Definition: parse.h:75
char * appid
Definition: mkisofs.c:161

◆ mcs_reset_state()

void mcs_reset_state ( RDPCLIENT This)

Definition at line 467 of file mcs.c.

468{
469 This->mcs_userid = 0;
471}
void iso_reset_state(void)
Definition: iso.c:370

◆ mcs_send()

BOOL mcs_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 349 of file mcs.c.

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

◆ mcs_send_to_channel()

BOOL mcs_send_to_channel ( RDPCLIENT This,
STREAM  s,
uint16  channel 
)

Definition at line 330 of file mcs.c.

331{
333
334 s_pop_layer(s, mcs_hdr);
335 length = (uint16)(s->end - s->p - 8);
336 length |= 0x8000;
337
338 out_uint8(s, (MCS_SDRQ << 2));
339 out_uint16_be(s, This->mcs_userid);
340 out_uint16_be(s, channel);
341 out_uint8(s, 0x70); /* flags */
343
344 return iso_send(This, s);
345}
@ MCS_SDRQ
Definition: constants.h:70
void iso_send(STREAM s)
Definition: iso.c:162

◆ mppc_expand()

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

Definition at line 56 of file mppc.c.

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

◆ 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}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strchr(const char *String, int ch)
Definition: utclib.c:501
unsigned char
Definition: typeof.h:29
GLenum src
Definition: glext.h:6340

Referenced by main().

◆ parallel_enum_devices()

int parallel_enum_devices ( RDPCLIENT This,
uint32 id,
char optarg 
)

Definition at line 40 of file parallel.c.

41{
42 PARALLEL_DEVICE *ppar_info;
43
44 char *pos = optarg;
45 char *pos2;
46 int count = 0;
47
48 /* skip the first colon */
49 optarg++;
50 while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
51 {
52 ppar_info = (PARALLEL_DEVICE *) xmalloc(sizeof(PARALLEL_DEVICE));
53
54 pos2 = next_arg(optarg, '=');
55 strcpy(This->rdpdr_device[*id].name, optarg);
56
57 toupper_str(This->rdpdr_device[*id].name);
58
59 This->rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);
60 strcpy(This->rdpdr_device[*id].local_path, pos2);
61 printf("PARALLEL %s to %s\n", optarg, pos2);
62
63 /* set device type */
64 This->rdpdr_device[*id].device_type = DEVICE_TYPE_PARALLEL;
65 This->rdpdr_device[*id].pdevice_data = (void *) ppar_info;
66 This->rdpdr_device[*id].handle = 0;
67 count++;
68 (*id)++;
69
70 optarg = pos;
71 }
72 return count;
73}
#define RDPDR_MAX_DEVICES
Definition: constants.h:484
#define DEVICE_TYPE_PARALLEL
Definition: constants.h:486
char * next_arg(char *src, char needle)
Definition: rdesktop.c:1174
void toupper_str(char *p)
Definition: rdesktop.c:1223
#define printf
Definition: freeldr.h:93

◆ printer_enum_devices()

int printer_enum_devices ( RDPCLIENT This,
uint32 id,
char optarg 
)

Definition at line 36 of file printer.c.

37{
38 PRINTER *pprinter_data;
39
40 char *pos = optarg;
41 char *pos2;
42 int count = 0;
43 int already = 0;
44
45 /* we need to know how many printers we've already set up
46 supplied from other -r flags than this one. */
47 while (count < *id)
48 {
49 if (This->rdpdr_device[count].device_type == DEVICE_TYPE_PRINTER)
50 already++;
51 count++;
52 }
53
54 count = 0;
55
56 if (*optarg == ':')
57 optarg++;
58
59 while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
60 {
61 pprinter_data = (PRINTER *) xmalloc(sizeof(PRINTER));
62
63 strcpy(This->rdpdr_device[*id].name, "PRN");
64 strcat(This->rdpdr_device[*id].name, l_to_a(already + count + 1, 10));
65
66 /* first printer is set as default printer */
67 if ((already + count) == 0)
68 pprinter_data->default_printer = True;
69 else
70 pprinter_data->default_printer = False;
71
72 pos2 = next_arg(optarg, '=');
73 if (*optarg == (char) 0x00)
74 pprinter_data->printer = "mydeskjet"; /* set default */
75 else
76 {
77 pprinter_data->printer = xmalloc(strlen(optarg) + 1);
78 strcpy(pprinter_data->printer, optarg);
79 }
80
81 if (!pos2 || (*pos2 == (char) 0x00))
82 pprinter_data->driver = "HP Color LaserJet 8500 PS"; /* no printer driver supplied set default */
83 else
84 {
85 pprinter_data->driver = xmalloc(strlen(pos2) + 1);
86 strcpy(pprinter_data->driver, pos2);
87 }
88
89 printf("PRINTER %s to %s driver %s\n", This->rdpdr_device[*id].name,
90 pprinter_data->printer, pprinter_data->driver);
91 This->rdpdr_device[*id].device_type = DEVICE_TYPE_PRINTER;
92 This->rdpdr_device[*id].pdevice_data = (void *) pprinter_data;
93 count++;
94 (*id)++;
95
96 optarg = pos;
97 }
98 return count;
99}
#define DEVICE_TYPE_PRINTER
Definition: constants.h:487
char * l_to_a(long N, int base)
Definition: rdesktop.c:1356
char * printer
Definition: types.h:263
char * driver
Definition: types.h:263
RD_BOOL default_printer
Definition: types.h:266

◆ 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

◆ printercache_process()

void printercache_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 233 of file printercache.c.

234{
235 uint32 type, printer_length, driver_length, printer_unicode_length, blob_length;
236 char device_name[9], printer[256], driver[256];
237
239 switch (type)
240 {
241 case 4: /* rename item */
242 in_uint8(s, printer_length);
243 in_uint8s(s, 0x3); /* padding */
244 in_uint8(s, driver_length);
245 in_uint8s(s, 0x3); /* padding */
246
247 /* NOTE - 'driver' doesn't contain driver, it contains the new printer name */
248
249 rdp_in_unistr(This, s, printer, printer_length);
250 rdp_in_unistr(This, s, driver, driver_length);
251
253 break;
254
255 case 3: /* delete item */
256 in_uint8(s, printer_unicode_length);
257 in_uint8s(s, 0x3); /* padding */
258 printer_length = rdp_in_unistr(This, s, printer, printer_unicode_length);
260 break;
261
262 case 2: /* save printer data */
263 in_uint32_le(s, printer_unicode_length);
264 in_uint32_le(s, blob_length);
265
266 if (printer_unicode_length < 2 * 255)
267 {
268 rdp_in_unistr(This, s, printer, printer_unicode_length);
269 printercache_save_blob(printer, s->p, blob_length);
270 }
271 break;
272
273 case 1: /* save device data */
274 in_uint8a(s, device_name, 5); /* get LPTx/COMx name */
275
276 /* need to fetch this data so that we can get the length of the packet to store. */
277 in_uint8s(s, 0x2); /* ??? */
278 in_uint8s(s, 0x2) /* pad?? */
279 in_uint32_be(s, driver_length);
280 in_uint32_be(s, printer_length);
281 in_uint8s(s, 0x7) /* pad?? */
282 /* next is driver in unicode */
283 /* next is printer in unicode */
284 /* TODO: figure out how to use this information when reconnecting */
285 /* actually - all we need to store is the driver and printer */
286 /* and figure out what the first word is. */
287 /* rewind stream so that we can save this blob */
288 /* length is driver_length + printer_length + 19 */
289 /* rewind stream */
290 s->p = s->p - 19;
291
293 driver_length + printer_length + 19);
294 break;
295 default:
296
297 unimpl("RDPDR Printer Cache Packet Type: %d\n", type);
298 break;
299 }
300}
Type
Definition: Type.h:7
#define in_uint32_be(s, v)
Definition: parse.h:76
#define in_uint8a(s, v, n)
Definition: parse.h:90
#define in_uint32_le(s, v)
Definition: parse.h:56
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
Definition: rdp.c:265
static const WCHAR device_name[]
Definition: btrfs.c:60
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define d
Definition: ke_i.h:81
struct @1669::@1670 driver
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
static BOOL printercache_rename_blob(char *printer, char *new_printer)
Definition: printercache.c:113
static void printercache_save_blob(char *printer_name, uint8 *data, uint32 length)
Definition: printercache.c:195
static BOOL printercache_unlink_blob(char *printer)
Definition: printercache.c:76
Definition: fatfs.h:173

◆ process_bitmap_updates()

void process_bitmap_updates ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1084 of file rdp.c.

1085{
1086 uint16 num_updates;
1088 uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
1089 uint8 *data, *bmpdata;
1090 int i;
1091
1092 in_uint16_le(s, num_updates);
1093
1094 for (i = 0; i < num_updates; i++)
1095 {
1097 in_uint16_le(s, top);
1102 in_uint16_le(s, bpp);
1103 Bpp = (bpp + 7) / 8;
1106
1107 cx = right - left + 1;
1108 cy = bottom - top + 1;
1109
1110 DEBUG(("BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1111 left, top, right, bottom, width, height, Bpp, compress));
1112
1113 if (!compress)
1114 {
1115#if 0
1116 int y;
1117 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1118 for (y = 0; y < height; y++)
1119 {
1120 in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)],
1121 width * Bpp);
1122 }
1123 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1124 xfree(bmpdata);
1125#else
1126 in_uint8p(s, bmpdata, width * height * Bpp);
1127 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1128#endif
1129 continue;
1130 }
1131
1132
1133 if (compress & 0x400)
1134 {
1135 size = bufsize;
1136 }
1137 else
1138 {
1139 in_uint8s(s, 2); /* pad */
1141 in_uint8s(s, 4); /* line_size, final_size */
1142 }
1143 in_uint8p(s, data, size);
1144 bmpdata = (uint8 *) malloc(width * height * Bpp);
1145
1146 if(bmpdata == NULL)
1147 return;
1148
1149 if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
1150 {
1151 ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1152 }
1153 else
1154 {
1155 DEBUG_RDP5(("Failed to decompress data\n"));
1156 }
1157
1158 free(bmpdata);
1159 }
1160}
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
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
Definition: uimain.c:307
#define DEBUG(args)
Definition: rdesktop.h:129
DWORD bpp
Definition: surface.c:185
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

◆ process_cached_pointer_pdu()

void process_cached_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1020 of file rdp.c.

1021{
1022 uint16 cache_idx;
1023
1024 in_uint16_le(s, cache_idx);
1026}
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
Definition: cache.c:400
void ui_set_cursor(RD_HCURSOR cursor)

◆ process_colour_pointer_pdu()

void process_colour_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 998 of file rdp.c.

999{
1000 uint16 x, y, width, height, cache_idx, masklen, datalen;
1001 uint8 *mask, *data;
1003
1004 in_uint16_le(s, cache_idx);
1005 in_uint16_le(s, x);
1006 in_uint16_le(s, y);
1009 in_uint16_le(s, masklen);
1012 in_uint8p(s, mask, masklen);
1015 cache_put_cursor(This, cache_idx, cursor);
1016}
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
Definition: cache.c:417
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
Definition: uimain.c:175
GLenum GLint GLuint mask
Definition: glext.h:6028
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1031

◆ 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

Referenced by process_data_pdu().

◆ process_orders()

void process_orders ( RDPCLIENT This,
STREAM  s,
uint16  num_orders 
)

Definition at line 1243 of file orders.c.

1244{
1245 RDP_ORDER_STATE *os = &This->orders.order_state;
1246 uint32 present;
1247 uint8 order_flags;
1248 int size, processed = 0;
1249 BOOL delta;
1250
1251 while (processed < num_orders)
1252 {
1253 in_uint8(s, order_flags);
1254
1255 if (!(order_flags & RDP_ORDER_STANDARD))
1256 {
1257 error("order parsing failed\n");
1258 break;
1259 }
1260
1261 if (order_flags & RDP_ORDER_SECONDARY)
1262 {
1264 }
1265 else
1266 {
1267 if (order_flags & RDP_ORDER_CHANGE)
1268 {
1269 in_uint8(s, os->order_type);
1270 }
1271
1272 switch (os->order_type)
1273 {
1274 case RDP_ORDER_TRIBLT:
1275 case RDP_ORDER_TEXT2:
1276 size = 3;
1277 break;
1278
1279 case RDP_ORDER_PATBLT:
1280 case RDP_ORDER_MEMBLT:
1281 case RDP_ORDER_LINE:
1282 case RDP_ORDER_POLYGON2:
1283 case RDP_ORDER_ELLIPSE2:
1284 size = 2;
1285 break;
1286
1287 default:
1288 size = 1;
1289 }
1290
1291 rdp_in_present(s, &present, order_flags, size);
1292
1293 if (order_flags & RDP_ORDER_BOUNDS)
1294 {
1295 if (!(order_flags & RDP_ORDER_LASTBOUNDS))
1296 rdp_parse_bounds(s, &os->bounds);
1297
1299 os->bounds.top,
1300 os->bounds.right -
1301 os->bounds.left + 1,
1302 os->bounds.bottom - os->bounds.top + 1);
1303 }
1304
1305 delta = order_flags & RDP_ORDER_DELTA;
1306
1307 switch (os->order_type)
1308 {
1309 case RDP_ORDER_DESTBLT:
1310 process_destblt(This, s, &os->destblt, present, delta);
1311 break;
1312
1313 case RDP_ORDER_PATBLT:
1314 process_patblt(This, s, &os->patblt, present, delta);
1315 break;
1316
1318 process_screenblt(This, s, &os->screenblt, present, delta);
1319 break;
1320
1321 case RDP_ORDER_LINE:
1322 process_line(This, s, &os->line, present, delta);
1323 break;
1324
1325 case RDP_ORDER_RECT:
1326 process_rect(This, s, &os->rect, present, delta);
1327 break;
1328
1329 case RDP_ORDER_DESKSAVE:
1330 process_desksave(This, s, &os->desksave, present, delta);
1331 break;
1332
1333 case RDP_ORDER_MEMBLT:
1334 process_memblt(This, s, &os->memblt, present, delta);
1335 break;
1336
1337 case RDP_ORDER_TRIBLT:
1338 process_triblt(This, s, &os->triblt, present, delta);
1339 break;
1340
1341 case RDP_ORDER_POLYGON:
1342 process_polygon(This, s, &os->polygon, present, delta);
1343 break;
1344
1345 case RDP_ORDER_POLYGON2:
1346 process_polygon2(This, s, &os->polygon2, present, delta);
1347 break;
1348
1349 case RDP_ORDER_POLYLINE:
1350 process_polyline(This, s, &os->polyline, present, delta);
1351 break;
1352
1353 case RDP_ORDER_ELLIPSE:
1354 process_ellipse(This, s, &os->ellipse, present, delta);
1355 break;
1356
1357 case RDP_ORDER_ELLIPSE2:
1358 process_ellipse2(This, s, &os->ellipse2, present, delta);
1359 break;
1360
1361 case RDP_ORDER_TEXT2:
1362 process_text2(This, s, &os->text2, present, delta);
1363 break;
1364
1365 default:
1366 unimpl("order %d\n", os->order_type);
1367 return;
1368 }
1369
1370 if (order_flags & RDP_ORDER_BOUNDS)
1372 }
1373
1374 processed++;
1375 }
1376#if 0
1377 /* not true when RDP_COMPRESSION is set */
1378 if (s->p != This->next_packet)
1379 error("%d bytes remaining\n", (int) (This->next_packet - s->p));
1380#endif
1381
1382}
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
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 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

◆ process_palette()

void process_palette ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1164 of file rdp.c.

1165{
1167 COLOURMAP map;
1168 HCOLOURMAP hmap;
1169 int i;
1170
1171 in_uint8s(s, 2); /* pad */
1172 in_uint16_le(s, map.ncolours);
1173 in_uint8s(s, 2); /* pad */
1174
1175 map.colours = (COLOURENTRY *) malloc(sizeof(COLOURENTRY) * map.ncolours);
1176
1177 if(map.colours == NULL)
1178 {
1179 in_uint8s(s, sizeof(*entry) * map.ncolours);
1180 return;
1181 }
1182
1183 DEBUG(("PALETTE(c=%d)\n", map.ncolours));
1184
1185 for (i = 0; i < map.ncolours; i++)
1186 {
1187 entry = &map.colours[i];
1188 in_uint8(s, entry->red);
1189 in_uint8(s, entry->green);
1190 in_uint8(s, entry->blue);
1191 }
1192
1193 hmap = ui_create_colourmap(This, &map);
1194 ui_set_colourmap(This, hmap);
1195
1196 free(map.colours);
1197}
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

◆ process_system_pointer_pdu()

void process_system_pointer_pdu ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1030 of file rdp.c.

1031{
1032 uint16 system_pointer_type;
1033
1034 in_uint16(s, system_pointer_type);
1035 switch (system_pointer_type)
1036 {
1037 case RDP_NULL_POINTER:
1039 break;
1040
1041 default:
1042 unimpl("System pointer message 0x%x\n", system_pointer_type);
1043 }
1044}
@ RDP_NULL_POINTER
Definition: constants.h:225
#define in_uint16(s, v)
Definition: parse.h:82
void ui_set_null_cursor(void)
Definition: uimain.c:227

◆ pstcache_enumerate()

int pstcache_enumerate ( RDPCLIENT This,
uint8  id,
HASH_KEY keylist 
)

Definition at line 104 of file pstcache.c.

105{
106 int fd, n;
107 uint16 idx;
108 sint16 mru_idx[0xa00];
109 uint32 mru_stamp[0xa00];
110 CELLHEADER cellhdr;
111
112 if (!(This->bitmap_cache && This->bitmap_cache_persist_enable && IS_PERSISTENT(id)))
113 return 0;
114
115 /* The server disconnects if the bitmap cache content is sent more than once */
116 if (This->pstcache_enumerated)
117 return 0;
118
119 DEBUG_RDP5(("Persistent bitmap cache enumeration... "));
120 for (idx = 0; idx < BMPCACHE2_NUM_PSTCELLS; idx++)
121 {
122 fd = This->pstcache_fd[id];
123 rd_lseek_file(fd, idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
124 if (rd_read_file(fd, &cellhdr, sizeof(CELLHEADER)) <= 0)
125 break;
126
127 if (memcmp(cellhdr.key, zero_key, sizeof(HASH_KEY)) != 0)
128 {
129 memcpy(keylist[idx], cellhdr.key, sizeof(HASH_KEY));
130
131 /* Pre-cache (not possible for 8 bit colour depth cause it needs a colourmap) */
132 if (This->bitmap_cache_precache && cellhdr.stamp && This->server_depth > 8)
134
135 /* Sort by stamp */
136 for (n = idx; n > 0 && cellhdr.stamp < mru_stamp[n - 1]; n--)
137 {
138 mru_idx[n] = mru_idx[n - 1];
139 mru_stamp[n] = mru_stamp[n - 1];
140 }
141
142 mru_idx[n] = idx;
143 mru_stamp[n] = cellhdr.stamp;
144 }
145 else
146 {
147 break;
148 }
149 }
150
151 DEBUG_RDP5(("%d cached bitmaps.\n", idx));
152
154 This->pstcache_enumerated = True;
155 return idx;
156}
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
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
uint8 zero_key[]
Definition: pstcache.c:34
#define IS_PERSISTENT(id)
Definition: pstcache.c:24
#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

◆ pstcache_init()

BOOL pstcache_init ( RDPCLIENT This,
uint8  cache_id 
)

Definition at line 160 of file pstcache.c.

161{
162 int fd;
163 char filename[256];
164
165 if (This->pstcache_enumerated)
166 return True;
167
168 This->pstcache_fd[cache_id] = 0;
169
170 if (!(This->bitmap_cache && This->bitmap_cache_persist_enable))
171 return False;
172
173 if (!rd_pstcache_mkdir())
174 {
175 DEBUG(("failed to get/make cache directory!\n"));
176 return False;
177 }
178
179 This->pstcache_Bpp = (This->server_depth + 7) / 8;
180 sprintf(filename, "cache/pstcache_%d_%d", cache_id, This->pstcache_Bpp);
181 DEBUG(("persistent bitmap cache file: %s\n", filename));
182
184 if (fd == -1)
185 return False;
186
187 if (!rd_lock_file(fd, 0, 0))
188 {
189 warning("Persistent bitmap caching is disabled. (The file is already in use)\n");
191 return False;
192 }
193
194 This->pstcache_fd[cache_id] = fd;
195 return True;
196}
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
const char * filename
Definition: ioapi.h:137
#define warning(s)
Definition: debug.h:83

◆ pstcache_load_bitmap()

BOOL pstcache_load_bitmap ( RDPCLIENT This,
uint8  cache_id,
uint16  cache_idx 
)

Definition at line 46 of file pstcache.c.

47{
48 uint8 *celldata;
49 int fd;
50 CELLHEADER cellhdr;
52
53 if (!This->bitmap_cache_persist_enable)
54 return False;
55
56 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
57 return False;
58
59 fd = This->pstcache_fd[cache_id];
60 rd_lseek_file(fd, cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
61 rd_read_file(fd, &cellhdr, sizeof(CELLHEADER));
62 celldata = (uint8 *) malloc(cellhdr.length);
63
64 if(celldata == NULL)
65 return False;
66
67 rd_read_file(fd, celldata, cellhdr.length);
68
69 bitmap = ui_create_bitmap(This, cellhdr.width, cellhdr.height, celldata);
70 DEBUG(("Load bitmap from disk: id=%d, idx=%d, bmp=0x%x)\n", cache_id, cache_idx, bitmap));
71 cache_put_bitmap(This, cache_id, cache_idx, bitmap);
72
73 free(celldata);
74 return True;
75}
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

◆ pstcache_save_bitmap()

BOOL pstcache_save_bitmap ( RDPCLIENT This,
uint8  cache_id,
uint16  cache_idx,
uint8 key,
uint8  width,
uint8  height,
uint16  length,
uint8 data 
)

Definition at line 79 of file pstcache.c.

81{
82 int fd;
83 CELLHEADER cellhdr;
84
85 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
86 return False;
87
88 memcpy(cellhdr.key, key, sizeof(HASH_KEY));
89 cellhdr.width = width;
90 cellhdr.height = height;
91 cellhdr.length = length;
92 cellhdr.stamp = 0;
93
94 fd = This->pstcache_fd[cache_id];
95 rd_lseek_file(fd, cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
96 rd_write_file(fd, &cellhdr, sizeof(CELLHEADER));
98
99 return True;
100}
int rd_write_file(int fd, void *ptr, int len)
Definition: uimain.c:861

◆ pstcache_touch_bitmap()

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

Definition at line 32 of file pstcache.c.

33{
34 int fd;
35
36 if (!IS_PERSISTENT(cache_id) || cache_idx >= BMPCACHE2_NUM_PSTCELLS)
37 return;
38
39 fd = This->pstcache_fd[cache_id];
40 rd_lseek_file(fd, 12 + cache_idx * (This->pstcache_Bpp * MAX_CELL_SIZE + sizeof(CELLHEADER)));
41 rd_write_file(fd, &stamp, sizeof(stamp));
42}

◆ rd_close_file()

void rd_close_file ( int  fd)

Definition at line 847 of file uimain.c.

848{
849 return;
850}

◆ rd_lock_file()

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

Definition at line 875 of file uimain.c.

876{
877 return False;
878}

◆ rd_lseek_file()

int rd_lseek_file ( int  fd,
int  offset 
)

Definition at line 868 of file uimain.c.

869{
870 return 0;
871}

◆ rd_open_file()

int rd_open_file ( char filename)

Definition at line 840 of file uimain.c.

841{
842 return 0;
843}

◆ rd_pstcache_mkdir()

BOOL rd_pstcache_mkdir ( void  )

Definition at line 833 of file uimain.c.

834{
835 return 0;
836}

◆ 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}

◆ 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}

◆ rdp5_process()

BOOL rdp5_process ( RDPCLIENT This,
STREAM  s 
)

Definition at line 25 of file rdp5.c.

26{
29 uint8 *next;
30
31 uint32 roff, rlen;
32 struct stream *ns = &(This->mppc_dict.ns);
33 struct stream *ts;
34
35#if 0
36 printf("RDP5 data:\n");
37 hexdump(s->p, s->end - s->p);
38#endif
39
41 while (s->p < s->end)
42 {
43 in_uint8(s, type);
45 {
49 }
50 else
51 {
52 ctype = 0;
54 }
55 This->next_packet = next = s->p + length;
56
58 {
59 void * p;
60
61 if (mppc_expand(This, s->p, length, ctype, &roff, &rlen) == -1)
62 error("error while decompressing packet\n");
63
64 /* allocate memory and copy the uncompressed data into the temporary stream */
65 p = realloc(ns->data, rlen);
66
67 if(p == NULL)
68 {
69 This->disconnect_reason = 262;
70 return False;
71 }
72
73 ns->data = (uint8 *) p;
74
75 memcpy((ns->data), (unsigned char *) (This->mppc_dict.hist + roff), rlen);
76
77 ns->size = rlen;
78 ns->end = (ns->data + ns->size);
79 ns->p = ns->data;
80 ns->rdp_hdr = ns->p;
81
82 ts = ns;
83 }
84 else
85 ts = s;
86
87 switch (type)
88 {
89 case 0: /* update orders */
92 break;
93 case 1: /* update bitmap */
94 in_uint8s(ts, 2); /* part length */
96 break;
97 case 2: /* update palette */
98 in_uint8s(ts, 2); /* uint16 = 2 */
100 break;
101 case 3: /* update synchronize */
102 break;
103 case 5: /* null pointer */
105 break;
106 case 6: /* default pointer */
107 break;
108 case 8: /* pointer position */
109 in_uint16_le(ts, x);
110 in_uint16_le(ts, y);
111 if (s_check(ts))
113 break;
114 case 9: /* color pointer */
116 break;
117 case 10: /* cached pointer */
119 break;
120 default:
121 unimpl("RDP5 opcode %d\n", type);
122 }
123
124 s->p = next;
125 }
127 return True;
128}
#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
#define s_check(s)
Definition: parse.h:42
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
#define realloc
Definition: debug_ros.c:6
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: mxnamespace.c:45

◆ rdp_connect()

BOOL rdp_connect ( RDPCLIENT This,
char server,
uint32  flags,
wchar_t username,
wchar_t domain,
wchar_t password,
wchar_t command,
wchar_t directory,
wchar_t hostname,
char cookie 
)

Definition at line 1474 of file rdp.c.

1476{
1478 return False;
1479
1481 return True;
1482}
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
char * hostname
Definition: ftp.c:88

◆ rdp_disconnect()

void rdp_disconnect ( RDPCLIENT This)

Definition at line 1507 of file rdp.c.

1508{
1510}
void sec_disconnect(void)
Definition: secure.c:1032

◆ rdp_in_unistr()

int rdp_in_unistr ( RDPCLIENT This,
STREAM  s,
wchar_t string,
int  uni_len 
)

Definition at line 210 of file rdp.c.

211{
212#ifdef HAVE_ICONV
213 size_t ibl = uni_len, obl = uni_len;
214 char *pin = (char *) s->p, *pout = string;
215 static iconv_t iconv_h = (iconv_t) - 1;
216
217 if (This->rdp.iconv_works)
218 {
219 if (iconv_h == (iconv_t) - 1)
220 {
221 if ((iconv_h = iconv_open(This->codepage, WINDOWS_CODEPAGE)) == (iconv_t) - 1)
222 {
223 warning("rdp_in_unistr: iconv_open[%s -> %s] fail %d\n",
224 WINDOWS_CODEPAGE, This->codepage, (int) iconv_h);
225
226 This->rdp.iconv_works = False;
227 return rdp_in_unistr(This, s, string, uni_len);
228 }
229 }
230
231 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
232 {
233 iconv_close(iconv_h);
234 iconv_h = (iconv_t) - 1;
235 warning("rdp_in_unistr: iconv fail, errno %d\n", errno);
236
237 This->rdp.iconv_works = False;
238 return rdp_in_unistr(This, s, string, uni_len);
239 }
240
241 /* we must update the location of the current STREAM for future reads of s->p */
242 s->p += uni_len;
243
244 return pout - string;
245 }
246 else
247#endif
248 // TODO
249 {
250 int i = 0;
251
252 while (i < uni_len / 2)
253 {
254 in_uint8a(s, &string[i++], 1);
255 in_uint8s(s, 1);
256 }
257
258 return i - 1;
259 }
260}
#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
int iconv_close(iconv_t cd)
Definition: win_iconv.c:756
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

◆ rdp_loop()

BOOL rdp_loop ( RDPCLIENT This,
BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1431 of file rdp.c.

1432{
1433 uint8 type;
1434 BOOL disc = False; /* True when a disconnect PDU was received */
1435 BOOL cont = True;
1436 STREAM s;
1437
1438 while (cont)
1439 {
1440 s = rdp_recv(This, &type);
1441 if (s == NULL)
1442 return False;
1443 switch (type)
1444 {
1447 return False;
1448 *deactivated = False;
1449 break;
1450 case RDP_PDU_DEACTIVATE:
1451 DEBUG(("RDP_PDU_DEACTIVATE\n"));
1452 *deactivated = True;
1453 break;
1454 case RDP_PDU_REDIRECT:
1455 return process_redirect_pdu(This, s);
1456 break;
1457 case RDP_PDU_DATA:
1459 break;
1460 case 0:
1461 break;
1462 default:
1463 unimpl("PDU %d\n", type);
1464 }
1465 if (disc)
1466 return False;
1467 cont = This->next_packet < s->end;
1468 }
1469 return True;
1470}
@ RDP_PDU_DEMAND_ACTIVE
Definition: constants.h:160
@ RDP_PDU_DEACTIVATE
Definition: constants.h:163
@ 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
static STREAM rdp_recv(uint8 *type)
Definition: rdp.c:85
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
int deactivated
Definition: svgawin.c:63

◆ rdp_main_loop()

void rdp_main_loop ( RDPCLIENT This,
BOOL deactivated,
uint32 ext_disc_reason 
)

Definition at line 1423 of file rdp.c.

1424{
1426 ;
1427}
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
Definition: rdp.c:1695

◆ rdp_out_unistr()

void rdp_out_unistr ( RDPCLIENT This,
STREAM  s,
wchar_t string,
int  len 
)

Definition at line 134 of file rdp.c.

135{
136#ifdef HAVE_ICONV
137 size_t ibl = strlen(string), obl = len + 2;
138 static iconv_t iconv_h = (iconv_t) - 1;
139 char *pin = string, *pout = (char *) s->p;
140
141 memset(pout, 0, len + 4);
142
143 if (This->rdp.iconv_works)
144 {
145 if (iconv_h == (iconv_t) - 1)
146 {
147 size_t i = 1, o = 4;
148 if ((iconv_h = iconv_open(WINDOWS_CODEPAGE, This->codepage)) == (iconv_t) - 1)
149 {
150 warning("rdp_out_unistr: iconv_open[%s -> %s] fail %d\n",
151 This->codepage, WINDOWS_CODEPAGE, (int) iconv_h);
152
153 This->rdp.iconv_works = False;
154 rdp_out_unistr(This, s, string, len);
155 return;
156 }
157 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &i, &pout, &o) ==
158 (size_t) - 1)
159 {
160 iconv_close(iconv_h);
161 iconv_h = (iconv_t) - 1;
162 warning("rdp_out_unistr: iconv(1) fail, errno %d\n", errno);
163
164 This->rdp.iconv_works = False;
165 rdp_out_unistr(This, s, string, len);
166 return;
167 }
168 pin = string;
169 pout = (char *) s->p;
170 }
171
172 if (iconv(iconv_h, (ICONV_CONST char **) &pin, &ibl, &pout, &obl) == (size_t) - 1)
173 {
174 iconv_close(iconv_h);
175 iconv_h = (iconv_t) - 1;
176 warning("rdp_out_unistr: iconv(2) fail, errno %d\n", errno);
177
178 This->rdp.iconv_works = False;
179 rdp_out_unistr(This, s, string, len);
180 return;
181 }
182
183 s->p += len + 2;
184
185 }
186 else
187#endif
188 // TODO
189 {
190 int i = 0, j = 0;
191
192 len += 2;
193
194 while (i < len)
195 {
196 int c = string[j++];
197 s->p[i++] = (c >> 0) & 0xFF;
198 s->p[i++] = (c >> 8) & 0xFF;
199 }
200
201 s->p += len;
202 }
203}
void rdp_out_unistr(STREAM s, char *string, int len)
Definition: rdp.c:188
__kernel_size_t size_t
Definition: linux.h:237
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

◆ rdp_reconnect()

BOOL rdp_reconnect ( RDPCLIENT This,
char server,
uint32  flags,
wchar_t username,
wchar_t domain,
wchar_t password,
wchar_t command,
wchar_t directory,
wchar_t hostname,
char cookie 
)

Definition at line 1486 of file rdp.c.

1488{
1490 return False;
1491
1493 return True;
1494}
BOOL sec_reconnect(RDPCLIENT *This, char *server, wchar_t *hostname, char *cookie)
Definition: secure.c:933

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

◆ rdp_reset_state()

void rdp_reset_state ( RDPCLIENT This)

Definition at line 1498 of file rdp.c.

1499{
1500 This->next_packet = NULL; /* reset the packet information */
1501 This->rdp_shareid = 0;
1503}
void sec_reset_state(void)
Definition: secure.c:1039

◆ rdp_send_client_window_status()

BOOL rdp_send_client_window_status ( RDPCLIENT This,
int  status 
)

Definition at line 483 of file rdp.c.

484{
485 STREAM s;
486
487 if (This->rdp.current_status == status)
488 return True;
489
490 s = rdp_init_data(This, 12);
491
492 if(s == NULL)
493 return False;
494
496
497 switch (status)
498 {
499 case 0: /* shut the server up */
500 break;
501
502 case 1: /* receive data again */
503 out_uint32_le(s, 0); /* unknown */
504 out_uint16_le(s, This->width);
505 out_uint16_le(s, This->height);
506 break;
507 }
508
509 s_mark_end(s);
510 This->rdp.current_status = status;
512}
@ RDP_DATA_PDU_CLIENT_WINDOW_STATUS
Definition: constants.h:176
#define out_uint16_le(s, v)
Definition: parse.h:58
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

◆ rdp_send_input()

BOOL rdp_send_input ( RDPCLIENT This,
uint32  time,
uint16  message_type,
uint16  device_flags,
uint16  param1,
uint16  param2 
)

Definition at line 459 of file rdp.c.

460{
461 STREAM s;
462
463 s = rdp_init_data(This, 16);
464
465 if(s == NULL)
466 return False;
467
468 out_uint16_le(s, 1); /* number of events */
469 out_uint16(s, 0); /* pad */
470
472 out_uint16_le(s, message_type);
473 out_uint16_le(s, device_flags);
474 out_uint16_le(s, param1);
475 out_uint16_le(s, param2);
476
477 s_mark_end(s);
479}
@ RDP_DATA_PDU_INPUT
Definition: constants.h:173
#define out_uint16(s, v)
Definition: parse.h:84
__u16 time
Definition: mkdosfs.c:8

◆ reset_order_state()

void reset_order_state ( RDPCLIENT This)

Definition at line 1386 of file orders.c.

1387{
1388 memset(&This->orders.order_state, 0, sizeof(This->orders.order_state));
1389 This->orders.order_state.order_type = RDP_ORDER_PATBLT;
1390}

◆ save_licence()

void save_licence ( RDPCLIENT This,
unsigned char data,
int  length 
)

Definition at line 178 of file rdesktop-core-tester.cpp.

179 {
180 }

◆ seamless_init()

BOOL seamless_init ( RDPCLIENT This)

Definition at line 333 of file seamless.c.

334{
335 if (!This->seamless_rdp)