21#include "../rdesktop.h"
24#include <vgakeyboard.h>
33#include <linux/keyboard.h>
151 if ((
fd=
open(
"/dev/console", O_NOCTTY)) != -1 )
153 if (
ioctl (
fd, KDGETLED, &leds) != -1)
174 case 0x1:
return ~(
src |
dst);
175 case 0x2:
return (~
src) &
dst;
176 case 0x3:
return ~src;
178 case 0x5:
return ~(
dst);
179 case 0x6:
return src ^
dst;
180 case 0x7:
return ~(
src &
dst);
181 case 0x8:
return src &
dst;
182 case 0x9:
return ~(
src) ^
dst;
183 case 0xa:
return dst;
184 case 0xb:
return (~
src) |
dst;
185 case 0xc:
return src;
187 case 0xe:
return src |
dst;
197 if (
x >= 0 && x < g_width && y >= 0 &&
y <
g_height)
209 return vga_getpixel(
x,
y);
221 if (
x >= 0 && x < g_width && y >= 0 &&
y <
g_height)
412 for (
i = 0;
i <
cy;
i++)
421 vga_accel(ACCEL_PUTIMAGE,
x,
y,
cx,
cy,
data);
426 for (
i = 0;
i <
cy;
i++)
445 for (
i = 0;
i <
cx;
i++)
448 for (
i = 0;
i <
cx;
i++)
451 for (
i = 0;
i <
cy;
i++)
460 vga_accel(ACCEL_SETFGCOLOR,
color);
461 vga_accel(ACCEL_FILLBOX,
x,
y,
cx,
cy);
467 for (
i = 0;
i <
cx;
i++)
470 for (
i = 0;
i <
cx;
i++)
472 for (
i = 0;
i <
cy;
i++)
492 for (
i = 0;
i <
cy;
i++)
499 else if (srcy >
y || srcx >
x)
503 for (
i = 0;
i <
cy;
i++)
514 for (
i = 0;
i <
cy;
i++)
524 vga_accel(ACCEL_SCREENCOPY, srcx, srcy,
x,
y,
cx,
cy);
530 for (
i = 0;
i <
cy;
i++)
532 for (
i = 0;
i <
cy;
i++)
561 else if (opcode == 0xf)
563 else if (opcode == 0x0)
567 for (
i = 0;
i <
cy;
i++)
568 for (
j = 0;
j <
cx;
j++)
591 for (
i = 0;
i <
cy;
i++)
599 for (
i = 0;
i <
cy;
i++)
611 if (
r1->x >=
r2->x &&
638 for (
i = 0;
i < 32;
i++)
643 vga_drawscansegment(
ptr, ox +
k, oy +
i,
len);
656 uint8 mouse_a[32 * 32 * 4];
663 for (
i = 0;
i < 32;
i++)
665 for (
j = 0;
j < 32;
j++)
673 pixel =
rop(0x8,
k, pixel);
678 pixel =
rop(0x6,
k, pixel);
692 if (i < g_height && i >= 0)
734 walk_rect = walk_rect->
next;
741 while (walk_rect->
next != 0);
743 rect->prev = walk_rect;
784 if ((scancode == SCANCODE_CAPSLOCK) && pressed)
789 if ((scancode == SCANCODE_SCROLLLOCK) && pressed)
795 if ((scancode == SCANCODE_NUMLOCK) && pressed)
804 case SCANCODE_CURSORBLOCKDOWN: rdpkey = 0xd0;
ext =
KBD_FLAG_EXT;
break;
805 case SCANCODE_CURSORBLOCKRIGHT: rdpkey = 0xcd;
ext =
KBD_FLAG_EXT;
break;
806 case SCANCODE_CURSORBLOCKLEFT: rdpkey = 0xcb;
ext =
KBD_FLAG_EXT;
break;
813 case SCANCODE_KEYPADDIVIDE: rdpkey = 0x35;
break;
814 case SCANCODE_KEYPADENTER: rdpkey = 0x1c;
break;
815 case SCANCODE_RIGHTCONTROL: rdpkey = 0x1d;
break;
816 case SCANCODE_RIGHTALT: rdpkey = 0x38;
break;
831 case SCANCODE_SCROLLLOCK: rdpkey = 0x46;
break;
835 mouse_getx(), mouse_gety());
841 mouse_getx(), mouse_gety());
875 vgamode = G800x600x256;
879 vgamode = G640x480x256;
881 vgamode = G640x480x64K;
886 vgamode = G800x600x256;
888 vgamode = G800x600x64K;
893 vgamode = G1024x768x256;
895 vgamode = G1024x768x64K;
899 error(
"Invalid width / height");
903 if (!vga_hasmode(vgamode))
905 error(
"Graphics unavailable");
908 vga_setmousesupport(1);
910 vga_setmode(vgamode);
913 error(
"Keyboard unavailable");
919 i = vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ACCEL);
920 if (
i & ACCELFLAG_PUTIMAGE)
922 if (
i & ACCELFLAG_SCREENCOPY)
924 if (
i & ACCELFLAG_FILLBOX)
953 mouseb = mouse_getbutton();
1058 the_glyph->
data = glyph_data;
1072 the_glyph = (
bitmap*)glyph;
1073 if (the_glyph !=
NULL)
1115 int* cmap = (
int*)
xmalloc(3 * 256 *
sizeof (
int));
1118 bzero(cmap, 256 * 3 *
sizeof (
int));
1119 for (
i = 0;
i < (3 *
n);
c++)
1121 cmap[
i++] = (
c->red) >> 2;
1122 cmap[
i++] = (
c->green) >> 2;
1123 cmap[
i++] = (
c->blue) >> 2;
1141 vga_setpalvec(0, 256, (
int*)
map);
1165 the_glyph = (
bitmap*)glyph;
1166 if (the_glyph ==
NULL)
1169 for (
j = 0;
j < the_glyph->
width;
j++)
1174#define DO_GLYPH(ttext,idx) \
1176 glyph = cache_get_font (font, ttext[idx]);\
1177 if (!(flags & TEXT2_IMPLICIT_X))\
1179 xyoffset = ttext[++idx];\
1180 if ((xyoffset & 0x80))\
1182 if (flags & TEXT2_VERTICAL) \
1183 y += ttext[idx+1] | (ttext[idx+2] << 8);\
1185 x += ttext[idx+1] | (ttext[idx+2] << 8);\
1190 if (flags & TEXT2_VERTICAL) \
1198 draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\
1199 if (flags & TEXT2_IMPLICIT_X)\
1207 int clipx,
int clipy,
int clipcx,
int clipcy,
1208 int boxx,
int boxy,
int boxcx,
int boxcy,
BRUSH * brush,
1221 fill_rect(boxx, boxy, boxcx, boxcy, bgcolour, 0xc);
1228 fill_rect(clipx, clipy, clipcx, clipcy, bgcolour, 0xc);
1241 error(
"this shouldn't be happening\n");
1336 dpru = dpr - (
dx << 1);
1338 for (;
dx >= 0;
dx--)
1357 dpru = dpr - (
dy << 1);
1359 for (;
dy >= 0;
dy--)
1381 BRUSH* brush,
int bgcolour,
int fgcolour)
1405 for (
i = 0;
i <
cy;
i++)
1407 for (
j = 0;
j <
cx;
j++)
1466 if (
x == srcx &&
y == srcy)
1477 for (
i = 0;
i <
cy;
i++)
1478 for (
j = 0;
j <
cx;
j++)
1480 for (
i = 0;
i <
cy;
i++)
1481 for (
j = 0;
j <
cx;
j++)
1492 BRUSH * brush,
int bgcolour,
int fgcolour)
1502 switch (brush->style)
1508 for (
i = 0;
i < 8;
i++)
1509 ipattern[
i] = ~brush->pattern[7 -
i];
1511 for (
j = 0;
j <
cx;
j++)
1513 (
y +
i + brush->yorigin) % 8, 8, 1))
1580 for (
i = 0;
i < 32;
i++)
1582 for (
j = 0;
j < 32;
j++)
1650 BRUSH * brush,
int bgcolour,
int fgcolour)
1661 int x,
int y,
int cx,
int cy,
1662 BRUSH * brush,
int bgcolour,
int fgcolour)
1669 memcpy(
random,
"12345678901234567890123456789012", 32);
1790 char fullhostname[64];
1797 if (pw !=
NULL && pw->pw_name !=
NULL)
1801 if (
gethostname(fullhostname,
sizeof(fullhostname)) != -1)
1803 p =
strchr(fullhostname,
'.');
1813 fprintf(
stderr,
"rdesktop: A Remote Desktop Protocol client.\n");
1815 fprintf(
stderr,
"See http://www.rdesktop.org/ for more information.\n\n");
1846 for (
i = 0;
i < thisline;
i++)
1852 for (
i = 0;
i < thisline;
i++)
1874 for (
i = 1;
i < in_argc;
i++)
1877 if (
strcmp(in_argv[
i],
"-g") == 0)
1882 error(
"invalid geometry\n");
1889 error(
"invalid geometry\n");
1894 else if (
strcmp(in_argv[
i],
"-4") == 0)
1896 else if (
strcmp(in_argv[
i],
"-5") == 0)
1898 else if (
strcmp(in_argv[
i],
"-t") == 0)
1900 else if (
strcmp(in_argv[
i],
"-h") == 0)
1905 else if (
strcmp(in_argv[
i],
"-n") == 0)
1909 else if (
strcmp(in_argv[
i],
"-u") == 0)
1913 else if (
strcmp(in_argv[
i],
"-d") == 0)
1917 else if (
strcmp(in_argv[
i],
"-a") == 0)
1922 error(
"invalid server bpp\n");
1927 else if (
strcmp(in_argv[
i],
"-l") == 0)
1934int main(
int in_argc,
char** in_argv)
int strcmp(const char *String1, const char *String2)
char * strcpy(char *DstString, const char *SrcString)
char * strchr(const char *String, int ch)
void cache_put_text(uint8 cache_id, void *data, int length)
DATABLOB * cache_get_text(uint8 cache_id)
#define MOUSE_FLAG_BUTTON5
#define MOUSE_FLAG_BUTTON1
#define MOUSE_FLAG_BUTTON2
#define MOUSE_FLAG_BUTTON4
#define MOUSE_FLAG_BUTTON3
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
#define STRNCPY(dst, src, n)
static const WCHAR *const ext[]
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble top
GLboolean GLboolean GLboolean b
GLuint GLsizei GLsizei * length
GLsizei const GLfloat * points
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
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
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define memcpy(s1, s2, n)
_Out_opt_ int _Out_opt_ int * cy
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
HBITMAP ui_create_bitmap(int width, int height, uint8 *data)
char g_redirect_cookie[128]
int get_pixel2(int x, int y, uint8 *data, int width, int bpp)
void ui_polygon(uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
void accel_fill_rect(int x, int y, int cx, int cy, int color)
void set_pixel2(int x, int y, int pixel, uint8 *data, int width, int bpp)
void * ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
void ui_rect(int x, int y, int cx, int cy, int colour)
void * ui_create_colourmap(COLOURMAP *colours)
BOOL rd_pstcache_mkdir(void)
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
void set_pixel_on(uint8 *data, int x, int y, int width, int bpp, int pixel)
#define DO_GLYPH(ttext, idx)
void key_event(int scancode, int pressed)
void ui_destroy_bitmap(void *bmp)
uint16 ui_get_numlock_state(unsigned int state)
int g_rdp5_performanceflags
int parse_parameters(int in_argc, char **in_argv)
int rd_write_file(int fd, void *ptr, int len)
BOOL rd_lock_file(int fd, int start, int len)
char g_redirect_username[64]
void ui_destroy_cursor(void *cursor)
char * xstrdup(const char *s)
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
int ui_create_window(void)
int rd_read_file(int fd, void *ptr, int len)
int warp_coords(int *x, int *y, int *cx, int *cy, int *srcx, int *srcy)
void draw_cache_rects(void)
void ui_set_null_cursor(void)
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
void ui_destroy_window(void)
void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
unsigned int read_keyboard_state(void)
void ui_polyline(uint8 opcode, POINT *points, int npoints, PEN *pen)
char g_redirect_domain[16]
int g_keyboard_functionkeys
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
static int has_screen_copy
int load_licence(uint8 **data)
void rd_close_file(int fd)
void copy_mem(uint8 *d, uint8 *s, int n)
void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
void ui_set_colourmap(void *map)
void ui_set_cursor(void *cursor)
int get_pixel(int x, int y)
uint8 * get_ptr(int x, int y, uint8 *data, int width, int bpp)
void unimpl(char *format,...)
int contains_mouse(int x, int y, int cx, int cy)
void cache_rect(int x, int y, int cx, int cy, int do_warp)
void accel_draw_box(int x, int y, int cx, int cy, uint8 *data, int line_size)
void draw_glyph(int x, int y, HGLYPH glyph, int fgcolour)
uint8 mouse_under[32 *32 *4]
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
static void setled(int mask, int state)
void process_keyboard(void)
char g_redirect_password[64]
void copy_memb(uint8 *d, uint8 *s, int n)
void ui_destblt(uint8 opcode, int x, int y, int cx, int cy)
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
void * xrealloc(void *in_val, int size)
void ui_set_clip(int x, int y, int cx, int cy)
void fill_rect(int x, int y, int cx, int cy, int colour, int opcode)
void ui_resize_window(void)
void ui_destroy_colourmap(HCOLOURMAP map)
void set_pixel(int x, int y, int pixel, int op)
void get_rect(int x, int y, int cx, int cy, uint8 *p)
void * ui_create_glyph(int width, int height, uint8 *data)
void draw_cursor_under(int ox, int oy)
int g_bitmap_cache_precache
int g_bitmap_cache_persist_enable
void hexdump(uint8 *p, uint32 len)
void save_licence(uint8 *data, int length)
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
void ui_begin_update(void)
char g_redirect_server[64]
int rd_lseek_file(int fd, int offset)
int rd_open_file(char *filename)
void ui_move_pointer(int x, int y)
void generate_random(uint8 *random)
int g_polygon_ellipse_orders
void accel_screen_copy(int x, int y, int cx, int cy, int srcx, int srcy)
void ui_destroy_glyph(void *glyph)
void get_username_and_hostname(void)
int rop(int rop, int src, int dst)
int is_contained_by(myrect *r1, myrect *r2)
BOOL is_pixel_on(uint8 *data, int x, int y, int width, int bpp)
void int int ULONGLONG int va_list * ap