1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
User interface services - X Window System |
User interface services - QT Emb System |
4 |
Copyright (C) Jay Sorg 2004 |
Copyright (C) Jay Sorg 2004 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
41 |
#include <qpopupmenu.h> |
#include <qpopupmenu.h> |
42 |
#include <stdlib.h> |
#include <stdlib.h> |
43 |
#include <stdarg.h> // va_list va_start va_end |
#include <stdarg.h> // va_list va_start va_end |
44 |
|
#include <unistd.h> // gethostname |
45 |
|
#include <pwd.h> // getpwuid |
46 |
|
|
47 |
#include "../rdesktop.h" |
#include "../rdesktop.h" |
48 |
#include "qtewin.h" |
#include "qtewin.h" |
51 |
struct QColorMap |
struct QColorMap |
52 |
{ |
{ |
53 |
uint32 RGBColors[256]; |
uint32 RGBColors[256]; |
54 |
int NumColors; |
uint32 NumColors; |
55 |
}; |
}; |
56 |
|
|
57 |
struct bitmap |
struct bitmap |
58 |
{ |
{ |
59 |
int w; |
int w; |
60 |
int h; |
int h; |
61 |
uint8* data; |
uint8 * data; |
62 |
}; |
}; |
63 |
|
|
64 |
uint32 g_flags = 0; |
extern int g_tcp_port_rdp; |
65 |
char g_server[64] = ""; |
extern int g_dsp_fd; |
66 |
char g_domain[16] = ""; |
|
67 |
char g_password[16] = ""; |
#ifdef WITH_RDPSND |
68 |
char g_shell[128] = ""; |
BOOL g_rdpsnd = True; |
69 |
char g_directory[32] = ""; |
extern int g_dsp_busy; |
70 |
|
#endif |
71 |
int g_encryption = 1; |
int g_encryption = 1; |
72 |
int g_bitmap_cache = 1; |
int g_bitmap_cache = 1; |
73 |
int g_bitmap_cache_persist_enable = 0; |
int g_bitmap_cache_persist_enable = 0; |
78 |
int g_rdp5_performanceflags = 0; |
int g_rdp5_performanceflags = 0; |
79 |
int g_console_session = 0; |
int g_console_session = 0; |
80 |
int g_keylayout = 0x409; /* Defaults to US keyboard layout */ |
int g_keylayout = 0x409; /* Defaults to US keyboard layout */ |
|
|
|
81 |
int g_width = 640; |
int g_width = 640; |
82 |
int g_height = 480; |
int g_height = 480; |
83 |
int g_server_bpp = 8; |
int g_server_bpp = 8; |
|
int g_fullscreen = 0; |
|
84 |
char g_hostname[16] = ""; |
char g_hostname[16] = ""; |
85 |
char g_username[100] = ""; |
char g_username[100] = ""; |
|
int g_global_sock = 0; |
|
86 |
|
|
87 |
int g_deactivated = 0; |
static uint32 g_flags = RDP_LOGON_NORMAL; |
88 |
uint32 g_ext_disc_reason = 0; |
static char g_server[64] = ""; |
89 |
|
static char g_domain[16] = ""; |
90 |
|
static char g_password[16] = ""; |
91 |
|
static char g_shell[128] = ""; |
92 |
|
static char g_directory[32] = ""; |
93 |
|
static int g_fullscreen = 0; |
94 |
|
static int g_global_sock = 0; |
95 |
|
static int g_deactivated = 0; |
96 |
|
static uint32 g_ext_disc_reason = 0; |
97 |
|
|
98 |
QSocketNotifier* g_SocketNotifier = 0; |
static QSocketNotifier * g_SocketNotifier = 0; |
99 |
|
static QSocketNotifier * g_SoundNotifier = 0; |
100 |
#ifdef SHARP |
#ifdef SHARP |
101 |
QPEApplication* g_App = 0; |
static QPEApplication * g_App = 0; |
102 |
#else |
#else |
103 |
QApplication* g_App = 0; |
static QApplication * g_App = 0; |
104 |
#endif |
#endif |
105 |
static QMyMainWindow *g_MW = 0; |
static QMyMainWindow * g_MW = 0; |
106 |
static QMyScrollView *g_SV = 0; |
static QMyScrollView * g_SV = 0; |
107 |
static struct QColorMap *g_CM = 0; |
static struct QColorMap * g_CM = 0; |
108 |
static uint8 *g_BS = 0; |
static uint8 * g_BS = 0; /* the screen data */ |
|
|
|
109 |
static int g_clipx = 0; |
static int g_clipx = 0; |
110 |
static int g_clipy = 0; |
static int g_clipy = 0; |
111 |
static int g_clipcx = 0; |
static int g_clipcx = 0; |
112 |
static int g_clipcy = 0; |
static int g_clipcy = 0; |
113 |
|
|
114 |
|
#define BPP ((g_server_bpp + 7) / 8) |
115 |
|
#define GETPIXEL8(d, x, y, w) (*(((uint8*)d) + ((y) * (w) + (x)))) |
116 |
|
#define GETPIXEL16(d, x, y, w) (*(((uint16*)d) + ((y) * (w) + (x)))) |
117 |
|
#define GETPIXEL32(d, x, y, w) (*(((uint32*)d) + ((y) * (w) + (x)))) |
118 |
|
#define SETPIXEL8(d, x, y, w, v) *(((uint8*)d) + ((y) * (w) + (x))) = v |
119 |
|
#define SETPIXEL16(d, x, y, w, v) *(((uint16*)d) + ((y) * (w) + (x))) = v |
120 |
|
#define SETPIXEL32(d, x, y, w, v) *(((uint32*)d) + ((y) * (w) + (x))) = v |
121 |
|
|
122 |
//***************************************************************************** |
//***************************************************************************** |
123 |
void CleanString(QString* Item) |
void CleanString(QString * Item) |
124 |
{ |
{ |
125 |
int i; |
int i; |
126 |
|
|
134 |
} |
} |
135 |
|
|
136 |
//***************************************************************************** |
//***************************************************************************** |
137 |
QMyDialog::QMyDialog(QWidget* parent) : QDialog(parent, "Settings", true) |
QMyDialog::QMyDialog(QWidget * parent) : QDialog(parent, "Settings", true) |
138 |
{ |
{ |
139 |
int i, j; |
int i, j; |
140 |
char* home; |
char * home; |
141 |
char Text[256]; |
char Text[256]; |
142 |
QString Line; |
QString Line; |
143 |
QString ItemName; |
QString ItemName; |
339 |
void QMyDialog::AddClicked() |
void QMyDialog::AddClicked() |
340 |
{ |
{ |
341 |
int i; |
int i; |
342 |
QMyConnectionItem* Item; |
QMyConnectionItem * Item; |
343 |
|
|
344 |
i = ListBox->count(); |
i = ListBox->count(); |
345 |
if (i < 10) |
if (i < 10) |
359 |
void QMyDialog::EditClicked() |
void QMyDialog::EditClicked() |
360 |
{ |
{ |
361 |
int i; |
int i; |
362 |
QMyConnectionItem* Item; |
QMyConnectionItem * Item; |
363 |
|
|
364 |
i = ListBox->currentItem(); |
i = ListBox->currentItem(); |
365 |
if (i >= 0) |
if (i >= 0) |
385 |
void QMyDialog::SaveClicked() |
void QMyDialog::SaveClicked() |
386 |
{ |
{ |
387 |
int i, j; |
int i, j; |
388 |
QMyConnectionItem* Item; |
QMyConnectionItem * Item; |
389 |
QString Line; |
QString Line; |
390 |
char* home; |
char * home; |
391 |
char Text[256]; |
char Text[256]; |
392 |
QFile* File; |
QFile* File; |
393 |
|
|
443 |
void QMyDialog::RemoveClicked() |
void QMyDialog::RemoveClicked() |
444 |
{ |
{ |
445 |
int i, j, c; |
int i, j, c; |
446 |
QMyConnectionItem* Item1; |
QMyConnectionItem * Item1; |
447 |
QMyConnectionItem* Item2; |
QMyConnectionItem * Item2; |
448 |
|
|
449 |
i = ListBox->currentItem(); |
i = ListBox->currentItem(); |
450 |
if (i >= 0) |
if (i >= 0) |
469 |
void QMyDialog::ListBoxChanged() |
void QMyDialog::ListBoxChanged() |
470 |
{ |
{ |
471 |
int i; |
int i; |
472 |
QMyConnectionItem* Item; |
QMyConnectionItem * Item; |
473 |
char Text[100]; |
char Text[100]; |
474 |
|
|
475 |
i = ListBox->currentItem(); |
i = ListBox->currentItem(); |
493 |
} |
} |
494 |
|
|
495 |
//***************************************************************************** |
//***************************************************************************** |
496 |
void GetScanCode(QKeyEvent* e, int* ScanCode, int* code) |
void GetScanCode(QKeyEvent * e, int * ScanCode, int * code) |
497 |
{ |
{ |
498 |
int key; |
int key; |
499 |
int mod; |
int mod; |
725 |
} |
} |
726 |
|
|
727 |
//***************************************************************************** |
//***************************************************************************** |
728 |
void QMyScrollView::timerEvent(QTimerEvent* e) |
void QMyScrollView::timerEvent(QTimerEvent * e) |
729 |
{ |
{ |
730 |
QScrollView::timerEvent(e); |
QScrollView::timerEvent(e); |
731 |
killTimer(timer_id); |
killTimer(timer_id); |
732 |
QMyDialog* d; |
QMyDialog * d; |
733 |
QWidget* Desktop; |
QWidget * Desktop; |
734 |
int dw; |
int dw; |
735 |
int dh; |
int dh; |
736 |
|
|
737 |
d = new QMyDialog(this); |
d = new QMyDialog(this); |
738 |
if (d->exec() == 1) // ok clicked |
if (d->exec() == 1) // ok clicked |
739 |
{ |
{ |
|
g_flags = RDP_LOGON_NORMAL; |
|
740 |
g_width = d->Width; |
g_width = d->Width; |
741 |
g_height = d->Height; |
g_height = d->Height; |
742 |
g_fullscreen = d->FullScreen; |
g_fullscreen = d->FullScreen; |
749 |
g_SV->close(); |
g_SV->close(); |
750 |
return; |
return; |
751 |
} |
} |
752 |
g_BS = (uint8*)xmalloc(g_width * g_height); |
g_BS = (uint8*)xmalloc(g_width * g_height * 4); |
753 |
memset(g_BS, 0, g_width * g_height); |
memset(g_BS, 0, g_width * g_height * 4); |
754 |
g_clipx = 0; |
g_clipx = 0; |
755 |
g_clipy = 0; |
g_clipy = 0; |
756 |
g_clipcx = g_width; |
g_clipcx = g_width; |
804 |
} |
} |
805 |
|
|
806 |
//***************************************************************************** |
//***************************************************************************** |
807 |
void QMyMainWindow::timerEvent(QTimerEvent* e) |
void QMyMainWindow::timerEvent(QTimerEvent * e) |
808 |
{ |
{ |
809 |
QWidget::timerEvent(e); |
QWidget::timerEvent(e); |
810 |
if (e->timerId() == timer_id) |
if (e->timerId() == timer_id) |
827 |
//***************************************************************************** |
//***************************************************************************** |
828 |
void QMyMainWindow::MemuClicked(int MenuID) |
void QMyMainWindow::MemuClicked(int MenuID) |
829 |
{ |
{ |
830 |
QWidget* Desktop; |
QWidget * Desktop; |
831 |
int dw; |
int dw; |
832 |
int dh; |
int dh; |
833 |
|
|
928 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, e->x(), e->y()); |
929 |
} |
} |
930 |
|
|
931 |
#define NOT(x) (255-(x)) |
#define NOT(x) (~x) |
932 |
|
|
933 |
//***************************************************************************** |
//***************************************************************************** |
934 |
uint8 rop(int rop, uint8 src, uint8 dst) |
int rop(int rop, int src, int dst) |
935 |
{ |
{ |
936 |
switch (rop) |
switch (rop) |
937 |
{ |
{ |
956 |
} |
} |
957 |
|
|
958 |
/*****************************************************************************/ |
/*****************************************************************************/ |
959 |
uint8 get_pixel(int x, int y) |
int get_pixel(int x, int y) |
960 |
{ |
{ |
961 |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
962 |
return g_BS[y * g_width + x]; |
{ |
963 |
|
if (g_server_bpp == 8) |
964 |
|
return g_BS[y * g_width + x]; |
965 |
|
else if (g_server_bpp == 16) |
966 |
|
return *(((uint16*)g_BS) + (y * g_width + x)); |
967 |
|
else |
968 |
|
return 0; |
969 |
|
} |
970 |
else |
else |
971 |
return 0; |
return 0; |
972 |
} |
} |
973 |
|
|
974 |
//***************************************************************************** |
//***************************************************************************** |
975 |
void set_pixel(int x, int y, uint8 pixel, int op = 0xc) |
void set_pixel(int x, int y, int pixel, int op = 0xc) |
976 |
{ |
{ |
977 |
|
uint32 p; |
978 |
|
|
979 |
if (x >= g_clipx && x < (g_clipx + g_clipcx) && |
if (x >= g_clipx && x < (g_clipx + g_clipcx) && |
980 |
y >= g_clipy && y < (g_clipy + g_clipcy)) |
y >= g_clipy && y < (g_clipy + g_clipcy)) |
981 |
|
{ |
982 |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
983 |
|
{ |
984 |
if (op == 0xc) |
if (op == 0xc) |
985 |
g_BS[y * g_width + x] = pixel; |
{ |
986 |
|
if (g_server_bpp == 8) |
987 |
|
{ |
988 |
|
SETPIXEL8(g_BS, x, y, g_width, pixel); |
989 |
|
} |
990 |
|
else if (g_server_bpp == 16) |
991 |
|
{ |
992 |
|
SETPIXEL16(g_BS, x, y, g_width, pixel); |
993 |
|
} |
994 |
|
} |
995 |
else |
else |
996 |
g_BS[y * g_width + x] = rop(op, pixel, g_BS[y * g_width + x]); |
{ |
997 |
|
if (g_server_bpp == 8) |
998 |
|
{ |
999 |
|
p = GETPIXEL8(g_BS, x, y, g_width); |
1000 |
|
p = rop(op, pixel, p); |
1001 |
|
SETPIXEL8(g_BS, x, y, g_width, p); |
1002 |
|
} |
1003 |
|
else if (g_server_bpp == 16) |
1004 |
|
{ |
1005 |
|
p = GETPIXEL16(g_BS, x, y, g_width); |
1006 |
|
p = rop(op, pixel, p); |
1007 |
|
SETPIXEL16(g_BS, x, y, g_width, p); |
1008 |
|
} |
1009 |
|
} |
1010 |
|
} |
1011 |
|
} |
1012 |
} |
} |
1013 |
|
|
1014 |
//****************************************************************************** |
//****************************************************************************** |
1015 |
// adjust coordinates for cliping rect |
// adjust coordinates for cliping rect |
1016 |
bool WarpCoords(int* x, int* y, int* cx, int* cy, int* srcx, int* srcy) |
bool WarpCoords(int * x, int * y, int * cx, int * cy, int * srcx, int * srcy) |
1017 |
{ |
{ |
1018 |
int dx, dy; |
int dx, dy; |
1019 |
QRect InRect(*x, *y, *cx, *cy); |
QRect InRect(*x, *y, *cx, *cy); |
1036 |
} |
} |
1037 |
|
|
1038 |
//***************************************************************************** |
//***************************************************************************** |
1039 |
void QMyMainWindow::paintEvent(QPaintEvent* pe) |
uint32 color16to32(uint32 colour) |
1040 |
{ |
{ |
1041 |
QImage* Image; |
uint32 r, g, b; |
1042 |
QPainter* Painter; |
r = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7); |
1043 |
|
g = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3); |
1044 |
|
b = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
1045 |
|
return ((r << 16) | (g << 8) | b); |
1046 |
|
} |
1047 |
|
|
1048 |
|
//***************************************************************************** |
1049 |
|
void QMyMainWindow::paintEvent(QPaintEvent * pe) |
1050 |
|
{ |
1051 |
|
QImage * Image; |
1052 |
|
QPainter * Painter; |
1053 |
QRect Rect; |
QRect Rect; |
1054 |
int i, j, w, h, l, t; |
int i, j, w, h, l, t; |
1055 |
uint8* data; |
uint8 * data; |
1056 |
|
|
1057 |
|
Image = 0; |
1058 |
|
data = 0; |
1059 |
if (!testWFlags(WRepaintNoErase)) |
if (!testWFlags(WRepaintNoErase)) |
1060 |
setWFlags(WRepaintNoErase); |
setWFlags(WRepaintNoErase); |
1061 |
if (g_CM != NULL) |
if (g_CM != NULL || g_server_bpp > 8) |
1062 |
{ |
{ |
1063 |
Rect = pe->rect(); |
Rect = pe->rect(); |
1064 |
l = Rect.left(); |
l = Rect.left(); |
1065 |
t = Rect.top(); |
t = Rect.top(); |
1066 |
w = Rect.width(); |
w = Rect.width(); |
1067 |
h = Rect.height(); |
h = Rect.height(); |
1068 |
if (w > 0 && h > 0 && g_CM->NumColors > 0) |
if (w > 0 && h > 0) |
1069 |
{ |
{ |
1070 |
w = (w + 3) & ~3; |
if (g_server_bpp == 8 && g_CM->NumColors > 0) |
1071 |
data = (uint8*)xmalloc(w * h); |
{ |
1072 |
for (i = 0; i < h; i++) |
w = (w + 3) & ~3; |
1073 |
for (j = 0; j < w; j++) |
data = (uint8*)xmalloc(w * h); |
1074 |
data[i * w + j] = get_pixel(l + j, t + i); |
for (i = 0; i < h; i++) |
1075 |
Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors, |
for (j = 0; j < w; j++) |
1076 |
g_CM->NumColors, QImage::IgnoreEndian); |
data[i * w + j] = get_pixel(l + j, t + i); |
1077 |
Painter = new QPainter(this); |
Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors, |
1078 |
Painter->drawImage(l, t, *Image, 0, 0, w, h); |
g_CM->NumColors, QImage::IgnoreEndian); |
1079 |
|
} |
1080 |
|
else if (g_server_bpp == 16) |
1081 |
|
{ |
1082 |
|
w = (w + 3) & ~3; |
1083 |
|
data = (uint8*)xmalloc(w * h * 4); |
1084 |
|
for (i = 0; i < h; i++) |
1085 |
|
for (j = 0; j < w; j++) |
1086 |
|
*(((uint32*)data) + (i * w + j)) = color16to32(get_pixel(l + j, t + i)); |
1087 |
|
Image = new QImage(data, w, h, 32, NULL, |
1088 |
|
0, QImage::IgnoreEndian); |
1089 |
|
} |
1090 |
|
if (Image != 0) |
1091 |
|
{ |
1092 |
|
Painter = new QPainter(this); |
1093 |
|
Painter->drawImage(l, t, *Image, 0, 0, w, h); |
1094 |
|
delete Painter; |
1095 |
|
delete Image; |
1096 |
|
} |
1097 |
xfree(data); |
xfree(data); |
|
delete Painter; |
|
|
delete Image; |
|
1098 |
} |
} |
1099 |
} |
} |
1100 |
} |
} |
1101 |
|
|
1102 |
//***************************************************************************** |
//***************************************************************************** |
1103 |
void QMyMainWindow::closeEvent(QCloseEvent* e) |
void QMyMainWindow::closeEvent(QCloseEvent * e) |
1104 |
{ |
{ |
1105 |
e->accept(); |
e->accept(); |
1106 |
} |
} |
1110 |
{ |
{ |
1111 |
if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) |
if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) |
1112 |
g_SV->close(); |
g_SV->close(); |
1113 |
|
#ifdef WITH_RDPSND |
1114 |
|
if (g_dsp_busy) |
1115 |
|
{ |
1116 |
|
if (g_SoundNotifier == 0) |
1117 |
|
{ |
1118 |
|
g_SoundNotifier = new QSocketNotifier(g_dsp_fd, QSocketNotifier::Write, |
1119 |
|
g_MW); |
1120 |
|
g_MW->connect(g_SoundNotifier, SIGNAL(activated(int)), g_MW, |
1121 |
|
SLOT(soundSend())); |
1122 |
|
} |
1123 |
|
else |
1124 |
|
{ |
1125 |
|
if (!g_SoundNotifier->isEnabled()) |
1126 |
|
g_SoundNotifier->setEnabled(true); |
1127 |
|
} |
1128 |
|
} |
1129 |
|
#endif |
1130 |
|
} |
1131 |
|
|
1132 |
|
//***************************************************************************** |
1133 |
|
void QMyMainWindow::soundSend() |
1134 |
|
{ |
1135 |
|
g_SoundNotifier->setEnabled(false); |
1136 |
|
#ifdef WITH_RDPSND |
1137 |
|
wave_out_play(); |
1138 |
|
if (g_dsp_busy) |
1139 |
|
g_SoundNotifier->setEnabled(true); |
1140 |
|
#endif |
1141 |
} |
} |
1142 |
|
|
1143 |
//***************************************************************************** |
//***************************************************************************** |
1153 |
/* Returns 0 after user quit, 1 otherwise */ |
/* Returns 0 after user quit, 1 otherwise */ |
1154 |
int ui_select(int rdp_socket) |
int ui_select(int rdp_socket) |
1155 |
{ |
{ |
1156 |
g_global_sock = rdp_socket; |
if (g_global_sock == 0) |
1157 |
|
g_global_sock = rdp_socket; |
1158 |
return 1; |
return 1; |
1159 |
} |
} |
1160 |
|
|
1171 |
//***************************************************************************** |
//***************************************************************************** |
1172 |
HBITMAP ui_create_bitmap(int width, int height, uint8 * data) |
HBITMAP ui_create_bitmap(int width, int height, uint8 * data) |
1173 |
{ |
{ |
1174 |
struct bitmap* the_bitmap; |
struct bitmap * the_bitmap; |
1175 |
uint8* bitmap_data; |
uint8 * bitmap_data; |
1176 |
int i, j; |
int i, j; |
1177 |
|
|
1178 |
bitmap_data = (uint8*)xmalloc(width * height); |
bitmap_data = (uint8*)xmalloc(width * height * BPP); |
1179 |
the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); |
the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); |
1180 |
the_bitmap->w = width; |
the_bitmap->w = width; |
1181 |
the_bitmap->h = height; |
the_bitmap->h = height; |
1182 |
the_bitmap->data = bitmap_data; |
the_bitmap->data = bitmap_data; |
1183 |
for (i = 0; i < height; i++) |
if (g_server_bpp == 8) |
1184 |
for (j = 0; j < width; j++) |
{ |
1185 |
bitmap_data[i * width + j] = data[i * width + j]; |
for (i = 0; i < height; i++) |
1186 |
|
for (j = 0; j < width; j++) |
1187 |
|
bitmap_data[i * width + j] = data[i * width + j]; |
1188 |
|
} |
1189 |
|
else if (g_server_bpp == 16) |
1190 |
|
{ |
1191 |
|
for (i = 0; i < height; i++) |
1192 |
|
for (j = 0; j < width; j++) |
1193 |
|
*(((uint16*)bitmap_data) + (i * width + j)) = *(((uint16*)data) + (i * width + j)); |
1194 |
|
} |
1195 |
return the_bitmap; |
return the_bitmap; |
1196 |
} |
} |
1197 |
|
|
1201 |
{ |
{ |
1202 |
int i, j; |
int i, j; |
1203 |
|
|
1204 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1205 |
for (j = 0; j < cx; j++) |
{ |
1206 |
if (i < height) |
for (i = 0; i < cy; i++) |
1207 |
if (j < width) |
for (j = 0; j < cx; j++) |
1208 |
set_pixel(x + j, y + i, data[i * width + j]); |
if (i < height) |
1209 |
|
if (j < width) |
1210 |
|
set_pixel(x + j, y + i, data[i * width + j]); |
1211 |
|
} |
1212 |
|
else if (g_server_bpp == 16) |
1213 |
|
{ |
1214 |
|
for (i = 0; i < cy; i++) |
1215 |
|
for (j = 0; j < cx; j++) |
1216 |
|
if (i < height) |
1217 |
|
if (j < width) |
1218 |
|
set_pixel(x + j, y + i, *(((uint16*)data) + (i * width + j))); |
1219 |
|
} |
1220 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1221 |
} |
} |
1222 |
|
|
1294 |
} |
} |
1295 |
|
|
1296 |
//***************************************************************************** |
//***************************************************************************** |
1297 |
HCURSOR ui_create_cursor(unsigned int x, unsigned int y, |
HCURSOR ui_create_cursor(uint32 x, uint32 y, |
1298 |
int width, int height, uint8 * andmask, |
int width, int height, |
1299 |
uint8 * xormask) |
uint8 * andmask, uint8 * xormask) |
1300 |
{ |
{ |
1301 |
return (void*)1; |
return (void*)1; |
1302 |
} |
} |
1307 |
} |
} |
1308 |
|
|
1309 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1310 |
uint16 ui_get_numlock_state(unsigned int state) |
uint16 ui_get_numlock_state(uint32 state) |
1311 |
{ |
{ |
1312 |
return 0; |
return 0; |
1313 |
} |
} |
1348 |
} |
} |
1349 |
|
|
1350 |
//***************************************************************************** |
//***************************************************************************** |
1351 |
void ui_destroy_colourmap(HCOLOURMAP /*map*/) |
void ui_set_colourmap(HCOLOURMAP map) |
1352 |
{ |
{ |
1353 |
} |
} |
1354 |
|
|
1355 |
//***************************************************************************** |
//***************************************************************************** |
1356 |
void ui_set_colourmap(HCOLOURMAP /*map*/) |
void ui_destroy_colourmap(HCOLOURMAP map) |
1357 |
{ |
{ |
1358 |
} |
} |
1359 |
|
|
1408 |
{ |
{ |
1409 |
int i, j; |
int i, j; |
1410 |
|
|
1411 |
|
if (x + cx > g_width) |
1412 |
|
cx = g_width - x; |
1413 |
|
if (y + cy > g_height) |
1414 |
|
cy = g_height - y; |
1415 |
for (i = 0; i < cy; i++) |
for (i = 0; i < cy; i++) |
1416 |
for (j = 0; j < cx; j++) |
for (j = 0; j < cx; j++) |
1417 |
set_pixel(x + j, y + i, colour, opcode); |
set_pixel(x + j, y + i, colour, opcode); |
1458 |
int i, j; |
int i, j; |
1459 |
uint8* temp; |
uint8* temp; |
1460 |
|
|
1461 |
temp = (uint8*)xmalloc(cx * cy); |
temp = (uint8*)xmalloc(cx * cy * BPP); |
1462 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1463 |
for (j = 0; j < cx; j++) |
{ |
1464 |
temp[i * cx + j] = get_pixel(srcx + j, srcy + i); |
for (i = 0; i < cy; i++) |
1465 |
for (i = 0; i < cy; i++) |
for (j = 0; j < cx; j++) |
1466 |
for (j = 0; j < cx; j++) |
temp[i * cx + j] = get_pixel(srcx + j, srcy + i); |
1467 |
set_pixel(x + j, y + i, temp[i * cx + j], opcode); |
for (i = 0; i < cy; i++) |
1468 |
|
for (j = 0; j < cx; j++) |
1469 |
|
set_pixel(x + j, y + i, temp[i * cx + j], opcode); |
1470 |
|
} |
1471 |
|
else if (g_server_bpp == 16) |
1472 |
|
{ |
1473 |
|
for (i = 0; i < cy; i++) |
1474 |
|
for (j = 0; j < cx; j++) |
1475 |
|
*(((uint16*)temp) + (i * cx + j)) = get_pixel(srcx + j, srcy + i); |
1476 |
|
for (i = 0; i < cy; i++) |
1477 |
|
for (j = 0; j < cx; j++) |
1478 |
|
set_pixel(x + j, y + i, *(((uint16*)temp) + (i * cx + j)), opcode); |
1479 |
|
} |
1480 |
xfree(temp); |
xfree(temp); |
1481 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1482 |
} |
} |
1491 |
the_bitmap = (struct bitmap*)src; |
the_bitmap = (struct bitmap*)src; |
1492 |
if (the_bitmap == NULL) |
if (the_bitmap == NULL) |
1493 |
return; |
return; |
1494 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1495 |
for (j = 0; j < cx; j++) |
{ |
1496 |
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
for (i = 0; i < cy; i++) |
1497 |
set_pixel(x + j, y + i, |
for (j = 0; j < cx; j++) |
1498 |
the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)], |
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
1499 |
opcode); |
set_pixel(x + j, y + i, |
1500 |
|
the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)], |
1501 |
|
opcode); |
1502 |
|
} |
1503 |
|
else if (g_server_bpp == 16) |
1504 |
|
{ |
1505 |
|
for (i = 0; i < cy; i++) |
1506 |
|
for (j = 0; j < cx; j++) |
1507 |
|
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
1508 |
|
set_pixel(x + j, y + i, |
1509 |
|
*(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), |
1510 |
|
opcode); |
1511 |
|
} |
1512 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1513 |
} |
} |
1514 |
|
|
1603 |
//***************************************************************************** |
//***************************************************************************** |
1604 |
void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) |
void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) |
1605 |
{ |
{ |
1606 |
struct bitmap* the_glyph; |
struct bitmap *the_glyph; |
1607 |
int i, j; |
int i, j; |
1608 |
|
|
1609 |
the_glyph = (struct bitmap*)glyph; |
the_glyph = (struct bitmap*)glyph; |
1722 |
uint8* data; |
uint8* data; |
1723 |
int i, j; |
int i, j; |
1724 |
|
|
1725 |
data = (uint8*)xmalloc(cx * cy); |
data = (uint8*)xmalloc(cx * cy * BPP); |
1726 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1727 |
for (j = 0; j < cx; j++) |
{ |
1728 |
data[i * cx + j] = get_pixel(x + j, y + i); |
for (i = 0; i < cy; i++) |
1729 |
cache_put_desktop(offset, cx, cy, cx, 1, data); |
for (j = 0; j < cx; j++) |
1730 |
|
data[i * cx + j] = get_pixel(x + j, y + i); |
1731 |
|
} |
1732 |
|
else if (g_server_bpp == 16) |
1733 |
|
{ |
1734 |
|
for (i = 0; i < cy; i++) |
1735 |
|
for (j = 0; j < cx; j++) |
1736 |
|
*(((uint16*)data) + (i * cx + j)) = get_pixel(x + j, y + i); |
1737 |
|
} |
1738 |
|
offset *= BPP; |
1739 |
|
cache_put_desktop(offset, cx, cy, cx * BPP, BPP, data); |
1740 |
xfree(data); |
xfree(data); |
1741 |
} |
} |
1742 |
|
|
1746 |
uint8* data; |
uint8* data; |
1747 |
int i, j; |
int i, j; |
1748 |
|
|
1749 |
data = cache_get_desktop(offset, cx, cy, 1); |
offset *= BPP; |
1750 |
for (i = 0; i < cy; i++) |
data = cache_get_desktop(offset, cx, cy, BPP); |
1751 |
for (j = 0; j < cx; j++) |
if (g_server_bpp == 8) |
1752 |
set_pixel(x + j, y + i, data[i * cx + j]); |
{ |
1753 |
|
for (i = 0; i < cy; i++) |
1754 |
|
for (j = 0; j < cx; j++) |
1755 |
|
set_pixel(x + j, y + i, data[i * cx + j]); |
1756 |
|
} |
1757 |
|
else if (g_server_bpp == 16) |
1758 |
|
{ |
1759 |
|
for (i = 0; i < cy; i++) |
1760 |
|
for (j = 0; j < cx; j++) |
1761 |
|
set_pixel(x + j, y + i, *(((uint16*)data) + (i * cx + j))); |
1762 |
|
} |
1763 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1764 |
} |
} |
1765 |
|
|
1766 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1767 |
void* xrealloc(void* in_val, int size) |
void* xrealloc(void *in_val, int size) |
1768 |
{ |
{ |
1769 |
|
if (size < 1) |
1770 |
|
size = 1; |
1771 |
return realloc(in_val, size); |
return realloc(in_val, size); |
1772 |
} |
} |
1773 |
|
|
1778 |
} |
} |
1779 |
|
|
1780 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1781 |
void xfree(void* in_val) |
void xfree(void * in_val) |
1782 |
{ |
{ |
1783 |
free(in_val); |
if (in_val != NULL) |
1784 |
|
free(in_val); |
1785 |
} |
} |
1786 |
|
|
1787 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1788 |
void warning(char* format, ...) |
void warning(char * format, ...) |
1789 |
{ |
{ |
1790 |
va_list ap; |
va_list ap; |
1791 |
|
|
1796 |
} |
} |
1797 |
|
|
1798 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1799 |
void unimpl(char* format, ...) |
void unimpl(char * format, ...) |
1800 |
{ |
{ |
1801 |
va_list ap; |
va_list ap; |
1802 |
|
|
1807 |
} |
} |
1808 |
|
|
1809 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1810 |
void error(char* format, ...) |
void error(char * format, ...) |
1811 |
{ |
{ |
1812 |
va_list ap; |
va_list ap; |
1813 |
|
|
1824 |
} |
} |
1825 |
|
|
1826 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1827 |
int rd_open_file(char *filename) |
int rd_open_file(char * filename) |
1828 |
{ |
{ |
1829 |
return 0; |
return 0; |
1830 |
} |
} |
1836 |
} |
} |
1837 |
|
|
1838 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1839 |
int rd_read_file(int fd, void *ptr, int len) |
int rd_read_file(int fd, void * ptr, int len) |
1840 |
{ |
{ |
1841 |
return 0; |
return 0; |
1842 |
} |
} |
1843 |
|
|
1844 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1845 |
int rd_write_file(int fd, void* ptr, int len) |
int rd_write_file(int fd, void * ptr, int len) |
1846 |
{ |
{ |
1847 |
return 0; |
return 0; |
1848 |
} |
} |
1860 |
} |
} |
1861 |
|
|
1862 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1863 |
void save_licence(uint8* data, int length) |
int load_licence(uint8 ** data) |
1864 |
{ |
{ |
1865 |
|
return 0; |
1866 |
} |
} |
1867 |
|
|
1868 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1869 |
void generate_random(uint8* random) |
void save_licence(uint8 * data, int length) |
1870 |
|
{ |
1871 |
|
} |
1872 |
|
|
1873 |
|
/*****************************************************************************/ |
1874 |
|
void generate_random(uint8 * random) |
1875 |
{ |
{ |
1876 |
QFile File("/dev/random"); |
QFile File("/dev/random"); |
1877 |
File.open(IO_ReadOnly); |
File.open(IO_ReadOnly); |
1882 |
} |
} |
1883 |
|
|
1884 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1885 |
int load_licence(uint8** data) |
/* produce a hex dump */ |
1886 |
|
void hexdump(uint8 * p, uint32 len) |
1887 |
{ |
{ |
1888 |
|
uint8 * line = p; |
1889 |
|
int i, thisline; |
1890 |
|
uint32 offset = 0; |
1891 |
|
|
1892 |
|
while (offset < len) |
1893 |
|
{ |
1894 |
|
printf("%04x ", offset); |
1895 |
|
thisline = len - offset; |
1896 |
|
if (thisline > 16) |
1897 |
|
thisline = 16; |
1898 |
|
|
1899 |
|
for (i = 0; i < thisline; i++) |
1900 |
|
printf("%02x ", line[i]); |
1901 |
|
|
1902 |
|
for (; i < 16; i++) |
1903 |
|
printf(" "); |
1904 |
|
|
1905 |
|
for (i = 0; i < thisline; i++) |
1906 |
|
printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); |
1907 |
|
|
1908 |
|
printf("\n"); |
1909 |
|
offset += thisline; |
1910 |
|
line += thisline; |
1911 |
|
} |
1912 |
|
} |
1913 |
|
|
1914 |
|
/*****************************************************************************/ |
1915 |
|
void get_username_and_hostname(void) |
1916 |
|
{ |
1917 |
|
char fullhostname[64]; |
1918 |
|
char* p; |
1919 |
|
struct passwd* pw; |
1920 |
|
|
1921 |
|
STRNCPY(g_username, "unknown", sizeof(g_username)); |
1922 |
|
STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); |
1923 |
|
pw = getpwuid(getuid()); |
1924 |
|
if (pw != NULL && pw->pw_name != NULL) |
1925 |
|
{ |
1926 |
|
STRNCPY(g_username, pw->pw_name, sizeof(g_username)); |
1927 |
|
} |
1928 |
|
if (gethostname(fullhostname, sizeof(fullhostname)) != -1) |
1929 |
|
{ |
1930 |
|
p = strchr(fullhostname, '.'); |
1931 |
|
if (p != NULL) |
1932 |
|
*p = 0; |
1933 |
|
STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); |
1934 |
|
} |
1935 |
|
} |
1936 |
|
|
1937 |
|
/*****************************************************************************/ |
1938 |
|
void out_params(void) |
1939 |
|
{ |
1940 |
|
fprintf(stderr, "qterdesktop: A Remote Desktop Protocol client.\n"); |
1941 |
|
fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2004 Matt Chapman.\n"); |
1942 |
|
fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); |
1943 |
|
fprintf(stderr, "Usage: qterdesktop [options] server\n"); |
1944 |
|
fprintf(stderr, " -g: desktop geometry (WxH)\n"); |
1945 |
|
fprintf(stderr, " -4: use RDP version 4\n"); |
1946 |
|
fprintf(stderr, " -5: use RDP version 5 (default)\n"); |
1947 |
|
fprintf(stderr, " -t: tcp port)\n"); |
1948 |
|
fprintf(stderr, " -a: connection colour depth\n"); |
1949 |
|
|
1950 |
|
fprintf(stderr, " -u: user name\n"); |
1951 |
|
fprintf(stderr, " -d: domain\n"); |
1952 |
|
fprintf(stderr, " -s: shell\n"); |
1953 |
|
fprintf(stderr, " -c: working directory\n"); |
1954 |
|
fprintf(stderr, " -p: password (- to prompt)\n"); |
1955 |
|
fprintf(stderr, " -n: client hostname\n"); |
1956 |
|
|
1957 |
|
fprintf(stderr, "\n"); |
1958 |
|
} |
1959 |
|
|
1960 |
|
/*****************************************************************************/ |
1961 |
|
int parse_parameters(int in_argc, char ** in_argv) |
1962 |
|
{ |
1963 |
|
int i; |
1964 |
|
char * p; |
1965 |
|
|
1966 |
|
for (i = 1; i < in_argc; i++) |
1967 |
|
{ |
1968 |
|
strcpy(g_server, in_argv[i]); |
1969 |
|
if (strcmp(in_argv[i], "-h") == 0) |
1970 |
|
{ |
1971 |
|
out_params(); |
1972 |
|
return 0; |
1973 |
|
} |
1974 |
|
else if (strcmp(in_argv[i], "-g") == 0) |
1975 |
|
{ |
1976 |
|
g_width = strtol(in_argv[i + 1], &p, 10); |
1977 |
|
if (g_width <= 0) |
1978 |
|
{ |
1979 |
|
error("invalid geometry\n"); |
1980 |
|
return 0; |
1981 |
|
} |
1982 |
|
if (*p == 'x') |
1983 |
|
g_height = strtol(p + 1, NULL, 10); |
1984 |
|
if (g_height <= 0) |
1985 |
|
{ |
1986 |
|
error("invalid geometry\n"); |
1987 |
|
return 0; |
1988 |
|
} |
1989 |
|
g_width = (g_width + 3) & ~3; |
1990 |
|
} |
1991 |
|
else if (strcmp(in_argv[i], "-4") == 0) |
1992 |
|
g_use_rdp5 = 0; |
1993 |
|
else if (strcmp(in_argv[i], "-5") == 0) |
1994 |
|
g_use_rdp5 = 1; |
1995 |
|
else if (strcmp(in_argv[i], "-a") == 0) |
1996 |
|
{ |
1997 |
|
g_server_bpp = strtol(in_argv[i + 1], &p, 10); |
1998 |
|
if (g_server_bpp != 8 && g_server_bpp != 15 && |
1999 |
|
g_server_bpp != 16 && g_server_bpp != 24) |
2000 |
|
{ |
2001 |
|
error("invalid bpp\n"); |
2002 |
|
return 0; |
2003 |
|
} |
2004 |
|
} |
2005 |
|
else if (strcmp(in_argv[i], "-t") == 0) |
2006 |
|
g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10); |
2007 |
|
|
2008 |
|
else if (strcmp(in_argv[i], "-u") == 0) |
2009 |
|
{ |
2010 |
|
STRNCPY(g_username, in_argv[i + 1], sizeof(g_username)); |
2011 |
|
} |
2012 |
|
else if (strcmp(in_argv[i], "-d") == 0) |
2013 |
|
{ |
2014 |
|
STRNCPY(g_domain, in_argv[i + 1], sizeof(g_domain)); |
2015 |
|
} |
2016 |
|
else if (strcmp(in_argv[i], "-s") == 0) |
2017 |
|
{ |
2018 |
|
STRNCPY(g_shell, in_argv[i + 1], sizeof(g_shell)); |
2019 |
|
} |
2020 |
|
else if (strcmp(in_argv[i], "-c") == 0) |
2021 |
|
{ |
2022 |
|
STRNCPY(g_directory, in_argv[i + 1], sizeof(g_directory)); |
2023 |
|
} |
2024 |
|
else if (strcmp(in_argv[i], "-p") == 0) |
2025 |
|
{ |
2026 |
|
STRNCPY(g_password, in_argv[i + 1], sizeof(g_password)); |
2027 |
|
g_flags |= RDP_LOGON_AUTO; |
2028 |
|
} |
2029 |
|
else if (strcmp(in_argv[i], "-n") == 0) |
2030 |
|
{ |
2031 |
|
STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); |
2032 |
|
} |
2033 |
|
} |
2034 |
|
return 1; |
2035 |
|
} |
2036 |
|
|
2037 |
|
//***************************************************************************** |
2038 |
|
int param_connect(void) |
2039 |
|
{ |
2040 |
|
QWidget * Desktop; |
2041 |
|
int dw, dh; |
2042 |
|
|
2043 |
|
#ifdef WITH_RDPSND |
2044 |
|
rdpsnd_init(); |
2045 |
|
#endif |
2046 |
|
if (rdp_connect(g_server, g_flags, g_domain, g_password, g_shell, |
2047 |
|
g_directory)) |
2048 |
|
{ |
2049 |
|
g_BS = (uint8*)xmalloc(g_width * g_height * 4); |
2050 |
|
memset(g_BS, 0, g_width * g_height * 4); |
2051 |
|
g_clipx = 0; |
2052 |
|
g_clipy = 0; |
2053 |
|
g_clipcx = g_width; |
2054 |
|
g_clipcy = g_height; |
2055 |
|
g_CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); |
2056 |
|
memset(g_CM, 0, sizeof(struct QColorMap)); |
2057 |
|
g_CM->NumColors = 256; |
2058 |
|
g_MW = new QMyMainWindow(); |
2059 |
|
g_MW->resize(g_width, g_height); |
2060 |
|
g_MW->show(); |
2061 |
|
g_SV->addChild(g_MW); |
2062 |
|
g_MW->setMouseTracking(true); |
2063 |
|
g_SocketNotifier = new QSocketNotifier(g_global_sock, |
2064 |
|
QSocketNotifier::Read, |
2065 |
|
g_MW); |
2066 |
|
g_MW->connect(g_SocketNotifier, SIGNAL(activated(int)), g_MW, |
2067 |
|
SLOT(dataReceived())); |
2068 |
|
if (g_fullscreen) |
2069 |
|
{ |
2070 |
|
Desktop = g_App->desktop(); |
2071 |
|
dw = Desktop->width(); |
2072 |
|
dh = Desktop->height(); |
2073 |
|
if (dw == g_width && dh == g_height) |
2074 |
|
g_MW->resize(g_width - 4, g_height - 4); |
2075 |
|
g_SV->showFullScreen(); |
2076 |
|
} |
2077 |
|
g_MW->setCursor(BlankCursor); |
2078 |
|
g_App->exec(); |
2079 |
|
} |
2080 |
return 0; |
return 0; |
2081 |
} |
} |
2082 |
|
|
2083 |
//***************************************************************************** |
//***************************************************************************** |
2084 |
int main(int argc, char** argv) |
int main(int argc, char ** argv) |
2085 |
{ |
{ |
|
g_CM = NULL; |
|
|
g_BS = NULL; |
|
2086 |
#ifdef SHARP |
#ifdef SHARP |
2087 |
g_App = new QPEApplication(argc, argv); |
g_App = new QPEApplication(argc, argv); |
2088 |
#else |
#else |
2091 |
g_SV = new QMyScrollView(); |
g_SV = new QMyScrollView(); |
2092 |
g_App->setMainWidget(g_SV); |
g_App->setMainWidget(g_SV); |
2093 |
g_SV->showMaximized(); |
g_SV->showMaximized(); |
2094 |
g_SV->timer_id = g_SV->startTimer(1000); |
if (argc > 1) |
2095 |
g_App->exec(); |
{ |
2096 |
|
get_username_and_hostname(); |
2097 |
|
if (parse_parameters(argc, argv)) |
2098 |
|
param_connect(); |
2099 |
|
} |
2100 |
|
else |
2101 |
|
{ |
2102 |
|
g_SV->timer_id = g_SV->startTimer(1000); /* one sec delay, then dialog */ |
2103 |
|
g_MW->setCursor(BlankCursor); |
2104 |
|
g_App->exec(); |
2105 |
|
} |
2106 |
delete g_SV; |
delete g_SV; |
2107 |
delete g_App; |
delete g_App; |
2108 |
if (g_CM != NULL) |
xfree(g_CM); |
2109 |
xfree(g_CM); |
xfree(g_BS); |
|
if (g_BS !=NULL) |
|
|
xfree(g_BS); |
|
2110 |
return 0; |
return 0; |
2111 |
} |
} |