ReactOS  0.4.13-dev-73-gcfe54aa
proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

◆ bitmap_decompress()

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

Definition at line 884 of file bitmap.c.

885 {
886  RD_BOOL rv = False;
887 
888  switch (Bpp)
889  {
890  case 1:
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
uint8 Bpp
Definition: svgawin.c:129
void unimpl(char *format,...)
Definition: uimain.c:801

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

◆ buf_out_uint32()

void buf_out_uint32 ( uint8 buffer,
uint32  value 
)

Definition at line 304 of file secure.c.

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

Referenced by sec_sign().

◆ cache_bump_bitmap()

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

Definition at line 89 of file cache.c.

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

◆ cache_evict_bitmap()

void cache_evict_bitmap ( RDPCLIENT This,
uint8  id 
)

Definition at line 155 of file cache.c.

156 {
157  uint16 idx;
158  int n_idx;
159 
160  if (!IS_PERSISTENT(id))
161  return;
162 
163  idx = This->cache.bmpcache_lru[id];
164  n_idx = This->cache.bmpcache[id][idx].next;
165  DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=0x%x\n", id, idx, n_idx,
166  This->cache.bmpcache[id][idx].bitmap));
167 
168  ui_destroy_bitmap(This, This->cache.bmpcache[id][idx].bitmap);
169  --This->cache.bmpcache_count[id];
170  This->cache.bmpcache[id][idx].bitmap = 0;
171 
172  This->cache.bmpcache_lru[id] = n_idx;
173  This->cache.bmpcache[id][n_idx].previous = NOT_SET;
174 
175  pstcache_touch_bitmap(This, id, idx, 0);
176 }
unsigned int idx
Definition: utils.c:41
void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp)
Definition: pstcache.c:39
#define NOT_SET
Definition: cache.c:30
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define DEBUG_RDP5(args)
Definition: rdesktop.h:141
void ui_destroy_bitmap(RD_HBITMAP bmp)
unsigned short uint16
Definition: types.h:30
GLenum GLuint id
Definition: glext.h:5579

◆ cache_get_bitmap()

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

Definition at line 180 of file cache.c.

181 {
182  if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
183  {
184  if (This->cache.bmpcache[id][idx].bitmap || pstcache_load_bitmap(This, id, idx))
185  {
186  if (IS_PERSISTENT(id))
188 
189  return This->cache.bmpcache[id][idx].bitmap;
190  }
191  }
192  else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
193  {
194  return This->cache.volatile_bc[id];
195  }
196 
197  error("get bitmap %d:%d\n", id, idx);
198  return NULL;
199 }
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
#define NUM_ELEMENTS(array)
Definition: cache.c:27
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define IS_PERSISTENT(id)
Definition: cache.c:28
#define BUMP_COUNT
Definition: cache.c:39
GLenum GLuint id
Definition: glext.h:5579

◆ cache_get_cursor()

HCURSOR cache_get_cursor ( RDPCLIENT This,
uint16  cache_idx 
)

Definition at line 381 of file cache.c.

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

◆ cache_get_desktop()

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

Definition at line 336 of file cache.c.

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

◆ cache_get_font()

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

Definition at line 262 of file cache.c.

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

◆ cache_get_text()

DATABLOB* cache_get_text ( RDPCLIENT This,
uint8  cache_id 
)

Definition at line 306 of file cache.c.

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

◆ cache_put_bitmap()

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

Definition at line 203 of file cache.c.

204 {
205  HBITMAP old;
206 
207  if ((id < NUM_ELEMENTS(This->cache.bmpcache)) && (idx < NUM_ELEMENTS(This->cache.bmpcache[0])))
208  {
209  old = This->cache.bmpcache[id][idx].bitmap;
210  if (old != NULL)
211  ui_destroy_bitmap(This, old);
212  This->cache.bmpcache[id][idx].bitmap = bitmap;
213 
214  if (IS_PERSISTENT(id))
215  {
216  if (old == NULL)
217  This->cache.bmpcache[id][idx].previous = This->cache.bmpcache[id][idx].next = NOT_SET;
218 
220  if (This->cache.bmpcache_count[id] > BMPCACHE2_C2_CELLS)
222  }
223  }
224  else if ((id < NUM_ELEMENTS(This->cache.volatile_bc)) && (idx == 0x7fff))
225  {
226  old = This->cache.volatile_bc[id];
227  if (old != NULL)
228  ui_destroy_bitmap(This, old);
229  This->cache.volatile_bc[id] = bitmap;
230  }
231  else
232  {
233  error("put bitmap %d:%d\n", id, idx);
234  }
235 }
#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
#define TO_TOP
Definition: cache.c:29
#define NUM_ELEMENTS(array)
Definition: cache.c:27
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define NOT_SET
Definition: cache.c:30
#define IS_PERSISTENT(id)
Definition: cache.c:28
void cache_evict_bitmap(uint8 id)
Definition: cache.c:170
void ui_destroy_bitmap(RD_HBITMAP bmp)
GLenum GLuint id
Definition: glext.h:5579
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP
Definition: button.c:44

◆ cache_put_cursor()

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

Definition at line 398 of file cache.c.

399 {
400  HCURSOR old;
401 
402  if (cache_idx < NUM_ELEMENTS(This->cache.cursorcache))
403  {
404  old = This->cache.cursorcache[cache_idx];
405  if (old != NULL)
406  ui_destroy_cursor(This, old);
407 
408  This->cache.cursorcache[cache_idx] = cursor;
409  }
410  else
411  {
412  error("put cursor %d\n", cache_idx);
413  }
414 }
#define error(str)
Definition: mkdosfs.c:1605
HICON HCURSOR
Definition: windef.h:284
#define NUM_ELEMENTS(array)
Definition: cache.c:27
smooth NULL
Definition: ftsmooth.c:416
const char cursor[]
Definition: icontest.c:13
void ui_destroy_cursor(RD_HCURSOR cursor)

◆ cache_put_desktop()

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

Definition at line 354 of file cache.c.

355 {
356  int length = cx * cy * bytes_per_pixel;
357 
358  if (offset > sizeof(This->cache.deskcache))
359  offset = 0;
360 
361  if ((offset + length) <= sizeof(This->cache.deskcache))
362  {
363  cx *= bytes_per_pixel;
364  while (cy--)
365  {
366  memcpy(&This->cache.deskcache[offset], data, cx);
367  data += scanline;
368  offset += cx;
369  }
370  }
371  else
372  {
373  error("put desktop %d:%d\n", offset, length);
374  }
375 }
#define error(str)
Definition: mkdosfs.c:1605
GLintptr offset
Definition: glext.h:5920
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
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 ( RDPCLIENT This,
uint8  font,
uint16  character,
uint16  offset,
uint16  baseline,
uint16  width,
uint16  height,
HGLYPH  pixmap 
)

Definition at line 279 of file cache.c.

281 {
282  FONTGLYPH *glyph;
283 
284  if ((font < NUM_ELEMENTS(This->cache.fontcache)) && (character < NUM_ELEMENTS(This->cache.fontcache[0])))
285  {
286  glyph = &This->cache.fontcache[font][character];
287  if (glyph->pixmap != NULL)
288  ui_destroy_glyph(This, glyph->pixmap);
289 
290  glyph->offset = offset;
291  glyph->baseline = baseline;
292  glyph->width = width;
293  glyph->height = height;
294  glyph->pixmap = pixmap;
295  }
296  else
297  {
298  error("put font %d:%d\n", font, character);
299  }
300 }
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
#define NUM_ELEMENTS(array)
Definition: cache.c:27
smooth NULL
Definition: ftsmooth.c:416
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 ( RDPCLIENT This,
uint8  cache_id,
void data,
int  length 
)

Definition at line 316 of file cache.c.

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

◆ cache_rebuild_bmpcache_linked_list()

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

Definition at line 43 of file cache.c.

44 {
45  int n = count, c = 0;
46  sint16 n_idx;
47 
48  /* find top, skip evicted bitmaps */
49  while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
50  if (n < 0)
51  {
52  This->cache.bmpcache_mru[id] = This->cache.bmpcache_lru[id] = NOT_SET;
53  return;
54  }
55 
56  This->cache.bmpcache_mru[id] = idx[n];
57  This->cache.bmpcache[id][idx[n]].next = NOT_SET;
58  n_idx = idx[n];
59  c++;
60 
61  /* link list */
62  while (n >= 0)
63  {
64  /* skip evicted bitmaps */
65  while (--n >= 0 && This->cache.bmpcache[id][idx[n]].bitmap == NULL);
66 
67  if (n < 0)
68  break;
69 
70  This->cache.bmpcache[id][n_idx].previous = idx[n];
71  This->cache.bmpcache[id][idx[n]].next = n_idx;
72  n_idx = idx[n];
73  c++;
74  }
75 
76  This->cache.bmpcache[id][n_idx].previous = NOT_SET;
77  This->cache.bmpcache_lru[id] = n_idx;
78 
79  if (c != This->cache.bmpcache_count[id])
80  {
81  error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
82  This->cache.bmpcache_count[id]);
83  exit(1);
84  }
85 }
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define NOT_SET
Definition: cache.c:30
const GLubyte * c
Definition: glext.h:8905
signed short sint16
Definition: types.h:31
GLenum GLuint id
Definition: glext.h:5579
void exit(int exitcode)
Definition: _exit.c:33

◆ cache_save_state()

void cache_save_state ( RDPCLIENT This)

Definition at line 239 of file cache.c.

240 {
241  uint32 id = 0, t = 0;
242  int idx;
243 
244  for (id = 0; id < NUM_ELEMENTS(This->cache.bmpcache); id++)
245  if (IS_PERSISTENT(id))
246  {
247  DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id));
248  idx = This->cache.bmpcache_lru[id];
249  while (idx >= 0)
250  {
251  pstcache_touch_bitmap(This, id, idx, ++t);
252  idx = This->cache.bmpcache[id][idx].next;
253  }
254  DEBUG_RDP5((" %d stamps written.\n", t));
255  }
256 }
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble t
Definition: gl.h:2047
#define NUM_ELEMENTS(array)
Definition: cache.c:27
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 DEBUG_RDP5(args)
Definition: rdesktop.h:141
GLenum GLuint id
Definition: glext.h:5579

◆ channel_init()

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

Definition at line 66 of file channels.c.

67 {
68  STREAM s;
69 
70  s = sec_init(This, This->encryption ? SEC_ENCRYPT : 0, length + 8);
71  s_push_layer(s, channel_hdr, 8);
72  return s;
73 }
STREAM sec_init(uint32 flags, int maxlen)
Definition: secure.c:419
#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 ( RDPCLIENT This,
STREAM  s,
uint16  mcs_channel 
)

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

414 {
415 }

◆ channel_register()

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

Definition at line 43 of file channels.c.

44 {
45  VCHANNEL *channel;
46 
47  if (!This->use_rdp5)
48  return NULL;
49 
50  if (This->num_channels >= MAX_CHANNELS)
51  {
52  error("Channel table full, increase MAX_CHANNELS\n");
53  return NULL;
54  }
55 
56  channel = &This->channels[This->num_channels];
57  channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + This->num_channels;
58  strncpy(channel->name, name, 8);
59  channel->flags = flags;
60  channel->process = callback;
61  This->num_channels++;
62  return channel;
63 }
#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
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
void(* process)(STREAM)
Definition: types.h:156
GLbitfield flags
Definition: glext.h:7161
Definition: name.c:36

◆ channel_send()

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

Definition at line 76 of file channels.c.

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

◆ cliprdr_init()

BOOL cliprdr_init ( RDPCLIENT This)

Definition at line 174 of file cliprdr.c.

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

◆ cliprdr_send_data()

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

Definition at line 102 of file cliprdr.c.

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

◆ cliprdr_send_data_request()

void cliprdr_send_data_request ( RDPCLIENT This,
uint32  format 
)

Definition at line 92 of file cliprdr.c.

93 {
94  uint8 buffer[4];
95 
96  DEBUG_CLIPBOARD(("cliprdr_send_data_request\n"));
99 }
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
unsigned char uint8
Definition: types.h:28
#define CLIPRDR_DATA_REQUEST
Definition: cliprdr.c:27
static void cliprdr_send_packet(RDPCLIENT *This, uint16 type, uint16 status, uint8 *data, uint32 length)
Definition: cliprdr.c:35
#define CLIPRDR_REQUEST
Definition: cliprdr.c:30

◆ cliprdr_send_native_format_announce()

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

Definition at line 73 of file cliprdr.c.

74 {
75  DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n"));
76 
78  formats_data_length);
79 
80  if (formats_data != This->cliprdr.last_formats)
81  {
82  if (This->cliprdr.last_formats)
83  xfree(This->cliprdr.last_formats);
84 
85  This->cliprdr.last_formats = xmalloc(formats_data_length);
86  memcpy(This->cliprdr.last_formats, formats_data, formats_data_length);
87  This->cliprdr.last_formats_length = formats_data_length;
88  }
89 }
#define CLIPRDR_FORMAT_ANNOUNCE
Definition: cliprdr.c:25
void * xmalloc(int size)
Definition: uimain.c:747
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
void xfree(void *mem)
Definition: uimain.c:758
static void cliprdr_send_packet(RDPCLIENT *This, uint16 type, uint16 status, uint8 *data, uint32 length)
Definition: cliprdr.c:35
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CLIPRDR_REQUEST
Definition: cliprdr.c:30

Referenced by cliprdr_process(), and cliprdr_send_simple_native_format_announce().

◆ cliprdr_send_simple_native_format_announce()

void cliprdr_send_simple_native_format_announce ( RDPCLIENT This,
uint32  format 
)

Definition at line 57 of file cliprdr.c.

58 {
59  uint8 buffer[36];
60 
61  DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n"));
62 
64  memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */
66 }
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define DEBUG_CLIPBOARD(args)
Definition: rdesktop.h:147
void buf_out_uint32(uint8 *buffer, uint32 value)
Definition: secure.c:304
unsigned char uint8
Definition: types.h:28
void cliprdr_send_native_format_announce(RDPCLIENT *This, uint8 *formats_data, uint32 formats_data_length)
Definition: cliprdr.c:73
#define memset(x, y, z)
Definition: compat.h:39

◆ cliprdr_set_mode()

void cliprdr_set_mode ( RDPCLIENT This,
const char optarg 
)

Definition at line 168 of file cliprdr.c.

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

◆ 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

Referenced by EvaluateExpression(), main(), map_view_of_file(), parse_parameters(), ParseInputFile(), read_client_conf(), ui_create_window(), ui_draw_text(), WriteLine(), xmalloc(), and xrealloc().

◆ event_logon()

void event_logon ( RDPCLIENT This)

Definition at line 5908 of file activex.cpp.

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

Referenced by process_data_pdu().

◆ event_pubkey()

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

Definition at line 5900 of file activex.cpp.

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

◆ event_redirect()

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

Definition at line 5913 of file activex.cpp.

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

Referenced by process_redirect_pdu().

◆ ewmh_init()

void ewmh_init ( RDPCLIENT This)

Definition at line 167 of file ewmhints.c.

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

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 709 of file uimain.c.

710 {
711  int i;
712 
713  rand();
714  rand();
715  for (i = 0; i < 32; i++)
716  {
717  random[i] = rand(); /* higher bits are more random */
718  }
719 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define random
Definition: rosdhcp.h:81

◆ get_current_workarea()

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

Definition at line 123 of file ewmhints.c.

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

◆ get_key_state()

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

Definition at line 1143 of file xwin.c.

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

◆ hexdump()

void hexdump ( unsigned char p,
unsigned int  len 
)

Definition at line 234 of file shimdbg.c.

235 {
236  unsigned char *line = p;
237  unsigned int i, thisline, offset = 0;
238 
239  while (offset < len)
240  {
241  xprintf("%04x ", offset);
242  thisline = len - offset;
243  if (thisline > 16)
244  thisline = 16;
245 
246  for (i = 0; i < thisline; i++)
247  xprintf("%02x ", line[i]);
248 
249  for (; i < 16; i++)
250  xprintf(" ");
251 
252  for (i = 0; i < thisline; i++)
253  xprintf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
254 
255  xprintf("\n");
256  offset += thisline;
257  line += thisline;
258  }
259 }
GLintptr offset
Definition: glext.h:5920
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
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

Referenced by DumpRegistryData().

◆ iso_connect()

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

Definition at line 179 of file iso.c.

180 {
181  uint8 code = 0;
182 
183  if (!tcp_connect(This, server))
184  return False;
185 
186  if (!iso_send_connection_request(This, cookie))
187  return False;
188 
189  if (iso_recv_msg(This, &code, NULL) == NULL)
190  return False;
191 
192  if (code != ISO_PDU_CC)
193  {
194  error("expected CC, got 0x%x\n", code);
196  return False;
197  }
198 
199  return True;
200 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL iso_send_connection_request(RDPCLIENT *This, char *cookie)
Definition: iso.c:49
smooth NULL
Definition: ftsmooth.c:416
#define True
Definition: types.h:24
#define False
Definition: types.h:25
unsigned char uint8
Definition: types.h:28
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
void tcp_disconnect(void)
Definition: tcp.c:832
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

◆ iso_disconnect()

BOOL iso_disconnect ( RDPCLIENT This)

Definition at line 229 of file iso.c.

230 {
232  return tcp_disconnect(This);
233 }
static BOOL iso_send_msg(RDPCLIENT *This, uint8 code)
Definition: iso.c:25
void tcp_disconnect(void)
Definition: tcp.c:832

◆ iso_init()

STREAM iso_init ( RDPCLIENT This,
int  length 
)

Definition at line 122 of file iso.c.

123 {
124  STREAM s;
125 
126  s = tcp_init(This, length + 7);
127 
128  if(s == NULL)
129  return NULL;
130 
131  s_push_layer(s, iso_hdr, 7);
132 
133  return s;
134 }
smooth NULL
Definition: ftsmooth.c:416
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_reconnect()

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

Definition at line 204 of file iso.c.

205 {
206  uint8 code = 0;
207 
208  if (!tcp_connect(This, server))
209  return False;
210 
211  if (!iso_send_connection_request(This, cookie)) // BUGBUG should we really pass the cookie here?
212  return False;
213 
214  if (iso_recv_msg(This, &code, NULL) == NULL)
215  return False;
216 
217  if (code != ISO_PDU_CC)
218  {
219  error("expected CC, got 0x%x\n", code);
221  return False;
222  }
223 
224  return True;
225 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL iso_send_connection_request(RDPCLIENT *This, char *cookie)
Definition: iso.c:49
smooth NULL
Definition: ftsmooth.c:416
#define True
Definition: types.h:24
#define False
Definition: types.h:25
unsigned char uint8
Definition: types.h:28
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
void tcp_disconnect(void)
Definition: tcp.c:832
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

Referenced by mcs_reconnect().

◆ iso_recv()

STREAM iso_recv ( RDPCLIENT This,
uint8 rdpver 
)

Definition at line 158 of file iso.c.

159 {
160  STREAM s;
161  uint8 code = 0;
162 
163  s = iso_recv_msg(This, &code, rdpver);
164  if (s == NULL)
165  return NULL;
166  if (rdpver != NULL)
167  if (*rdpver != 3)
168  return s;
169  if (code != ISO_PDU_DT)
170  {
171  error("expected DT, got 0x%x\n", code);
172  return NULL;
173  }
174  return s;
175 }
#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
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

◆ iso_reset_state()

void iso_reset_state ( RDPCLIENT This)

Definition at line 237 of file iso.c.

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

◆ iso_send()

BOOL iso_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 138 of file iso.c.

139 {
140  uint16 length;
141 
142  s_pop_layer(s, iso_hdr);
143  length = (uint16)(s->end - s->p);
144 
145  out_uint8(s, 3); /* version */
146  out_uint8(s, 0); /* reserved */
148 
149  out_uint8(s, 2); /* hdrlen */
150  out_uint8(s, ISO_PDU_DT); /* code */
151  out_uint8(s, 0x80); /* eot */
152 
153  return tcp_send(This, s);
154 }
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
GLdouble s
Definition: gl.h:2039
unsigned short uint16
Definition: types.h:30
#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.

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 ( RDPCLIENT This,
STREAM  s 
)

Definition at line 300 of file licence.c.

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

◆ load_licence()

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

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

173  {
174  return -1;
175  }

◆ lspci_init()

BOOL lspci_init ( RDPCLIENT This)

Definition at line 152 of file lspci.c.

153 {
154  lspci_channel =
156  lspci_process);
157  return (lspci_channel != NULL);
158 }
static void lspci_process(RDPCLIENT *This, STREAM s)
Definition: lspci.c:131
VCHANNEL * channel_register(char *name, uint32 flags, void(*callback)(STREAM))
Definition: channels.c:46
#define CHANNEL_OPTION_INITIALIZED
Definition: constants.h:431
smooth NULL
Definition: ftsmooth.c:416
static VCHANNEL * lspci_channel
Definition: lspci.c:25
#define CHANNEL_OPTION_ENCRYPT_RDP
Definition: constants.h:432

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

Referenced by __declspec(), Indic_process_next_syllable(), and parse_consonant_syllable().

◆ mcs_connect()

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

Definition at line 388 of file mcs.c.

389 {
390  unsigned int i;
391 
392  if (!iso_connect(This, server, cookie))
393  return False;
394 
395  if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
396  goto error;
397 
399  goto error;
400 
401  if (!mcs_recv_aucf(This, &This->mcs_userid))
402  goto error;
403 
404  if (!mcs_send_cjrq(This, This->mcs_userid + MCS_USERCHANNEL_BASE) || !mcs_recv_cjcf(This))
405  goto error;
406 
408  goto error;
409 
410  for (i = 0; i < This->num_channels; i++)
411  {
413  goto error;
414  }
415  return True;
416 
417  error:
419  return False;
420 }
static BOOL mcs_send_edrq(RDPCLIENT *This)
Definition: mcs.c:194
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL mcs_send_connect_initial(RDPCLIENT *This, STREAM mcs_data)
Definition: mcs.c:117
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
static BOOL mcs_send_aurq(RDPCLIENT *This)
Definition: mcs.c:213
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void iso_disconnect(void)
Definition: iso.c:362
static BOOL mcs_send_cjrq(RDPCLIENT *This, uint16 chanid)
Definition: mcs.c:261
#define True
Definition: types.h:24
#define False
Definition: types.h:25
#define MCS_USERCHANNEL_BASE
Definition: constants.h:88
static BOOL mcs_recv_aucf(RDPCLIENT *This, uint16 *mcs_userid)
Definition: mcs.c:230
RD_BOOL iso_connect(char *server, char *username, char *domain, char *password, RD_BOOL reconnect, uint32 *selected_protocol)
Definition: iso.c:203
static BOOL mcs_recv_cjcf(RDPCLIENT *This)
Definition: mcs.c:282
static BOOL mcs_recv_connect_response(RDPCLIENT *This, STREAM mcs_data)
Definition: mcs.c:150

Referenced by sec_connect().

◆ mcs_disconnect()

void mcs_disconnect ( RDPCLIENT This)

Definition at line 460 of file mcs.c.

461 {
463 }
void iso_disconnect(void)
Definition: iso.c:362

◆ mcs_init()

STREAM mcs_init ( RDPCLIENT This,
int  length 
)

Definition at line 314 of file mcs.c.

315 {
316  STREAM s;
317 
318  s = iso_init(This, length + 8);
319 
320  if(s == NULL)
321  return NULL;
322 
323  s_push_layer(s, mcs_hdr, 8);
324 
325  return s;
326 }
smooth NULL
Definition: ftsmooth.c:416
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_reconnect()

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

Definition at line 424 of file mcs.c.

425 {
426  unsigned int i;
427 
428  if (!iso_reconnect(This, server, cookie))
429  return False;
430 
431  if (!mcs_send_connect_initial(This, mcs_data) || !mcs_recv_connect_response(This, mcs_data))
432  goto error;
433 
435  goto error;
436 
437  if (!mcs_recv_aucf(This, &This->mcs_userid))
438  goto error;
439 
440  if (!mcs_send_cjrq(This, This->mcs_userid + MCS_USERCHANNEL_BASE) || !mcs_recv_cjcf(This))
441  goto error;
442 
444  goto error;
445 
446  for (i = 0; i < This->num_channels; i++)
447  {
449  goto error;
450  }
451  return True;
452 
453  error:
455  return False;
456 }
static BOOL mcs_send_edrq(RDPCLIENT *This)
Definition: mcs.c:194
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL mcs_send_connect_initial(RDPCLIENT *This, STREAM mcs_data)
Definition: mcs.c:117
BOOL iso_reconnect(RDPCLIENT *This, char *server, char *cookie)
Definition: iso.c:204
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
static BOOL mcs_send_aurq(RDPCLIENT *This)
Definition: mcs.c:213
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void iso_disconnect(void)
Definition: iso.c:362
static BOOL mcs_send_cjrq(RDPCLIENT *This, uint16 chanid)
Definition: mcs.c:261
#define True
Definition: types.h:24
#define False
Definition: types.h:25
#define MCS_USERCHANNEL_BASE
Definition: constants.h:88
static BOOL mcs_recv_aucf(RDPCLIENT *This, uint16 *mcs_userid)
Definition: mcs.c:230
static BOOL mcs_recv_cjcf(RDPCLIENT *This)
Definition: mcs.c:282
static BOOL mcs_recv_connect_response(RDPCLIENT *This, STREAM mcs_data)
Definition: mcs.c:150

Referenced by sec_reconnect().

◆ mcs_recv()

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

Definition at line 356 of file mcs.c.

357 {
358  uint8 opcode, appid, length;
359  STREAM s;
360 
361  s = iso_recv(This, rdpver);
362  if (s == NULL)
363  return NULL;
364  if (rdpver != NULL)
365  if (*rdpver != 3)
366  return s;
367  in_uint8(s, opcode);
368  appid = opcode >> 2;
369  if (appid != MCS_SDIN)
370  {
371  if (appid != MCS_DPUM)
372  {
373  error("expected data, got %d\n", opcode);
374  }
375  return NULL;
376  }
377  in_uint8s(s, 2); /* userid */
378  in_uint16_be(s, *channel);
379  in_uint8s(s, 1); /* flags */
380  in_uint8(s, length);
381  if (length & 0x80)
382  in_uint8s(s, 1); /* second byte of length */
383  return s;
384 }
#define error(str)
Definition: mkdosfs.c:1605
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 ( RDPCLIENT This)

Definition at line 467 of file mcs.c.

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

◆ mcs_send()

BOOL mcs_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 349 of file mcs.c.

350 {
352 }
void mcs_send_to_channel(STREAM s, uint16 channel)
Definition: mcs.c:254
#define MCS_GLOBAL_CHANNEL
Definition: constants.h:87
GLdouble s
Definition: gl.h:2039

◆ mcs_send_to_channel()

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

Definition at line 330 of file mcs.c.

331 {
332  uint16 length;
333 
334  s_pop_layer(s, mcs_hdr);
335  length = (uint16)(s->end - s->p - 8);
336  length |= 0x8000;
337 
338  out_uint8(s, (MCS_SDRQ << 2));
339  out_uint16_be(s, This->mcs_userid);
340  out_uint16_be(s, channel);
341  out_uint8(s, 0x70); /* flags */
343 
344  return iso_send(This, s);
345 }
#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
GLdouble s
Definition: gl.h:2039
unsigned short uint16
Definition: types.h:30
#define out_uint16_be(s, v)
Definition: parse.h:77

◆ mppc_expand()

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

Definition at line 56 of file mppc.c.

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

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

Referenced by main().

◆ parallel_enum_devices()

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

Definition at line 40 of file parallel.c.

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

◆ printer_enum_devices()

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

Definition at line 36 of file printer.c.

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

◆ printercache_load_blob()

int printercache_load_blob ( char printer_name,
uint8 **  data 
)

Definition at line 154 of file printercache.c.

155 {
156  char *home, *path;
157  struct stat st;
158  int fd, length;
159 
160  if (printer_name == NULL)
161  return 0;
162 
163  *data = NULL;
164 
165  home = getenv("HOME");
166  if (home == NULL)
167  return 0;
168 
169  path = (char *) xmalloc(strlen(home) + sizeof("/.rdesktop/rdpdr/") + strlen(printer_name) +
170  sizeof("/AutoPrinterCacheData") + 1);
171  sprintf(path, "%s/.rdesktop/rdpdr/%s/AutoPrinterCacheData", home, printer_name);
172 
173  fd = open(path, O_RDONLY);
174  if (fd == -1)
175  {
176  xfree(path);
177  return 0;
178  }
179 
180  if (fstat(fd, &st))
181  {
182  xfree(path);
183  close(fd);
184  return 0;
185  }
186 
187  *data = (uint8 *) xmalloc(st.st_size);
188  length = read(fd, *data, st.st_size);
189  close(fd);
190  xfree(path);
191  return length;
192 }
#define 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
Definition: tftpd.h:37
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)
Definition: services.c:325
_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 ( RDPCLIENT This,
STREAM  s 
)

Definition at line 233 of file printercache.c.

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

◆ process_bitmap_updates()

void process_bitmap_updates ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1084 of file rdp.c.

1085 {
1086  uint16 num_updates;
1088  uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
1089  uint8 *data, *bmpdata;
1090  int i;
1091 
1092  in_uint16_le(s, num_updates);
1093 
1094  for (i = 0; i < num_updates; i++)
1095  {
1096  in_uint16_le(s, left);
1097  in_uint16_le(s, top);
1098  in_uint16_le(s, right);
1099  in_uint16_le(s, bottom);
1100  in_uint16_le(s, width);
1101  in_uint16_le(s, height);
1102  in_uint16_le(s, bpp);
1103  Bpp = (bpp + 7) / 8;
1106 
1107  cx = right - left + 1;
1108  cy = bottom - top + 1;
1109 
1110  DEBUG(("BITMAP_UPDATE(l=%d,t=%d,r=%d,b=%d,w=%d,h=%d,Bpp=%d,cmp=%d)\n",
1111  left, top, right, bottom, width, height, Bpp, compress));
1112 
1113  if (!compress)
1114  {
1115 #if 0
1116  int y;
1117  bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1118  for (y = 0; y < height; y++)
1119  {
1120  in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)],
1121  width * Bpp);
1122  }
1123  ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1124  xfree(bmpdata);
1125 #else
1126  in_uint8p(s, bmpdata, width * height * Bpp);
1127  ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1128 #endif
1129  continue;
1130  }
1131 
1132 
1133  if (compress & 0x400)
1134  {
1135  size = bufsize;
1136  }
1137  else
1138  {
1139  in_uint8s(s, 2); /* pad */
1140  in_uint16_le(s, size);
1141  in_uint8s(s, 4); /* line_size, final_size */
1142  }
1143  in_uint8p(s, data, size);
1144  bmpdata = (uint8 *) malloc(width * height * Bpp);
1145 
1146  if(bmpdata == NULL)
1147  return;
1148 
1149  if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
1150  {
1151  ui_paint_bitmap(This, left, top, cx, cy, width, height, bmpdata);
1152  }
1153  else
1154  {
1155  DEBUG_RDP5(("Failed to decompress data\n"));
1156  }
1157 
1158  free(bmpdata);
1159  }
1160 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define free
Definition: debug_ros.c:5
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define in_uint8p(s, v, n)
Definition: parse.h:89
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void * 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
smooth NULL
Definition: ftsmooth.c:416
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
GLdouble s
Definition: gl.h:2039
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
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:570
#define malloc
Definition: debug_ros.c:4
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 ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1020 of file rdp.c.

1021 {
1022  uint16 cache_idx;
1023 
1024  in_uint16_le(s, cache_idx);
1025  ui_set_cursor(This, cache_get_cursor(This, cache_idx));
1026 }
void ui_set_cursor(RD_HCURSOR cursor)
RD_HCURSOR cache_get_cursor(uint16 cache_idx)
Definition: cache.c:400
GLdouble s
Definition: gl.h:2039
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 ( RDPCLIENT This,
STREAM  s 
)

Definition at line 998 of file rdp.c.

999 {
1000  uint16 x, y, width, height, cache_idx, masklen, datalen;
1001  uint8 *mask, *data;
1002  HCURSOR cursor;
1003 
1004  in_uint16_le(s, cache_idx);
1005  in_uint16_le(s, x);
1006  in_uint16_le(s, y);
1007  in_uint16_le(s, width);
1008  in_uint16_le(s, height);
1009  in_uint16_le(s, masklen);
1011  in_uint8p(s, data, datalen);
1012  in_uint8p(s, mask, masklen);
1015  cache_put_cursor(This, cache_idx, cursor);
1016 }
void ui_set_cursor(RD_HCURSOR cursor)
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask, int bpp)
Definition: uimain.c:175
GLint GLint GLsizei width
Definition: gl.h:1546
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HICON HCURSOR
Definition: windef.h:284
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
#define in_uint8p(s, v, n)
Definition: parse.h:89
GLenum GLint GLuint mask
Definition: glext.h:6028
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor)
Definition: cache.c:417
unsigned char uint8
Definition: types.h:28
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble s
Definition: gl.h:2039
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
const char cursor[]
Definition: icontest.c:13
unsigned short uint16
Definition: types.h:30
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define in_uint16_le(s, v)
Definition: parse.h:55

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

Referenced by process_data_pdu().

◆ process_orders()

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

Definition at line 1243 of file orders.c.

1244 {
1245  RDP_ORDER_STATE *os = &This->orders.order_state;
1246  uint32 present;
1247  uint8 order_flags;
1248  int size, processed = 0;
1249  BOOL delta;
1250 
1251  while (processed < num_orders)
1252  {
1253  in_uint8(s, order_flags);
1254 
1255  if (!(order_flags & RDP_ORDER_STANDARD))
1256  {
1257  error("order parsing failed\n");
1258  break;
1259  }
1260 
1261  if (order_flags & RDP_ORDER_SECONDARY)
1262  {
1264  }
1265  else
1266  {
1267  if (order_flags & RDP_ORDER_CHANGE)
1268  {
1269  in_uint8(s, os->order_type);
1270  }
1271 
1272  switch (os->order_type)
1273  {
1274  case RDP_ORDER_TRIBLT:
1275  case RDP_ORDER_TEXT2:
1276  size = 3;
1277  break;
1278 
1279  case RDP_ORDER_PATBLT:
1280  case RDP_ORDER_MEMBLT:
1281  case RDP_ORDER_LINE:
1282  case RDP_ORDER_POLYGON2:
1283  case RDP_ORDER_ELLIPSE2:
1284  size = 2;
1285  break;
1286 
1287  default:
1288  size = 1;
1289  }
1290 
1291  rdp_in_present(s, &present, order_flags, size);
1292 
1293  if (order_flags & RDP_ORDER_BOUNDS)
1294  {
1295  if (!(order_flags & RDP_ORDER_LASTBOUNDS))
1296  rdp_parse_bounds(s, &os->bounds);
1297 
1298  ui_set_clip(This, os->bounds.left,
1299  os->bounds.top,
1300  os->bounds.right -
1301  os->bounds.left + 1,
1302  os->bounds.bottom - os->bounds.top + 1);
1303  }
1304 
1305  delta = order_flags & RDP_ORDER_DELTA;
1306 
1307  switch (os->order_type)
1308  {
1309  case RDP_ORDER_DESTBLT:
1310  process_destblt(This, s, &os->destblt, present, delta);
1311  break;
1312 
1313  case RDP_ORDER_PATBLT:
1314  process_patblt(This, s, &os->patblt, present, delta);
1315  break;
1316 
1317  case RDP_ORDER_SCREENBLT:
1318  process_screenblt(This, s, &os->screenblt, present, delta);
1319  break;
1320 
1321  case RDP_ORDER_LINE:
1322  process_line(This, s, &os->line, present, delta);
1323  break;
1324 
1325  case RDP_ORDER_RECT:
1326  process_rect(This, s, &os->rect, present, delta);
1327  break;
1328 
1329  case RDP_ORDER_DESKSAVE:
1330  process_desksave(This, s, &os->desksave, present, delta);
1331  break;
1332 
1333  case RDP_ORDER_MEMBLT:
1334  process_memblt(This, s, &os->memblt, present, delta);
1335  break;
1336 
1337  case RDP_ORDER_TRIBLT:
1338  process_triblt(This, s, &os->triblt, present, delta);
1339  break;
1340 
1341  case RDP_ORDER_POLYGON:
1342  process_polygon(This, s, &os->polygon, present, delta);
1343  break;
1344 
1345  case RDP_ORDER_POLYGON2:
1346  process_polygon2(This, s, &os->polygon2, present, delta);
1347  break;
1348 
1349  case RDP_ORDER_POLYLINE:
1350  process_polyline(This, s, &os->polyline, present, delta);
1351  break;
1352 
1353  case RDP_ORDER_ELLIPSE:
1354  process_ellipse(This, s, &os->ellipse, present, delta);
1355  break;
1356 
1357  case RDP_ORDER_ELLIPSE2:
1358  process_ellipse2(This, s, &os->ellipse2, present, delta);
1359  break;
1360 
1361  case RDP_ORDER_TEXT2:
1362  process_text2(This, s, &os->text2, present, delta);
1363  break;
1364 
1365  default:
1366  unimpl("order %d\n", os->order_type);
1367  return;
1368  }
1369 
1370  if (order_flags & RDP_ORDER_BOUNDS)
1372  }
1373 
1374  processed++;
1375  }
1376 #if 0
1377  /* not true when RDP_COMPRESSION is set */
1378  if (s->p != This->next_packet)
1379  error("%d bytes remaining\n", (int) (This->next_packet - s->p));
1380 #endif
1381 
1382 }
#define error(str)
Definition: mkdosfs.c:1605
#define RDP_ORDER_DELTA
Definition: orders.h:24
unsigned int uint32
Definition: types.h:32
void ui_set_clip(int x, int y, int cx, int cy)
Definition: uimain.c:320
#define RDP_ORDER_SECONDARY
Definition: orders.h:21
static void process_triblt(RDPCLIENT *This, STREAM s, TRIBLT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:443
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_desksave(RDPCLIENT *This, STREAM s, DESKSAVE_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:357
PATBLT_ORDER patblt
Definition: orders.h:275
static void process_line(RDPCLIENT *This, STREAM s, LINE_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:274
sint16 right
Definition: types.h:76
SCREENBLT_ORDER screenblt
Definition: orders.h:276
ELLIPSE_ORDER ellipse
Definition: orders.h:285
static void process_text2(RDPCLIENT *This, STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:850
unsigned int BOOL
Definition: ntddk_ex.h:94
TRIBLT_ORDER triblt
Definition: orders.h:281
#define RDP_ORDER_LASTBOUNDS
Definition: orders.h:25
DESKSAVE_ORDER desksave
Definition: orders.h:279
static void process_memblt(RDPCLIENT *This, STREAM s, MEMBLT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:393
static void process_secondary_order(RDPCLIENT *This, STREAM s)
Definition: orders.c:1192
static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
Definition: orders.c:26
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(RDPCLIENT *This, STREAM s, SCREENBLT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:239
static void process_ellipse(RDPCLIENT *This, STREAM s, ELLIPSE_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:770
static void process_ellipse2(RDPCLIENT *This, STREAM s, ELLIPSE2_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:807
GLsizeiptr size
Definition: glext.h:5919
MEMBLT_ORDER memblt
Definition: orders.h:280
static void process_destblt(RDPCLIENT *This, STREAM s, DESTBLT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:171
#define RDP_ORDER_STANDARD
Definition: orders.h:20
RECT_ORDER rect
Definition: orders.h:278
POLYGON_ORDER polygon
Definition: orders.h:282
sint16 bottom
Definition: types.h:77
BOUNDS bounds
Definition: orders.h:272
static void process_polygon2(RDPCLIENT *This, STREAM s, POLYGON2_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:590
uint8 order_type
Definition: orders.h:271
unsigned char uint8
Definition: types.h:28
static void process_polygon(RDPCLIENT *This, STREAM s, POLYGON_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:502
sint16 top
Definition: types.h:75
GLdouble s
Definition: gl.h:2039
static void process_patblt(RDPCLIENT *This, STREAM s, PATBLT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:200
static BOOL rdp_parse_bounds(STREAM s, BOUNDS *bounds)
Definition: orders.c:102
static void process_polyline(RDPCLIENT *This, STREAM s, POLYLINE_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:684
#define in_uint8(s, v)
Definition: parse.h:88
ELLIPSE2_ORDER ellipse2
Definition: orders.h:286
static int processed(const type_t *type)
Definition: typegen.c:2236
POLYGON2_ORDER polygon2
Definition: orders.h:283
void unimpl(char *format,...)
Definition: uimain.c:801
static void process_rect(RDPCLIENT *This, STREAM s, RECT_ORDER *os, uint32 present, BOOL delta)
Definition: orders.c:317
TEXT2_ORDER text2
Definition: orders.h:287

◆ process_palette()

void process_palette ( RDPCLIENT This,
STREAM  s 
)

Definition at line 1164 of file rdp.c.

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