1
/* -*- c-basic-offset: 8 -*-
2
rdesktop: A Remote Desktop Protocol client.
3
User interface services - Generic
4
Copyright (C) Jay Sorg 2004-2007
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
#include "../rdesktop.h"
24
extern int g_tcp_port_rdp; /* in tcp.c */
25
RD_BOOL g_use_rdp5 = False;
30
int g_server_depth = 8;
31
RD_BOOL g_encryption = True;
32
RD_BOOL g_desktop_save = True;
33
RD_BOOL g_polygon_ellipse_orders = False;
34
RD_BOOL g_bitmap_cache = True;
35
RD_BOOL g_bitmap_cache_persist_enable = False;
36
RD_BOOL g_bitmap_cache_precache = True;
37
RD_BOOL g_bitmap_compression = True;
38
uint32 g_rdp5_performanceflags = 0;
39
RD_BOOL g_console_session = False;
40
uint32 g_keylayout = 0x409; /* Defaults to US keyboard layout */
41
int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */
42
int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */
43
int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */
44
/* Session Directory redirection */
45
RD_BOOL g_redirect = False;
46
RD_BOOL g_numlock_sync = False;
47
char g_redirect_server[64];
48
char g_redirect_domain[16];
49
char g_redirect_password[64];
50
char g_redirect_username[64];
51
char g_redirect_cookie[128];
52
uint32 g_redirect_flags = 0;
53
char g_codepage[16] = "";
55
/*****************************************************************************/
60
/*****************************************************************************/
66
/*****************************************************************************/
67
void ui_destroy_cursor(void* cursor)
71
/*****************************************************************************/
72
void* ui_create_glyph(int width, int height, uint8* data)
77
/*****************************************************************************/
78
void ui_destroy_glyph(void* glyph)
82
/*****************************************************************************/
83
void ui_destroy_bitmap(void* bmp)
87
/*****************************************************************************/
88
void ui_reset_clip(void)
92
/*****************************************************************************/
93
void ui_set_clip(int x, int y, int cx, int cy)
97
/*****************************************************************************/
98
void* ui_create_colourmap(COLOURMAP * colours)
103
/*****************************************************************************/
104
void ui_set_colourmap(void* map)
108
/*****************************************************************************/
109
RD_HBITMAP ui_create_bitmap(int width, int height, uint8* data)
114
/*****************************************************************************/
115
void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode,
117
int clipx, int clipy, int clipcx, int clipcy,
118
int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush,
119
int bgcolour, int fgcolour, uint8* text, uint8 length)
123
/*****************************************************************************/
124
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy,
129
/*****************************************************************************/
130
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy,
131
RD_HBITMAP src, int srcx, int srcy,
132
BRUSH* brush, int bgcolour, int fgcolour)
136
/*****************************************************************************/
137
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy,
138
RD_HBITMAP src, int srcx, int srcy)
142
/*****************************************************************************/
143
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
147
/*****************************************************************************/
148
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
152
/*****************************************************************************/
153
void ui_rect(int x, int y, int cx, int cy, int colour)
157
/*****************************************************************************/
158
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy,
163
/*****************************************************************************/
164
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy,
165
BRUSH * brush, int bgcolour, int fgcolour)
169
/*****************************************************************************/
170
void ui_destblt(uint8 opcode, int x, int y, int cx, int cy)
174
/*****************************************************************************/
175
void ui_move_pointer(int x, int y)
179
/*****************************************************************************/
180
void ui_set_null_cursor(void)
184
/*****************************************************************************/
185
void ui_paint_bitmap(int x, int y, int cx, int cy,
186
int width, int height, uint8* data)
190
/*****************************************************************************/
191
void ui_set_cursor(RD_HCURSOR cursor)
195
/*****************************************************************************/
196
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y,
197
int width, int height,
198
uint8* andmask, uint8* xormask)
203
/*****************************************************************************/
204
uint16 ui_get_numlock_state(unsigned int state)
209
/*****************************************************************************/
210
unsigned int read_keyboard_state(void)
215
/*****************************************************************************/
216
void ui_resize_window(void)
220
/*****************************************************************************/
221
void ui_begin_update(void)
225
/*****************************************************************************/
226
void ui_end_update(void)
230
/*****************************************************************************/
231
void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints,
232
BRUSH * brush, int bgcolour, int fgcolour)
236
/*****************************************************************************/
237
/* todo, use qt function for this (QPainter::drawPolyline) */
238
void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen)
245
for (i = 1; i < npoints; i++)
249
ui_line(opcode, x, y, x + dx, y + dy, pen);
256
/*****************************************************************************/
257
void ui_ellipse(uint8 opcode, uint8 fillmode,
258
int x, int y, int cx, int cy,
259
BRUSH * brush, int bgcolour, int fgcolour)
263
/*****************************************************************************/
264
void generate_random(uint8* random)
268
/*****************************************************************************/
269
void save_licence(uint8* data, int length)
273
/*****************************************************************************/
274
int load_licence(uint8** data)
279
/*****************************************************************************/
280
void* xrealloc(void* in, int size)
285
/*****************************************************************************/
286
void* xmalloc(int size)
291
/*****************************************************************************/
296
/*****************************************************************************/
297
char * xstrdup(const char * s)
299
char * mem = strdup(s);
307
/*****************************************************************************/
308
void warning(char* format, ...)
312
/*****************************************************************************/
313
void unimpl(char* format, ...)
317
/*****************************************************************************/
318
void error(char* format, ...)
322
/*****************************************************************************/
323
RD_BOOL rd_pstcache_mkdir(void)
328
/*****************************************************************************/
329
int rd_open_file(char *filename)
334
/*****************************************************************************/
335
void rd_close_file(int fd)
340
/*****************************************************************************/
341
int rd_read_file(int fd, void *ptr, int len)
346
/*****************************************************************************/
347
int rd_write_file(int fd, void* ptr, int len)
352
/*****************************************************************************/
353
int rd_lseek_file(int fd, int offset)
358
/*****************************************************************************/
359
RD_BOOL rd_lock_file(int fd, int start, int len)
364
/*****************************************************************************/
365
int main(int c, char** p)