got vnc mod working in win32
This commit is contained in:
parent
666b5dd175
commit
2f4ea16051
@ -678,7 +678,7 @@ long
|
||||
g_load_library(char* in)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return 0;
|
||||
return (long)LoadLibrary(in);
|
||||
#else
|
||||
return (long)dlopen(in, RTLD_LOCAL | RTLD_LAZY);
|
||||
#endif
|
||||
@ -693,7 +693,7 @@ g_free_library(long lib)
|
||||
return 0;
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
return 0;
|
||||
return FreeLibrary((HMODULE)lib);
|
||||
#else
|
||||
return dlclose((void*)lib);
|
||||
#endif
|
||||
@ -709,7 +709,7 @@ g_get_proc_address(long lib, char* name)
|
||||
return 0;
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
return 0;
|
||||
return GetProcAddress((HMODULE)lib, name);
|
||||
#else
|
||||
return dlsym((void*)lib, name);
|
||||
#endif
|
||||
|
25
vnc/makefile_win32
Executable file
25
vnc/makefile_win32
Executable file
@ -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
|
58
vnc/vnc.c
58
vnc/vnc.c
@ -24,7 +24,8 @@
|
||||
|
||||
/******************************************************************************/
|
||||
/* taken from vncauth.c */
|
||||
void rfbEncryptBytes(char* bytes, char* passwd)
|
||||
void DEFAULT_CC
|
||||
rfbEncryptBytes(char* bytes, char* passwd)
|
||||
{
|
||||
char key[12];
|
||||
|
||||
@ -38,7 +39,8 @@ void rfbEncryptBytes(char* bytes, char* passwd)
|
||||
|
||||
/******************************************************************************/
|
||||
/* 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;
|
||||
|
||||
@ -80,7 +82,8 @@ int lib_recv(struct vnc* v, char* data, int len)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* 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;
|
||||
|
||||
@ -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,
|
||||
long param3, long param4)
|
||||
int DEFAULT_CC
|
||||
lib_mod_event(struct vnc* v, int msg, long param1, long param2,
|
||||
long param3, long param4)
|
||||
{
|
||||
struct stream* s;
|
||||
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 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,
|
||||
int pixel)
|
||||
void DEFAULT_CC
|
||||
set_pixel_safe(char* data, int x, int y, int width, int height, int bpp,
|
||||
int pixel)
|
||||
{
|
||||
int start;
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
@ -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* 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;
|
||||
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;
|
||||
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;
|
||||
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_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
|
||||
*/
|
||||
int lib_mod_connect(struct vnc* v)
|
||||
int DEFAULT_CC
|
||||
lib_mod_connect(struct vnc* v)
|
||||
{
|
||||
char cursor_data[32 * (32 * 3)];
|
||||
char cursor_mask[32 * (32 / 8)];
|
||||
@ -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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
@ -94,6 +94,8 @@ static int APP_CC
|
||||
xrdp_wm_setup_mod(struct xrdp_wm* self,
|
||||
struct xrdp_mod_data* mod_data)
|
||||
{
|
||||
void* func;
|
||||
|
||||
if (self == 0)
|
||||
{
|
||||
return 1;
|
||||
@ -103,10 +105,18 @@ xrdp_wm_setup_mod(struct xrdp_wm* self,
|
||||
self->mod_handle = g_load_library(mod_data->lib);
|
||||
if (self->mod_handle != 0)
|
||||
{
|
||||
self->mod_init = (struct xrdp_mod* (*)(void))
|
||||
g_get_proc_address(self->mod_handle, "mod_init");
|
||||
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");
|
||||
if (func == 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
self->mod = self->mod_init();
|
||||
|
Loading…
Reference in New Issue
Block a user