ReactOS  0.4.12-dev-14-gd0c8636
proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

◆ ber_in_header()

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

Definition at line 90 of file asn.c.

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

◆ ber_out_header()

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

Definition at line 61 of file asn.c.

Referenced by ber_out_integer().

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

◆ ber_out_integer()

void ber_out_integer ( STREAM  s,
int  value 
)

Definition at line 83 of file asn.c.

84 {
86  out_uint16_be(s, value);
87 }
Definition: get.c:139
void ber_out_header(STREAM s, int tagval, int length)
Definition: asn.c:61
#define BER_TAG_INTEGER
Definition: constants.h:78
#define out_uint16_be(s, v)
Definition: parse.h:77

◆ ber_parse_header()

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

Definition at line 25 of file asn.c.

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

◆ bitmap_decompress()

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

Definition at line 884 of file bitmap.c.

885 {
886  RD_BOOL rv = False;
887 
888  switch (Bpp)
889  {
890  case 1:
892  break;
893  case 2:
895  break;
896  case 3:
898  break;
899  case 4:
901  break;
902  default:
903  unimpl("Bpp %d\n", Bpp);
904  break;
905  }
906  return rv;
907 }
GLint GLint GLsizei width
Definition: gl.h:1546
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
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
int RD_BOOL
Definition: types.h:21
#define False
Definition: types.h:25
GLsizeiptr size
Definition: glext.h:5919
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
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLenum GLenum GLenum input
Definition: glext.h:9031
void unimpl(char *format,...)
Definition: uimain.c:801

◆ buf_out_uint32()

void buf_out_uint32 ( uint8 buffer,
uint32  value 
)

Definition at line 304 of file secure.c.

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

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 }
Definition: get.c:139
GLuint buffer
Definition: glext.h:5915
GLsizei const GLfloat * value
Definition: glext.h:6069

◆ cache_bump_bitmap()

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

Definition at line 104 of file cache.c.

Referenced by cache_get_bitmap(), and cache_put_bitmap().

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

◆ cache_evict_bitmap()

void cache_evict_bitmap ( uint8  id)

Definition at line 170 of file cache.c.

Referenced by cache_put_bitmap().

171 {
172  uint16 idx;
173  int n_idx;
174 
175  if (!IS_PERSISTENT(id))
176  return;
177 
178  idx = g_bmpcache_lru[id];
179  n_idx = g_bmpcache[id][idx].next;
180  DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=%p\n", id, idx, n_idx,
181  g_bmpcache[id][idx].bitmap));
182 
184  --g_bmpcache_count[id];
185  g_bmpcache[id][idx].bitmap = 0;
186 
187  g_bmpcache_lru[id] = n_idx;
188  g_bmpcache[id][n_idx].previous = NOT_SET;
189 
190  pstcache_touch_bitmap(id, idx, 0);
191 }
static int g_bmpcache_lru[3]
Definition: cache.c:51
static int g_bmpcache_count[3]
Definition: cache.c:54
unsigned int idx
Definition: utils.c:41
void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp)
Definition: pstcache.c:39
Definition: uimain.c:88
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define NOT_SET
Definition: cache.c:30
#define DEBUG_RDP5(args)
Definition: rdesktop.h:141
void ui_destroy_bitmap(RD_HBITMAP bmp)
unsigned short uint16
Definition: types.h:30
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
GLenum GLuint id
Definition: glext.h:5579

◆ cache_get_bitmap()

RD_HBITMAP cache_get_bitmap ( uint8  id,
uint16  idx 
)

Definition at line 195 of file cache.c.

Referenced by process_memblt(), and process_triblt().

196 {
197  if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
198  {
199  if (g_bmpcache[id][idx].bitmap || pstcache_load_bitmap(id, idx))
200  {
201  if (IS_PERSISTENT(id))
203 
204  return g_bmpcache[id][idx].bitmap;
205  }
206  }
207  else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
208  {
209  return g_volatile_bc[id];
210  }
211 
212  error("get bitmap %d:%d\n", id, idx);
213  return NULL;
214 }
RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx)
Definition: pstcache.c:53
void cache_bump_bitmap(uint8 id, uint16 idx, int bump)
Definition: cache.c:104
#define error(str)
Definition: mkdosfs.c:1605
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
static RD_HBITMAP g_volatile_bc[3]
Definition: cache.c:49
Definition: uimain.c:88
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define NUM_ELEMENTS(array)
Definition: cache.c:27
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
GLenum GLuint id
Definition: glext.h:5579
#define BUMP_COUNT
Definition: cache.c:39

◆ cache_get_brush_data()

BRUSHDATA* cache_get_brush_data ( uint8  colour_code,
uint8  idx 
)

Definition at line 441 of file cache.c.

Referenced by setup_brush().

442 {
443  colour_code = colour_code == 1 ? 0 : 1;
444  if (idx < NUM_ELEMENTS(g_brushcache[0]))
445  {
446  return &g_brushcache[colour_code][idx];
447  }
448  error("get brush %d %d\n", colour_code, idx);
449  return NULL;
450 }
#define error(str)
Definition: mkdosfs.c:1605
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define NUM_ELEMENTS(array)
Definition: cache.c:27
static BRUSHDATA g_brushcache[2][64]
Definition: cache.c:437

◆ cache_get_cursor()

RD_HCURSOR cache_get_cursor ( uint16  cache_idx)

Definition at line 400 of file cache.c.

Referenced by process_cached_pointer_pdu().

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

◆ cache_get_desktop()

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

Definition at line 353 of file cache.c.

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

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

◆ cache_get_font()

FONTGLYPH* cache_get_font ( uint8  font,
uint16  character 
)

Definition at line 279 of file cache.c.

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

◆ cache_get_text()

DATABLOB* cache_get_text ( uint8  cache_id)

Definition at line 325 of file cache.c.

Referenced by ui_draw_text().

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

◆ cache_put_bitmap()

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

Definition at line 218 of file cache.c.

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

219 {
220  RD_HBITMAP old;
221 
222  if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
223  {
224  old = g_bmpcache[id][idx].bitmap;
225  if (old != NULL)
226  ui_destroy_bitmap(old);
227  g_bmpcache[id][idx].bitmap = bitmap;
228 
229  if (IS_PERSISTENT(id))
230  {
231  if (old == NULL)
232  g_bmpcache[id][idx].previous = g_bmpcache[id][idx].next = NOT_SET;
233 
236  cache_evict_bitmap(id);
237  }
238  }
239  else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
240  {
241  old = g_volatile_bc[id];
242  if (old != NULL)
243  ui_destroy_bitmap(old);
245  }
246  else
247  {
248  error("put bitmap %d:%d\n", id, idx);
249  }
250 }
#define TO_TOP
Definition: cache.c:29
#define BMPCACHE2_C2_CELLS
Definition: constants.h:284
void cache_bump_bitmap(uint8 id, uint16 idx, int bump)
Definition: cache.c:104
#define error(str)
Definition: mkdosfs.c:1605
static int g_bmpcache_count[3]
Definition: cache.c:54
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
static RD_HBITMAP g_volatile_bc[3]
Definition: cache.c:49
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define NUM_ELEMENTS(array)
Definition: cache.c:27
void cache_evict_bitmap(uint8 id)
Definition: cache.c:170
#define NOT_SET
Definition: cache.c:30
void ui_destroy_bitmap(RD_HBITMAP bmp)
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
GLenum GLuint id
Definition: glext.h:5579
static HBITMAP bitmap
Definition: clipboard.c:1344

◆ cache_put_brush_data()

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

Definition at line 455 of file cache.c.

Referenced by process_brushcache().

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

◆ cache_put_cursor()

void cache_put_cursor ( uint16  cache_idx,
RD_HCURSOR  cursor 
)

Definition at line 417 of file cache.c.

Referenced by process_colour_pointer_common(), and process_colour_pointer_pdu().

418 {
419  RD_HCURSOR old;
420 
421  if (cache_idx < NUM_ELEMENTS(g_cursorcache))
422  {
423  old = g_cursorcache[cache_idx];
424  if (old != NULL)
425  ui_destroy_cursor(old);
426 
427  g_cursorcache[cache_idx] = cursor;
428  }
429  else
430  {
431  error("put cursor %d\n", cache_idx);
432  }
433 }
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
#define NUM_ELEMENTS(array)
Definition: cache.c:27
void ui_destroy_cursor(HCURSOR)
Definition: qtewin.cpp:1502
const char cursor[]
Definition: icontest.c:13
static RD_HCURSOR g_cursorcache[0x20]
Definition: cache.c:396

◆ cache_put_desktop()

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

Definition at line 371 of file cache.c.

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

372 {
373  int length = cx * cy * bytes_per_pixel;
374 
375  if (offset > sizeof(g_deskcache))
376  offset = 0;
377 
378  if ((offset + length) <= sizeof(g_deskcache))
379  {
380  cx *= bytes_per_pixel;
381  while (cy--)
382  {
384  data += scanline;
385  offset += cx;
386  }
387  }
388  else
389  {
390  error("put desktop %d:%d\n", offset, length);
391  }
392 }
#define error(str)
Definition: mkdosfs.c:1605
GLintptr offset
Definition: glext.h:5920
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
static uint8 g_deskcache[0x38400 *4]
Definition: cache.c:349
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_Out_opt_ int * cx
Definition: commctrl.h:570

◆ cache_put_font()

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

Definition at line 296 of file cache.c.

Referenced by process_fontcache().

298 {
299  FONTGLYPH *glyph;
300 
301  if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0])))
302  {
303  glyph = &g_fontcache[font][character];
304  if (glyph->pixmap != NULL)
305  ui_destroy_glyph(glyph->pixmap);
306 
307  glyph->offset = offset;
308  glyph->baseline = baseline;
309  glyph->width = width;
310  glyph->height = height;
311  glyph->pixmap = pixmap;
312  }
313  else
314  {
315  error("put font %d:%d\n", font, character);
316  }
317 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define error(str)
Definition: mkdosfs.c:1605
Definition: mk_font.cpp:20
uint16 height
Definition: types.h:115
GLintptr offset
Definition: glext.h:5920
sint16 baseline
Definition: types.h:113
smooth NULL
Definition: ftsmooth.c:416
#define NUM_ELEMENTS(array)
Definition: cache.c:27
static FONTGLYPH g_fontcache[12][256]
Definition: cache.c:275
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
uint16 width
Definition: types.h:114
sint16 offset
Definition: types.h:112
RD_HBITMAP pixmap
Definition: types.h:116
void ui_destroy_glyph(RD_HGLYPH glyph)
Definition: qtewin.cpp:1424

◆ cache_put_text()

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

Definition at line 335 of file cache.c.

Referenced by ui_draw_text().

336 {
337  DATABLOB *text;
338 
339  text = &g_textcache[cache_id];
340  if (text->data != NULL)
341  xfree(text->data);
342  text->data = xmalloc(length);
343  text->size = length;
344  memcpy(text->data, data, length);
345 }
int size
Definition: types.h:124
const WCHAR * text
Definition: package.c:1827
void * xmalloc(int size)
Definition: uimain.c:747
smooth NULL
Definition: ftsmooth.c:416
void xfree(void *mem)
Definition: uimain.c:758
static DATABLOB g_textcache[256]
Definition: cache.c:321
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void * data
Definition: types.h:123

◆ cache_rebuild_bmpcache_linked_list()

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

Definition at line 58 of file cache.c.

Referenced by pstcache_enumerate().

59 {
60  int n = count, c = 0;
61  sint16 n_idx;
62 
63  /* find top, skip evicted bitmaps */
64  while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
65  if (n < 0)
66  {
68  return;
69  }
70 
71  g_bmpcache_mru[id] = idx[n];
72  g_bmpcache[id][idx[n]].next = NOT_SET;
73  n_idx = idx[n];
74  c++;
75 
76  /* link list */
77  while (n >= 0)
78  {
79  /* skip evicted bitmaps */
80  while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
81 
82  if (n < 0)
83  break;
84 
85  g_bmpcache[id][n_idx].previous = idx[n];
86  g_bmpcache[id][idx[n]].next = n_idx;
87  n_idx = idx[n];
88  c++;
89  }
90 
91  g_bmpcache[id][n_idx].previous = NOT_SET;
92  g_bmpcache_lru[id] = n_idx;
93 
94  if (c != g_bmpcache_count[id])
95  {
96  error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
97  g_bmpcache_count[id]);
99  }
100 }
#define error(str)
Definition: mkdosfs.c:1605
static int g_bmpcache_lru[3]
Definition: cache.c:51
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int g_bmpcache_count[3]
Definition: cache.c:54
static int g_bmpcache_mru[3]
Definition: cache.c:52
GLuint n
Definition: s_context.h:57
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
Definition: uimain.c:88
const GLubyte * c
Definition: glext.h:8905
#define EX_SOFTWARE
Definition: rdesktop.h:70
signed short sint16
Definition: types.h:31
#define NOT_SET
Definition: cache.c:30
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
GLenum GLuint id
Definition: glext.h:5579
void exit(int exitcode)
Definition: _exit.c:33

◆ cache_save_state()

void cache_save_state ( void  )

Definition at line 254 of file cache.c.

Referenced by main().

255 {
256  uint32 id = 0, t = 0;
257  int idx;
258 
259  for (id = 0; id < NUM_ELEMENTS(g_bmpcache); id++)
260  if (IS_PERSISTENT(id))
261  {
262  DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id));
263  idx = g_bmpcache_lru[id];
264  while (idx >= 0)
265  {
266  pstcache_touch_bitmap(id, idx, ++t);
267  idx = g_bmpcache[id][idx].next;
268  }
269  DEBUG_RDP5((" %d stamps written.\n", t));
270  }
271 }
static int g_bmpcache_lru[3]
Definition: cache.c:51
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble t
Definition: gl.h:2047
unsigned int idx
Definition: utils.c:41
void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp)
Definition: pstcache.c:39
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define NUM_ELEMENTS(array)
Definition: cache.c:27
#define DEBUG_RDP5(args)
Definition: rdesktop.h:141
static struct bmpcache_entry g_bmpcache[3][0xa00]
Definition: cache.c:48
GLenum GLuint id
Definition: glext.h:5579

◆ channel_init()

STREAM channel_init ( VCHANNEL channel,
uint32  length 
)

Definition at line 69 of file channels.c.

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

70 {
71  STREAM s;
72 
73  s = sec_init(g_encryption ? SEC_ENCRYPT : 0, length + 8);
74  s_push_layer(s, channel_hdr, 8);
75  return s;
76 }
STREAM sec_init(uint32 flags, int maxlen)
Definition: secure.c:419
RD_BOOL g_encryption
Definition: uimain.c:40
#define SEC_ENCRYPT
Definition: constants.h:101
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define s_push_layer(s, h, n)
Definition: parse.h:39

◆ channel_process()

void channel_process ( STREAM  s,
uint16  mcs_channel 
)

Definition at line 138 of file channels.c.

Referenced by sec_recv().

139 {
141  uint32 thislength;
142  VCHANNEL *channel = NULL;
143  unsigned int i;
144  STREAM in;
145 
146  for (i = 0; i < g_num_channels; i++)
147  {
148  channel = &g_channels[i];
149  if (channel->mcs_id == mcs_channel)
150  break;
151  }
152 
153  if (i >= g_num_channels)
154  return;
155 
156  in_uint32_le(s, length);
157  in_uint32_le(s, flags);
158  if ((flags & CHANNEL_FLAG_FIRST) && (flags & CHANNEL_FLAG_LAST))
159  {
160  /* single fragment - pass straight up */
161  channel->process(s);
162  }
163  else
164  {
165  /* add fragment to defragmentation buffer */
166  in = &channel->in;
167  if (flags & CHANNEL_FLAG_FIRST)
168  {
169  if (length > in->size)
170  {
171  in->data = (uint8 *) xrealloc(in->data, length);
172  in->size = length;
173  }
174  in->p = in->data;
175  }
176 
177  thislength = MIN(s->end - s->p, in->data + in->size - in->p);
178  memcpy(in->p, s->p, thislength);
179  in->p += thislength;
180 
181  if (flags & CHANNEL_FLAG_LAST)
182  {
183  in->end = in->p;
184  in->p = in->data;
185  channel->process(in);
186  }
187  }
188 }
struct stream in
Definition: types.h:155
unsigned int uint32
Definition: types.h:32
#define CHANNEL_FLAG_LAST
Definition: channels.c:26
unsigned char * data
Definition: parse.h:26
T MIN(T a, T b)
Definition: polytest.cpp:79
GLenum GLclampf GLint i
Definition: glfuncs.h:14
void * xrealloc(void *oldmem, size_t size)
Definition: uimain.c:736
#define CHANNEL_FLAG_FIRST
Definition: channels.c:25
smooth NULL
Definition: ftsmooth.c:416
uint16 mcs_id
Definition: types.h:152
void(* process)(STREAM)
Definition: types.h:156
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned char * end
Definition: parse.h:25
unsigned char uint8
Definition: types.h:28
GLbitfield flags
Definition: glext.h:7161
unsigned int size
Definition: parse.h:27
Definition: parse.h:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VCHANNEL g_channels[MAX_CHANNELS]
Definition: channels.c:32
GLfloat CONST GLvector4f * in
Definition: m_xform.h:122
unsigned int g_num_channels
Definition: channels.c:33
unsigned char * p
Definition: parse.h:24
#define in_uint32_le(s, v)
Definition: parse.h:56

◆ channel_register()

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

Definition at line 46 of file channels.c.

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

47 {
48  VCHANNEL *channel;
49 
50  if (g_rdp_version < RDP_V5)
51  return NULL;
52 
54  {
55  error("Channel table full, increase MAX_CHANNELS\n");
56  return NULL;
57  }
58 
59  channel = &g_channels[g_num_channels];
60  channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + g_num_channels;
61  strncpy(channel->name, name, 8);
62  channel->flags = flags;
63  channel->process = callback;
64  g_num_channels++;
65  return channel;
66 }
#define error(str)
Definition: mkdosfs.c:1605
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char name[8]
Definition: types.h:153
#define MAX_CHANNELS
Definition: channels.c:23
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
RDP_VERSION g_rdp_version
Definition: uimain.c:74
smooth NULL
Definition: ftsmooth.c:416
uint32 flags
Definition: types.h:154
uint16 mcs_id
Definition: types.h:152
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
Definition: types.h:44
void(* process)(STREAM)
Definition: types.h:156
GLbitfield flags
Definition: glext.h:7161
VCHANNEL g_channels[MAX_CHANNELS]
Definition: channels.c:32
unsigned int g_num_channels
Definition: channels.c:33
Definition: name.c:36

◆ channel_send()

void channel_send ( STREAM  s,
VCHANNEL channel 
)

Definition at line 79 of file channels.c.

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

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

◆ cliprdr_init()

RD_BOOL cliprdr_init ( void  )

Referenced by xclip_init().

◆ cliprdr_send_data()

void cliprdr_send_data ( uint8 data,
uint32  length 
)

◆ cliprdr_send_data_request()

void cliprdr_send_data_request ( uint32  format)

◆ cliprdr_send_native_format_announce()

void cliprdr_send_native_format_announce ( uint8 formats_data,
uint32  formats_data_length 
)

◆ cliprdr_send_simple_native_format_announce()

void cliprdr_send_simple_native_format_announce ( uint32  format)

◆ cliprdr_set_mode()

void cliprdr_set_mode ( const char optarg)

Referenced by main().

◆ convert_to_unix_filename()

void convert_to_unix_filename ( char filename)

Definition at line 78 of file rdpdr.c.

Referenced by disk_set_information(), and rdpdr_process_irp().

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

◆ cssp_connect()

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

Referenced by iso_connect().

◆ ctrl_add_fds()

void ctrl_add_fds ( int n,
fd_set rfds 
)

◆ ctrl_check_fds()

void ctrl_check_fds ( fd_set rfds,
fd_set wfds 
)

◆ ctrl_cleanup()

void ctrl_cleanup ( )

◆ ctrl_init()

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

◆ ctrl_is_slave()

RD_BOOL ctrl_is_slave ( )

◆ ctrl_send_command()

int ctrl_send_command ( const char cmd,
const char args 
)

◆ disk_check_notify()

RD_NTSTATUS disk_check_notify ( RD_NTHANDLE  handle)

Referenced by _rdpdr_check_fds().

◆ disk_create_notify()

RD_NTSTATUS disk_create_notify ( RD_NTHANDLE  handle,
uint32  info_class 
)

Referenced by rdpdr_process_irp().

◆ disk_enum_devices()

int disk_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ disk_query_directory()

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

Referenced by rdpdr_process_irp().

◆ disk_query_information()

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

Referenced by rdpdr_process_irp().

◆ disk_query_volume_information()

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

Referenced by rdpdr_process_irp().

◆ disk_set_information()

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

Referenced by rdpdr_process_irp().

◆ ensure_remote_modifiers()

void ensure_remote_modifiers ( uint32  ev_time,
key_translation  tr 
)

Referenced by vncKey().

◆ error()

void error ( char format,
  ... 
)

Definition at line 817 of file uimain.c.

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

◆ ewmh_init()

void ewmh_init ( void  )

Referenced by ui_init().

◆ exit_if_null()

void exit_if_null ( void ptr)

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 709 of file uimain.c.

Referenced by sec_process_crypt_info().

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 }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define random
Definition: rosdhcp.h:81

◆ get_current_workarea()

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

Referenced by ui_init().

◆ get_device_index()

◆ get_key_state()

RD_BOOL get_key_state ( unsigned int  state,
uint32  keysym 
)

Definition at line 146 of file vnc.c.

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

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

◆ get_ksname()

char* get_ksname ( uint32  keysym)

Definition at line 734 of file xkeymap.c.

Referenced by xkeymap_translate_key(), and xwin_process_events().

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

◆ handle_special_keys()

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

Referenced by vncKey(), and xwin_process_events().

◆ hexdump()

void hexdump ( unsigned char p,
unsigned int  len 
)

Definition at line 234 of file shimdbg.c.

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

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 }
GLintptr offset
Definition: glext.h:5920
GLenum GLclampf GLint i
Definition: glfuncs.h:14
Definition: parser.c:48
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat p
Definition: glext.h:8902
void xprintf(const char *fmt,...)
Definition: shimdbg.c:16

◆ iso_connect()

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

Definition at line 203 of file iso.c.

Referenced by mcs_connect(), and mcs_connect_start().

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

◆ iso_disconnect()

void iso_disconnect ( void  )

Definition at line 362 of file iso.c.

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

363 {
365  tcp_disconnect();
366 }
static void iso_send_msg(uint8 code)
Definition: iso.c:39
void tcp_disconnect(void)
Definition: tcp.c:832

◆ iso_init()

STREAM iso_init ( int  length)

Definition at line 150 of file iso.c.

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

151 {
152  STREAM s;
153 
154  s = tcp_init(length + 7);
155  s_push_layer(s, iso_hdr, 7);
156 
157  return s;
158 }
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define s_push_layer(s, h, n)
Definition: parse.h:39

◆ iso_recv()

STREAM iso_recv ( uint8 rdpver)

Definition at line 182 of file iso.c.

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

183 {
184  STREAM s;
185  uint8 code = 0;
186 
187  s = iso_recv_msg(&code, rdpver);
188  if (s == NULL)
189  return NULL;
190  if (rdpver != NULL)
191  if (*rdpver != 3)
192  return s;
193  if (code != ISO_PDU_DT)
194  {
195  error("expected DT, got 0x%x\n", code);
196  return NULL;
197  }
198  return s;
199 }
static STREAM iso_recv_msg(uint8 *code, uint8 *rdpver)
Definition: iso.c:101
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
unsigned char uint8
Definition: types.h:28
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039

◆ iso_reset_state()

void iso_reset_state ( void  )

Definition at line 370 of file iso.c.

Referenced by mcs_reset_state().

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

◆ iso_send()

void iso_send ( STREAM  s)

Definition at line 162 of file iso.c.

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

163 {
164  uint16 length;
165 
166  s_pop_layer(s, iso_hdr);
167  length = s->end - s->p;
168 
169  out_uint8(s, 3); /* version */
170  out_uint8(s, 0); /* reserved */
171  out_uint16_be(s, length);
172 
173  out_uint8(s, 2); /* hdrlen */
174  out_uint8(s, ISO_PDU_DT); /* code */
175  out_uint8(s, 0x80); /* eot */
176 
177  tcp_send(s);
178 }
void tcp_send(STREAM s)
Definition: tcp.c:270
#define out_uint8(s, v)
Definition: parse.h:92
#define s_pop_layer(s, h)
Definition: parse.h:40
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned char * end
Definition: parse.h:25
unsigned short uint16
Definition: types.h:30
unsigned char * p
Definition: parse.h:24
#define out_uint16_be(s, v)
Definition: parse.h:77

◆ l_to_a()

char* l_to_a ( long  N,
int  base 
)

Definition at line 1356 of file rdesktop.c.

Referenced by printer_enum_devices().

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 }
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
GLuint base
Definition: 3dtext.c:35
Definition: bidi.c:97
int ret
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define LTOA_BUFSIZE
Definition: rdesktop.c:1353

◆ licence_process()

void licence_process ( STREAM  s)

Definition at line 378 of file licence.c.

Referenced by sec_recv().

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

◆ load_licence()

int load_licence ( unsigned char **  data)

◆ lspci_init()

RD_BOOL lspci_init ( void  )

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 1685 of file atactl.cpp.

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

◆ mcs_connect_finalize()

RD_BOOL mcs_connect_finalize ( STREAM  s)

Definition at line 318 of file mcs.c.

Referenced by sec_connect().

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

◆ mcs_connect_start()

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

Definition at line 311 of file mcs.c.

Referenced by sec_connect().

313 {
314  return iso_connect(server, username, domain, password, reconnect, selected_protocol);
315 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
static WCHAR username[]
Definition: url.c:32
RD_BOOL iso_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: iso.c:203
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64

◆ mcs_disconnect()

void mcs_disconnect ( void  )

Definition at line 356 of file mcs.c.

Referenced by sec_disconnect().

357 {
358  iso_disconnect();
359 }
void iso_disconnect(void)
Definition: iso.c:362

◆ mcs_init()

STREAM mcs_init ( int  length)

Definition at line 242 of file mcs.c.

Referenced by sec_init().

243 {
244  STREAM s;
245 
246  s = iso_init(length + 8);
247  s_push_layer(s, mcs_hdr, 8);
248 
249  return s;
250 }
STREAM iso_init(int length)
Definition: iso.c:150
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define s_push_layer(s, h, n)
Definition: parse.h:39

◆ mcs_recv()

STREAM mcs_recv ( uint16 channel,
uint8 rdpver 
)

Definition at line 280 of file mcs.c.

Referenced by sec_recv().

281 {
283  STREAM s;
284 
285  s = iso_recv(rdpver);
286  if (s == NULL)
287  return NULL;
288  if (rdpver != NULL)
289  if (*rdpver != 3)
290  return s;
291  in_uint8(s, opcode);
292  appid = opcode >> 2;
293  if (appid != MCS_SDIN)
294  {
295  if (appid != MCS_DPUM)
296  {
297  error("expected data, got %d\n", opcode);
298  }
299  return NULL;
300  }
301  in_uint8s(s, 2); /* userid */
302  in_uint16_be(s, *channel);
303  in_uint8s(s, 1); /* flags */
304  in_uint8(s, length);
305  if (length & 0x80)
306  in_uint8s(s, 1); /* second byte of length */
307  return s;
308 }
#define error(str)
Definition: mkdosfs.c:1605
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum GLuint GLenum GLvoid const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLint GLenum GLint GLenum GLenum GLint GLuint GLdouble GLfloat GLint GLshort GLubyte GLenum GLuint GLenum const GLfloat GLenum const GLint GLenum GLenum const GLfloat GLenum GLenum const GLint GLfloat const GLfloat GLenum opcode
Definition: glfuncs.h:172
char * appid
Definition: mkisofs.c:161
smooth NULL
Definition: ftsmooth.c:416
#define in_uint8s(s, n)
Definition: parse.h:91
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
STREAM iso_recv(uint8 *rdpver)
Definition: iso.c:182
unsigned char uint8
Definition: types.h:28
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define in_uint8(s, v)
Definition: parse.h:88
#define in_uint16_be(s, v)
Definition: parse.h:75

◆ mcs_reset_state()

void mcs_reset_state ( void  )

Definition at line 363 of file mcs.c.

Referenced by sec_reset_state().

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

◆ mcs_send()

void mcs_send ( STREAM  s)

Definition at line 273 of file mcs.c.

274 {
276 }
void mcs_send_to_channel(STREAM s, uint16 channel)
Definition: mcs.c:254
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87

◆ mcs_send_to_channel()

void mcs_send_to_channel ( STREAM  s,
uint16  channel 
)

Definition at line 254 of file mcs.c.

Referenced by mcs_send(), and sec_send_to_channel().

255 {
256  uint16 length;
257 
258  s_pop_layer(s, mcs_hdr);
259  length = s->end - s->p - 8;
260  length |= 0x8000;
261 
262  out_uint8(s, (MCS_SDRQ << 2));
264  out_uint16_be(s, channel);
265  out_uint8(s, 0x70); /* flags */
266  out_uint16_be(s, length);
267 
268  iso_send(s);
269 }
uint16 g_mcs_userid
Definition: mcs.c:23
#define out_uint8(s, v)
Definition: parse.h:92
#define s_pop_layer(s, h)
Definition: parse.h:40
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
void iso_send(STREAM s)
Definition: iso.c:162
unsigned char * end
Definition: parse.h:25
unsigned short uint16
Definition: types.h:30
unsigned char * p
Definition: parse.h:24
#define out_uint16_be(s, v)
Definition: parse.h:77

◆ mppc_expand()

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

Definition at line 58 of file mppc.c.

Referenced by process_data_pdu(), and rdp5_process().

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

◆ next_arg()

char* next_arg ( char src,
char  needle 
)

Definition at line 1174 of file rdesktop.c.

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

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
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
unsigned char
Definition: typeof.h:27
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GLfloat GLfloat p
Definition: glext.h:8902

◆ parallel_enum_devices()

int parallel_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ printer_enum_devices()

int printer_enum_devices ( uint32 id,
char optarg 
)

Referenced by main().

◆ printercache_load_blob()

int printercache_load_blob ( char printer_name,
uint8 **  data 
)

Definition at line 154 of file printercache.c.

Referenced by announcedata_size().

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 open
Definition: acwin.h:71
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei const GLchar ** path
Definition: glext.h:7234
static int fd
Definition: io.c:51
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void * xmalloc(int size)
Definition: uimain.c:747
smooth NULL
Definition: ftsmooth.c:416
void xfree(void *mem)
Definition: uimain.c:758
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned char uint8
Definition: types.h:28
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
char home[]
Definition: main.c:47
Definition: stat.h:55
#define close
Definition: acwin.h:74
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
_CRTIMP int __cdecl fstat(int _Desc, struct stat *_Stat)
Definition: stat.h:341
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define O_RDONLY
Definition: acwin.h:82

◆ printercache_process()

void printercache_process ( STREAM  s)

Referenced by rdpdr_process().

◆ process_bitmap_updates()

void process_bitmap_updates ( STREAM  s)

Definition at line 1224 of file rdp.c.

Referenced by process_update_pdu(), and rdp5_process().

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

◆ process_cached_pointer_pdu()

void process_cached_pointer_pdu ( STREAM  s)

Definition at line 1156 of file rdp.c.

Referenced by process_pointer_pdu(), and rdp5_process().

1157 {
1158  uint16 cache_idx;
1159 
1160  in_uint16_le(s, cache_idx);
1161  ui_set_cursor(cache_get_cursor(cache_idx));
1162 }
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
Definition: cache.c:400
void ui_set_cursor(HCURSOR)
Definition: qtewin.cpp:1446
unsigned short uint16
Definition: types.h:30
#define in_uint16_le(s, v)
Definition: parse.h:55

◆ process_colour_pointer_pdu()

void process_colour_pointer_pdu ( STREAM  s)

Definition at line 1139 of file rdp.c.

Referenced by process_pointer_pdu(), and rdp5_process().

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

◆ 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
#define DEBUG(args)
Definition: rdesktop.h:129
#define in_uint32_le(s, v)
Definition: parse.h:56

◆ process_new_pointer_pdu()

void process_new_pointer_pdu ( STREAM  s)

Definition at line 1146 of file rdp.c.

Referenced by process_pointer_pdu(), and rdp5_process().

1147 {
1148  int xor_bpp;
1149 
1150  in_uint16_le(s, xor_bpp);
1151  process_colour_pointer_common(s, xor_bpp);
1152 }
static void process_colour_pointer_common(STREAM s, int bpp)
Definition: rdp.c:1107
#define in_uint16_le(s, v)
Definition: parse.h:55

◆ process_orders()

void process_orders ( STREAM  s,
uint16  num_orders 
)

Definition at line 1311 of file orders.c.

Referenced by process_update_pdu(), and rdp5_process().

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

◆ process_palette()

void process_palette ( STREAM  s)

Definition at line 1295 of file rdp.c.

Referenced by process_update_pdu(), and rdp5_process().

1296 {
1297  COLOURENTRY *entry;
1298  COLOURMAP map;
1299  RD_HCOLOURMAP hmap;
1300  int i;
1301 
1302  in_uint8s(s, 2); /* pad */
1303  in_uint16_le(s, map.ncolours);
1304  in_uint8s(s, 2); /* pad */
1305 
1306  map.colours = (COLOURENTRY *) xmalloc(sizeof(COLOURENTRY) * map.ncolours);
1307 
1308  DEBUG(("PALETTE(c=%d)\n", map.ncolours));
1309 
1310  for (i = 0; i < map.ncolours; i++)
1311  {
1312  entry = &map.colours[i];
1313  in_uint8(s, entry->red);
1314  in_uint8(s, entry->green);
1315  in_uint8(s, entry->blue);
1316  }
1317 
1318  hmap = ui_create_colourmap(&map);
1319  ui_set_colourmap(hmap);
1320 
1321  xfree(map.colours);
1322 }
void ui_set_colourmap(RD_HCOLOURMAP map)
Definition: qtewin.cpp:1527
uint16 ncolours
Definition: types.h:66
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
Definition: uimain.c:336
uint8_t entry
Definition: isohybrid.c:63
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum map
Definition: glfuncs.h:124
GLenum GLclampf GLint i
Definition: glfuncs.h:14
void * xmalloc(int size)
Definition: uimain.c:747
#define in_uint8s(s, n)
Definition: parse.h:91
uint8 blue
Definition: types.h:59
COLOURENTRY * colours
Definition: types.h:67
void xfree(void *mem)
Definition: uimain.c:758
uint8 green
Definition: types.h:58
#define in_uint8(s, v)
Definition: parse.h:88
uint8 red
Definition: types.h:57
#define DEBUG(args)
Definition: rdesktop.h:129
#define in_uint16_le(s, v)
Definition: parse.h:55

◆ process_system_pointer_pdu()

void process_system_pointer_pdu ( STREAM  s)

Definition at line 1166 of file rdp.c.

Referenced by process_pointer_pdu().

1167 {
1168  uint16 system_pointer_type;
1169 
1170  in_uint16_le(s, system_pointer_type);
1171  switch (system_pointer_type)
1172  {
1173  case RDP_NULL_POINTER:
1175  break;
1176 
1177  default:
1178  unimpl("System pointer message 0x%x\n", system_pointer_type);
1179  }
1180 }
void ui_set_null_cursor(void)
Definition: uimain.c:227
unsigned short uint16
Definition: types.h:30
void unimpl(char *format,...)
Definition: uimain.c:801
#define in_uint16_le(s, v)
Definition: parse.h:55

◆ pstcache_enumerate()

int pstcache_enumerate ( uint8  id,
HASH_KEY keylist 
)

Definition at line 107 of file pstcache.c.

Referenced by rdp_enum_bmpcache2().

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

◆ pstcache_init()

RD_BOOL pstcache_init ( uint8  cache_id)

Definition at line 163 of file pstcache.c.

Referenced by rdp_out_bmpcache2_caps().

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