fix the header mess and get it building with rosbe, albeit with many warnings at the moment

svn path=/trunk/; revision=30269
This commit is contained in:
Ged Murphy 2007-11-08 12:47:25 +00:00
parent 75b952dde1
commit aaa63f3354
25 changed files with 199 additions and 141 deletions

View file

@ -28,7 +28,7 @@
/* indent is confused by this file */
/* *INDENT-OFF* */
#include "rdesktop.h"
#include "todo.h"
#define CVAL(p) (*(p++))
#ifdef NEED_ALIGN

View file

@ -18,23 +18,24 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <string.h>
#include "bsops.h"
//#include <stdlib.h>
//#include <string.h>
//#include "bsops.h"
#include "todo.h"
/* globals */
static char * g_bs = 0;
static int g_bs_size = 0;
static int g_width = 800;
static int g_height = 600;
static int g_width1 = 800;
static int g_height1 = 600;
static int g_bpp = 8;
static int g_Bpp = 1;
static int g_clip_left = 0;
static int g_clip_top = 0;
static int g_clip_right = 800;
static int g_clip_bottom = 600;
static int g_clip_left1 = 0;
static int g_clip_top1 = 0;
static int g_clip_right1 = 800;
static int g_clip_bottom1 = 600;
/* for bs_patblt */
static unsigned char g_hatch_patterns[] =
@ -82,9 +83,9 @@ bs_get_pixel(int x, int y)
{
char * p;
if (x >= 0 && x < g_width && y >= 0 && y < g_height)
if (x >= 0 && x < g_width1 && y >= 0 && y < g_height1)
{
p = g_bs + (y * g_width * g_Bpp) + (x * g_Bpp);
p = g_bs + (y * g_width1 * g_Bpp) + (x * g_Bpp);
if (g_Bpp == 1)
{
return *((unsigned char *) p);
@ -112,12 +113,12 @@ bs_set_pixel(int x, int y, int pixel, int rop, int use_clip)
char * p;
if (!use_clip ||
(x >= g_clip_left && x < g_clip_right &&
y >= g_clip_top && y < g_clip_bottom))
(x >= g_clip_left1 && x < g_clip_right1 &&
y >= g_clip_top1 && y < g_clip_bottom1))
{
if (x >= 0 && x < g_width && y >= 0 && y < g_height)
if (x >= 0 && x < g_width1 && y >= 0 && y < g_height1)
{
p = g_bs + (y * g_width * g_Bpp) + (x * g_Bpp);
p = g_bs + (y * g_width1 * g_Bpp) + (x * g_Bpp);
if (rop != 12)
{
pixel = bs_do_rop(rop, pixel, bs_get_pixel(x, y));
@ -144,9 +145,9 @@ get_bs_ptr(int x, int y)
{
char * p;
if (x >= 0 && x < g_width && y >= 0 && y < g_height)
if (x >= 0 && x < g_width1 && y >= 0 && y < g_height1)
{
p = g_bs + (y * g_width * g_Bpp) + (x * g_Bpp);
p = g_bs + (y * g_width1 * g_Bpp) + (x * g_Bpp);
return p;
}
else
@ -163,17 +164,17 @@ bs_init(int width, int height, int bpp)
{
free(g_bs);
}
g_width = width;
g_height = height;
g_width1 = width;
g_height1 = height;
g_bpp = bpp;
g_Bpp = (bpp + 7) / 8;
g_bs_size = width * height * g_Bpp;
g_bs = malloc(g_bs_size);
memset(g_bs, 0, g_bs_size);
g_clip_left = 0;
g_clip_top = 0;
g_clip_right = width;
g_clip_bottom = height;
g_clip_left1 = 0;
g_clip_top1 = 0;
g_clip_right1 = width;
g_clip_bottom1 = height;
}
/*****************************************************************************/
@ -190,20 +191,20 @@ bs_exit(void)
void
bs_set_clip(int x, int y, int cx, int cy)
{
g_clip_left = x;
g_clip_top = y;
g_clip_right = x + cx;
g_clip_bottom = y + cy;
g_clip_left1 = x;
g_clip_top1 = y;
g_clip_right1 = x + cx;
g_clip_bottom1 = y + cy;
}
/*****************************************************************************/
void
bs_reset_clip(void)
{
g_clip_left = 0;
g_clip_top = 0;
g_clip_right = g_width;
g_clip_bottom = g_height;
g_clip_left1 = 0;
g_clip_top1 = 0;
g_clip_right1 = g_width1;
g_clip_bottom1 = g_height1;
}
/*****************************************************************************/
@ -326,29 +327,29 @@ bs_warp_coords(int * x, int * y, int * cx, int * cy,
int dx;
int dy;
if (g_clip_left > *x)
if (g_clip_left1 > *x)
{
dx = g_clip_left - *x;
dx = g_clip_left1 - *x;
}
else
{
dx = 0;
}
if (g_clip_top > *y)
if (g_clip_top1 > *y)
{
dy = g_clip_top - *y;
dy = g_clip_top1 - *y;
}
else
{
dy = 0;
}
if (*x + *cx > g_clip_right)
if (*x + *cx > g_clip_right1)
{
*cx = (*cx - ((*x + *cx) - g_clip_right));
*cx = (*cx - ((*x + *cx) - g_clip_right1));
}
if (*y + *cy > g_clip_bottom)
if (*y + *cy > g_clip_bottom1)
{
*cy = (*cy - ((*y + *cy) - g_clip_bottom));
*cy = (*cy - ((*y + *cy) - g_clip_bottom1));
}
*cx = *cx - dx;
*cy = *cy - dy;
@ -793,13 +794,13 @@ bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size)
return;
}
/* nothing to draw, memset and leave */
if (x + cx < 0 || y + cy < 0 || x >= g_width || y >= g_height)
if (x + cx < 0 || y + cy < 0 || x >= g_width1 || y >= g_height1)
{
memset(dst, 0, cx * cy * g_Bpp);
return;
}
/* check if it goes over an edge */
if (x < 0 || y < 0 || x + cx > g_width || y + cy > g_height)
if (x < 0 || y < 0 || x + cx > g_width1 || y + cy > g_height1)
{
memset(dst, 0, cx * cy * g_Bpp);
if (x < 0)
@ -808,9 +809,9 @@ bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size)
dst += -x * g_Bpp;
x = 0;
}
if (x + cx > g_width)
if (x + cx > g_width1)
{
cx = g_width - x;
cx = g_width1 - x;
}
for (i = 0; i < cy; i++)
{

View file

@ -18,6 +18,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __BSOPS_MSTSC_H
#define __BSOPS_MSTSC_H
int bs_get_pixel(int x, int y);
void bs_set_pixel(int x, int y, int pixel, int rop, int use_clip);
int bs_do_rop(int rop, int src, int dst);
@ -47,3 +50,5 @@ void bs_patblt(int opcode, int x, int y, int cx, int cy,
int brush_style, char * brush_pattern,
int brush_x_org, int brush_y_org,
int bgcolour, int fgcolour);
#endif /* __BSOPS_MSTSC_H */

View file

@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
/* BITMAP CACHE */
extern int g_pstcache_fd[];

View file

@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
#define MAX_CHANNELS 6
#define CHANNEL_CHUNK_LENGTH 1600

View file

@ -18,11 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <todo.h>
#include "resource.h"
#include "todo.h"
#define MAX_KEY_NAME 255
@ -72,6 +68,8 @@ typedef struct _INFO
HWND hDisplayPage;
HBITMAP hHeader;
BITMAP headerbitmap;
HICON hMstscSm;
HICON hMstscLg;
HICON hLogon;
HICON hConn;
HICON hRemote;
@ -541,11 +539,19 @@ OnResolutionChanged(PINFO pInfo, INT position)
Pixel,
sizeof(Pixel) / sizeof(WCHAR)))
{
#ifdef _MSC_VER
_swprintf(Buffer,
Pixel,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight,
Pixel);
#else
swprintf(Buffer,
Pixel,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth,
pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight,
Pixel);
#endif
}
}
@ -678,11 +684,20 @@ FillResolutionsAndColors(PINFO pInfo)
Pixel,
sizeof(Pixel) / sizeof(WCHAR)))
{
#ifdef _MSC_VER
_swprintf(Buffer,
Pixel,
width,
height,
Pixel);
#else
swprintf(Buffer,
Pixel,
width,
height,
Pixel);
#endif
SendDlgItemMessageW(pInfo->hDisplayPage,
IDC_SETTINGS_RESOLUTION_TEXT,
WM_SETTEXT,
@ -918,6 +933,34 @@ OnMainCreate(HWND hwnd,
/* add main settings pointer */
pInfo->pRdpSettings = pRdpSettings;
/* set the dialog icons */
pInfo->hMstscSm = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_MSTSC),
IMAGE_ICON,
16,
16,
LR_DEFAULTCOLOR);
if (pInfo->hMstscSm)
{
SendMessageW(hwnd,
WM_SETICON,
ICON_SMALL,
(WPARAM)pInfo->hMstscSm);
}
pInfo->hMstscLg = LoadImageW(hInst,
MAKEINTRESOURCEW(IDI_MSTSC),
IMAGE_ICON,
32,
32,
LR_DEFAULTCOLOR);
if (pInfo->hMstscLg)
{
SendMessageW(hwnd,
WM_SETICON,
ICON_BIG,
(WPARAM)pInfo->hMstscLg);
}
pInfo->hHeader = (HBITMAP)LoadImageW(hInst,
MAKEINTRESOURCEW(IDB_HEADER),
IMAGE_BITMAP,
@ -940,10 +983,10 @@ OnMainCreate(HWND hwnd,
(DLGPROC)GeneralDlgProc))
{
WCHAR str[256];
LoadStringW(hInst, IDS_TAB_GENERAL, str, 256);
ZeroMemory(&item, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = str;
if (LoadStringW(hInst, IDS_TAB_GENERAL, str, 256))
item.pszText = str;
item.cchTextMax = 256;
(void)TabCtrl_InsertItem(pInfo->hTab, 0, &item);
}
@ -954,10 +997,10 @@ OnMainCreate(HWND hwnd,
(DLGPROC)DisplayDlgProc))
{
WCHAR str[256];
LoadStringW(hInst, IDS_TAB_DISPLAY, str, 256);
ZeroMemory(&item, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = str;
if (LoadStringW(hInst, IDS_TAB_DISPLAY, str, 256))
item.pszText = str;
item.cchTextMax = 256;
(void)TabCtrl_InsertItem(pInfo->hTab, 1, &item);
}
@ -1057,6 +1100,13 @@ DlgProc(HWND hDlg,
{
if (pInfo)
{
if (pInfo->hMstscSm)
DestroyIcon(pInfo->hMstscSm);
if (pInfo->hMstscLg)
DestroyIcon(pInfo->hMstscLg);
if (pInfo->hHeader)
DeleteObject(pInfo->hHeader);
HeapFree(GetProcessHeap(),
0,
pInfo);

View file

@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
/* Send a self-contained ISO PDU */
static void

View file

@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
//#include <openssl/rc4.h>
void *
@ -33,8 +33,8 @@ int
ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len);
extern char g_username[64];
extern char g_hostname[16];
extern char g_username[];
extern char g_hostname[];
static uint8 g_licence_key[16];
static uint8 g_licence_sign_key[16];

View file

@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
uint16 g_mcs_userid;
extern VCHANNEL g_channels[];

View file

@ -18,10 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <string.h>
#include "rdesktop.h"
#include "todo.h"
/* mppc decompression */
/* http://www.faqs.org/rfcs/rfc2118.html */

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="mstsc" type="win32gui" installbase="system32" installname="mstsc.exe" unicode="no">
<module name="mstsc" type="win32gui" installbase="system32" installname="mstsc.exe" unicode="yes" allowwarnings="true">
<include base="mstsc">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
@ -9,6 +9,9 @@
<library>gdi32</library>
<library>comctl32</library>
<library>ws2_32</library>
<library>advapi32</library>
<library>shell32</library>
<library>ole32</library>
<compilationunit name="unit.c">
<file>bitmap.c</file>
<file>bsops.c</file>
@ -23,6 +26,7 @@
<file>pstcache.c</file>
<file>rdp5.c</file>
<file>rdp.c</file>
<file>rdpfile.c</file>
<file>secure.c</file>
<file>ssl_calls.c</file>
<file>tcp.c</file>

View file

@ -18,8 +18,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "orders.h"
#include "todo.h"
extern uint8 *g_next_packet;
static RDP_ORDER_STATE g_order_state;

View file

@ -18,6 +18,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ORDERS_MSTSC_H
#define __ORDERS_MSTSC_H
#define RDP_ORDER_STANDARD 0x01
#define RDP_ORDER_SECONDARY 0x02
#define RDP_ORDER_BOUNDS 0x04
@ -366,3 +369,5 @@ typedef struct _RDP_COLCACHE_ORDER
}
RDP_COLCACHE_ORDER;
#endif /* __ORDERS_MSTSC_H */

View file

@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
#define MAX_CELL_SIZE 0x1000 /* pixels */

View file

@ -18,11 +18,14 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __RDESKTOP_MSTSC_H
#define __RDESKTOP_MSTSC_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <winsock2.h> /* winsock2.h first */
//#include <winsock2.h> /* winsock2.h first */
#include <windows.h>
#include <time.h>
#else /* WIN32 */
@ -124,3 +127,5 @@
#ifndef MAKE_PROTO
#include "proto.h"
#endif
#endif /* __RDESKTOP_MSTSC_H */

View file

@ -18,26 +18,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <time.h>
#ifndef _WIN32
#include <errno.h>
#include <unistd.h>
#endif
#include "rdesktop.h"
#include "todo.h"
#ifdef HAVE_ICONV
#ifdef HAVE_ICONV_H
#include <iconv.h>
#endif
#ifndef ICONV_CONST
#define ICONV_CONST ""
#endif
#endif
extern uint16 g_mcs_userid;
extern char g_username[64];
extern char g_codepage[16];
extern char g_username[];
extern char g_codepage[];
extern BOOL g_bitmap_compression;
extern BOOL g_orders;
extern BOOL g_encryption;

View file

@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
extern uint8 *g_next_packet;

View file

@ -1,8 +1,5 @@
#include <windows.h>
#include <stdio.h>
#include <shlobj.h>
#include <todo.h>
#include "resource.h"
#include "todo.h"
#define NUM_SETTINGS 6
LPWSTR lpSettings[NUM_SETTINGS] =

View file

@ -18,7 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "todo.h"
//#include <openssl/rc4.h>
//#include <openssl/md5.h>
@ -62,7 +62,7 @@ int
ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len);
extern char g_hostname[16];
extern char g_hostname[];
extern int g_width;
extern int g_height;
extern unsigned int g_keylayout;

View file

@ -20,7 +20,7 @@
*/
#include "rdesktop.h"
#include "todo.h"
#define APP_CC

View file

@ -18,18 +18,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _WIN32
#include <unistd.h> /* select read write close */
#include <sys/socket.h> /* socket connect setsockopt */
#include <sys/time.h> /* timeval */
#include <netdb.h> /* gethostbyname */
#include <netinet/in.h> /* sockaddr_in */
#include <netinet/tcp.h> /* TCP_NODELAY */
#include <arpa/inet.h> /* inet_addr */
#include <errno.h> /* errno */
#endif /* _WIN32 */
#include "rdesktop.h"
#include "todo.h"
#ifdef _WIN32
#define socklen_t int

View file

@ -1,3 +1,19 @@
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <stdio.h>
#include "uimain.h"
#include "rdesktop.h"
#include "bsops.h"
#include "orders.h"
#include "resource.h"
//#include <stdio.h>
#ifndef __TODO_MSTSC_H
#define __TODO_MSTSC_H
#define MAXKEY 256
#define MAXVALUE 256
@ -24,3 +40,6 @@ INT GetIntegerFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue);
LPWSTR GetStringFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue);
BOOL SetIntegerToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, INT Value);
BOOL SetStringToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, LPWSTR lpValue);
#endif /* __TODO_MSTSC_H */

View file

@ -18,8 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "rdesktop.h"
#include "bsops.h"
#include "todo.h"
char g_username[256] = "";
char g_hostname[256] = "";
@ -97,9 +96,12 @@ void
mi_reset_clip(void);
void
mi_line(int x1, int y1, int x2, int y2, int colour);
void*
mi_create_cursor(unsigned int x, unsigned int y,
int width, int height,
unsigned char * andmask, unsigned char * xormask);
void
mi_destroy_cursor(void * cursor);
void

View file

@ -18,6 +18,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __UIMAIN_MSTSC_H
#define __UIMAIN_MSTSC_H
/* in uimain.c */
int
ui_main(void);
@ -74,3 +77,5 @@ ui_set_modifier_state(int code);
#define UI_MAX(a, b) (((a) > (b)) ? (a) : (b))
#undef UI_MIN
#define UI_MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif /* __UIMAIN_MSTSC_H */

View file

@ -19,12 +19,8 @@
*/
#include <winsock2.h> /* winsock2.h first */
#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include "uimain.h"
#include "todo.h"
#include "resource.h"
extern char g_username[];
extern char g_hostname[];
@ -999,7 +995,7 @@ mi_process_a_param(char * param1, int state)
}
else
{
if (state == 1) /* -g */
if (state == 1) /* -g widthxheight*/
{
state = 0;
if (strcmp(param1, "workarea") == 0)
@ -1022,12 +1018,12 @@ mi_process_a_param(char * param1, int state)
}
g_width_height_set = 1;
}
if (state == 2) /* -t */
if (state == 2) /* -t port */
{
state = 0;
g_tcp_port_rdp = atol(param1);
}
if (state == 3) /* -a */
if (state == 3) /* -a bpp */
{
state = 0;
g_server_depth = atol(param1);
@ -1036,32 +1032,32 @@ mi_process_a_param(char * param1, int state)
mi_error("invalid server bpp\r\n");
}
}
if (state == 5) /* -u */
if (state == 5) /* -u username */
{
state = 0;
strcpy(g_username, param1);
}
if (state == 6) /* -p */
if (state == 6) /* -p password */
{
state = 0;
strcpy(g_password, param1);
}
if (state == 7) /* -d */
if (state == 7) /* -d domain */
{
state = 0;
strcpy(g_domain, param1);
}
if (state == 8) /* -s */
if (state == 8) /* -s shell */
{
state = 0;
strcpy(g_shell, param1);
}
if (state == 9) /* -c */
if (state == 9) /* -c workin directory*/
{
state = 0;
strcpy(g_directory, param1);
}
if (state == 10) /* -n */
if (state == 10) /* -n host name*/
{
state = 0;
strcpy(g_hostname, param1);
@ -1272,28 +1268,12 @@ mi_process_cl(LPTSTR lpCmdLine)
return (state == 0);
}
#ifdef WITH_DEBUG
/*****************************************************************************/
int
main(int argc, char ** argv)
{
WSADATA d;
WSAStartup(MAKEWORD(2, 0), &d);
if (!mi_process_cl(argv[0]))
{
mi_show_params();
WSACleanup();
return 0;
}
return ui_main();
}
#else /* WITH_DEBUG */
/*****************************************************************************/
int WINAPI
WinMain(HINSTANCE hInstance,
wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
LPWSTR lpCmdLine,
int nCmdShow)
{
PRDPSETTINGS pRdpSettings;
@ -1310,6 +1290,18 @@ WinMain(HINSTANCE hInstance,
if (OpenRDPConnectDialog(hInstance,
pRdpSettings))
{
strcpy(g_servername, "192.168.40.50");
//g_port = 3389;
strcpy(g_username, "buildbot");
strcpy(g_password, "P4ssw0rd");
g_server_depth = 16;
g_width = 800;
g_height = 600;
g_screen_width = GetSystemMetrics(SM_CXSCREEN);
g_screen_height = GetSystemMetrics(SM_CYSCREEN);
g_xoff = GetSystemMetrics(SM_CXEDGE) * 2;
g_yoff = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYEDGE) * 2;
ui_main();
ret = 0;
}
@ -1328,7 +1320,7 @@ WinMain(HINSTANCE hInstance,
return ret;
}
#endif /* WITH_DEBUG */
/*****************************************************************************/
void