got vnc mod working in win32

ulab-original
jsorg71 20 years ago
parent 666b5dd175
commit 2f4ea16051

@ -678,7 +678,7 @@ long
g_load_library(char* in) g_load_library(char* in)
{ {
#if defined(_WIN32) #if defined(_WIN32)
return 0; return (long)LoadLibrary(in);
#else #else
return (long)dlopen(in, RTLD_LOCAL | RTLD_LAZY); return (long)dlopen(in, RTLD_LOCAL | RTLD_LAZY);
#endif #endif
@ -693,7 +693,7 @@ g_free_library(long lib)
return 0; return 0;
} }
#if defined(_WIN32) #if defined(_WIN32)
return 0; return FreeLibrary((HMODULE)lib);
#else #else
return dlclose((void*)lib); return dlclose((void*)lib);
#endif #endif
@ -709,7 +709,7 @@ g_get_proc_address(long lib, char* name)
return 0; return 0;
} }
#if defined(_WIN32) #if defined(_WIN32)
return 0; return GetProcAddress((HMODULE)lib, name);
#else #else
return dlsym((void*)lib, name); return dlsym((void*)lib, name);
#endif #endif

@ -0,0 +1,25 @@
# borland windows makefile
#
# this assumes openssl and borland free command line tools are installed
# this assumes c:\windows is windows directory
#
# run 'set PATH=c:\borland\bcc55\bin' and run 'make -f makefile_win32 all'
#
VNCOBJ = vnc.obj os_calls.obj d3des.obj
CFLAGS = -w- -O2 -I../common -Ic:/borland/bcc55/include
LDFLAGS = -Lc:/borland/bcc55/lib
all: vnc
vnc: $(VNCOBJ)
$(CC) $(LDFLAGS) -WD -evnc.dll $(VNCOBJ)
clean:
del $(VNCOBJ) vnc.dll
os_calls.obj:
$(CC) $(CFLAGS) -c ../common/os_calls.c
d3des.obj:
$(CC) $(CFLAGS) -c ../common/d3des.c

@ -24,7 +24,8 @@
/******************************************************************************/ /******************************************************************************/
/* taken from vncauth.c */ /* taken from vncauth.c */
void rfbEncryptBytes(char* bytes, char* passwd) void DEFAULT_CC
rfbEncryptBytes(char* bytes, char* passwd)
{ {
char key[12]; char key[12];
@ -38,7 +39,8 @@ void rfbEncryptBytes(char* bytes, char* passwd)
/******************************************************************************/ /******************************************************************************/
/* returns error */ /* returns error */
int lib_recv(struct vnc* v, char* data, int len) int DEFAULT_CC
lib_recv(struct vnc* v, char* data, int len)
{ {
int rcvd; int rcvd;
@ -80,7 +82,8 @@ int lib_recv(struct vnc* v, char* data, int len)
/*****************************************************************************/ /*****************************************************************************/
/* returns error */ /* returns error */
int lib_send(struct vnc* v, char* data, int len) int DEFAULT_CC
lib_send(struct vnc* v, char* data, int len)
{ {
int sent; int sent;
@ -121,8 +124,9 @@ int lib_send(struct vnc* v, char* data, int len)
} }
/******************************************************************************/ /******************************************************************************/
int lib_mod_event(struct vnc* v, int msg, long param1, long param2, int DEFAULT_CC
long param3, long param4) lib_mod_event(struct vnc* v, int msg, long param1, long param2,
long param3, long param4)
{ {
struct stream* s; struct stream* s;
int key; int key;
@ -314,7 +318,8 @@ param1 0x%4.4x param2 0x%4.4x\n\r", msg, param1, param2);
} }
//****************************************************************************** //******************************************************************************
int get_pixel_safe(char* data, int x, int y, int width, int height, int bpp) int DEFAULT_CC
get_pixel_safe(char* data, int x, int y, int width, int height, int bpp)
{ {
int start; int start;
int shift; int shift;
@ -368,8 +373,9 @@ int get_pixel_safe(char* data, int x, int y, int width, int height, int bpp)
} }
/******************************************************************************/ /******************************************************************************/
void set_pixel_safe(char* data, int x, int y, int width, int height, int bpp, void DEFAULT_CC
int pixel) set_pixel_safe(char* data, int x, int y, int width, int height, int bpp,
int pixel)
{ {
int start; int start;
int shift; int shift;
@ -417,7 +423,8 @@ void set_pixel_safe(char* data, int x, int y, int width, int height, int bpp,
} }
/******************************************************************************/ /******************************************************************************/
int split_color(int pixel, int* r, int* g, int* b, int bpp, int* palette) int DEFAULT_CC
split_color(int pixel, int* r, int* g, int* b, int bpp, int* palette)
{ {
if (bpp == 8) if (bpp == 8)
{ {
@ -438,7 +445,8 @@ int split_color(int pixel, int* r, int* g, int* b, int bpp, int* palette)
} }
/******************************************************************************/ /******************************************************************************/
int make_color(int r, int g, int b, int bpp) int DEFAULT_CC
make_color(int r, int g, int b, int bpp)
{ {
if (bpp == 24) if (bpp == 24)
{ {
@ -448,7 +456,8 @@ int make_color(int r, int g, int b, int bpp)
} }
/******************************************************************************/ /******************************************************************************/
int lib_framebuffer_update(struct vnc* v) int DEFAULT_CC
lib_framebuffer_update(struct vnc* v)
{ {
char* data; char* data;
char* d1; char* d1;
@ -597,7 +606,8 @@ int lib_framebuffer_update(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_clip_data(struct vnc* v) int DEFAULT_CC
lib_clip_data(struct vnc* v)
{ {
struct stream* s; struct stream* s;
int size; int size;
@ -618,7 +628,8 @@ int lib_clip_data(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_palette_update(struct vnc* v) int DEFAULT_CC
lib_palette_update(struct vnc* v)
{ {
struct stream* s; struct stream* s;
int first_color; int first_color;
@ -667,7 +678,8 @@ int lib_palette_update(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_mod_signal(struct vnc* v) int DEFAULT_CC
lib_mod_signal(struct vnc* v)
{ {
char type; char type;
int error; int error;
@ -696,7 +708,8 @@ int lib_mod_signal(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_mod_start(struct vnc* v, int w, int h, int bpp) int DEFAULT_CC
lib_mod_start(struct vnc* v, int w, int h, int bpp)
{ {
v->server_begin_update(v); v->server_begin_update(v);
v->server_fill_rect(v, 0, 0, w, h, 0); v->server_fill_rect(v, 0, 0, w, h, 0);
@ -711,7 +724,8 @@ int lib_mod_start(struct vnc* v, int w, int h, int bpp)
/* /*
return error return error
*/ */
int lib_mod_connect(struct vnc* v) int DEFAULT_CC
lib_mod_connect(struct vnc* v)
{ {
char cursor_data[32 * (32 * 3)]; char cursor_data[32 * (32 * 3)];
char cursor_mask[32 * (32 / 8)]; char cursor_mask[32 * (32 / 8)];
@ -949,7 +963,7 @@ int lib_mod_connect(struct vnc* v)
{ {
out_uint8(pixel_format, 8); /* bits per pixel */ out_uint8(pixel_format, 8); /* bits per pixel */
out_uint8(pixel_format, 8); /* depth */ out_uint8(pixel_format, 8); /* depth */
#if defined(B_ENDIAN) #if defined(B_ENDIAN)
out_uint8(pixel_format, 1); /* big endian */ out_uint8(pixel_format, 1); /* big endian */
#else #else
out_uint8(pixel_format, 0); /* big endian */ out_uint8(pixel_format, 0); /* big endian */
@ -967,7 +981,7 @@ int lib_mod_connect(struct vnc* v)
{ {
out_uint8(pixel_format, 16); /* bits per pixel */ out_uint8(pixel_format, 16); /* bits per pixel */
out_uint8(pixel_format, 16); /* depth */ out_uint8(pixel_format, 16); /* depth */
#if defined(B_ENDIAN) #if defined(B_ENDIAN)
out_uint8(pixel_format, 1); /* big endian */ out_uint8(pixel_format, 1); /* big endian */
#else #else
out_uint8(pixel_format, 0); /* big endian */ out_uint8(pixel_format, 0); /* big endian */
@ -1044,7 +1058,8 @@ int lib_mod_connect(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_mod_end(struct vnc* v) int DEFAULT_CC
lib_mod_end(struct vnc* v)
{ {
if (v->vnc_desktop != 0) if (v->vnc_desktop != 0)
{ {
@ -1053,7 +1068,8 @@ int lib_mod_end(struct vnc* v)
} }
/******************************************************************************/ /******************************************************************************/
int lib_mod_set_param(struct vnc* v, char* name, char* value) int DEFAULT_CC
lib_mod_set_param(struct vnc* v, char* name, char* value)
{ {
if (g_strcmp(name, "username") == 0) if (g_strcmp(name, "username") == 0)
{ {
@ -1075,7 +1091,8 @@ int lib_mod_set_param(struct vnc* v, char* name, char* value)
} }
/******************************************************************************/ /******************************************************************************/
struct vnc* mod_init(void) struct vnc* EXPORT_CC
mod_init(void)
{ {
struct vnc* v; struct vnc* v;
@ -1093,7 +1110,8 @@ struct vnc* mod_init(void)
} }
/******************************************************************************/ /******************************************************************************/
int mod_exit(struct vnc* v) int EXPORT_CC
mod_exit(struct vnc* v)
{ {
if (v == 0) if (v == 0)
{ {

@ -94,6 +94,8 @@ static int APP_CC
xrdp_wm_setup_mod(struct xrdp_wm* self, xrdp_wm_setup_mod(struct xrdp_wm* self,
struct xrdp_mod_data* mod_data) struct xrdp_mod_data* mod_data)
{ {
void* func;
if (self == 0) if (self == 0)
{ {
return 1; return 1;
@ -103,10 +105,18 @@ xrdp_wm_setup_mod(struct xrdp_wm* self,
self->mod_handle = g_load_library(mod_data->lib); self->mod_handle = g_load_library(mod_data->lib);
if (self->mod_handle != 0) if (self->mod_handle != 0)
{ {
self->mod_init = (struct xrdp_mod* (*)(void)) func = g_get_proc_address(self->mod_handle, "mod_init");
g_get_proc_address(self->mod_handle, "mod_init"); if (func == 0)
self->mod_exit = (int (*)(struct xrdp_mod*)) {
g_get_proc_address(self->mod_handle, "mod_exit"); func = g_get_proc_address(self->mod_handle, "_mod_init");
}
self->mod_init = (struct xrdp_mod* (*)(void))func;
func = g_get_proc_address(self->mod_handle, "mod_exit");
if (func == 0)
{
func = g_get_proc_address(self->mod_handle, "_mod_exit");
}
self->mod_exit = (int (*)(struct xrdp_mod*))func;
if (self->mod_init != 0 && self->mod_exit != 0) if (self->mod_init != 0 && self->mod_exit != 0)
{ {
self->mod = self->mod_init(); self->mod = self->mod_init();

Loading…
Cancel
Save