moved files around
This commit is contained in:
parent
74a67d2d3f
commit
fd4beef2df
@ -1,26 +1,24 @@
|
||||
|
||||
XRDPOBJ = xrdp.o xrdp_tcp.o xrdp_iso.o xrdp_mcs.o xrdp_sec.o \
|
||||
xrdp_rdp.o xrdp_process.o xrdp_listen.o xrdp_orders.o \
|
||||
xrdp_bitmap.o xrdp_wm.o xrdp_painter.o xrdp_list.o \
|
||||
XRDPOBJ = xrdp.o xrdp_process.o xrdp_listen.o \
|
||||
xrdp_bitmap.o xrdp_wm.o xrdp_painter.o \
|
||||
xrdp_region.o xrdp_cache.o xrdp_font.o funcs.o \
|
||||
xrdp_login_wnd.o xrdp_file.o xrdp_bitmap_compress.o \
|
||||
xrdp_interface.o \
|
||||
os_calls.o
|
||||
xrdp_login_wnd.o xrdp_interface.o \
|
||||
../common/list.o \
|
||||
../common/file.o \
|
||||
../common/os_calls.o \
|
||||
../common/thread_calls.o
|
||||
|
||||
CFLAGS = -Wall -O2 -I../common
|
||||
C_OS_FLAGS = $(CFLAGS) -DUSE_OPENSSL -DUSE_PTHREAD -c
|
||||
LDFLAGS = -L /usr/gnu/lib
|
||||
LIBS = -lpthread -lcrypto -ldl
|
||||
#CC = g++
|
||||
#CFLAGS = -Wall -O2 -I../common -I../libxrdp -DXRDP_DEBUG
|
||||
CFLAGS = -Wall -O2 -I../common -I../libxrdp
|
||||
LDFLAGS = -L/usr/gnu/lib -L../libxrdp -Wl,-rpath,.
|
||||
LIBS = -ldl -lpthread -lxrdp
|
||||
CC = gcc
|
||||
|
||||
all: xrdp
|
||||
|
||||
xrdp: $(XRDPOBJ)
|
||||
$(CC) $(LDFLAGS) -o xrdp $(XRDPOBJ) $(LIBS)
|
||||
strip xrdp
|
||||
|
||||
clean:
|
||||
rm -f $(XRDPOBJ) xrdp
|
||||
|
||||
os_calls.o:
|
||||
$(CC) $(C_OS_FLAGS) ../common/os_calls.c
|
||||
|
433
xrdp/constants.h
433
xrdp/constants.h
@ -1,433 +0,0 @@
|
||||
/*
|
||||
rdesktop: A Remote Desktop Protocol client.
|
||||
Miscellaneous protocol constants
|
||||
Copyright (C) Matthew Chapman 1999-2002
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* modified for xrdp */
|
||||
|
||||
/* TCP port for Remote Desktop Protocol */
|
||||
#define TCP_PORT_RDP 3389
|
||||
|
||||
#define ISO_PDU_CR 0xE0 /* Connection Request */
|
||||
#define ISO_PDU_CC 0xD0 /* Connection Confirm */
|
||||
#define ISO_PDU_DR 0x80 /* Disconnect Request */
|
||||
#define ISO_PDU_DT 0xF0 /* Data */
|
||||
#define ISO_PDU_ER 0x70 /* Error */
|
||||
|
||||
/* MCS PDU codes */
|
||||
#define MCS_EDRQ 1 /* Erect Domain Request */
|
||||
#define MCS_DPUM 8 /* Disconnect Provider Ultimatum */
|
||||
#define MCS_AURQ 10 /* Attach User Request */
|
||||
#define MCS_AUCF 11 /* Attach User Confirm */
|
||||
#define MCS_CJRQ 14 /* Channel Join Request */
|
||||
#define MCS_CJCF 15 /* Channel Join Confirm */
|
||||
#define MCS_SDRQ 25 /* Send Data Request */
|
||||
#define MCS_SDIN 26 /* Send Data Indication */
|
||||
|
||||
#define MCS_CONNECT_INITIAL 0x7f65
|
||||
#define MCS_CONNECT_RESPONSE 0x7f66
|
||||
|
||||
#define BER_TAG_BOOLEAN 1
|
||||
#define BER_TAG_INTEGER 2
|
||||
#define BER_TAG_OCTET_STRING 4
|
||||
#define BER_TAG_RESULT 10
|
||||
#define MCS_TAG_DOMAIN_PARAMS 0x30
|
||||
|
||||
#define MCS_GLOBAL_CHANNEL 1003
|
||||
#define MCS_USERCHANNEL_BASE 1001
|
||||
|
||||
/* RDP secure transport constants */
|
||||
#define SEC_RANDOM_SIZE 32
|
||||
#define SEC_MODULUS_SIZE 64
|
||||
#define SEC_PADDING_SIZE 8
|
||||
#define SEC_EXPONENT_SIZE 4
|
||||
|
||||
#define SEC_CLIENT_RANDOM 0x0001
|
||||
#define SEC_ENCRYPT 0x0008
|
||||
#define SEC_LOGON_INFO 0x0040
|
||||
#define SEC_LICENCE_NEG 0x0080
|
||||
|
||||
#define SEC_TAG_SRV_INFO 0x0c01
|
||||
#define SEC_TAG_SRV_CRYPT 0x0c02
|
||||
#define SEC_TAG_SRV_CHANNELS 0x0c03
|
||||
|
||||
#define SEC_TAG_CLI_INFO 0xc001
|
||||
#define SEC_TAG_CLI_CRYPT 0xc002
|
||||
#define SEC_TAG_CLI_CHANNELS 0xc003
|
||||
#define SEC_TAG_CLI_4 0xc004
|
||||
|
||||
#define SEC_TAG_PUBKEY 0x0006
|
||||
#define SEC_TAG_KEYSIG 0x0008
|
||||
|
||||
#define SEC_RSA_MAGIC 0x31415352 /* RSA1 */
|
||||
|
||||
/* RDP licensing constants */
|
||||
#define LICENCE_TOKEN_SIZE 10
|
||||
#define LICENCE_HWID_SIZE 20
|
||||
#define LICENCE_SIGNATURE_SIZE 16
|
||||
|
||||
#define LICENCE_TAG_DEMAND 0x01
|
||||
#define LICENCE_TAG_AUTHREQ 0x02
|
||||
#define LICENCE_TAG_ISSUE 0x03
|
||||
#define LICENCE_TAG_REISSUE 0x04
|
||||
#define LICENCE_TAG_PRESENT 0x12
|
||||
#define LICENCE_TAG_REQUEST 0x13
|
||||
#define LICENCE_TAG_AUTHRESP 0x15
|
||||
#define LICENCE_TAG_RESULT 0xff
|
||||
|
||||
#define LICENCE_TAG_USER 0x000f
|
||||
#define LICENCE_TAG_HOST 0x0010
|
||||
|
||||
/* RDP PDU codes */
|
||||
#define RDP_PDU_DEMAND_ACTIVE 1
|
||||
#define RDP_PDU_CONFIRM_ACTIVE 3
|
||||
#define RDP_PDU_DEACTIVATE 6
|
||||
#define RDP_PDU_DATA 7
|
||||
|
||||
#define RDP_DATA_PDU_UPDATE 2
|
||||
#define RDP_DATA_PDU_CONTROL 20
|
||||
#define RDP_DATA_PDU_POINTER 27
|
||||
#define RDP_DATA_PDU_INPUT 28
|
||||
#define RDP_DATA_PDU_SYNCHRONISE 31
|
||||
#define RDP_DATA_PDU_BELL 34
|
||||
#define RDP_DATA_PDU_LOGON 38
|
||||
#define RDP_DATA_PDU_FONT2 39
|
||||
#define RDP_DATA_PDU_DISCONNECT 47
|
||||
|
||||
#define RDP_CTL_REQUEST_CONTROL 1
|
||||
#define RDP_CTL_GRANT_CONTROL 2
|
||||
#define RDP_CTL_DETACH 3
|
||||
#define RDP_CTL_COOPERATE 4
|
||||
|
||||
#define RDP_UPDATE_ORDERS 0
|
||||
#define RDP_UPDATE_BITMAP 1
|
||||
#define RDP_UPDATE_PALETTE 2
|
||||
#define RDP_UPDATE_SYNCHRONIZE 3
|
||||
|
||||
#define RDP_POINTER_SYSTEM 1
|
||||
#define RDP_POINTER_MOVE 3
|
||||
#define RDP_POINTER_COLOR 6
|
||||
#define RDP_POINTER_CACHED 7
|
||||
|
||||
#define RDP_NULL_POINTER 0
|
||||
#define RDP_DEFAULT_POINTER 0x7F00
|
||||
|
||||
#define RDP_INPUT_SYNCHRONIZE 0
|
||||
#define RDP_INPUT_CODEPOINT 1
|
||||
#define RDP_INPUT_VIRTKEY 2
|
||||
#define RDP_INPUT_SCANCODE 4
|
||||
#define RDP_INPUT_MOUSE 0x8001
|
||||
|
||||
/* Device flags */
|
||||
#define KBD_FLAG_RIGHT 0x0001
|
||||
#define KBD_FLAG_EXT 0x0100
|
||||
#define KBD_FLAG_QUIET 0x1000
|
||||
#define KBD_FLAG_DOWN 0x4000
|
||||
#define KBD_FLAG_UP 0x8000
|
||||
|
||||
/* These are for synchronization; not for keystrokes */
|
||||
#define KBD_FLAG_SCROLL 0x0001
|
||||
#define KBD_FLAG_NUMLOCK 0x0002
|
||||
#define KBD_FLAG_CAPITAL 0x0004
|
||||
|
||||
/* See T.128 */
|
||||
#define RDP_KEYPRESS 0
|
||||
#define RDP_KEYRELEASE (KBD_FLAG_DOWN | KBD_FLAG_UP)
|
||||
|
||||
#define MOUSE_FLAG_MOVE 0x0800
|
||||
#define MOUSE_FLAG_BUTTON1 0x1000
|
||||
#define MOUSE_FLAG_BUTTON2 0x2000
|
||||
#define MOUSE_FLAG_BUTTON3 0x4000
|
||||
#define MOUSE_FLAG_BUTTON4 0x0280
|
||||
#define MOUSE_FLAG_BUTTON5 0x0380
|
||||
#define MOUSE_FLAG_DOWN 0x8000
|
||||
|
||||
/* Raster operation masks */
|
||||
#define ROP2_S(rop3) (rop3 & 0xf)
|
||||
#define ROP2_P(rop3) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2))
|
||||
|
||||
#define ROP2_COPY 0xc
|
||||
#define ROP2_XOR 0x6
|
||||
#define ROP2_AND 0x8
|
||||
#define ROP2_NXOR 0x9
|
||||
#define ROP2_OR 0xe
|
||||
|
||||
#define MIX_TRANSPARENT 0
|
||||
#define MIX_OPAQUE 1
|
||||
|
||||
#define TEXT2_VERTICAL 0x04
|
||||
#define TEXT2_IMPLICIT_X 0x20
|
||||
|
||||
/* RDP bitmap cache (version 2) constants */
|
||||
#define BMPCACHE2_C0_CELLS 0x78
|
||||
#define BMPCACHE2_C1_CELLS 0x78
|
||||
#define BMPCACHE2_C2_CELLS 0x150
|
||||
#define BMPCACHE2_NUM_PSTCELLS 0x9f6
|
||||
|
||||
#define PDU_FLAG_FIRST 0x01
|
||||
#define PDU_FLAG_LAST 0x02
|
||||
|
||||
/* Maps to generalCapabilitySet in T.128 page 138 */
|
||||
|
||||
/* RDP capabilities */
|
||||
#define RDP_CAPSET_GENERAL 1
|
||||
#define RDP_CAPLEN_GENERAL 0x18
|
||||
#define OS_MAJOR_TYPE_UNIX 4
|
||||
#define OS_MINOR_TYPE_XSERVER 7
|
||||
|
||||
#define RDP_CAPSET_BITMAP 2
|
||||
#define RDP_CAPLEN_BITMAP 0x1C
|
||||
|
||||
#define RDP_CAPSET_ORDER 3
|
||||
#define RDP_CAPLEN_ORDER 0x58
|
||||
#define ORDER_CAP_NEGOTIATE 2
|
||||
#define ORDER_CAP_NOSUPPORT 4
|
||||
|
||||
#define RDP_CAPSET_BMPCACHE 4
|
||||
#define RDP_CAPLEN_BMPCACHE 0x28
|
||||
|
||||
#define RDP_CAPSET_CONTROL 5
|
||||
#define RDP_CAPLEN_CONTROL 0x0C
|
||||
|
||||
#define RDP_CAPSET_ACTIVATE 7
|
||||
#define RDP_CAPLEN_ACTIVATE 0x0C
|
||||
|
||||
#define RDP_CAPSET_POINTER 8
|
||||
#define RDP_CAPLEN_POINTER 0x08
|
||||
|
||||
#define RDP_CAPSET_SHARE 9
|
||||
#define RDP_CAPLEN_SHARE 0x08
|
||||
|
||||
#define RDP_CAPSET_COLCACHE 10
|
||||
#define RDP_CAPLEN_COLCACHE 0x08
|
||||
|
||||
#define RDP_CAPSET_BMPCACHE2 19
|
||||
#define RDP_CAPLEN_BMPCACHE2 0x28
|
||||
#define BMPCACHE2_FLAG_PERSIST ((long)1<<31)
|
||||
|
||||
#define RDP_SOURCE "MSTSC"
|
||||
|
||||
/* Logon flags */
|
||||
#define RDP_LOGON_AUTO 0x0008
|
||||
#define RDP_LOGON_NORMAL 0x0033
|
||||
#define RDP_COMPRESSION 0x0080
|
||||
#define RDP_LOGON_BLOB 0x0100
|
||||
#define RDP_LOGON_LEAVE_AUDIO 0x2000
|
||||
|
||||
#define RDP5_DISABLE_NOTHING 0x00
|
||||
#define RDP5_NO_WALLPAPER 0x01
|
||||
#define RDP5_NO_FULLWINDOWDRAG 0x02
|
||||
#define RDP5_NO_MENUANIMATIONS 0x04
|
||||
#define RDP5_NO_THEMING 0x08
|
||||
#define RDP5_NO_CURSOR_SHADOW 0x20
|
||||
#define RDP5_NO_CURSORSETTINGS 0x40 /* disables cursor blinking */
|
||||
|
||||
/* compression types */
|
||||
#define RDP_MPPC_COMPRESSED 0x20
|
||||
#define RDP_MPPC_RESET 0x40
|
||||
#define RDP_MPPC_FLUSH 0x80
|
||||
#define RDP_MPPC_DICT_SIZE 8192
|
||||
|
||||
/* Keymap flags */
|
||||
#define MapRightShiftMask (1 << 0)
|
||||
#define MapLeftShiftMask (1 << 1)
|
||||
#define MapShiftMask (MapRightShiftMask | MapLeftShiftMask)
|
||||
|
||||
#define MapRightAltMask (1 << 2)
|
||||
#define MapLeftAltMask (1 << 3)
|
||||
#define MapAltGrMask MapRightAltMask
|
||||
|
||||
#define MapRightCtrlMask (1 << 4)
|
||||
#define MapLeftCtrlMask (1 << 5)
|
||||
#define MapCtrlMask (MapRightCtrlMask | MapLeftCtrlMask)
|
||||
|
||||
#define MapRightWinMask (1 << 6)
|
||||
#define MapLeftWinMask (1 << 7)
|
||||
#define MapWinMask (MapRightWinMask | MapLeftWinMask)
|
||||
|
||||
#define MapNumLockMask (1 << 8)
|
||||
#define MapCapsLockMask (1 << 9)
|
||||
|
||||
#define MapLocalStateMask (1 << 10)
|
||||
|
||||
#define MapInhibitMask (1 << 11)
|
||||
|
||||
#define MASK_ADD_BITS(var, mask) (var |= mask)
|
||||
#define MASK_REMOVE_BITS(var, mask) (var &= ~mask)
|
||||
#define MASK_HAS_BITS(var, mask) ((var & mask)>0)
|
||||
#define MASK_CHANGE_BIT(var, mask, active) \
|
||||
(var = ((var & ~mask) | (active ? mask : 0)))
|
||||
|
||||
/* Clipboard constants, "borrowed" from GCC system headers in
|
||||
the w32 cross compiler */
|
||||
|
||||
#define CF_TEXT 1
|
||||
#define CF_BITMAP 2
|
||||
#define CF_METAFILEPICT 3
|
||||
#define CF_SYLK 4
|
||||
#define CF_DIF 5
|
||||
#define CF_TIFF 6
|
||||
#define CF_OEMTEXT 7
|
||||
#define CF_DIB 8
|
||||
#define CF_PALETTE 9
|
||||
#define CF_PENDATA 10
|
||||
#define CF_RIFF 11
|
||||
#define CF_WAVE 12
|
||||
#define CF_UNICODETEXT 13
|
||||
#define CF_ENHMETAFILE 14
|
||||
#define CF_HDROP 15
|
||||
#define CF_LOCALE 16
|
||||
#define CF_MAX 17
|
||||
#define CF_OWNERDISPLAY 128
|
||||
#define CF_DSPTEXT 129
|
||||
#define CF_DSPBITMAP 130
|
||||
#define CF_DSPMETAFILEPICT 131
|
||||
#define CF_DSPENHMETAFILE 142
|
||||
#define CF_PRIVATEFIRST 512
|
||||
#define CF_PRIVATELAST 767
|
||||
#define CF_GDIOBJFIRST 768
|
||||
#define CF_GDIOBJLAST 1023
|
||||
|
||||
/* Sound format constants */
|
||||
#define WAVE_FORMAT_PCM 1
|
||||
#define WAVE_FORMAT_ADPCM 2
|
||||
#define WAVE_FORMAT_ALAW 6
|
||||
#define WAVE_FORMAT_MULAW 7
|
||||
|
||||
/* Virtual channel options */
|
||||
#define CHANNEL_OPTION_INITIALIZED 0x80000000
|
||||
#define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
|
||||
#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000
|
||||
#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
|
||||
|
||||
/* NT status codes for RDPDR */
|
||||
#define STATUS_SUCCESS 0x00000000
|
||||
#define STATUS_PENDING 0x00000103
|
||||
|
||||
#define STATUS_NO_MORE_FILES 0x80000006
|
||||
#define STATUS_DEVICE_PAPER_EMPTY 0x8000000e
|
||||
#define STATUS_DEVICE_POWERED_OFF 0x8000000f
|
||||
#define STATUS_DEVICE_OFF_LINE 0x80000010
|
||||
#define STATUS_DEVICE_BUSY 0x80000011
|
||||
|
||||
#define STATUS_INVALID_HANDLE 0xc0000008
|
||||
#define STATUS_INVALID_PARAMETER 0xc000000d
|
||||
#define STATUS_NO_SUCH_FILE 0xc000000f
|
||||
#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010
|
||||
#define STATUS_ACCESS_DENIED 0xc0000022
|
||||
#define STATUS_OBJECT_NAME_COLLISION 0xc0000035
|
||||
#define STATUS_DISK_FULL 0xc000007f
|
||||
#define STATUS_FILE_IS_A_DIRECTORY 0xc00000ba
|
||||
#define STATUS_NOT_SUPPORTED 0xc00000bb
|
||||
#define STATUS_TIMEOUT 0xc0000102
|
||||
#define STATUS_CANCELLED 0xc0000120
|
||||
|
||||
/* RDPDR constants */
|
||||
#define RDPDR_MAX_DEVICES 0x10
|
||||
#define DEVICE_TYPE_SERIAL 0x01
|
||||
#define DEVICE_TYPE_PARALLEL 0x02
|
||||
#define DEVICE_TYPE_PRINTER 0x04
|
||||
#define DEVICE_TYPE_DISK 0x08
|
||||
#define DEVICE_TYPE_SCARD 0x20
|
||||
|
||||
#define FILE_DIRECTORY_FILE 0x00000001
|
||||
#define FILE_NON_DIRECTORY_FILE 0x00000040
|
||||
#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
|
||||
|
||||
/* RDP5 disconnect PDU */
|
||||
#define exDiscReasonNoInfo 0x0000
|
||||
#define exDiscReasonAPIInitiatedDisconnect 0x0001
|
||||
#define exDiscReasonAPIInitiatedLogoff 0x0002
|
||||
#define exDiscReasonServerIdleTimeout 0x0003
|
||||
#define exDiscReasonServerLogonTimeout 0x0004
|
||||
#define exDiscReasonReplacedByOtherConnection 0x0005
|
||||
#define exDiscReasonOutOfMemory 0x0006
|
||||
#define exDiscReasonServerDeniedConnection 0x0007
|
||||
#define exDiscReasonServerDeniedConnectionFips 0x0008
|
||||
#define exDiscReasonLicenseInternal 0x0100
|
||||
#define exDiscReasonLicenseNoLicenseServer 0x0101
|
||||
#define exDiscReasonLicenseNoLicense 0x0102
|
||||
#define exDiscReasonLicenseErrClientMsg 0x0103
|
||||
#define exDiscReasonLicenseHwidDoesntMatchLicense 0x0104
|
||||
#define exDiscReasonLicenseErrClientLicense 0x0105
|
||||
#define exDiscReasonLicenseCantFinishProtocol 0x0106
|
||||
#define exDiscReasonLicenseClientEndedProtocol 0x0107
|
||||
#define exDiscReasonLicenseErrClientEncryption 0x0108
|
||||
#define exDiscReasonLicenseCantUpgradeLicense 0x0109
|
||||
#define exDiscReasonLicenseNoRemoteConnections 0x010a
|
||||
|
||||
#define RDP_ORDER_STANDARD 0x01
|
||||
#define RDP_ORDER_SECONDARY 0x02
|
||||
#define RDP_ORDER_BOUNDS 0x04
|
||||
#define RDP_ORDER_CHANGE 0x08
|
||||
#define RDP_ORDER_DELTA 0x10
|
||||
#define RDP_ORDER_LASTBOUNDS 0x20
|
||||
#define RDP_ORDER_SMALL 0x40
|
||||
#define RDP_ORDER_TINY 0x80
|
||||
|
||||
#define RDP_ORDER_DESTBLT 0
|
||||
#define RDP_ORDER_PATBLT 1
|
||||
#define RDP_ORDER_SCREENBLT 2
|
||||
#define RDP_ORDER_LINE 9
|
||||
#define RDP_ORDER_RECT 10
|
||||
#define RDP_ORDER_DESKSAVE 11
|
||||
#define RDP_ORDER_MEMBLT 13
|
||||
#define RDP_ORDER_TRIBLT 14
|
||||
#define RDP_ORDER_POLYLINE 22
|
||||
#define RDP_ORDER_TEXT2 27
|
||||
|
||||
#define RDP_ORDER_RAW_BMPCACHE 0
|
||||
#define RDP_ORDER_COLCACHE 1
|
||||
#define RDP_ORDER_BMPCACHE 2
|
||||
#define RDP_ORDER_FONTCACHE 3
|
||||
#define RDP_ORDER_RAW_BMPCACHE2 4
|
||||
#define RDP_ORDER_BMPCACHE2 5
|
||||
|
||||
/* drawable types */
|
||||
#define WND_TYPE_BITMAP 0
|
||||
#define WND_TYPE_WND 1
|
||||
#define WND_TYPE_SCREEN 2
|
||||
#define WND_TYPE_BUTTON 3
|
||||
#define WND_TYPE_IMAGE 4
|
||||
#define WND_TYPE_EDIT 5
|
||||
#define WND_TYPE_LABEL 6
|
||||
#define WND_TYPE_COMBO 7
|
||||
#define WND_TYPE_SPECIAL 8
|
||||
|
||||
/* button states */
|
||||
#define BUTTON_STATE_UP 0
|
||||
#define BUTTON_STATE_DOWN 1
|
||||
|
||||
/* messages */
|
||||
#define WM_PAINT 3
|
||||
#define WM_KEYDOWN 15
|
||||
#define WM_KEYUP 16
|
||||
#define WM_MOUSEMOVE 100
|
||||
#define WM_LBUTTONUP 101
|
||||
#define WM_LBUTTONDOWN 102
|
||||
#define WM_RBUTTONUP 103
|
||||
#define WM_RBUTTONDOWN 104
|
||||
#define WM_BUTTON3UP 105
|
||||
#define WM_BUTTON3DOWN 106
|
||||
#define WM_BUTTON4UP 107
|
||||
#define WM_BUTTON4DOWN 108
|
||||
#define WM_BUTTON5UP 109
|
||||
#define WM_BUTTON5DOWN 110
|
||||
#define WM_INVALIDATE 200
|
||||
|
||||
#define CB_ITEMCHANGE 300
|
91
xrdp/funcs.c
91
xrdp/funcs.c
@ -24,7 +24,8 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns boolean */
|
||||
int rect_contains_pt(struct xrdp_rect* in, int x, int y)
|
||||
int APP_CC
|
||||
rect_contains_pt(struct xrdp_rect* in, int x, int y)
|
||||
{
|
||||
if (x < in->left)
|
||||
{
|
||||
@ -46,8 +47,9 @@ int rect_contains_pt(struct xrdp_rect* in, int x, int y)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
|
||||
struct xrdp_rect* out)
|
||||
int APP_CC
|
||||
rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
|
||||
struct xrdp_rect* out)
|
||||
{
|
||||
int rv;
|
||||
struct xrdp_rect dumby;
|
||||
@ -84,7 +86,8 @@ int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
|
||||
/*****************************************************************************/
|
||||
/* adjust the bounds to fit in the bitmap */
|
||||
/* return false if there is nothing to draw else return true */
|
||||
int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy)
|
||||
int APP_CC
|
||||
check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy)
|
||||
{
|
||||
if (*x >= b->width)
|
||||
{
|
||||
@ -221,43 +224,46 @@ int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy)
|
||||
*/
|
||||
|
||||
/* non shift chars */
|
||||
char chars1[] = {'\0', '\0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', '0', '-', '=', '\0', '\0',
|
||||
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
|
||||
'o', 'p', '[', ']', '\0', '\0', 'a', 's',
|
||||
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
|
||||
'\'', '`', '\0', '\\', 'z', 'x', 'c', 'v',
|
||||
'b', 'n', 'm', ',', '.', '/', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3', '0', '.', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
|
||||
static char chars1[] =
|
||||
{'\0', '\0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', '0', '-', '=', '\0', '\0',
|
||||
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
|
||||
'o', 'p', '[', ']', '\0', '\0', 'a', 's',
|
||||
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
|
||||
'\'', '`', '\0', '\\', 'z', 'x', 'c', 'v',
|
||||
'b', 'n', 'm', ',', '.', '/', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3', '0', '.', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
|
||||
/* shift chars */
|
||||
char chars2[] = {'\0', '\0', '!', '@', '#', '$', '%', '^',
|
||||
'&', '*', '(', ')', '_', '+', '\0', '\0',
|
||||
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
|
||||
'O', 'P', '{', '}', '\0', '\0', 'A', 'S',
|
||||
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
|
||||
'"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
|
||||
'B', 'N', 'M', '<', '>', '?', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3', '0', '.', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
|
||||
static char chars2[] =
|
||||
{'\0', '\0', '!', '@', '#', '$', '%', '^',
|
||||
'&', '*', '(', ')', '_', '+', '\0', '\0',
|
||||
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
|
||||
'O', 'P', '{', '}', '\0', '\0', 'A', 'S',
|
||||
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
|
||||
'"', '~', '\0', '|', 'Z', 'X', 'C', 'V',
|
||||
'B', 'N', 'M', '<', '>', '?', '\0', '*',
|
||||
'\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '7',
|
||||
'8', '9', '-', '4', '5', '6', '+', '1',
|
||||
'2', '3', '0', '.', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
|
||||
|
||||
/*****************************************************************************/
|
||||
char get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
int caps_lock, int num_lock, int scroll_lock)
|
||||
char APP_CC
|
||||
get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
int caps_lock, int num_lock, int scroll_lock)
|
||||
{
|
||||
char rv;
|
||||
int shift;
|
||||
@ -321,7 +327,8 @@ char get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
/*****************************************************************************/
|
||||
/* add a ch at index position in text, index starts at 0 */
|
||||
/* if index = -1 add it to the end */
|
||||
int add_char_at(char* text, char ch, int index)
|
||||
int APP_CC
|
||||
add_char_at(char* text, char ch, int index)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
@ -345,7 +352,8 @@ int add_char_at(char* text, char ch, int index)
|
||||
/*****************************************************************************/
|
||||
/* remove a ch at index position in text, index starts at 0 */
|
||||
/* if index = -1 remove it from the end */
|
||||
int remove_char_at(char* text, int index)
|
||||
int APP_CC
|
||||
remove_char_at(char* text, int index)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
@ -369,7 +377,8 @@ int remove_char_at(char* text, int index)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int set_string(char** in_str, char* in)
|
||||
int APP_CC
|
||||
set_string(char** in_str, char* in)
|
||||
{
|
||||
if (in_str == 0)
|
||||
{
|
||||
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
use freely
|
||||
*/
|
||||
|
||||
int server_init(void);
|
||||
int server_exit(void);
|
||||
int server_connect(int sck, int* width, int* height, int* bpp);
|
||||
int server_loop(int sck);
|
||||
int server_set_callback(int (* callback)(int, int, int));
|
||||
int server_begin_update(void);
|
||||
int server_end_update(void);
|
||||
int server_fill_rect(int x, int y, int cx, int cy, int color);
|
||||
int server_screen_blt(int x, int y, int cx, int cy, int srcx, int srcy);
|
||||
int server_paint_rect(int x, int y, int cx, int cy, char* data);
|
||||
int server_set_pointer(int x, int y, char* data, char* mask);
|
||||
int server_palette(int* palette);
|
||||
|
@ -1,21 +0,0 @@
|
||||
|
||||
XRDPOBJ = ../common/os_calls.o \
|
||||
xrdp_tcp.o xrdp_iso.o xrdp_mcs.o xrdp_sec.o \
|
||||
xrdp_rdp.o xrdp_process.o xrdp_orders.o \
|
||||
xrdp_bitmap.o xrdp_wm.o xrdp_painter.o xrdp_list.o \
|
||||
xrdp_region.o xrdp_cache.o xrdp_font.o funcs.o \
|
||||
xrdp_file.o xrdp_bitmap_compress.o \
|
||||
xrdp_interface.o
|
||||
|
||||
CFLAGS = -Wall -O2 -I../common -DXRDP_LIB
|
||||
LDFLAGS = -L /usr/gnu/lib -shared
|
||||
LIBS = -lcrypto
|
||||
CC = gcc
|
||||
|
||||
all: xrdp
|
||||
|
||||
xrdp: $(XRDPOBJ)
|
||||
$(CC) $(LDFLAGS) -o libxrdp.so $(XRDPOBJ) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(XRDPOBJ) xrdp
|
@ -6,20 +6,20 @@
|
||||
# run 'set PATH=c:\borland\bcc55\bin' and run 'make -f makefile_win32 all'
|
||||
#
|
||||
|
||||
XRDPOBJ = xrdp.obj xrdp_tcp.obj xrdp_iso.obj xrdp_mcs.obj \
|
||||
xrdp_sec.obj xrdp_rdp.obj xrdp_process.obj xrdp_listen.obj \
|
||||
xrdp_orders.obj xrdp_bitmap.obj xrdp_wm.obj xrdp_painter.obj \
|
||||
xrdp_list.obj xrdp_region.obj xrdp_cache.obj xrdp_font.obj \
|
||||
funcs.obj xrdp_login_wnd.obj xrdp_file.obj xrdp_interface.obj \
|
||||
xrdp_bitmap_compress.obj \
|
||||
os_calls.obj
|
||||
XRDPOBJ = xrdp.obj xrdp_process.obj xrdp_listen.obj \
|
||||
xrdp_bitmap.obj xrdp_wm.obj xrdp_painter.obj \
|
||||
xrdp_region.obj xrdp_cache.obj xrdp_font.obj funcs.obj \
|
||||
xrdp_login_wnd.obj xrdp_interface.obj \
|
||||
list.obj \
|
||||
file.obj \
|
||||
os_calls.obj \
|
||||
thread_calls.obj
|
||||
|
||||
CFLAGS = -w- -O2 -I../common
|
||||
C_OS_FLAGS = -w- -O2 -Ic:/borland/bcc55/include -Ic:/openssl/include -DUSE_OPENSSL -c
|
||||
CFLAGS = -w- -O2 -I../common -Ic:/borland/bcc55/include -Ic:/openssl/include -I../libxrdp
|
||||
LDFLAGS = -Lc:/borland/bcc55/lib
|
||||
|
||||
xrdp: $(XRDPOBJ)
|
||||
$(CC) $(LDFLAGS) libeay32.lib $(XRDPOBJ)
|
||||
$(CC) $(LDFLAGS) libeay32.lib xrdp.lib $(XRDPOBJ)
|
||||
|
||||
all: lib xrdp
|
||||
|
||||
@ -28,6 +28,17 @@ clean:
|
||||
|
||||
lib:
|
||||
implib -a -w libeay32.lib c:/windows/system32/libeay32.dll
|
||||
implib -w xrdp.lib ../libxrdp/xrdp.dll
|
||||
|
||||
list.obj:
|
||||
$(CC) $(CFLAGS) -c ../common/list.c
|
||||
|
||||
file.obj:
|
||||
$(CC) $(CFLAGS) -c ../common/file.c
|
||||
|
||||
os_calls.obj:
|
||||
$(CC) $(C_OS_FLAGS) ../common/os_calls.c
|
||||
$(CC) $(CFLAGS) -c ../common/os_calls.c
|
||||
|
||||
thread_calls.obj:
|
||||
$(CC) $(CFLAGS) -c ../common/thread_calls.c
|
||||
|
||||
|
78
xrdp/xrdp.c
78
xrdp/xrdp.c
@ -20,13 +20,26 @@
|
||||
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include "xrdp.h"
|
||||
|
||||
static struct xrdp_listen* g_listen = 0;
|
||||
static int g_threadid = 0; /* main threadid */
|
||||
|
||||
#if defined(_WIN32)
|
||||
static CRITICAL_SECTION g_term_mutex;
|
||||
#else
|
||||
static pthread_mutex_t g_term_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
static int g_term = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
void shutdown(int sig)
|
||||
void
|
||||
xrdp_shutdown(int sig)
|
||||
{
|
||||
struct xrdp_listen* listen;
|
||||
|
||||
@ -43,19 +56,70 @@ void shutdown(int sig)
|
||||
g_set_term(1);
|
||||
g_sleep(1000);
|
||||
xrdp_listen_delete(listen);
|
||||
g_exit_system();
|
||||
#if defined(_WIN32)
|
||||
WSACleanup();
|
||||
DeleteCriticalSection(&g_term_mutex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int main(int argc, char** argv)
|
||||
int
|
||||
g_is_term(void)
|
||||
{
|
||||
g_init_system();
|
||||
int rv;
|
||||
|
||||
#if defined(_WIN32)
|
||||
EnterCriticalSection(&g_term_mutex);
|
||||
rv = g_term;
|
||||
LeaveCriticalSection(&g_term_mutex);
|
||||
#else
|
||||
pthread_mutex_lock(&g_term_mutex);
|
||||
rv = g_term;
|
||||
pthread_mutex_unlock(&g_term_mutex);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
g_set_term(int in_val)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
EnterCriticalSection(&g_term_mutex);
|
||||
g_term = in_val;
|
||||
LeaveCriticalSection(&g_term_mutex);
|
||||
#else
|
||||
pthread_mutex_lock(&g_term_mutex);
|
||||
g_term = in_val;
|
||||
pthread_mutex_unlock(&g_term_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
pipe_sig(int sig_num)
|
||||
{
|
||||
/* do nothing */
|
||||
g_printf("got SIGPIPE(%d)\n\r", sig_num);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSADATA w;
|
||||
|
||||
WSAStartup(2, &w);
|
||||
InitializeCriticalSection(&g_term_mutex);
|
||||
#endif
|
||||
g_threadid = g_get_threadid();
|
||||
g_listen = xrdp_listen_create();
|
||||
g_signal(2, shutdown);
|
||||
g_signal(9, shutdown);
|
||||
g_signal(15, shutdown);
|
||||
g_signal(2, xrdp_shutdown);
|
||||
g_signal(9, xrdp_shutdown);
|
||||
g_signal(13, pipe_sig); /* sig pipe */
|
||||
g_signal(15, xrdp_shutdown);
|
||||
xrdp_listen_main_loop(g_listen);
|
||||
return 0;
|
||||
}
|
||||
|
482
xrdp/xrdp.h
482
xrdp/xrdp.h
@ -23,278 +23,262 @@
|
||||
/* include other h files */
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
#include "libxrdpinc.h"
|
||||
#include "xrdp_types.h"
|
||||
#include "constants.h"
|
||||
#include "xrdp_defines.h"
|
||||
#include "xrdp_constants.h"
|
||||
#include "defines.h"
|
||||
#include "os_calls.h"
|
||||
#include "ssl_calls.h"
|
||||
#include "thread_calls.h"
|
||||
#include "list.h"
|
||||
#include "file.h"
|
||||
|
||||
/* xrdp_tcp.c */
|
||||
struct xrdp_tcp* xrdp_tcp_create(struct xrdp_iso* owner, int sck);
|
||||
void xrdp_tcp_delete(struct xrdp_tcp* self);
|
||||
int xrdp_tcp_init(struct xrdp_tcp* self, struct stream* s);
|
||||
int xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len);
|
||||
int xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s);
|
||||
|
||||
/* xrdp_iso.c */
|
||||
struct xrdp_iso* xrdp_iso_create(struct xrdp_mcs* owner, int sck);
|
||||
void xrdp_iso_delete(struct xrdp_iso* self);
|
||||
int xrdp_iso_init(struct xrdp_iso* self, struct stream* s);
|
||||
int xrdp_iso_recv(struct xrdp_iso* self, struct stream* s);
|
||||
int xrdp_iso_send(struct xrdp_iso* self, struct stream* s);
|
||||
int xrdp_iso_incoming(struct xrdp_iso* self);
|
||||
|
||||
/* xrdp_mcs.c */
|
||||
struct xrdp_mcs* xrdp_mcs_create(struct xrdp_sec* owner, int sck,
|
||||
struct stream* client_mcs_data,
|
||||
struct stream* server_mcs_data);
|
||||
void xrdp_mcs_delete(struct xrdp_mcs* self);
|
||||
int xrdp_mcs_init(struct xrdp_mcs* self, struct stream* s);
|
||||
int xrdp_mcs_recv(struct xrdp_mcs* self, struct stream* s, int* chan);
|
||||
int xrdp_mcs_send(struct xrdp_mcs* self, struct stream* s);
|
||||
int xrdp_mcs_incoming(struct xrdp_mcs* self);
|
||||
int xrdp_mcs_disconnect(struct xrdp_mcs* self);
|
||||
|
||||
/* xrdp_sec.c */
|
||||
struct xrdp_sec* xrdp_sec_create(struct xrdp_rdp* owner, int sck);
|
||||
void xrdp_sec_delete(struct xrdp_sec* self);
|
||||
int xrdp_sec_init(struct xrdp_sec* self, struct stream* s);
|
||||
int xrdp_sec_recv(struct xrdp_sec* self, struct stream* s, int* chan);
|
||||
int xrdp_sec_send(struct xrdp_sec* self, struct stream* s, int flags);
|
||||
int xrdp_sec_incoming(struct xrdp_sec* self);
|
||||
int xrdp_sec_disconnect(struct xrdp_sec* self);
|
||||
|
||||
/* xrdp_rdp.c */
|
||||
struct xrdp_rdp* xrdp_rdp_create(struct xrdp_process* owner, int sck);
|
||||
void xrdp_rdp_delete(struct xrdp_rdp* self);
|
||||
int xrdp_rdp_init(struct xrdp_rdp* self, struct stream* s);
|
||||
int xrdp_rdp_init_data(struct xrdp_rdp* self, struct stream* s);
|
||||
int xrdp_rdp_recv(struct xrdp_rdp* self, struct stream* s, int* code);
|
||||
int xrdp_rdp_send(struct xrdp_rdp* self, struct stream* s, int pdu_type);
|
||||
int xrdp_rdp_send_data(struct xrdp_rdp* self, struct stream* s,
|
||||
int data_pdu_type);
|
||||
int xrdp_rdp_incoming(struct xrdp_rdp* self);
|
||||
int xrdp_rdp_send_demand_active(struct xrdp_rdp* self);
|
||||
int xrdp_rdp_process_confirm_active(struct xrdp_rdp* self, struct stream* s);
|
||||
int xrdp_rdp_process_data(struct xrdp_rdp* self, struct stream* s);
|
||||
int xrdp_rdp_disconnect(struct xrdp_rdp* self);
|
||||
|
||||
/* xrdp_orders.c */
|
||||
struct xrdp_orders* xrdp_orders_create(struct xrdp_process* owner,
|
||||
struct xrdp_rdp* rdp_layer);
|
||||
void xrdp_orders_delete(struct xrdp_orders* self);
|
||||
int xrdp_orders_init(struct xrdp_orders* self);
|
||||
int xrdp_orders_send(struct xrdp_orders* self);
|
||||
int xrdp_orders_force_send(struct xrdp_orders* self);
|
||||
int xrdp_orders_rect(struct xrdp_orders* self, int x, int y, int cx, int cy,
|
||||
int color, struct xrdp_rect* rect);
|
||||
int xrdp_orders_screen_blt(struct xrdp_orders* self, int x, int y,
|
||||
int cx, int cy, int srcx, int srcy,
|
||||
int rop, struct xrdp_rect* rect);
|
||||
int xrdp_orders_pat_blt(struct xrdp_orders* self, int x, int y,
|
||||
int cx, int cy, int rop, int bg_color,
|
||||
int fg_color, struct xrdp_brush* brush,
|
||||
struct xrdp_rect* rect);
|
||||
int xrdp_orders_dest_blt(struct xrdp_orders* self, int x, int y,
|
||||
int cx, int cy, int rop,
|
||||
struct xrdp_rect* rect);
|
||||
int xrdp_orders_line(struct xrdp_orders* self, int mix_mode,
|
||||
int startx, int starty,
|
||||
int endx, int endy, int rop, int bg_color,
|
||||
struct xrdp_pen* pen,
|
||||
struct xrdp_rect* rect);
|
||||
int xrdp_orders_mem_blt(struct xrdp_orders* self, int cache_id,
|
||||
int color_table, int x, int y, int cx, int cy,
|
||||
int rop, int srcx, int srcy,
|
||||
int cache_idx, struct xrdp_rect* rect);
|
||||
int xrdp_orders_text(struct xrdp_orders* self,
|
||||
int font, int flags, int mixmode,
|
||||
int fg_color, int bg_color,
|
||||
int clip_left, int clip_top,
|
||||
int clip_right, int clip_bottom,
|
||||
int box_left, int box_top,
|
||||
int box_right, int box_bottom,
|
||||
int x, int y, char* data, int data_len,
|
||||
struct xrdp_rect* rect);
|
||||
int xrdp_orders_send_palette(struct xrdp_orders* self, int* palette,
|
||||
int cache_id);
|
||||
int xrdp_orders_send_raw_bitmap(struct xrdp_orders* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int cache_id, int cache_idx);
|
||||
int xrdp_orders_send_bitmap(struct xrdp_orders* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int cache_id, int cache_idx);
|
||||
int xrdp_orders_send_font(struct xrdp_orders* self,
|
||||
struct xrdp_font_item* font_item,
|
||||
int font_index, int char_index);
|
||||
/* xrdp.c */
|
||||
int
|
||||
g_is_term(void);
|
||||
void
|
||||
g_set_term(int in_val);
|
||||
|
||||
/* xrdp_cache.c */
|
||||
struct xrdp_cache* xrdp_cache_create(struct xrdp_wm* owner,
|
||||
struct xrdp_orders* orders,
|
||||
struct xrdp_client_info* client_info);
|
||||
void xrdp_cache_delete(struct xrdp_cache* self);
|
||||
int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap);
|
||||
int xrdp_cache_add_palette(struct xrdp_cache* self, int* palette);
|
||||
int xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
struct xrdp_font_item* font_item);
|
||||
int xrdp_cache_add_pointer(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item);
|
||||
int xrdp_cache_add_pointer_static(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item,
|
||||
int index);
|
||||
struct xrdp_cache* APP_CC
|
||||
xrdp_cache_create(struct xrdp_wm* owner, struct xrdp_session* session,
|
||||
struct xrdp_client_info* client_info);
|
||||
void APP_CC
|
||||
xrdp_cache_delete(struct xrdp_cache* self);
|
||||
int APP_CC
|
||||
xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap);
|
||||
int APP_CC
|
||||
xrdp_cache_add_palette(struct xrdp_cache* self, int* palette);
|
||||
int APP_CC
|
||||
xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
struct xrdp_font_char* font_item);
|
||||
int APP_CC
|
||||
xrdp_cache_add_pointer(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item);
|
||||
int APP_CC
|
||||
xrdp_cache_add_pointer_static(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item,
|
||||
int index);
|
||||
|
||||
/* xrdp_wm.c */
|
||||
struct xrdp_wm* xrdp_wm_create(struct xrdp_process* owner,
|
||||
struct xrdp_client_info* client_info);
|
||||
void xrdp_wm_delete(struct xrdp_wm* self);
|
||||
int xrdp_wm_send_palette(struct xrdp_wm* self);
|
||||
int xrdp_wm_init(struct xrdp_wm* self);
|
||||
int xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx);
|
||||
int xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd);
|
||||
int xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy,
|
||||
struct xrdp_region* region, int clip_children);
|
||||
int xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y);
|
||||
int xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down);
|
||||
int xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code);
|
||||
int xrdp_wm_key_sync(struct xrdp_wm* self, int device_flags, int key_flags);
|
||||
int xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control);
|
||||
int xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
|
||||
char* data, char* mask, int x, int y);
|
||||
int xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y);
|
||||
struct xrdp_wm* APP_CC
|
||||
xrdp_wm_create(struct xrdp_process* owner,
|
||||
struct xrdp_client_info* client_info);
|
||||
void APP_CC
|
||||
xrdp_wm_delete(struct xrdp_wm* self);
|
||||
int APP_CC
|
||||
xrdp_wm_send_palette(struct xrdp_wm* self);
|
||||
int APP_CC
|
||||
xrdp_wm_init(struct xrdp_wm* self);
|
||||
int APP_CC
|
||||
xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx);
|
||||
int APP_CC
|
||||
xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd);
|
||||
int APP_CC
|
||||
xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy,
|
||||
struct xrdp_region* region, int clip_children);
|
||||
int APP_CC
|
||||
xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y);
|
||||
int APP_CC
|
||||
xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down);
|
||||
int APP_CC
|
||||
xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code);
|
||||
int APP_CC
|
||||
xrdp_wm_key_sync(struct xrdp_wm* self, int device_flags, int key_flags);
|
||||
int APP_CC
|
||||
xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control);
|
||||
int APP_CC
|
||||
xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
|
||||
char* data, char* mask, int x, int y);
|
||||
int APP_CC
|
||||
xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y);
|
||||
int
|
||||
callback(long id, int msg, long param1, long param2, long param3, long param4);
|
||||
|
||||
/* xrdp_process.c */
|
||||
struct xrdp_process* xrdp_process_create(struct xrdp_listen* owner);
|
||||
void xrdp_process_delete(struct xrdp_process* self);
|
||||
int xrdp_process_loop(struct xrdp_process* self, struct stream* s);
|
||||
int xrdp_process_main_loop(struct xrdp_process* self);
|
||||
struct xrdp_process* APP_CC
|
||||
xrdp_process_create(struct xrdp_listen* owner);
|
||||
void APP_CC
|
||||
xrdp_process_delete(struct xrdp_process* self);
|
||||
int APP_CC
|
||||
xrdp_process_loop(struct xrdp_process* self);
|
||||
int APP_CC
|
||||
xrdp_process_main_loop(struct xrdp_process* self);
|
||||
|
||||
/* xrdp_listen.c */
|
||||
struct xrdp_listen* xrdp_listen_create(void);
|
||||
void xrdp_listen_delete(struct xrdp_listen* self);
|
||||
int xrdp_listen_delete_pro(struct xrdp_listen* self, struct xrdp_process* pro);
|
||||
int xrdp_listen_main_loop(struct xrdp_listen* self);
|
||||
struct xrdp_listen* APP_CC
|
||||
xrdp_listen_create(void);
|
||||
void APP_CC
|
||||
xrdp_listen_delete(struct xrdp_listen* self);
|
||||
int APP_CC
|
||||
xrdp_listen_delete_pro(struct xrdp_listen* self, struct xrdp_process* pro);
|
||||
int APP_CC
|
||||
xrdp_listen_main_loop(struct xrdp_listen* self);
|
||||
|
||||
/* xrdp_region.c */
|
||||
struct xrdp_region* xrdp_region_create(struct xrdp_wm* wm);
|
||||
void xrdp_region_delete(struct xrdp_region* self);
|
||||
int xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect);
|
||||
int xrdp_region_insert_rect(struct xrdp_region* self, int i, int left,
|
||||
int top, int right, int bottom);
|
||||
int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
struct xrdp_rect* rect);
|
||||
int xrdp_region_get_rect(struct xrdp_region* self, int index,
|
||||
struct xrdp_rect* rect);
|
||||
struct xrdp_region* APP_CC
|
||||
xrdp_region_create(struct xrdp_wm* wm);
|
||||
void APP_CC
|
||||
xrdp_region_delete(struct xrdp_region* self);
|
||||
int APP_CC
|
||||
xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect);
|
||||
int APP_CC
|
||||
xrdp_region_insert_rect(struct xrdp_region* self, int i, int left,
|
||||
int top, int right, int bottom);
|
||||
int APP_CC
|
||||
xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
struct xrdp_rect* rect);
|
||||
int APP_CC
|
||||
xrdp_region_get_rect(struct xrdp_region* self, int index,
|
||||
struct xrdp_rect* rect);
|
||||
|
||||
/* xrdp_bitmap.c */
|
||||
struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
|
||||
int type, struct xrdp_wm* wm);
|
||||
struct xrdp_bitmap* xrdp_bitmap_create_with_data(int width, int height,
|
||||
int bpp, char* data,
|
||||
struct xrdp_wm* wm);
|
||||
void xrdp_bitmap_delete(struct xrdp_bitmap* self);
|
||||
struct xrdp_bitmap* xrdp_bitmap_get_child_by_id(struct xrdp_bitmap* self,
|
||||
int id);
|
||||
int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused);
|
||||
int xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette);
|
||||
int xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y);
|
||||
int xrdp_bitmap_set_pixel(struct xrdp_bitmap* self, int x, int y, int pixel);
|
||||
int xrdp_bitmap_copy_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_bitmap_compare(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b);
|
||||
int xrdp_bitmap_compare_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b);
|
||||
int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect);
|
||||
int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
int param1, int param2);
|
||||
int xrdp_bitmap_to_screenx(struct xrdp_bitmap* self, int x);
|
||||
int xrdp_bitmap_to_screeny(struct xrdp_bitmap* self, int y);
|
||||
int xrdp_bitmap_from_screenx(struct xrdp_bitmap* self, int x);
|
||||
int xrdp_bitmap_from_screeny(struct xrdp_bitmap* self, int y);
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_create(int width, int height, int bpp,
|
||||
int type, struct xrdp_wm* wm);
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_create_with_data(int width, int height,
|
||||
int bpp, char* data,
|
||||
struct xrdp_wm* wm);
|
||||
void APP_CC
|
||||
xrdp_bitmap_delete(struct xrdp_bitmap* self);
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_get_child_by_id(struct xrdp_bitmap* self, int id);
|
||||
int APP_CC
|
||||
xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused);
|
||||
int APP_CC
|
||||
xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette);
|
||||
int APP_CC
|
||||
xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y);
|
||||
int APP_CC
|
||||
xrdp_bitmap_set_pixel(struct xrdp_bitmap* self, int x, int y, int pixel);
|
||||
int APP_CC
|
||||
xrdp_bitmap_copy_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_bitmap_compare(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b);
|
||||
int APP_CC
|
||||
xrdp_bitmap_compare_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b);
|
||||
int APP_CC
|
||||
xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect);
|
||||
int APP_CC
|
||||
xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
int param1, int param2);
|
||||
int APP_CC
|
||||
xrdp_bitmap_to_screenx(struct xrdp_bitmap* self, int x);
|
||||
int APP_CC
|
||||
xrdp_bitmap_to_screeny(struct xrdp_bitmap* self, int y);
|
||||
int APP_CC
|
||||
xrdp_bitmap_from_screenx(struct xrdp_bitmap* self, int x);
|
||||
int APP_CC
|
||||
xrdp_bitmap_from_screeny(struct xrdp_bitmap* self, int y);
|
||||
|
||||
/* xrdp_painter.c */
|
||||
struct xrdp_painter* xrdp_painter_create(struct xrdp_wm* wn);
|
||||
void xrdp_painter_delete(struct xrdp_painter* self);
|
||||
int xrdp_painter_begin_update(struct xrdp_painter* self);
|
||||
int xrdp_painter_end_update(struct xrdp_painter* self);
|
||||
int xrdp_painter_font_needed(struct xrdp_painter* self);
|
||||
int xrdp_painter_set_clip(struct xrdp_painter* self,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_painter_clr_clip(struct xrdp_painter* self);
|
||||
int xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
struct xrdp_bitmap* to_draw,
|
||||
int x, int y, int cx, int cy);
|
||||
int xrdp_painter_text_width(struct xrdp_painter* self, char* text);
|
||||
int xrdp_painter_text_height(struct xrdp_painter* self, char* text);
|
||||
int xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, char* text);
|
||||
|
||||
/* xrdp_list.c */
|
||||
struct xrdp_list* xrdp_list_create(void);
|
||||
void xrdp_list_delete(struct xrdp_list* self);
|
||||
void xrdp_list_add_item(struct xrdp_list* self, long item);
|
||||
long xrdp_list_get_item(struct xrdp_list* self, int index);
|
||||
void xrdp_list_clear(struct xrdp_list* self);
|
||||
int xrdp_list_index_of(struct xrdp_list* self, long item);
|
||||
void xrdp_list_remove_item(struct xrdp_list* self, int index);
|
||||
void xrdp_list_insert_item(struct xrdp_list* self, int index, long item);
|
||||
struct xrdp_painter* APP_CC
|
||||
xrdp_painter_create(struct xrdp_wm* wm, struct xrdp_session* session);
|
||||
void APP_CC
|
||||
xrdp_painter_delete(struct xrdp_painter* self);
|
||||
int APP_CC
|
||||
xrdp_painter_begin_update(struct xrdp_painter* self);
|
||||
int APP_CC
|
||||
xrdp_painter_end_update(struct xrdp_painter* self);
|
||||
int APP_CC
|
||||
xrdp_painter_font_needed(struct xrdp_painter* self);
|
||||
int APP_CC
|
||||
xrdp_painter_set_clip(struct xrdp_painter* self,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_painter_clr_clip(struct xrdp_painter* self);
|
||||
int APP_CC
|
||||
xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
struct xrdp_bitmap* to_draw,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_painter_text_width(struct xrdp_painter* self, char* text);
|
||||
int APP_CC
|
||||
xrdp_painter_text_height(struct xrdp_painter* self, char* text);
|
||||
int APP_CC
|
||||
xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, char* text);
|
||||
|
||||
/* xrdp_font.c */
|
||||
struct xrdp_font* xrdp_font_create(struct xrdp_wm* wm);
|
||||
void xrdp_font_delete(struct xrdp_font* self);
|
||||
int xrdp_font_item_compare(struct xrdp_font_item* font1,
|
||||
struct xrdp_font_item* font2);
|
||||
struct xrdp_font* APP_CC
|
||||
xrdp_font_create(struct xrdp_wm* wm);
|
||||
void APP_CC
|
||||
xrdp_font_delete(struct xrdp_font* self);
|
||||
int APP_CC
|
||||
xrdp_font_item_compare(struct xrdp_font_char* font1,
|
||||
struct xrdp_font_char* font2);
|
||||
|
||||
/* funcs.c */
|
||||
int rect_contains_pt(struct xrdp_rect* in, int x, int y);
|
||||
int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
|
||||
struct xrdp_rect* out);
|
||||
int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy);
|
||||
char get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
int caps_lock, int num_lock, int scroll_lock);
|
||||
int add_char_at(char* text, char ch, int index);
|
||||
int remove_char_at(char* text, int index);
|
||||
int set_string(char** in_str, char* in);
|
||||
int APP_CC
|
||||
rect_contains_pt(struct xrdp_rect* in, int x, int y);
|
||||
int APP_CC
|
||||
rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
|
||||
struct xrdp_rect* out);
|
||||
int APP_CC
|
||||
check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy);
|
||||
char APP_CC
|
||||
get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
int caps_lock, int num_lock, int scroll_lock);
|
||||
int APP_CC
|
||||
add_char_at(char* text, char ch, int index);
|
||||
int APP_CC
|
||||
remove_char_at(char* text, int index);
|
||||
int APP_CC
|
||||
set_string(char** in_str, char* in);
|
||||
|
||||
int xrdp_login_wnd_create(struct xrdp_wm* self);
|
||||
|
||||
int xrdp_file_read_sections(int fd, struct xrdp_list* names);
|
||||
int xrdp_file_read_section(int fd, char* section, struct xrdp_list* names,
|
||||
struct xrdp_list* values);
|
||||
int APP_CC
|
||||
xrdp_login_wnd_create(struct xrdp_wm* self);
|
||||
|
||||
/* xrdp_bitmap_compress.c */
|
||||
int xrdp_bitmap_compress(char* in_data, int width, int height,
|
||||
struct stream* s, int bpp, int byte_limit,
|
||||
int start_line, struct stream* temp,
|
||||
int e);
|
||||
int APP_CC
|
||||
xrdp_bitmap_compress(char* in_data, int width, int height,
|
||||
struct stream* s, int bpp, int byte_limit,
|
||||
int start_line, struct stream* temp,
|
||||
int e);
|
||||
|
||||
#ifndef XRDP_LIB
|
||||
/* xrdp_interface.c */
|
||||
int server_begin_update(struct xrdp_mod* mod);
|
||||
int server_end_update(struct xrdp_mod* mod);
|
||||
int server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int color);
|
||||
int server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int srcx, int srcy);
|
||||
int server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
char* data);
|
||||
int server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
||||
char* data, char* mask);
|
||||
int server_palette(struct xrdp_mod* mod, int* palette);
|
||||
int server_msg(struct xrdp_mod* mod, char* msg);
|
||||
int server_is_term(struct xrdp_mod* mod);
|
||||
#endif
|
||||
int
|
||||
server_begin_update(struct xrdp_mod* mod);
|
||||
int
|
||||
server_end_update(struct xrdp_mod* mod);
|
||||
int
|
||||
server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int color);
|
||||
int
|
||||
server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int srcx, int srcy);
|
||||
int
|
||||
server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
char* data);
|
||||
int
|
||||
server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
||||
char* data, char* mask);
|
||||
int
|
||||
server_palette(struct xrdp_mod* mod, int* palette);
|
||||
int
|
||||
server_msg(struct xrdp_mod* mod, char* msg);
|
||||
int
|
||||
server_is_term(struct xrdp_mod* mod);
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
int g_crc_seed = 0xffffffff;
|
||||
int g_crc_table[256] =
|
||||
static int g_crc_seed = 0xffffffff;
|
||||
static int g_crc_table[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
@ -79,8 +79,9 @@ int g_crc_table[256] =
|
||||
#define CRC_END(in_crc) (in_crc) = ((in_crc) ^ g_crc_seed)
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
|
||||
int type, struct xrdp_wm* wm)
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_create(int width, int height, int bpp,
|
||||
int type, struct xrdp_wm* wm)
|
||||
{
|
||||
struct xrdp_bitmap* self;
|
||||
int Bpp;
|
||||
@ -103,14 +104,14 @@ struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
|
||||
}
|
||||
if (self->type != WND_TYPE_BITMAP)
|
||||
{
|
||||
self->child_list = xrdp_list_create();
|
||||
self->child_list = list_create();
|
||||
}
|
||||
self->line_size = width * Bpp;
|
||||
if (self->type == WND_TYPE_COMBO)
|
||||
{
|
||||
self->string_list = xrdp_list_create();
|
||||
self->string_list = list_create();
|
||||
self->string_list->auto_free = 1;
|
||||
self->data_list = xrdp_list_create();
|
||||
self->data_list = list_create();
|
||||
self->data_list->auto_free = 1;
|
||||
}
|
||||
self->wm = wm;
|
||||
@ -118,9 +119,10 @@ struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_bitmap* xrdp_bitmap_create_with_data(int width, int height,
|
||||
int bpp, char* data,
|
||||
struct xrdp_wm* wm)
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_create_with_data(int width, int height,
|
||||
int bpp, char* data,
|
||||
struct xrdp_wm* wm)
|
||||
{
|
||||
struct xrdp_bitmap* self;
|
||||
|
||||
@ -136,7 +138,8 @@ struct xrdp_bitmap* xrdp_bitmap_create_with_data(int width, int height,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_bitmap_delete(struct xrdp_bitmap* self)
|
||||
void APP_CC
|
||||
xrdp_bitmap_delete(struct xrdp_bitmap* self)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_mod_data* mod_data;
|
||||
@ -185,32 +188,32 @@ void xrdp_bitmap_delete(struct xrdp_bitmap* self)
|
||||
{
|
||||
xrdp_bitmap_delete((struct xrdp_bitmap*)self->child_list->items[i]);
|
||||
}
|
||||
xrdp_list_delete(self->child_list);
|
||||
list_delete(self->child_list);
|
||||
}
|
||||
if (self->parent != 0)
|
||||
{
|
||||
i = xrdp_list_index_of(self->parent->child_list, (long)self);
|
||||
i = list_index_of(self->parent->child_list, (long)self);
|
||||
if (i >= 0)
|
||||
{
|
||||
xrdp_list_remove_item(self->parent->child_list, i);
|
||||
list_remove_item(self->parent->child_list, i);
|
||||
}
|
||||
}
|
||||
if (self->string_list != 0) /* for combo */
|
||||
{
|
||||
xrdp_list_delete(self->string_list);
|
||||
list_delete(self->string_list);
|
||||
}
|
||||
if (self->data_list != 0) /* for combo */
|
||||
{
|
||||
for (i = 0; i < self->data_list->count; i++)
|
||||
{
|
||||
mod_data = (struct xrdp_mod_data*)xrdp_list_get_item(self->data_list, i);
|
||||
mod_data = (struct xrdp_mod_data*)list_get_item(self->data_list, i);
|
||||
if (mod_data != 0)
|
||||
{
|
||||
xrdp_list_delete(mod_data->names);
|
||||
xrdp_list_delete(mod_data->values);
|
||||
list_delete(mod_data->names);
|
||||
list_delete(mod_data->values);
|
||||
}
|
||||
}
|
||||
xrdp_list_delete(self->data_list);
|
||||
list_delete(self->data_list);
|
||||
}
|
||||
if (!self->do_not_free_data)
|
||||
{
|
||||
@ -221,15 +224,15 @@ void xrdp_bitmap_delete(struct xrdp_bitmap* self)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_bitmap* xrdp_bitmap_get_child_by_id(struct xrdp_bitmap* self,
|
||||
int id)
|
||||
struct xrdp_bitmap* APP_CC
|
||||
xrdp_bitmap_get_child_by_id(struct xrdp_bitmap* self, int id)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_bitmap* b;
|
||||
|
||||
for (i = 0; i < self->child_list->count; i++)
|
||||
{
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
||||
if (b->id == id)
|
||||
{
|
||||
return b;
|
||||
@ -241,7 +244,8 @@ struct xrdp_bitmap* xrdp_bitmap_get_child_by_id(struct xrdp_bitmap* self,
|
||||
/*****************************************************************************/
|
||||
/* if focused is true focus this window else unfocus it */
|
||||
/* returns error */
|
||||
int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
|
||||
int APP_CC
|
||||
xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
|
||||
{
|
||||
struct xrdp_painter* painter;
|
||||
|
||||
@ -253,7 +257,7 @@ int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
painter = xrdp_painter_create(self->wm);
|
||||
painter = xrdp_painter_create(self->wm, self->wm->session);
|
||||
xrdp_painter_font_needed(painter);
|
||||
xrdp_painter_begin_update(painter);
|
||||
if (focused)
|
||||
@ -277,7 +281,8 @@ int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_bitmap_get_index(struct xrdp_bitmap* self, int* palette, int color)
|
||||
int APP_CC
|
||||
xrdp_bitmap_get_index(struct xrdp_bitmap* self, int* palette, int color)
|
||||
{
|
||||
int r;
|
||||
int g;
|
||||
@ -293,7 +298,8 @@ int xrdp_bitmap_get_index(struct xrdp_bitmap* self, int* palette, int color)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height)
|
||||
int APP_CC
|
||||
xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height)
|
||||
{
|
||||
int Bpp;
|
||||
|
||||
@ -316,7 +322,8 @@ int xrdp_bitmap_resize(struct xrdp_bitmap* self, int width, int height)
|
||||
/* load a bmp file */
|
||||
/* return 0 ok */
|
||||
/* return 1 error */
|
||||
int xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette)
|
||||
int APP_CC
|
||||
xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette)
|
||||
{
|
||||
int fd;
|
||||
int i;
|
||||
@ -409,7 +416,8 @@ int xrdp_bitmap_load(struct xrdp_bitmap* self, char* filename, int* palette)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y)
|
||||
int APP_CC
|
||||
xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -438,7 +446,8 @@ int xrdp_bitmap_get_pixel(struct xrdp_bitmap* self, int x, int y)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_bitmap_set_pixel(struct xrdp_bitmap* self, int x, int y, int pixel)
|
||||
int APP_CC
|
||||
xrdp_bitmap_set_pixel(struct xrdp_bitmap* self, int x, int y, int pixel)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -469,9 +478,10 @@ int xrdp_bitmap_set_pixel(struct xrdp_bitmap* self, int x, int y, int pixel)
|
||||
/*****************************************************************************/
|
||||
/* copy part of self at x, y to 0, 0 in dest */
|
||||
/* returns error */
|
||||
int xrdp_bitmap_copy_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_bitmap_copy_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -552,9 +562,10 @@ int xrdp_bitmap_copy_box(struct xrdp_bitmap* self,
|
||||
/*****************************************************************************/
|
||||
/* copy part of self at x, y to 0, 0 in dest */
|
||||
/* returns error */
|
||||
int xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* dest,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -667,8 +678,9 @@ int xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap* self,
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns true if they are the same, else returns false */
|
||||
int xrdp_bitmap_compare(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b)
|
||||
int APP_CC
|
||||
xrdp_bitmap_compare(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -699,8 +711,9 @@ int xrdp_bitmap_compare(struct xrdp_bitmap* self,
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns true if they are the same, else returns false */
|
||||
int xrdp_bitmap_compare_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b)
|
||||
int APP_CC
|
||||
xrdp_bitmap_compare_with_crc(struct xrdp_bitmap* self,
|
||||
struct xrdp_bitmap* b)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -730,9 +743,10 @@ int xrdp_bitmap_compare_with_crc(struct xrdp_bitmap* self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_bitmap_draw_focus_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_painter* painter,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_bitmap_draw_focus_box(struct xrdp_bitmap* self,
|
||||
struct xrdp_painter* painter,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
painter->rop = 0xf0;
|
||||
xrdp_painter_begin_update(painter);
|
||||
@ -765,10 +779,11 @@ int xrdp_bitmap_draw_focus_box(struct xrdp_bitmap* self,
|
||||
|
||||
/*****************************************************************************/
|
||||
/* x and y are in relation to self for 0, 0 is the top left of the control */
|
||||
int xrdp_bitmap_draw_button(struct xrdp_bitmap* self,
|
||||
struct xrdp_painter* painter,
|
||||
int x, int y, int w, int h,
|
||||
int down)
|
||||
int APP_CC
|
||||
xrdp_bitmap_draw_button(struct xrdp_bitmap* self,
|
||||
struct xrdp_painter* painter,
|
||||
int x, int y, int w, int h,
|
||||
int down)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -830,7 +845,8 @@ int xrdp_bitmap_draw_button(struct xrdp_bitmap* self,
|
||||
/*****************************************************************************/
|
||||
/* nil for rect means the whole thing */
|
||||
/* returns error */
|
||||
int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
int APP_CC
|
||||
xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
{
|
||||
int i;
|
||||
int w;
|
||||
@ -852,7 +868,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
painter = xrdp_painter_create(self->wm);
|
||||
painter = xrdp_painter_create(self->wm, self->wm->session);
|
||||
xrdp_painter_font_needed(painter);
|
||||
painter->rop = 0xcc; /* copy */
|
||||
if (rect == 0)
|
||||
@ -928,7 +944,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
if (check_bounds(self->wm->screen, &x, &y, &w, &h))
|
||||
{
|
||||
self->wm->mod->mod_event(self->wm->mod, WM_INVALIDATE,
|
||||
MAKELONG(x, y), MAKELONG(w, h));
|
||||
MAKELONG(x, y), MAKELONG(w, h), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1080,7 +1096,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
else
|
||||
painter->font->color = self->wm->black;
|
||||
xrdp_painter_draw_text(painter, self, 4, 2,
|
||||
(char*)xrdp_list_get_item(self->string_list, self->item_index));
|
||||
(char*)list_get_item(self->string_list, self->item_index));
|
||||
/* draw button on right */
|
||||
x = self->width - 20;
|
||||
y = 2;
|
||||
@ -1101,7 +1117,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
y = 0;
|
||||
for (i = 0; i < self->popped_from->string_list->count; i++)
|
||||
{
|
||||
p = (char*)xrdp_list_get_item(self->popped_from->string_list, i);
|
||||
p = (char*)list_get_item(self->popped_from->string_list, i);
|
||||
h = xrdp_painter_text_height(painter, p);
|
||||
self->item_height = h;
|
||||
if (i == self->item_index)
|
||||
@ -1123,7 +1139,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
/* draw any child windows in the area */
|
||||
for (i = 0; i < self->child_list->count; i++)
|
||||
{
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
||||
if (rect == 0)
|
||||
xrdp_bitmap_invalidate(b, 0);
|
||||
else
|
||||
@ -1143,8 +1159,9 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
int param1, int param2)
|
||||
int APP_CC
|
||||
xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
int param1, int param2)
|
||||
{
|
||||
char c;
|
||||
int n;
|
||||
@ -1175,7 +1192,7 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
i = -1;
|
||||
if (self->child_list != 0)
|
||||
{
|
||||
i = xrdp_list_index_of(self->child_list, (long)self->focused_control);
|
||||
i = list_index_of(self->child_list, (long)self->focused_control);
|
||||
}
|
||||
if (shift)
|
||||
{
|
||||
@ -1194,7 +1211,7 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
}
|
||||
}
|
||||
n = self->child_list->count;
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
||||
while (b != self->focused_control && b != 0 && n > 0)
|
||||
{
|
||||
n--;
|
||||
@ -1222,7 +1239,7 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->child_list, i);
|
||||
}
|
||||
}
|
||||
else if (scan_code == 28) /* enter */
|
||||
@ -1417,7 +1434,8 @@ int xrdp_bitmap_def_proc(struct xrdp_bitmap* self, int msg,
|
||||
|
||||
/*****************************************************************************/
|
||||
/* convert the controls coords to screen coords */
|
||||
int xrdp_bitmap_to_screenx(struct xrdp_bitmap* self, int x)
|
||||
int APP_CC
|
||||
xrdp_bitmap_to_screenx(struct xrdp_bitmap* self, int x)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1432,7 +1450,8 @@ int xrdp_bitmap_to_screenx(struct xrdp_bitmap* self, int x)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* convert the controls coords to screen coords */
|
||||
int xrdp_bitmap_to_screeny(struct xrdp_bitmap* self, int y)
|
||||
int APP_CC
|
||||
xrdp_bitmap_to_screeny(struct xrdp_bitmap* self, int y)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1447,7 +1466,8 @@ int xrdp_bitmap_to_screeny(struct xrdp_bitmap* self, int y)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* convert the screen coords to controls coords */
|
||||
int xrdp_bitmap_from_screenx(struct xrdp_bitmap* self, int x)
|
||||
int APP_CC
|
||||
xrdp_bitmap_from_screenx(struct xrdp_bitmap* self, int x)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1462,7 +1482,8 @@ int xrdp_bitmap_from_screenx(struct xrdp_bitmap* self, int x)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* convert the screen coords to controls coords */
|
||||
int xrdp_bitmap_from_screeny(struct xrdp_bitmap* self, int y)
|
||||
int APP_CC
|
||||
xrdp_bitmap_from_screeny(struct xrdp_bitmap* self, int y)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,15 +23,16 @@
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_cache* xrdp_cache_create(struct xrdp_wm* owner,
|
||||
struct xrdp_orders* orders,
|
||||
struct xrdp_client_info* client_info)
|
||||
struct xrdp_cache* APP_CC
|
||||
xrdp_cache_create(struct xrdp_wm* owner,
|
||||
struct xrdp_session* session,
|
||||
struct xrdp_client_info* client_info)
|
||||
{
|
||||
struct xrdp_cache* self;
|
||||
|
||||
self = (struct xrdp_cache*)g_malloc(sizeof(struct xrdp_cache), 1);
|
||||
self->wm = owner;
|
||||
self->orders = orders;
|
||||
self->session = session;
|
||||
self->use_bitmap_comp = client_info->use_bitmap_comp;
|
||||
self->cache1_entries = client_info->cache1_entries;
|
||||
self->cache1_size = client_info->cache1_size;
|
||||
@ -44,7 +45,8 @@ struct xrdp_cache* xrdp_cache_create(struct xrdp_wm* owner,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_cache_delete(struct xrdp_cache* self)
|
||||
void APP_CC
|
||||
xrdp_cache_delete(struct xrdp_cache* self)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -74,7 +76,8 @@ void xrdp_cache_delete(struct xrdp_cache* self)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns cache id */
|
||||
int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
|
||||
int APP_CC
|
||||
xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -205,11 +208,15 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
|
||||
self->bitmap_items[cache_id][cache_idx].stamp = self->bitmap_stamp;
|
||||
if (self->use_bitmap_comp)
|
||||
{
|
||||
xrdp_orders_send_bitmap(self->orders, bitmap, cache_id, cache_idx);
|
||||
libxrdp_orders_send_bitmap(self->session, bitmap->width,
|
||||
bitmap->height, bitmap->bpp,
|
||||
bitmap->data, cache_id, cache_idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_orders_send_raw_bitmap(self->orders, bitmap, cache_id, cache_idx);
|
||||
libxrdp_orders_send_raw_bitmap(self->session, bitmap->width,
|
||||
bitmap->height, bitmap->bpp,
|
||||
bitmap->data, cache_id, cache_idx);
|
||||
}
|
||||
return MAKELONG(cache_id, cache_idx);
|
||||
}
|
||||
@ -217,7 +224,8 @@ int xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap)
|
||||
/*****************************************************************************/
|
||||
/* not used */
|
||||
/* not sure how to use a palette in rdp */
|
||||
int xrdp_cache_add_palette(struct xrdp_cache* self, int* palette)
|
||||
int APP_CC
|
||||
xrdp_cache_add_palette(struct xrdp_cache* self, int* palette)
|
||||
{
|
||||
int i;
|
||||
int oldest;
|
||||
@ -260,13 +268,14 @@ int xrdp_cache_add_palette(struct xrdp_cache* self, int* palette)
|
||||
/* set, send palette and return */
|
||||
g_memcpy(self->palette_items[index].palette, palette, 256 * sizeof(int));
|
||||
self->palette_items[index].stamp = self->palette_stamp;
|
||||
xrdp_orders_send_palette(self->orders, palette, index);
|
||||
libxrdp_orders_send_palette(self->session, palette, index);
|
||||
return index;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
struct xrdp_font_item* font_item)
|
||||
int APP_CC
|
||||
xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
struct xrdp_font_char* font_item)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -274,7 +283,7 @@ int xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
int f;
|
||||
int c;
|
||||
int datasize;
|
||||
struct xrdp_font_item* fi;
|
||||
struct xrdp_font_char* fi;
|
||||
|
||||
self->char_stamp++;
|
||||
/* look for match */
|
||||
@ -318,7 +327,7 @@ int xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
fi->width = font_item->width;
|
||||
fi->height = font_item->height;
|
||||
self->char_items[f][c].stamp = self->char_stamp;
|
||||
xrdp_orders_send_font(self->orders, fi, f, c);
|
||||
libxrdp_orders_send_font(self->session, fi, f, c);
|
||||
return MAKELONG(f, c);
|
||||
}
|
||||
|
||||
@ -327,8 +336,9 @@ int xrdp_cache_add_char(struct xrdp_cache* self,
|
||||
client if it finds it
|
||||
returns the index in the cache
|
||||
does not take ownership of pointer_item */
|
||||
int xrdp_cache_add_pointer(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item)
|
||||
int APP_CC
|
||||
xrdp_cache_add_pointer(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item)
|
||||
{
|
||||
int i;
|
||||
int oldest;
|
||||
@ -385,9 +395,10 @@ int xrdp_cache_add_pointer(struct xrdp_cache* self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_cache_add_pointer_static(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item,
|
||||
int index)
|
||||
int APP_CC
|
||||
xrdp_cache_add_pointer_static(struct xrdp_cache* self,
|
||||
struct xrdp_pointer_item* pointer_item,
|
||||
int index)
|
||||
{
|
||||
|
||||
if (self == 0)
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
main define/macro file
|
||||
|
||||
*/
|
||||
|
||||
/* check for debug */
|
||||
#ifdef XRDP_DEBUG
|
||||
#define DEBUG(args) g_printf args;
|
||||
#else
|
||||
#define DEBUG(args)
|
||||
#endif
|
||||
/* other macros */
|
||||
#define MIN(x1, x2) ((x1) < (x2) ? (x1) : (x2))
|
||||
#define MAX(x1, x2) ((x1) > (x2) ? (x1) : (x2))
|
||||
#define HIWORD(in) (((in) & 0xffff0000) >> 16)
|
||||
#define LOWORD(in) ((in) & 0x0000ffff)
|
||||
#define MAKELONG(hi, lo) ((((hi) & 0xffff) << 16) | ((lo) & 0xffff))
|
||||
#define MAKERECT(r, x, y, cx, cy) \
|
||||
{ (r).left = x; (r).top = y; (r).right = (x) + (cx); (r).bottom = (y) + (cy); }
|
||||
#define ISRECTEMPTY(r) (((r).right <= (r).left) || ((r).bottom <= (r).top))
|
||||
#define RECTOFFSET(r, dx, dy) \
|
||||
{ (r).left += dx; (r).top += dy; (r).right += dx; (r).bottom += dy; }
|
||||
#define GETPIXEL8(d, x, y, w) (*(((unsigned char*)d) + ((y) * (w) + (x))))
|
||||
#define GETPIXEL16(d, x, y, w) (*(((unsigned short*)d) + ((y) * (w) + (x))))
|
||||
#define GETPIXEL32(d, x, y, w) (*(((unsigned long*)d) + ((y) * (w) + (x))))
|
||||
#define SETPIXEL8(d, x, y, w, v) \
|
||||
(*(((unsigned char*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define SETPIXEL16(d, x, y, w, v) \
|
||||
(*(((unsigned short*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define SETPIXEL32(d, x, y, w, v) \
|
||||
(*(((unsigned long*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define COLOR8(r, g, b) \
|
||||
( \
|
||||
(((r) >> 5) << 0) | \
|
||||
(((g) >> 5) << 3) | \
|
||||
(((b) >> 6) << 6) \
|
||||
)
|
||||
#define COLOR15(r, g, b) ((((r) >> 3) << 10) | (((g) >> 3) << 5) | ((b) >> 3))
|
||||
#define COLOR16(r, g, b) ((((r) >> 3) << 11) | (((g) >> 2) << 5) | ((b) >> 3))
|
||||
#define COLOR24(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
|
||||
/* font macros */
|
||||
#define FONT_DATASIZE(f) ((((f)->height * (((f)->width + 7) / 8)) + 3) & ~3);
|
||||
/* use crc for bitmap cache lookups */
|
||||
#define USE_CRC
|
201
xrdp/xrdp_file.c
201
xrdp/xrdp_file.c
@ -1,201 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
read a config file
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_file_read_sections(int fd, struct xrdp_list* names)
|
||||
{
|
||||
struct stream* s;
|
||||
char text[256];
|
||||
char c;
|
||||
int in_it;
|
||||
int in_it_index;
|
||||
int len;
|
||||
int index;
|
||||
|
||||
g_file_seek(fd, 0);
|
||||
in_it_index = 0;
|
||||
in_it = 0;
|
||||
g_memset(text, 0, 256);
|
||||
xrdp_list_clear(names);
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
len = g_file_read(fd, s->data, 8192);
|
||||
if (len > 0)
|
||||
{
|
||||
s->end = s->p + len;
|
||||
for (index = 0; index < len; index++)
|
||||
{
|
||||
in_uint8(s, c);
|
||||
if (c == '[')
|
||||
in_it = 1;
|
||||
else if (c == ']')
|
||||
{
|
||||
xrdp_list_add_item(names, (long)g_strdup(text));
|
||||
in_it = 0;
|
||||
in_it_index = 0;
|
||||
g_memset(text, 0, 256);
|
||||
}
|
||||
else if (in_it)
|
||||
{
|
||||
text[in_it_index] = c;
|
||||
in_it_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_file_read_line(struct stream* s, char* text)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
char* hold;
|
||||
|
||||
if (!s_check(s))
|
||||
return 1;
|
||||
hold = s->p;
|
||||
i = 0;
|
||||
in_uint8(s, c);
|
||||
while (c != 10 && c != 13 && s_check(s))
|
||||
{
|
||||
text[i] = c;
|
||||
i++;
|
||||
in_uint8(s, c);
|
||||
}
|
||||
if (c == 10 || c == 13)
|
||||
{
|
||||
while ((c == 10 || c == 13) && s_check(s))
|
||||
{
|
||||
in_uint8(s, c);
|
||||
}
|
||||
s->p--;
|
||||
}
|
||||
text[i] = 0;
|
||||
if (text[0] == '[')
|
||||
{
|
||||
s->p = hold;
|
||||
return 1;
|
||||
}
|
||||
if (g_strlen(text) > 0)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_file_split_name_value(char* text, char* name, char* value)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
int value_index;
|
||||
int name_index;
|
||||
int on_to;
|
||||
|
||||
value_index = 0;
|
||||
name_index = 0;
|
||||
on_to = 0;
|
||||
name[0] = 0;
|
||||
value[0] = 0;
|
||||
len = g_strlen(text);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (text[i] == '=')
|
||||
on_to = 1;
|
||||
else if (on_to)
|
||||
{
|
||||
value[value_index] = text[i];
|
||||
value_index++;
|
||||
value[value_index] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
name[name_index] = text[i];
|
||||
name_index++;
|
||||
name[name_index] = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_file_read_section(int fd, char* section, struct xrdp_list* names,
|
||||
struct xrdp_list* values)
|
||||
{
|
||||
struct stream* s;
|
||||
char text[256];
|
||||
char name[256];
|
||||
char value[256];
|
||||
char c;
|
||||
int in_it;
|
||||
int in_it_index;
|
||||
int len;
|
||||
int index;
|
||||
|
||||
g_file_seek(fd, 0);
|
||||
in_it_index = 0;
|
||||
in_it = 0;
|
||||
g_memset(text, 0, 256);
|
||||
xrdp_list_clear(names);
|
||||
xrdp_list_clear(values);
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
len = g_file_read(fd, s->data, 8192);
|
||||
if (len > 0)
|
||||
{
|
||||
s->end = s->p + len;
|
||||
for (index = 0; index < len; index++)
|
||||
{
|
||||
in_uint8(s, c);
|
||||
if (c == '[')
|
||||
in_it = 1;
|
||||
else if (c == ']')
|
||||
{
|
||||
if (g_strcmp(section, text) == 0)
|
||||
{
|
||||
xrdp_file_read_line(s, text);
|
||||
while (xrdp_file_read_line(s, text) == 0)
|
||||
{
|
||||
xrdp_file_split_name_value(text, name, value);
|
||||
xrdp_list_add_item(names, (long)g_strdup(name));
|
||||
xrdp_list_add_item(values, (long)g_strdup(value));
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
in_it = 0;
|
||||
in_it_index = 0;
|
||||
g_memset(text, 0, 256);
|
||||
}
|
||||
else if (in_it)
|
||||
{
|
||||
text[in_it_index] = c;
|
||||
in_it_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
@ -40,7 +40,8 @@
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
char w_char[] =
|
||||
#if 0 /* not used */
|
||||
static char w_char[] =
|
||||
{
|
||||
0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00,
|
||||
@ -59,10 +60,11 @@ char w_char[] =
|
||||
0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_font* xrdp_font_create(struct xrdp_wm* wm)
|
||||
struct xrdp_font* APP_CC
|
||||
xrdp_font_create(struct xrdp_wm* wm)
|
||||
{
|
||||
struct xrdp_font* self;
|
||||
struct stream* s;
|
||||
@ -71,7 +73,7 @@ struct xrdp_font* xrdp_font_create(struct xrdp_wm* wm)
|
||||
int i;
|
||||
int index;
|
||||
int datasize;
|
||||
struct xrdp_font_item* f;
|
||||
struct xrdp_font_char* f;
|
||||
|
||||
//g_printf("loading font\n");
|
||||
self = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1);
|
||||
@ -131,38 +133,58 @@ struct xrdp_font* xrdp_font_create(struct xrdp_wm* wm)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* free the font and all the items */
|
||||
void xrdp_font_delete(struct xrdp_font* self)
|
||||
void APP_CC
|
||||
xrdp_font_delete(struct xrdp_font* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
g_free(self->font_items[i].data);
|
||||
}
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* compare the two font items returns 1 if they match */
|
||||
int xrdp_font_item_compare(struct xrdp_font_item* font1,
|
||||
struct xrdp_font_item* font2)
|
||||
int APP_CC
|
||||
xrdp_font_item_compare(struct xrdp_font_char* font1,
|
||||
struct xrdp_font_char* font2)
|
||||
{
|
||||
int datasize;
|
||||
|
||||
if (font1 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (font2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (font1->offset != font2->offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (font1->baseline != font2->baseline)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (font1->width != font2->width)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (font1->height != font2->height)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
datasize = FONT_DATASIZE(font1);
|
||||
if (g_memcmp(font1->data, font2->data, datasize) == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,204 +22,12 @@
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
#ifdef XRDP_LIB
|
||||
|
||||
struct xrdp_mod g_mod;
|
||||
struct xrdp_process* g_rdp_process;
|
||||
struct stream* g_s;
|
||||
int (* g_callback)(int, int, int);
|
||||
|
||||
/*****************************************************************************/
|
||||
int mod_event(struct xrdp_mod* v, int msg, int param1, int param2)
|
||||
{
|
||||
if (g_callback != 0)
|
||||
{
|
||||
return g_callback(msg, param1, param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_init(void)
|
||||
{
|
||||
g_init_system();
|
||||
g_memset(&g_mod, 0, sizeof(struct xrdp_mod));
|
||||
g_rdp_process = 0;
|
||||
make_stream(g_s);
|
||||
init_stream(g_s, 8192);
|
||||
g_mod.handle = (long)(&g_mod);
|
||||
g_mod.mod_event = mod_event;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_exit(void)
|
||||
{
|
||||
xrdp_process_delete(g_rdp_process);
|
||||
free_stream(g_s);
|
||||
g_exit_system();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_connect(int sck, int* width, int* height, int* bpp)
|
||||
{
|
||||
g_rdp_process = xrdp_process_create(0);
|
||||
g_rdp_process->sck = sck;
|
||||
if (xrdp_rdp_incoming(g_rdp_process->rdp_layer) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (width != 0)
|
||||
{
|
||||
*width = g_rdp_process->rdp_layer->client_info.width;
|
||||
}
|
||||
if (height != 0)
|
||||
{
|
||||
*height = g_rdp_process->rdp_layer->client_info.height;
|
||||
}
|
||||
if (bpp != 0)
|
||||
{
|
||||
*bpp = g_rdp_process->rdp_layer->client_info.bpp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_loop(int sck)
|
||||
{
|
||||
if (g_rdp_process == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (g_rdp_process->term)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (g_rdp_process->wm != 0)
|
||||
{
|
||||
if (g_rdp_process->wm->mod == 0)
|
||||
{
|
||||
g_rdp_process->wm->mod = &g_mod;
|
||||
}
|
||||
if (g_mod.wm == 0)
|
||||
{
|
||||
g_mod.wm = (long)(g_rdp_process->wm);
|
||||
}
|
||||
}
|
||||
init_stream(g_s, 8192);
|
||||
if (xrdp_process_loop(g_rdp_process, g_s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_set_callback(int (* callback)(int, int, int))
|
||||
{
|
||||
g_callback = callback;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_begin_update(void)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_painter* p;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
p = xrdp_painter_create(wm);
|
||||
xrdp_painter_begin_update(p);
|
||||
g_mod.painter = (long)p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_end_update(void)
|
||||
{
|
||||
struct xrdp_painter* p;
|
||||
|
||||
p = (struct xrdp_painter*)g_mod.painter;
|
||||
xrdp_painter_end_update(p);
|
||||
xrdp_painter_delete(p);
|
||||
g_mod.painter = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_fill_rect(int x, int y, int cx, int cy, int color)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_painter* p;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
p = (struct xrdp_painter*)g_mod.painter;
|
||||
p->fg_color = color;
|
||||
xrdp_painter_fill_rect(p, wm->screen, x, y, cx, cy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_screen_blt(int x, int y, int cx, int cy, int srcx, int srcy)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
xrdp_orders_init(wm->orders);
|
||||
xrdp_orders_screen_blt(wm->orders, x, y, cx, cy, srcx, srcy, 0xcc, 0);
|
||||
xrdp_orders_send(wm->orders);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_paint_rect(int x, int y, int cx, int cy, char* data)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_bitmap* b;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
b = xrdp_bitmap_create_with_data(cx, cy, wm->screen->bpp, data, wm);
|
||||
xrdp_painter_draw_bitmap((struct xrdp_painter*)g_mod.painter,
|
||||
wm->screen, b, x, y, cx, cy);
|
||||
xrdp_bitmap_delete(b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_set_pointer(int x, int y, char* data, char* mask)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
xrdp_wm_pointer(wm, data, mask, x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_palette(int* palette)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)g_mod.wm;
|
||||
if (g_memcmp(wm->palette, palette, 255 * sizeof(int)) != 0)
|
||||
{
|
||||
g_memcpy(wm->palette, palette, 256 * sizeof(int));
|
||||
xrdp_wm_send_palette(wm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*****************************************************************************/
|
||||
/* this is the log windows nofity function */
|
||||
int xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
int
|
||||
xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
{
|
||||
struct xrdp_painter* painter;
|
||||
struct xrdp_wm* wm;
|
||||
@ -262,7 +70,7 @@ int xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
|
||||
painter->font->color = wnd->wm->black;
|
||||
for (index = 0; index < wnd->wm->log->count; index++)
|
||||
{
|
||||
text = (char*)xrdp_list_get_item(wnd->wm->log, index);
|
||||
text = (char*)list_get_item(wnd->wm->log, index);
|
||||
xrdp_painter_draw_text(painter, wnd, 10, 30 + index * 15, text);
|
||||
}
|
||||
}
|
||||
@ -271,20 +79,22 @@ int xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_begin_update(struct xrdp_mod* mod)
|
||||
int
|
||||
server_begin_update(struct xrdp_mod* mod)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_painter* p;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
p = xrdp_painter_create(wm);
|
||||
p = xrdp_painter_create(wm, wm->session);
|
||||
xrdp_painter_begin_update(p);
|
||||
mod->painter = (long)p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_end_update(struct xrdp_mod* mod)
|
||||
int
|
||||
server_end_update(struct xrdp_mod* mod)
|
||||
{
|
||||
struct xrdp_painter* p;
|
||||
|
||||
@ -296,8 +106,9 @@ int server_end_update(struct xrdp_mod* mod)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int color)
|
||||
int
|
||||
server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int color)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_painter* p;
|
||||
@ -310,21 +121,23 @@ int server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int srcx, int srcy)
|
||||
int
|
||||
server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
int srcx, int srcy)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
xrdp_orders_init(wm->orders);
|
||||
xrdp_orders_screen_blt(wm->orders, x, y, cx, cy, srcx, srcy, 0xcc, 0);
|
||||
xrdp_orders_send(wm->orders);
|
||||
libxrdp_orders_init(wm->session);
|
||||
libxrdp_orders_screen_blt(wm->session, x, y, cx, cy, srcx, srcy, 0xcc, 0);
|
||||
libxrdp_orders_send(wm->session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
char* data)
|
||||
int
|
||||
server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
char* data)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_bitmap* b;
|
||||
@ -338,8 +151,9 @@ int server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
||||
char* data, char* mask)
|
||||
int
|
||||
server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
||||
char* data, char* mask)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
@ -349,7 +163,8 @@ int server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_palette(struct xrdp_mod* mod, int* palette)
|
||||
int
|
||||
server_palette(struct xrdp_mod* mod, int* palette)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
@ -363,19 +178,20 @@ int server_palette(struct xrdp_mod* mod, int* palette)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_msg(struct xrdp_mod* mod, char* msg)
|
||||
int
|
||||
server_msg(struct xrdp_mod* mod, char* msg)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_bitmap* but;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
xrdp_list_add_item(wm->log, (long)g_strdup(msg));
|
||||
list_add_item(wm->log, (long)g_strdup(msg));
|
||||
if (wm->log_wnd == 0)
|
||||
{
|
||||
/* log window */
|
||||
wm->log_wnd = xrdp_bitmap_create(400, 400, wm->screen->bpp,
|
||||
WND_TYPE_WND, wm);
|
||||
xrdp_list_add_item(wm->screen->child_list, (long)wm->log_wnd);
|
||||
list_add_item(wm->screen->child_list, (long)wm->log_wnd);
|
||||
wm->log_wnd->parent = wm->screen;
|
||||
wm->log_wnd->owner = wm->screen;
|
||||
wm->log_wnd->bg_color = wm->grey;
|
||||
@ -384,7 +200,7 @@ int server_msg(struct xrdp_mod* mod, char* msg)
|
||||
set_string(&wm->log_wnd->caption1, "Connection Log");
|
||||
/* ok button */
|
||||
but = xrdp_bitmap_create(60, 25, wm->screen->bpp, WND_TYPE_BUTTON, wm);
|
||||
xrdp_list_insert_item(wm->log_wnd->child_list, 0, (long)but);
|
||||
list_insert_item(wm->log_wnd->child_list, 0, (long)but);
|
||||
but->parent = wm->log_wnd;
|
||||
but->owner = wm->log_wnd;
|
||||
but->left = (400 - 60) - 10;
|
||||
@ -401,9 +217,8 @@ int server_msg(struct xrdp_mod* mod, char* msg)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int server_is_term(struct xrdp_mod* mod)
|
||||
int
|
||||
server_is_term(struct xrdp_mod* mod)
|
||||
{
|
||||
return g_is_term();
|
||||
}
|
||||
|
||||
#endif /* XRDP_LIB */
|
||||
|
187
xrdp/xrdp_iso.c
187
xrdp/xrdp_iso.c
@ -1,187 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
iso layer
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_iso* xrdp_iso_create(struct xrdp_mcs* owner, int sck)
|
||||
{
|
||||
struct xrdp_iso* self;
|
||||
|
||||
self = (struct xrdp_iso*)g_malloc(sizeof(struct xrdp_iso), 1);
|
||||
self->mcs_layer = owner;
|
||||
self->tcp_layer = xrdp_tcp_create(self, sck);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_iso_delete(struct xrdp_iso* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
xrdp_tcp_delete(self->tcp_layer);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_iso_recv_msg(struct xrdp_iso* self, struct stream* s, int* code)
|
||||
{
|
||||
int ver;
|
||||
int len;
|
||||
|
||||
*code = 0;
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, 4) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, ver);
|
||||
if (ver != 3)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, 1);
|
||||
in_uint16_be(s, len);
|
||||
if (xrdp_tcp_recv(self->tcp_layer, s, len - 4) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, 1);
|
||||
in_uint8(s, *code);
|
||||
if (*code == ISO_PDU_DT)
|
||||
{
|
||||
in_uint8s(s, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
in_uint8s(s, 5);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_iso_recv(struct xrdp_iso* self, struct stream* s)
|
||||
{
|
||||
int code;
|
||||
|
||||
DEBUG((" in xrdp_iso_recv\n\r"));
|
||||
if (xrdp_iso_recv_msg(self, s, &code) != 0)
|
||||
{
|
||||
DEBUG((" out xrdp_iso_recv xrdp_iso_recv_msg return non zero\n\r"));
|
||||
return 1;
|
||||
}
|
||||
if (code != ISO_PDU_DT)
|
||||
{
|
||||
DEBUG((" out xrdp_iso_recv code != ISO_PDU_DT\n\r"));
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_iso_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_iso_send_msg(struct xrdp_iso* self, struct stream* s, int code)
|
||||
{
|
||||
if (xrdp_tcp_init(self->tcp_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
out_uint8(s, 3);
|
||||
out_uint8(s, 0);
|
||||
out_uint16_be(s, 11); /* length */
|
||||
out_uint8(s, 8);
|
||||
out_uint8(s, code);
|
||||
out_uint16_le(s, 0);
|
||||
out_uint16_le(s, 0);
|
||||
out_uint8(s, 0);
|
||||
s_mark_end(s);
|
||||
if (xrdp_tcp_send(self->tcp_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_iso_incoming(struct xrdp_iso* self)
|
||||
{
|
||||
int code;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
DEBUG((" in xrdp_iso_incoming\n\r"));
|
||||
if (xrdp_iso_recv_msg(self, s, &code) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (code != ISO_PDU_CR)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_iso_send_msg(self, s, ISO_PDU_CC) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_iso_incoming\n\r"));
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_iso_init(struct xrdp_iso* self, struct stream* s)
|
||||
{
|
||||
xrdp_tcp_init(self->tcp_layer, s);
|
||||
s_push_layer(s, iso_hdr, 7);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_iso_send(struct xrdp_iso* self, struct stream* s)
|
||||
{
|
||||
int len;
|
||||
|
||||
DEBUG((" in xrdp_iso_send\n\r"));
|
||||
s_pop_layer(s, iso_hdr);
|
||||
len = s->end - s->p;
|
||||
out_uint8(s, 3);
|
||||
out_uint8(s, 0);
|
||||
out_uint16_be(s, len);
|
||||
out_uint8(s, 2);
|
||||
out_uint8(s, ISO_PDU_DT);
|
||||
out_uint8(s, 0x80);
|
||||
if (xrdp_tcp_send(self->tcp_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_iso_send\n\r"));
|
||||
return 0;
|
||||
}
|
171
xrdp/xrdp_list.c
171
xrdp/xrdp_list.c
@ -1,171 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
simple list
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_list* xrdp_list_create(void)
|
||||
{
|
||||
struct xrdp_list* self;
|
||||
|
||||
self = (struct xrdp_list*)g_malloc(sizeof(struct xrdp_list), 1);
|
||||
self->grow_by = 10;
|
||||
self->alloc_size = 10;
|
||||
self->items = (long*)g_malloc(sizeof(long) * 10, 1);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_list_delete(struct xrdp_list* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (self->auto_free)
|
||||
{
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
g_free((void*)self->items[i]);
|
||||
self->items[i] = 0;
|
||||
}
|
||||
}
|
||||
g_free(self->items);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_list_add_item(struct xrdp_list* self, long item)
|
||||
{
|
||||
long* p;
|
||||
int i;
|
||||
|
||||
if (self->count >= self->alloc_size)
|
||||
{
|
||||
i = self->alloc_size;
|
||||
self->alloc_size += self->grow_by;
|
||||
p = (long*)g_malloc(sizeof(long) * self->alloc_size, 1);
|
||||
g_memcpy(p, self->items, sizeof(long) * i);
|
||||
g_free(self->items);
|
||||
self->items = p;
|
||||
}
|
||||
self->items[self->count] = item;
|
||||
self->count++;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
long xrdp_list_get_item(struct xrdp_list* self, int index)
|
||||
{
|
||||
if (index < 0 || index >= self->count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return self->items[index];
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_list_clear(struct xrdp_list* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (self->auto_free)
|
||||
{
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
g_free((void*)self->items[i]);
|
||||
self->items[i] = 0;
|
||||
}
|
||||
}
|
||||
g_free(self->items);
|
||||
self->count = 0;
|
||||
self->grow_by = 10;
|
||||
self->alloc_size = 10;
|
||||
self->items = (long*)g_malloc(sizeof(long) * 10, 1);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_list_index_of(struct xrdp_list* self, long item)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
if (self->items[i] == item)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_list_remove_item(struct xrdp_list* self, int index)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (index >= 0 && index < self->count)
|
||||
{
|
||||
if (self->auto_free)
|
||||
{
|
||||
g_free((void*)self->items[index]);
|
||||
self->items[index] = 0;
|
||||
}
|
||||
for (i = index; i < (self->count - 1); i++)
|
||||
{
|
||||
self->items[i] = self->items[i + 1];
|
||||
}
|
||||
self->count--;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_list_insert_item(struct xrdp_list* self, int index, long item)
|
||||
{
|
||||
long* p;
|
||||
int i;
|
||||
|
||||
if (index == self->count)
|
||||
{
|
||||
xrdp_list_add_item(self, item);
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < self->count)
|
||||
{
|
||||
self->count++;
|
||||
if (self->count > self->alloc_size)
|
||||
{
|
||||
i = self->alloc_size;
|
||||
self->alloc_size += self->grow_by;
|
||||
p = (long*)g_malloc(sizeof(long) * self->alloc_size, 1);
|
||||
g_memcpy(p, self->items, sizeof(long) * i);
|
||||
g_free(self->items);
|
||||
self->items = p;
|
||||
}
|
||||
for (i = (self->count - 2); i >= index; i--)
|
||||
{
|
||||
self->items[i + 1] = self->items[i];
|
||||
}
|
||||
self->items[index] = item;
|
||||
}
|
||||
}
|
@ -25,7 +25,8 @@
|
||||
static struct xrdp_process* g_process = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_listen* xrdp_listen_create(void)
|
||||
struct xrdp_listen* APP_CC
|
||||
xrdp_listen_create(void)
|
||||
{
|
||||
struct xrdp_listen* self;
|
||||
|
||||
@ -35,13 +36,15 @@ struct xrdp_listen* xrdp_listen_create(void)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_listen_delete(struct xrdp_listen* self)
|
||||
void APP_CC
|
||||
xrdp_listen_delete(struct xrdp_listen* self)
|
||||
{
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_listen_term_processes(struct xrdp_listen* self)
|
||||
int APP_CC
|
||||
xrdp_listen_term_processes(struct xrdp_listen* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -77,7 +80,8 @@ int xrdp_listen_term_processes(struct xrdp_listen* self)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_listen_add_pro(struct xrdp_listen* self)
|
||||
int APP_CC
|
||||
xrdp_listen_add_pro(struct xrdp_listen* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -103,7 +107,8 @@ int xrdp_listen_add_pro(struct xrdp_listen* self)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_listen_delete_pro(struct xrdp_listen* self, struct xrdp_process* pro)
|
||||
int APP_CC
|
||||
xrdp_listen_delete_pro(struct xrdp_listen* self, struct xrdp_process* pro)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -122,7 +127,8 @@ int xrdp_listen_delete_pro(struct xrdp_listen* self, struct xrdp_process* pro)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* i can't get stupid in_val to work, hum using global var for now */
|
||||
THREAD_RV THREAD_CC xrdp_process_run(void* in_val)
|
||||
THREAD_RV THREAD_CC
|
||||
xrdp_process_run(void* in_val)
|
||||
{
|
||||
DEBUG(("process started\n\r"));
|
||||
xrdp_process_main_loop(g_process);
|
||||
@ -132,7 +138,8 @@ THREAD_RV THREAD_CC xrdp_process_run(void* in_val)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* wait for incoming connections */
|
||||
int xrdp_listen_main_loop(struct xrdp_listen* self)
|
||||
int APP_CC
|
||||
xrdp_listen_main_loop(struct xrdp_listen* self)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -24,9 +24,10 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
/* all login help screen events go here */
|
||||
int xrdp_wm_login_help_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
int APP_CC
|
||||
xrdp_wm_login_help_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
{
|
||||
struct xrdp_painter* p;
|
||||
|
||||
@ -78,16 +79,18 @@ logging on.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_popup_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, int param1, int param2)
|
||||
int APP_CC
|
||||
xrdp_wm_popup_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, int param1, int param2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_setup_mod(struct xrdp_wm* self,
|
||||
struct xrdp_mod_data* mod_data)
|
||||
int
|
||||
xrdp_wm_setup_mod(struct xrdp_wm* self,
|
||||
struct xrdp_mod_data* mod_data)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -131,14 +134,15 @@ int xrdp_wm_setup_mod(struct xrdp_wm* self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_delete_all_childs(struct xrdp_wm* self)
|
||||
int APP_CC
|
||||
xrdp_wm_delete_all_childs(struct xrdp_wm* self)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_bitmap* b;
|
||||
|
||||
for (i = self->screen->child_list->count - 1; i >= 0; i--)
|
||||
{
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->screen->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->screen->child_list, i);
|
||||
xrdp_bitmap_delete(b);
|
||||
}
|
||||
xrdp_bitmap_invalidate(self->screen, 0);
|
||||
@ -146,23 +150,25 @@ int xrdp_wm_delete_all_childs(struct xrdp_wm* self)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int set_mod_data_item(struct xrdp_mod_data* mod, char* name, char* value)
|
||||
int APP_CC
|
||||
set_mod_data_item(struct xrdp_mod_data* mod, char* name, char* value)
|
||||
{
|
||||
int index;
|
||||
|
||||
for (index = 0; index < mod->names->count; index++)
|
||||
{
|
||||
if (g_strcmp(name, (char*)xrdp_list_get_item(mod->names, index)) == 0)
|
||||
if (g_strcmp(name, (char*)list_get_item(mod->names, index)) == 0)
|
||||
{
|
||||
xrdp_list_remove_item(mod->values, index);
|
||||
xrdp_list_insert_item(mod->values, index, (long)g_strdup(value));
|
||||
list_remove_item(mod->values, index);
|
||||
list_insert_item(mod->values, index, (long)g_strdup(value));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_help_clicked(struct xrdp_bitmap* wnd)
|
||||
int APP_CC
|
||||
xrdp_wm_help_clicked(struct xrdp_bitmap* wnd)
|
||||
{
|
||||
struct xrdp_bitmap* help;
|
||||
struct xrdp_bitmap* but;
|
||||
@ -170,7 +176,7 @@ int xrdp_wm_help_clicked(struct xrdp_bitmap* wnd)
|
||||
/* create help screen */
|
||||
help = xrdp_bitmap_create(300, 300, wnd->wm->screen->bpp,
|
||||
WND_TYPE_WND, wnd->wm);
|
||||
xrdp_list_insert_item(wnd->wm->screen->child_list, 0, (long)help);
|
||||
list_insert_item(wnd->wm->screen->child_list, 0, (long)help);
|
||||
help->parent = wnd->wm->screen;
|
||||
help->owner = wnd;
|
||||
wnd->modal_dialog = help;
|
||||
@ -182,7 +188,7 @@ int xrdp_wm_help_clicked(struct xrdp_bitmap* wnd)
|
||||
/* ok button */
|
||||
but = xrdp_bitmap_create(60, 25, wnd->wm->screen->bpp,
|
||||
WND_TYPE_BUTTON, wnd->wm);
|
||||
xrdp_list_insert_item(help->child_list, 0, (long)but);
|
||||
list_insert_item(help->child_list, 0, (long)but);
|
||||
but->parent = help;
|
||||
but->owner = help;
|
||||
but->left = 120;
|
||||
@ -200,7 +206,8 @@ int xrdp_wm_help_clicked(struct xrdp_bitmap* wnd)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_cancel_clicked(struct xrdp_bitmap* wnd)
|
||||
int APP_CC
|
||||
xrdp_wm_cancel_clicked(struct xrdp_bitmap* wnd)
|
||||
{
|
||||
if (wnd != 0)
|
||||
{
|
||||
@ -216,14 +223,15 @@ int xrdp_wm_cancel_clicked(struct xrdp_bitmap* wnd)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
int APP_CC
|
||||
xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
{
|
||||
struct xrdp_bitmap* combo;
|
||||
struct xrdp_bitmap* label;
|
||||
struct xrdp_bitmap* edit;
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_list* names;
|
||||
struct xrdp_list* values;
|
||||
struct list* names;
|
||||
struct list* values;
|
||||
struct xrdp_mod_data* mod_data;
|
||||
int i;
|
||||
|
||||
@ -232,7 +240,7 @@ int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
if (combo != 0)
|
||||
{
|
||||
mod_data = (struct xrdp_mod_data*)
|
||||
xrdp_list_get_item(combo->data_list, combo->item_index);
|
||||
list_get_item(combo->data_list, combo->item_index);
|
||||
if (mod_data != 0)
|
||||
{
|
||||
/* get the user typed values */
|
||||
@ -249,19 +257,19 @@ int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
if (xrdp_wm_setup_mod(wm, mod_data) == 0)
|
||||
{
|
||||
/* gota copy these cause dialog gets freed */
|
||||
names = xrdp_list_create();
|
||||
names = list_create();
|
||||
names->auto_free = 1;
|
||||
for (i = 0; i < mod_data->names->count; i++)
|
||||
{
|
||||
xrdp_list_add_item(names,
|
||||
(long)g_strdup((char*)xrdp_list_get_item(mod_data->names, i)));
|
||||
list_add_item(names,
|
||||
(long)g_strdup((char*)list_get_item(mod_data->names, i)));
|
||||
}
|
||||
values = xrdp_list_create();
|
||||
values = list_create();
|
||||
values->auto_free = 1;
|
||||
for (i = 0; i < mod_data->values->count; i++)
|
||||
{
|
||||
xrdp_list_add_item(values,
|
||||
(long)g_strdup((char*)xrdp_list_get_item(mod_data->values, i)));
|
||||
list_add_item(values,
|
||||
(long)g_strdup((char*)list_get_item(mod_data->values, i)));
|
||||
}
|
||||
xrdp_wm_delete_all_childs(wm);
|
||||
if (!wm->pro_layer->term)
|
||||
@ -277,8 +285,8 @@ int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
for (i = 0; i < names->count; i++)
|
||||
{
|
||||
wm->mod->mod_set_param(wm->mod,
|
||||
(char*)xrdp_list_get_item(names, i),
|
||||
(char*)xrdp_list_get_item(values, i));
|
||||
(char*)list_get_item(names, i),
|
||||
(char*)list_get_item(values, i));
|
||||
}
|
||||
if (wm->mod->mod_connect(wm->mod) != 0)
|
||||
{
|
||||
@ -308,8 +316,8 @@ int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
}
|
||||
}
|
||||
}
|
||||
xrdp_list_delete(names);
|
||||
xrdp_list_delete(values);
|
||||
list_delete(names);
|
||||
list_delete(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -317,7 +325,8 @@ int xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
|
||||
int APP_CC
|
||||
xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
|
||||
{
|
||||
int count;
|
||||
int index;
|
||||
@ -335,23 +344,23 @@ int xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
|
||||
xrdp_bitmap_delete(b);
|
||||
}
|
||||
|
||||
insert_index = xrdp_list_index_of(self->login_window->child_list,
|
||||
insert_index = list_index_of(self->login_window->child_list,
|
||||
(long)combo);
|
||||
insert_index++;
|
||||
mod = (struct xrdp_mod_data*)
|
||||
xrdp_list_get_item(combo->data_list, combo->item_index);
|
||||
list_get_item(combo->data_list, combo->item_index);
|
||||
if (mod != 0)
|
||||
{
|
||||
count = 0;
|
||||
for (index = 0; index < mod->names->count; index++)
|
||||
{
|
||||
value = (char*)xrdp_list_get_item(mod->values, index);
|
||||
value = (char*)list_get_item(mod->values, index);
|
||||
if (g_strncmp("ask", value, 3) == 0)
|
||||
{
|
||||
/* label */
|
||||
b = xrdp_bitmap_create(60, 20, self->screen->bpp,
|
||||
WND_TYPE_LABEL, self);
|
||||
xrdp_list_insert_item(self->login_window->child_list, insert_index,
|
||||
list_insert_item(self->login_window->child_list, insert_index,
|
||||
(long)b);
|
||||
insert_index++;
|
||||
b->parent = self->login_window;
|
||||
@ -359,12 +368,12 @@ int xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
|
||||
b->left = 155;
|
||||
b->top = 60 + 25 * count;
|
||||
b->id = 100 + 2 * count;
|
||||
name = (char*)xrdp_list_get_item(mod->names, index);
|
||||
name = (char*)list_get_item(mod->names, index);
|
||||
set_string(&b->caption1, name);
|
||||
/* edit */
|
||||
b = xrdp_bitmap_create(140, 20, self->screen->bpp,
|
||||
WND_TYPE_EDIT, self);
|
||||
xrdp_list_insert_item(self->login_window->child_list, insert_index,
|
||||
list_insert_item(self->login_window->child_list, insert_index,
|
||||
(long)b);
|
||||
insert_index++;
|
||||
b->parent = self->login_window;
|
||||
@ -394,9 +403,10 @@ int xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* all login screen events go here */
|
||||
int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
int APP_CC
|
||||
xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
|
||||
struct xrdp_bitmap* sender,
|
||||
int msg, long param1, long param2)
|
||||
{
|
||||
struct xrdp_bitmap* b;
|
||||
struct xrdp_rect rect;
|
||||
@ -426,12 +436,12 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
|
||||
}
|
||||
else if (msg == 100) /* modal result is done */
|
||||
{
|
||||
i = xrdp_list_index_of(wnd->wm->screen->child_list, (long)sender);
|
||||
i = list_index_of(wnd->wm->screen->child_list, (long)sender);
|
||||
if (i >= 0)
|
||||
{
|
||||
b = (struct xrdp_bitmap*)
|
||||
xrdp_list_get_item(wnd->wm->screen->child_list, i);
|
||||
xrdp_list_remove_item(sender->wm->screen->child_list, i);
|
||||
list_get_item(wnd->wm->screen->child_list, i);
|
||||
list_remove_item(sender->wm->screen->child_list, i);
|
||||
MAKERECT(rect, b->left, b->top, b->width, b->height);
|
||||
xrdp_bitmap_invalidate(wnd->wm->screen, &rect);
|
||||
xrdp_bitmap_delete(sender);
|
||||
@ -448,11 +458,12 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
|
||||
int APP_CC
|
||||
xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
|
||||
{
|
||||
struct xrdp_list* sections;
|
||||
struct xrdp_list* section_names;
|
||||
struct xrdp_list* section_values;
|
||||
struct list* sections;
|
||||
struct list* section_names;
|
||||
struct list* section_values;
|
||||
int fd;
|
||||
int i;
|
||||
int j;
|
||||
@ -461,18 +472,18 @@ int xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
|
||||
char* r;
|
||||
struct xrdp_mod_data* mod_data;
|
||||
|
||||
sections = xrdp_list_create();
|
||||
sections = list_create();
|
||||
sections->auto_free = 1;
|
||||
section_names = xrdp_list_create();
|
||||
section_names = list_create();
|
||||
section_names->auto_free = 1;
|
||||
section_values = xrdp_list_create();
|
||||
section_values = list_create();
|
||||
section_values->auto_free = 1;
|
||||
fd = g_file_open("xrdp.ini");
|
||||
xrdp_file_read_sections(fd, sections);
|
||||
file_read_sections(fd, sections);
|
||||
for (i = 0; i < sections->count; i++)
|
||||
{
|
||||
p = (char*)xrdp_list_get_item(sections, i);
|
||||
xrdp_file_read_section(fd, p, section_names, section_values);
|
||||
p = (char*)list_get_item(sections, i);
|
||||
file_read_section(fd, p, section_names, section_values);
|
||||
if (g_strcmp(p, "globals") == 0)
|
||||
{
|
||||
}
|
||||
@ -480,15 +491,15 @@ int xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
|
||||
{
|
||||
mod_data = (struct xrdp_mod_data*)
|
||||
g_malloc(sizeof(struct xrdp_mod_data), 1);
|
||||
mod_data->names = xrdp_list_create();
|
||||
mod_data->names = list_create();
|
||||
mod_data->names->auto_free = 1;
|
||||
mod_data->values = xrdp_list_create();
|
||||
mod_data->values = list_create();
|
||||
mod_data->values->auto_free = 1;
|
||||
g_strcpy(mod_data->name, p); /* set name in square bracket */
|
||||
for (j = 0; j < section_names->count; j++)
|
||||
{
|
||||
q = (char*)xrdp_list_get_item(section_names, j);
|
||||
r = (char*)xrdp_list_get_item(section_values, j);
|
||||
q = (char*)list_get_item(section_names, j);
|
||||
r = (char*)list_get_item(section_values, j);
|
||||
if (g_strcmp("name", q) == 0)
|
||||
{
|
||||
g_strcpy(mod_data->name, r);
|
||||
@ -499,23 +510,24 @@ int xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_list_add_item(mod_data->names, (long)g_strdup(q));
|
||||
xrdp_list_add_item(mod_data->values, (long)g_strdup(r));
|
||||
list_add_item(mod_data->names, (long)g_strdup(q));
|
||||
list_add_item(mod_data->values, (long)g_strdup(r));
|
||||
}
|
||||
}
|
||||
xrdp_list_add_item(b->string_list, (long)g_strdup(mod_data->name));
|
||||
xrdp_list_add_item(b->data_list, (long)mod_data);
|
||||
list_add_item(b->string_list, (long)g_strdup(mod_data->name));
|
||||
list_add_item(b->data_list, (long)mod_data);
|
||||
}
|
||||
}
|
||||
g_file_close(fd);
|
||||
xrdp_list_delete(sections);
|
||||
xrdp_list_delete(section_names);
|
||||
xrdp_list_delete(section_values);
|
||||
list_delete(sections);
|
||||
list_delete(section_names);
|
||||
list_delete(section_values);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
int APP_CC
|
||||
xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
{
|
||||
struct xrdp_bitmap* but;
|
||||
struct xrdp_bitmap* combo;
|
||||
@ -523,7 +535,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
/* draw login window */
|
||||
self->login_window = xrdp_bitmap_create(400, 200, self->screen->bpp,
|
||||
WND_TYPE_WND, self);
|
||||
xrdp_list_add_item(self->screen->child_list, (long)self->login_window);
|
||||
list_add_item(self->screen->child_list, (long)self->login_window);
|
||||
self->login_window->parent = self->screen;
|
||||
self->login_window->owner = self->screen;
|
||||
self->login_window->bg_color = self->grey;
|
||||
@ -541,7 +553,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
but->owner = self->screen;
|
||||
but->left = self->screen->width - but->width;
|
||||
but->top = self->screen->height - but->height;
|
||||
xrdp_list_add_item(self->screen->child_list, (long)but);
|
||||
list_add_item(self->screen->child_list, (long)but);
|
||||
|
||||
/* image */
|
||||
but = xrdp_bitmap_create(4, 4, self->screen->bpp, WND_TYPE_IMAGE, self);
|
||||
@ -550,11 +562,11 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
but->owner = self->login_window;
|
||||
but->left = 10;
|
||||
but->top = 30;
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)but);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
|
||||
/* label */
|
||||
but = xrdp_bitmap_create(60, 20, self->screen->bpp, WND_TYPE_LABEL, self);
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)but);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
but->left = 155;
|
||||
@ -563,7 +575,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
|
||||
/* combo */
|
||||
combo = xrdp_bitmap_create(140, 20, self->screen->bpp, WND_TYPE_COMBO, self);
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)combo);
|
||||
list_add_item(self->login_window->child_list, (long)combo);
|
||||
combo->parent = self->login_window;
|
||||
combo->owner = self->login_window;
|
||||
combo->left = 220;
|
||||
@ -574,7 +586,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
|
||||
/* button */
|
||||
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)but);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
but->left = 180;
|
||||
@ -586,7 +598,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
|
||||
/* button */
|
||||
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)but);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
but->left = 250;
|
||||
@ -598,7 +610,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
|
||||
|
||||
/* button */
|
||||
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
|
||||
xrdp_list_add_item(self->login_window->child_list, (long)but);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
but->left = 320;
|
||||
|
606
xrdp/xrdp_mcs.c
606
xrdp/xrdp_mcs.c
@ -1,606 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
mcs layer
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_mcs* xrdp_mcs_create(struct xrdp_sec* owner, int sck,
|
||||
struct stream* client_mcs_data,
|
||||
struct stream* server_mcs_data)
|
||||
{
|
||||
struct xrdp_mcs* self;
|
||||
|
||||
self = (struct xrdp_mcs*)g_malloc(sizeof(struct xrdp_mcs), 1);
|
||||
self->sec_layer = owner;
|
||||
self->userid = 1;
|
||||
self->chanid = 1001;
|
||||
self->client_mcs_data = client_mcs_data;
|
||||
self->server_mcs_data = server_mcs_data;
|
||||
self->iso_layer = xrdp_iso_create(self, sck);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_mcs_delete(struct xrdp_mcs* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
xrdp_iso_delete(self->iso_layer);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_send_cjcf(struct xrdp_mcs* self, int chanid)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_init(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8(s, (MCS_CJCF << 2) | 2);
|
||||
out_uint8(s, 0);
|
||||
out_uint16_be(s, self->userid);
|
||||
out_uint16_be(s, chanid);
|
||||
out_uint16_be(s, chanid);
|
||||
s_mark_end(s);
|
||||
if (xrdp_iso_send(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_recv(struct xrdp_mcs* self, struct stream* s, int* chan)
|
||||
{
|
||||
int appid;
|
||||
int opcode;
|
||||
int len;
|
||||
|
||||
DEBUG((" in xrdp_mcs_recv\n\r"));
|
||||
while (1)
|
||||
{
|
||||
if (xrdp_iso_recv(self->iso_layer, s) != 0)
|
||||
{
|
||||
DEBUG((" out xrdp_mcs_recv xrdp_iso_recv returned non zero\n\r"));
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, opcode);
|
||||
appid = opcode >> 2;
|
||||
if (appid == MCS_DPUM)
|
||||
{
|
||||
DEBUG((" out xrdp_mcs_recv appid != MCS_DPUM\n\r"));
|
||||
return 1;
|
||||
}
|
||||
if (appid == MCS_CJRQ)
|
||||
{
|
||||
xrdp_mcs_send_cjcf(self, self->userid + MCS_USERCHANNEL_BASE);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (appid != MCS_SDRQ)
|
||||
{
|
||||
DEBUG((" out xrdp_mcs_recv err got 0x%x need MCS_SDRQ\n\r", appid));
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, 2);
|
||||
in_uint16_be(s, *chan);
|
||||
in_uint8s(s, 1);
|
||||
in_uint8(s, len);
|
||||
if (len & 0x80)
|
||||
{
|
||||
in_uint8s(s, 1);
|
||||
}
|
||||
DEBUG((" out xrdp_mcs_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_ber_parse_header(struct xrdp_mcs* self, struct stream* s,
|
||||
int tag_val, int* len)
|
||||
{
|
||||
int tag;
|
||||
int l;
|
||||
int i;
|
||||
|
||||
if (tag_val > 0xff)
|
||||
{
|
||||
in_uint16_be(s, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
in_uint8(s, tag);
|
||||
}
|
||||
if (tag != tag_val)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, l);
|
||||
if (l & 0x80)
|
||||
{
|
||||
l = l & ~0x80;
|
||||
*len = 0;
|
||||
while (l > 0)
|
||||
{
|
||||
in_uint8(s, i);
|
||||
*len = (*len << 8) | i;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*len = l;
|
||||
}
|
||||
if (s_check(s))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_parse_domain_params(struct xrdp_mcs* self, struct stream* s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (xrdp_mcs_ber_parse_header(self, s, MCS_TAG_DOMAIN_PARAMS, &len) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, len);
|
||||
if (s_check(s))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_recv_connect_initial(struct xrdp_mcs* self)
|
||||
{
|
||||
int len;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_recv(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_ber_parse_header(self, s, MCS_CONNECT_INITIAL, &len) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, len);
|
||||
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, len);
|
||||
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_BOOLEAN, &len) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, len);
|
||||
if (xrdp_mcs_parse_domain_params(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_parse_domain_params(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_parse_domain_params(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
/* make a copy of client mcs data */
|
||||
init_stream(self->client_mcs_data, len);
|
||||
out_uint8a(self->client_mcs_data, s->p, len);
|
||||
in_uint8s(s, len);
|
||||
s_mark_end(self->client_mcs_data);
|
||||
if (s_check_end(s))
|
||||
{
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_recv_edrq(struct xrdp_mcs* self)
|
||||
{
|
||||
int opcode;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_recv(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, opcode);
|
||||
if ((opcode >> 2) != MCS_EDRQ)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, 2);
|
||||
in_uint8s(s, 2);
|
||||
if (opcode & 2)
|
||||
{
|
||||
in_uint16_be(s, self->userid);
|
||||
}
|
||||
if (!(s_check_end(s)))
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_recv_aurq(struct xrdp_mcs* self)
|
||||
{
|
||||
int opcode;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_recv(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, opcode);
|
||||
if ((opcode >> 2) != MCS_AURQ)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
if (opcode & 2)
|
||||
{
|
||||
in_uint16_be(s, self->userid);
|
||||
}
|
||||
if (!(s_check_end(s)))
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_send_aucf(struct xrdp_mcs* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_init(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8(s, ((MCS_AUCF << 2) | 2));
|
||||
out_uint8s(s, 1);
|
||||
out_uint16_be(s, self->userid);
|
||||
s_mark_end(s);
|
||||
if (xrdp_iso_send(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_recv_cjrq(struct xrdp_mcs* self)
|
||||
{
|
||||
int opcode;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_recv(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, opcode);
|
||||
if ((opcode >> 2) != MCS_CJRQ)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
in_uint8s(s, 4);
|
||||
if (opcode & 2)
|
||||
{
|
||||
in_uint8s(s, 2);
|
||||
}
|
||||
if (!(s_check_end(s)))
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_ber_out_header(struct xrdp_mcs* self, struct stream* s,
|
||||
int tag_val, int len)
|
||||
{
|
||||
if (tag_val > 0xff)
|
||||
{
|
||||
out_uint16_be(s, tag_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
out_uint8(s, tag_val);
|
||||
}
|
||||
if (len >= 0x80)
|
||||
{
|
||||
out_uint8(s, 0x82);
|
||||
out_uint16_be(s, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
out_uint8(s, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_ber_out_int8(struct xrdp_mcs* self, struct stream* s, int value)
|
||||
{
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);
|
||||
out_uint8(s, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_ber_out_int16(struct xrdp_mcs* self, struct stream* s, int value)
|
||||
{
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 2);
|
||||
out_uint8(s, (value >> 8));
|
||||
out_uint8(s, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_ber_out_int24(struct xrdp_mcs* self, struct stream* s, int value)
|
||||
{
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 3);
|
||||
out_uint8(s, (value >> 16));
|
||||
out_uint8(s, (value >> 8));
|
||||
out_uint8(s, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_out_domain_params(struct xrdp_mcs* self, struct stream* s,
|
||||
int max_channels,
|
||||
int max_users, int max_tokens,
|
||||
int max_pdu_size)
|
||||
{
|
||||
xrdp_mcs_ber_out_header(self, s, MCS_TAG_DOMAIN_PARAMS, 26);
|
||||
xrdp_mcs_ber_out_int8(self, s, max_channels);
|
||||
xrdp_mcs_ber_out_int8(self, s, max_users);
|
||||
xrdp_mcs_ber_out_int8(self, s, max_tokens);
|
||||
xrdp_mcs_ber_out_int8(self, s, 1);
|
||||
xrdp_mcs_ber_out_int8(self, s, 0);
|
||||
xrdp_mcs_ber_out_int8(self, s, 1);
|
||||
xrdp_mcs_ber_out_int24(self, s, max_pdu_size);
|
||||
xrdp_mcs_ber_out_int8(self, s, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_send_connect_response(struct xrdp_mcs* self)
|
||||
{
|
||||
int data_len;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
data_len = self->server_mcs_data->end - self->server_mcs_data->data;
|
||||
xrdp_iso_init(self->iso_layer, s);
|
||||
xrdp_mcs_ber_out_header(self, s, MCS_CONNECT_RESPONSE, 313);
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_RESULT, 1);
|
||||
out_uint8(s, 0);
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);
|
||||
out_uint8(s, 0);
|
||||
xrdp_mcs_out_domain_params(self, s, 2, 2, 0, 0xffff);
|
||||
xrdp_mcs_ber_out_header(self, s, BER_TAG_OCTET_STRING, data_len);
|
||||
/* mcs data */
|
||||
out_uint8a(s, self->server_mcs_data->data, data_len);
|
||||
s_mark_end(s);
|
||||
if (xrdp_iso_send(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_incoming(struct xrdp_mcs* self)
|
||||
{
|
||||
DEBUG((" in xrdp_mcs_incoming\n\r"));
|
||||
if (xrdp_iso_incoming(self->iso_layer) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_recv_connect_initial(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_send_connect_response(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_recv_edrq(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_recv_aurq(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_send_aucf(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_recv_cjrq(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_send_cjcf(self, self->userid + MCS_USERCHANNEL_BASE) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_recv_cjrq(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_mcs_send_cjcf(self, MCS_GLOBAL_CHANNEL) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_mcs_incoming\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_init(struct xrdp_mcs* self, struct stream* s)
|
||||
{
|
||||
xrdp_iso_init(self->iso_layer, s);
|
||||
s_push_layer(s, mcs_hdr, 8);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_send(struct xrdp_mcs* self, struct stream* s)
|
||||
{
|
||||
int len;
|
||||
|
||||
DEBUG((" in xrdp_mcs_send\n\r"));
|
||||
s_pop_layer(s, mcs_hdr);
|
||||
len = (s->end - s->p) - 8;
|
||||
len = len | 0x8000;
|
||||
out_uint8(s, MCS_SDIN << 2);
|
||||
out_uint16_be(s, self->userid);
|
||||
out_uint16_be(s, MCS_GLOBAL_CHANNEL);
|
||||
out_uint8(s, 0x70);
|
||||
out_uint16_be(s, len);
|
||||
if (xrdp_iso_send(self->iso_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_mcs_send\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_mcs_disconnect(struct xrdp_mcs* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_iso_init(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8(s, (MCS_DPUM << 2) | 1);
|
||||
out_uint8(s, 0x80);
|
||||
s_mark_end(s);
|
||||
if (xrdp_iso_send(self->iso_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
1536
xrdp/xrdp_orders.c
1536
xrdp/xrdp_orders.c
File diff suppressed because it is too large
Load Diff
@ -23,20 +23,22 @@
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_painter* xrdp_painter_create(struct xrdp_wm* wm)
|
||||
struct xrdp_painter* APP_CC
|
||||
xrdp_painter_create(struct xrdp_wm* wm, struct xrdp_session* session)
|
||||
{
|
||||
struct xrdp_painter* self;
|
||||
|
||||
self = (struct xrdp_painter*)g_malloc(sizeof(struct xrdp_painter), 1);
|
||||
self->wm = wm;
|
||||
self->orders = wm->orders;
|
||||
self->session = session;
|
||||
self->rop = 0xcc; /* copy */
|
||||
self->clip_children = 1;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_painter_delete(struct xrdp_painter* self)
|
||||
void APP_CC
|
||||
xrdp_painter_delete(struct xrdp_painter* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -47,21 +49,24 @@ void xrdp_painter_delete(struct xrdp_painter* self)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_begin_update(struct xrdp_painter* self)
|
||||
int APP_CC
|
||||
xrdp_painter_begin_update(struct xrdp_painter* self)
|
||||
{
|
||||
xrdp_orders_init(self->orders);
|
||||
libxrdp_orders_init(self->session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_end_update(struct xrdp_painter* self)
|
||||
int APP_CC
|
||||
xrdp_painter_end_update(struct xrdp_painter* self)
|
||||
{
|
||||
xrdp_orders_send(self->orders);
|
||||
libxrdp_orders_send(self->session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_font_needed(struct xrdp_painter* self)
|
||||
int APP_CC
|
||||
xrdp_painter_font_needed(struct xrdp_painter* self)
|
||||
{
|
||||
if (self->font == 0)
|
||||
{
|
||||
@ -72,8 +77,9 @@ int xrdp_painter_font_needed(struct xrdp_painter* self)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns boolean, true if there is something to draw */
|
||||
int xrdp_painter_clip_adj(struct xrdp_painter* self, int* x, int* y,
|
||||
int* cx, int* cy)
|
||||
int APP_CC
|
||||
xrdp_painter_clip_adj(struct xrdp_painter* self, int* x, int* y,
|
||||
int* cx, int* cy)
|
||||
{
|
||||
int dx;
|
||||
int dy;
|
||||
@ -122,8 +128,9 @@ int xrdp_painter_clip_adj(struct xrdp_painter* self, int* x, int* y,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_set_clip(struct xrdp_painter* self,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_painter_set_clip(struct xrdp_painter* self,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
self->use_clip = 1;
|
||||
self->clip.left = x;
|
||||
@ -134,14 +141,16 @@ int xrdp_painter_set_clip(struct xrdp_painter* self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_clr_clip(struct xrdp_painter* self)
|
||||
int APP_CC
|
||||
xrdp_painter_clr_clip(struct xrdp_painter* self)
|
||||
{
|
||||
self->use_clip = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_rop(int rop, int src, int dst)
|
||||
int APP_CC
|
||||
xrdp_painter_rop(int rop, int src, int dst)
|
||||
{
|
||||
switch (rop & 0x0f)
|
||||
{
|
||||
@ -167,9 +176,10 @@ int xrdp_painter_rop(int rop, int src, int dst)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* fill in an area of the screen with one color */
|
||||
int xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_region* region;
|
||||
@ -201,10 +211,10 @@ int xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
DEBUG(("sending rect order %d %d %d %d\n\r",
|
||||
rect.left, rect.top,
|
||||
rect.right, rect.bottom));
|
||||
xrdp_orders_rect(self->orders, rect.left, rect.top,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
self->fg_color, 0);
|
||||
libxrdp_orders_rect(self->session, rect.left, rect.top,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
self->fg_color, 0);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -215,9 +225,10 @@ int xrdp_painter_fill_rect(struct xrdp_painter* self,
|
||||
/*****************************************************************************/
|
||||
/* fill in an area of the screen with opcodes and patterns */
|
||||
/* todo, this needs work */
|
||||
int xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_region* region;
|
||||
@ -249,11 +260,11 @@ int xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
DEBUG(("sending rect2 order %d %d %d %d\n\r",
|
||||
rect.left, rect.top,
|
||||
rect.right, rect.bottom));
|
||||
xrdp_orders_pat_blt(self->orders, rect.left, rect.top,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
self->rop, self->bg_color, self->fg_color,
|
||||
&self->brush, 0);
|
||||
libxrdp_orders_pat_blt(self->session, rect.left, rect.top,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
self->rop, self->bg_color, self->fg_color,
|
||||
&self->brush, 0);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -265,10 +276,11 @@ int xrdp_painter_fill_rect2(struct xrdp_painter* self,
|
||||
#define SSH 60
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
struct xrdp_bitmap* to_draw,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
struct xrdp_bitmap* to_draw,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@ -395,9 +407,9 @@ int xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
cache_id, palette_id,
|
||||
x1, y1, w, h, self->rop, srcx, srcy,
|
||||
cache_idx));
|
||||
xrdp_orders_mem_blt(self->orders, cache_id, palette_id,
|
||||
x1, y1, w, h, self->rop, srcx, srcy,
|
||||
cache_idx, &rect1);
|
||||
libxrdp_orders_mem_blt(self->session, cache_id, palette_id,
|
||||
x1, y1, w, h, self->rop, srcx, srcy,
|
||||
cache_idx, &rect1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -412,7 +424,7 @@ int xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
else /* no bitmap cache */
|
||||
{
|
||||
/* make sure there is no waiting orders */
|
||||
xrdp_orders_force_send(self->orders);
|
||||
libxrdp_orders_force_send(self->session);
|
||||
k = 0;
|
||||
while (xrdp_region_get_rect(region, k, &rect) == 0)
|
||||
{
|
||||
@ -432,12 +444,13 @@ int xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_text_width(struct xrdp_painter* self, char* text)
|
||||
int APP_CC
|
||||
xrdp_painter_text_width(struct xrdp_painter* self, char* text)
|
||||
{
|
||||
int index;
|
||||
int rv;
|
||||
int len;
|
||||
struct xrdp_font_item* font_item;
|
||||
struct xrdp_font_char* font_item;
|
||||
|
||||
xrdp_painter_font_needed(self);
|
||||
if (text == 0)
|
||||
@ -455,12 +468,13 @@ int xrdp_painter_text_width(struct xrdp_painter* self, char* text)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_text_height(struct xrdp_painter* self, char* text)
|
||||
int APP_CC
|
||||
xrdp_painter_text_height(struct xrdp_painter* self, char* text)
|
||||
{
|
||||
int index;
|
||||
int rv;
|
||||
int len;
|
||||
struct xrdp_font_item* font_item;
|
||||
struct xrdp_font_char* font_item;
|
||||
|
||||
xrdp_painter_font_needed(self);
|
||||
if (text == 0)
|
||||
@ -478,9 +492,10 @@ int xrdp_painter_text_height(struct xrdp_painter* self, char* text)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, char* text)
|
||||
int APP_CC
|
||||
xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
int x, int y, char* text)
|
||||
{
|
||||
int i;
|
||||
int f;
|
||||
@ -500,7 +515,7 @@ int xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_rect draw_rect;
|
||||
struct xrdp_bitmap* b;
|
||||
struct xrdp_font* font;
|
||||
struct xrdp_font_item* font_item;
|
||||
struct xrdp_font_char* font_item;
|
||||
|
||||
len = g_strlen(text);
|
||||
if (len < 1)
|
||||
@ -586,11 +601,11 @@ int xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
0, 0, 0, 0, x1, y1, len,
|
||||
draw_rect.left, draw_rect.top,
|
||||
draw_rect.right, draw_rect.bottom));
|
||||
xrdp_orders_text(self->orders, f, flags, 0,
|
||||
font->color, 0,
|
||||
x - 1, y - 1, x + total_width, y + total_height,
|
||||
0, 0, 0, 0,
|
||||
x1, y1, data, len * 2, &draw_rect);
|
||||
libxrdp_orders_text(self->session, f, flags, 0,
|
||||
font->color, 0,
|
||||
x - 1, y - 1, x + total_width, y + total_height,
|
||||
0, 0, 0, 0,
|
||||
x1, y1, data, len * 2, &draw_rect);
|
||||
}
|
||||
}
|
||||
k++;
|
||||
|
@ -23,7 +23,8 @@
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_process* xrdp_process_create(struct xrdp_listen* owner)
|
||||
struct xrdp_process* APP_CC
|
||||
xrdp_process_create(struct xrdp_listen* owner)
|
||||
{
|
||||
struct xrdp_process* self;
|
||||
|
||||
@ -33,87 +34,50 @@ struct xrdp_process* xrdp_process_create(struct xrdp_listen* owner)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_process_delete(struct xrdp_process* self)
|
||||
void APP_CC
|
||||
xrdp_process_delete(struct xrdp_process* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
xrdp_rdp_delete(self->rdp_layer);
|
||||
xrdp_orders_delete(self->orders);
|
||||
libxrdp_exit(self->session);
|
||||
xrdp_wm_delete(self->wm);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_process_loop(struct xrdp_process* self, struct stream* s)
|
||||
int APP_CC
|
||||
xrdp_process_loop(struct xrdp_process* self)
|
||||
{
|
||||
int cont;
|
||||
int rv;
|
||||
int code;
|
||||
|
||||
code = 0;
|
||||
rv = 0;
|
||||
cont = 1;
|
||||
while (cont && !self->term)
|
||||
if (self->session != 0)
|
||||
{
|
||||
if (xrdp_rdp_recv(self->rdp_layer, s, &code) != 0)
|
||||
{
|
||||
rv = 1;
|
||||
break;
|
||||
}
|
||||
DEBUG(("xrdp_process_main_loop code %d\n\r", code));
|
||||
switch (code)
|
||||
{
|
||||
case -1:
|
||||
xrdp_rdp_send_demand_active(self->rdp_layer);
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case RDP_PDU_CONFIRM_ACTIVE: /* 3 */
|
||||
xrdp_rdp_process_confirm_active(self->rdp_layer, s);
|
||||
break;
|
||||
case RDP_PDU_DATA: /* 7 */
|
||||
if (xrdp_rdp_process_data(self->rdp_layer, s) != 0)
|
||||
{
|
||||
DEBUG(("xrdp_rdp_process_data returned non zero\n\r"));
|
||||
cont = 0;
|
||||
self->term = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_printf("unknown in xrdp_process_main_loop\n\r");
|
||||
break;
|
||||
}
|
||||
if (cont)
|
||||
{
|
||||
cont = s->next_packet < s->end;
|
||||
}
|
||||
rv = libxrdp_process_data(self->session);
|
||||
}
|
||||
if (self->rdp_layer->up_and_running && self->wm == 0 && rv == 0)
|
||||
if (self->wm == 0 && self->session->up_and_running && rv == 0)
|
||||
{
|
||||
/* only do this once */
|
||||
DEBUG(("xrdp_process_main_loop up and running\n\r"));
|
||||
self->orders = xrdp_orders_create(self, self->rdp_layer);
|
||||
self->wm = xrdp_wm_create(self, &self->rdp_layer->client_info);
|
||||
DEBUG(("calling xrdp_wm_init and creating wm"));
|
||||
self->wm = xrdp_wm_create(self, self->session->client_info);
|
||||
xrdp_wm_init(self->wm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_process_main_loop(struct xrdp_process* self)
|
||||
int APP_CC
|
||||
xrdp_process_main_loop(struct xrdp_process* self)
|
||||
{
|
||||
#ifndef XRDP_LIB
|
||||
int sel_r;
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
self->status = 1;
|
||||
self->rdp_layer = xrdp_rdp_create(self, self->sck);
|
||||
self->session = libxrdp_init((long)self, self->sck);
|
||||
self->session->callback = callback;
|
||||
g_tcp_set_non_blocking(self->sck);
|
||||
g_tcp_set_no_delay(self->sck);
|
||||
if (xrdp_rdp_incoming(self->rdp_layer) == 0)
|
||||
if (libxrdp_process_incomming(self->session) == 0)
|
||||
{
|
||||
while (!g_is_term() && !self->term)
|
||||
{
|
||||
@ -128,8 +92,7 @@ int xrdp_process_main_loop(struct xrdp_process* self)
|
||||
}
|
||||
if (sel_r & 1)
|
||||
{
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_process_loop(self, s) != 0)
|
||||
if (xrdp_process_loop(self) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -150,22 +113,23 @@ int xrdp_process_main_loop(struct xrdp_process* self)
|
||||
}
|
||||
}
|
||||
}
|
||||
libxrdp_disconnect(self->session);
|
||||
g_sleep(500);
|
||||
}
|
||||
if (self->wm->mod != 0)
|
||||
if (self->wm != 0)
|
||||
{
|
||||
if (self->wm->mod->mod_end != 0)
|
||||
if (self->wm->mod != 0)
|
||||
{
|
||||
self->wm->mod->mod_end(self->wm->mod);
|
||||
if (self->wm->mod->mod_end != 0)
|
||||
{
|
||||
self->wm->mod->mod_end(self->wm->mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
xrdp_rdp_disconnect(self->rdp_layer);
|
||||
g_sleep(500);
|
||||
xrdp_rdp_delete(self->rdp_layer);
|
||||
self->rdp_layer = 0;
|
||||
libxrdp_exit(self->session);
|
||||
self->session = 0;
|
||||
g_tcp_close(self->sck);
|
||||
self->status = -1;
|
||||
xrdp_listen_delete_pro(self->lis_layer, self);
|
||||
free_stream(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
909
xrdp/xrdp_rdp.c
909
xrdp/xrdp_rdp.c
@ -1,909 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
rdp layer
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
char unknown1[172] =
|
||||
{ 0xff, 0x02, 0xb6, 0x00, 0x28, 0x00, 0x00, 0x00,
|
||||
0x27, 0x00, 0x27, 0x00, 0x03, 0x00, 0x04, 0x00,
|
||||
0x00, 0x00, 0x26, 0x00, 0x01, 0x00, 0x1e, 0x00,
|
||||
0x02, 0x00, 0x1f, 0x00, 0x03, 0x00, 0x1d, 0x00,
|
||||
0x04, 0x00, 0x27, 0x00, 0x05, 0x00, 0x0b, 0x00,
|
||||
0x06, 0x00, 0x28, 0x00, 0x08, 0x00, 0x21, 0x00,
|
||||
0x09, 0x00, 0x20, 0x00, 0x0a, 0x00, 0x22, 0x00,
|
||||
0x0b, 0x00, 0x25, 0x00, 0x0c, 0x00, 0x24, 0x00,
|
||||
0x0d, 0x00, 0x23, 0x00, 0x0e, 0x00, 0x19, 0x00,
|
||||
0x0f, 0x00, 0x16, 0x00, 0x10, 0x00, 0x15, 0x00,
|
||||
0x11, 0x00, 0x1c, 0x00, 0x12, 0x00, 0x1b, 0x00,
|
||||
0x13, 0x00, 0x1a, 0x00, 0x14, 0x00, 0x17, 0x00,
|
||||
0x15, 0x00, 0x18, 0x00, 0x16, 0x00, 0x0e, 0x00,
|
||||
0x18, 0x00, 0x0c, 0x00, 0x19, 0x00, 0x0d, 0x00,
|
||||
0x1a, 0x00, 0x12, 0x00, 0x1b, 0x00, 0x14, 0x00,
|
||||
0x1f, 0x00, 0x13, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0x21, 0x00, 0x0a, 0x00, 0x22, 0x00, 0x06, 0x00,
|
||||
0x23, 0x00, 0x07, 0x00, 0x24, 0x00, 0x08, 0x00,
|
||||
0x25, 0x00, 0x09, 0x00, 0x26, 0x00, 0x04, 0x00,
|
||||
0x27, 0x00, 0x03, 0x00, 0x28, 0x00, 0x02, 0x00,
|
||||
0x29, 0x00, 0x01, 0x00, 0x2a, 0x00, 0x05, 0x00,
|
||||
0x2b, 0x00, 0x2a, 0x00 };
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_read_config(struct xrdp_client_info* client_info)
|
||||
{
|
||||
int fd;
|
||||
int index;
|
||||
struct xrdp_list* items;
|
||||
struct xrdp_list* values;
|
||||
char* item;
|
||||
char* value;
|
||||
|
||||
fd = g_file_open("xrdp.ini");
|
||||
if (fd > 0)
|
||||
{
|
||||
items = xrdp_list_create();
|
||||
items->auto_free = 1;
|
||||
values = xrdp_list_create();
|
||||
values->auto_free = 1;
|
||||
xrdp_file_read_section(fd, "globals", items, values);
|
||||
for (index = 0; index < items->count; index++)
|
||||
{
|
||||
item = (char*)xrdp_list_get_item(items, index);
|
||||
value = (char*)xrdp_list_get_item(values, index);
|
||||
if (g_strcmp(item, "bitmap_cache") == 0)
|
||||
{
|
||||
if (g_strcmp(value, "yes") == 0)
|
||||
{
|
||||
client_info->use_bitmap_cache = 1;
|
||||
}
|
||||
}
|
||||
else if (g_strcmp(item, "bitmap_compression") == 0)
|
||||
{
|
||||
if (g_strcmp(value, "yes") == 0)
|
||||
{
|
||||
client_info->use_bitmap_comp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
xrdp_list_delete(items);
|
||||
xrdp_list_delete(values);
|
||||
g_file_close(fd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_rdp* xrdp_rdp_create(struct xrdp_process* owner, int sck)
|
||||
{
|
||||
struct xrdp_rdp* self;
|
||||
|
||||
self = (struct xrdp_rdp*)g_malloc(sizeof(struct xrdp_rdp), 1);
|
||||
self->pro_layer = owner;
|
||||
self->share_id = 66538;
|
||||
self->sec_layer = xrdp_sec_create(self, sck);
|
||||
/* read ini settings */
|
||||
xrdp_rdp_read_config(&self->client_info);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_rdp_delete(struct xrdp_rdp* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
xrdp_sec_delete(self->sec_layer);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_init(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
if (xrdp_sec_init(self->sec_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
s_push_layer(s, rdp_hdr, 6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_init_data(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
if (xrdp_sec_init(self->sec_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
s_push_layer(s, rdp_hdr, 18);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns erros */
|
||||
int xrdp_rdp_recv(struct xrdp_rdp* self, struct stream* s, int* code)
|
||||
{
|
||||
int error;
|
||||
int len;
|
||||
int pdu_code;
|
||||
int chan;
|
||||
|
||||
DEBUG(("in xrdp_rdp_recv\n\r"));
|
||||
if (s->next_packet == 0 || s->next_packet >= s->end)
|
||||
{
|
||||
chan = 0;
|
||||
error = xrdp_sec_recv(self->sec_layer, s, &chan);
|
||||
if (error == -1) /* special code for send demand active */
|
||||
{
|
||||
s->next_packet = 0;
|
||||
*code = -1;
|
||||
DEBUG(("out xrdp_rdp_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
if (error != 0)
|
||||
{
|
||||
DEBUG(("out xrdp_rdp_recv error\n\r"));
|
||||
return 1;
|
||||
}
|
||||
if (chan != MCS_GLOBAL_CHANNEL && chan > 0)
|
||||
{
|
||||
s->next_packet = 0;
|
||||
*code = 0;
|
||||
DEBUG(("out xrdp_rdp_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
s->next_packet = s->p;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->p = s->next_packet;
|
||||
}
|
||||
in_uint16_le(s, len);
|
||||
if (len == 0x8000)
|
||||
{
|
||||
s->next_packet += 8;
|
||||
*code = 0;
|
||||
DEBUG(("out xrdp_rdp_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
in_uint16_le(s, pdu_code);
|
||||
*code = pdu_code & 0xf;
|
||||
in_uint8s(s, 2); /* mcs user id */
|
||||
s->next_packet += len;
|
||||
DEBUG(("out xrdp_rdp_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send(struct xrdp_rdp* self, struct stream* s, int pdu_type)
|
||||
{
|
||||
int len;
|
||||
|
||||
DEBUG(("in xrdp_rdp_send\n\r"));
|
||||
s_pop_layer(s, rdp_hdr);
|
||||
len = s->end - s->p;
|
||||
out_uint16_le(s, len);
|
||||
out_uint16_le(s, 0x10 | pdu_type);
|
||||
out_uint16_le(s, self->mcs_channel);
|
||||
if (xrdp_sec_send(self->sec_layer, s, 0) != 0)
|
||||
{
|
||||
DEBUG(("out xrdp_rdp_send error\n\r"));
|
||||
return 1;
|
||||
}
|
||||
DEBUG(("out xrdp_rdp_send\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send_data(struct xrdp_rdp* self, struct stream* s,
|
||||
int data_pdu_type)
|
||||
{
|
||||
int len;
|
||||
|
||||
DEBUG(("in xrdp_rdp_send_data\n\r"));
|
||||
s_pop_layer(s, rdp_hdr);
|
||||
len = s->end - s->p;
|
||||
out_uint16_le(s, len);
|
||||
out_uint16_le(s, 0x10 | RDP_PDU_DATA);
|
||||
out_uint16_le(s, self->mcs_channel);
|
||||
out_uint32_le(s, self->share_id);
|
||||
out_uint8(s, 0);
|
||||
out_uint8(s, 1);
|
||||
out_uint16_le(s, len - 14);
|
||||
out_uint8(s, data_pdu_type);
|
||||
out_uint8(s, 0);
|
||||
out_uint16_le(s, 0);
|
||||
if (xrdp_sec_send(self->sec_layer, s, 0) != 0)
|
||||
{
|
||||
DEBUG(("out xrdp_rdp_send_data error\n\r"));
|
||||
return 1;
|
||||
}
|
||||
DEBUG(("out xrdp_rdp_send_data\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_parse_client_mcs_data(struct xrdp_rdp* self)
|
||||
{
|
||||
struct stream* p;
|
||||
int i;
|
||||
|
||||
p = &self->sec_layer->client_mcs_data;
|
||||
p->p = p->data;
|
||||
in_uint8s(p, 31);
|
||||
in_uint16_le(p, self->client_info.width);
|
||||
in_uint16_le(p, self->client_info.height);
|
||||
in_uint8s(p, 120);
|
||||
self->client_info.bpp = 8;
|
||||
in_uint16_le(p, i);
|
||||
switch (i)
|
||||
{
|
||||
case 0xca01:
|
||||
in_uint8s(p, 6);
|
||||
in_uint8(p, i);
|
||||
if (i > 8)
|
||||
{
|
||||
self->client_info.bpp = i;
|
||||
}
|
||||
break;
|
||||
case 0xca02:
|
||||
self->client_info.bpp = 15;
|
||||
break;
|
||||
case 0xca03:
|
||||
self->client_info.bpp = 16;
|
||||
break;
|
||||
case 0xca04:
|
||||
self->client_info.bpp = 24;
|
||||
break;
|
||||
}
|
||||
p->p = p->data;
|
||||
DEBUG(("client width %d, client height %d bpp %d\n\r",
|
||||
self->client_info.width, self->client_info.height,
|
||||
self->client_info.bpp));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_incoming(struct xrdp_rdp* self)
|
||||
{
|
||||
DEBUG(("in xrdp_rdp_incoming\n\r"));
|
||||
if (xrdp_sec_incoming(self->sec_layer) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
self->mcs_channel = self->sec_layer->mcs_layer->userid +
|
||||
MCS_USERCHANNEL_BASE;
|
||||
xrdp_rdp_parse_client_mcs_data(self);
|
||||
DEBUG(("out xrdp_rdp_incoming mcs channel %d\n\r", self->mcs_channel));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send_demand_active(struct xrdp_rdp* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
out_uint32_le(s, self->share_id);
|
||||
out_uint32_be(s, 0x04000401);
|
||||
out_uint32_be(s, 0x524e5300);
|
||||
out_uint32_be(s, 0x08000000);
|
||||
out_uint32_be(s, 0x09000800);
|
||||
out_uint16_le(s, self->mcs_channel);
|
||||
out_uint16_be(s, 0xb5e2);
|
||||
|
||||
/* Output general capability set */
|
||||
out_uint16_le(s, RDP_CAPSET_GENERAL); /* 1 */
|
||||
out_uint16_le(s, RDP_CAPLEN_GENERAL); /* 24(0x18) */
|
||||
out_uint16_le(s, 1); /* OS major type */
|
||||
out_uint16_le(s, 3); /* OS minor type */
|
||||
out_uint16_le(s, 0x200); /* Protocol version */
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
out_uint16_le(s, 0); /* Compression types */
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
out_uint16_le(s, 0); /* Update capability */
|
||||
out_uint16_le(s, 0); /* Remote unshare capability */
|
||||
out_uint16_le(s, 0); /* Compression level */
|
||||
out_uint16_le(s, 0); /* Pad */
|
||||
|
||||
/* Output bitmap capability set */
|
||||
out_uint16_le(s, RDP_CAPSET_BITMAP); /* 2 */
|
||||
out_uint16_le(s, RDP_CAPLEN_BITMAP); /* 28(0x1c) */
|
||||
out_uint16_le(s, self->client_info.bpp); /* Preferred BPP */
|
||||
out_uint16_le(s, 1); /* Receive 1 BPP */
|
||||
out_uint16_le(s, 1); /* Receive 4 BPP */
|
||||
out_uint16_le(s, 1); /* Receive 8 BPP */
|
||||
out_uint16_le(s, self->client_info.width); /* width */
|
||||
out_uint16_le(s, self->client_info.height); /* height */
|
||||
out_uint16_le(s, 0); /* Pad */
|
||||
out_uint16_le(s, 1); /* Allow resize */
|
||||
out_uint16_le(s, 1); /* bitmap compression */
|
||||
out_uint16_le(s, 0); /* unknown */
|
||||
out_uint16_le(s, 0); /* unknown */
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
|
||||
/* Output ? */
|
||||
out_uint16_le(s, 14);
|
||||
out_uint16_le(s, 4);
|
||||
|
||||
/* Output order capability set */
|
||||
out_uint16_le(s, RDP_CAPSET_ORDER); /* 3 */
|
||||
out_uint16_le(s, RDP_CAPLEN_ORDER); /* 88(0x58) */
|
||||
out_uint8s(s, 16);
|
||||
out_uint32_be(s, 0x40420f00);
|
||||
out_uint16_le(s, 1); /* Cache X granularity */
|
||||
out_uint16_le(s, 20); /* Cache Y granularity */
|
||||
out_uint16_le(s, 0); /* Pad */
|
||||
out_uint16_le(s, 1); /* Max order level */
|
||||
out_uint16_le(s, 0x2f); /* Number of fonts */
|
||||
out_uint16_le(s, 0x22); /* Capability flags */
|
||||
/* caps */
|
||||
out_uint8(s, 1); /* dest blt */
|
||||
out_uint8(s, 1); /* pat blt */
|
||||
out_uint8(s, 1); /* screen blt */
|
||||
out_uint8(s, 1); /* memblt */
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 0);
|
||||
out_uint8(s, 0);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 1);
|
||||
out_uint8(s, 0);
|
||||
out_uint8(s, 0);
|
||||
out_uint8(s, 0);
|
||||
out_uint16_le(s, 0x6a1);
|
||||
out_uint8s(s, 6); /* ? */
|
||||
out_uint32_le(s, 0x0f4240); /* desk save */
|
||||
out_uint32_le(s, 0); /* ? */
|
||||
out_uint32_le(s, 0); /* ? */
|
||||
|
||||
/* Output color cache capability set */
|
||||
out_uint16_le(s, RDP_CAPSET_COLCACHE);
|
||||
out_uint16_le(s, RDP_CAPLEN_COLCACHE);
|
||||
out_uint16_le(s, 6); /* cache size */
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
|
||||
/* Output pointer capability set */
|
||||
out_uint16_le(s, RDP_CAPSET_POINTER);
|
||||
out_uint16_le(s, RDP_CAPLEN_POINTER);
|
||||
out_uint16_le(s, 1); /* Colour pointer */
|
||||
out_uint16_le(s, 0x19); /* Cache size */
|
||||
|
||||
/* Output ? */
|
||||
out_uint16_le(s, 0xd);
|
||||
out_uint16_le(s, 0x58); /* 88 */
|
||||
out_uint8(s, 1);
|
||||
out_uint8s(s, 83);
|
||||
|
||||
s_mark_end(s);
|
||||
|
||||
if (xrdp_rdp_send(self, s, RDP_PDU_DEMAND_ACTIVE) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_process_capset_general(struct xrdp_rdp* self, struct stream* s,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
in_uint8s(s, 10);
|
||||
in_uint16_le(s, i);
|
||||
self->client_info.use_compact_packets = (i != 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_process_capset_order(struct xrdp_rdp* self, struct stream* s,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
in_uint8s(s, 72);
|
||||
in_uint32_le(s, i); /* desktop cache size, usually 0x38400 */
|
||||
self->client_info.desktop_cache = i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* get the bitmap cache size */
|
||||
int xrdp_process_capset_bmpcache(struct xrdp_rdp* self, struct stream* s,
|
||||
int len)
|
||||
{
|
||||
in_uint8s(s, 24);
|
||||
in_uint16_le(s, self->client_info.cache1_entries);
|
||||
in_uint16_le(s, self->client_info.cache1_size);
|
||||
in_uint16_le(s, self->client_info.cache2_entries);
|
||||
in_uint16_le(s, self->client_info.cache2_size);
|
||||
in_uint16_le(s, self->client_info.cache3_entries);
|
||||
in_uint16_le(s, self->client_info.cache3_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* get the number of client cursor cache */
|
||||
int xrdp_process_capset_pointercache(struct xrdp_rdp* self, struct stream* s,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
in_uint8s(s, 2); /* color pointer */
|
||||
in_uint16_le(s, i);
|
||||
i = MIN(i, 32);
|
||||
self->client_info.pointer_cache_entries = i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_confirm_active(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int cap_len;
|
||||
int source_len;
|
||||
int num_caps;
|
||||
int index;
|
||||
int type;
|
||||
int len;
|
||||
char* p;
|
||||
|
||||
in_uint8s(s, 4); /* rdp_shareid */
|
||||
in_uint8s(s, 2); /* userid */
|
||||
in_uint16_le(s, source_len); /* sizeof RDP_SOURCE */
|
||||
in_uint16_le(s, cap_len);
|
||||
in_uint8s(s, source_len);
|
||||
in_uint16_le(s, num_caps);
|
||||
in_uint8s(s, 2); /* pad */
|
||||
for (index = 0; index < num_caps; index++)
|
||||
{
|
||||
p = s->p;
|
||||
in_uint16_le(s, type);
|
||||
in_uint16_le(s, len);
|
||||
switch (type)
|
||||
{
|
||||
case RDP_CAPSET_GENERAL: /* 1 */
|
||||
xrdp_process_capset_general(self, s, len);
|
||||
break;
|
||||
case RDP_CAPSET_ORDER: /* 3 */
|
||||
xrdp_process_capset_order(self, s, len);
|
||||
break;
|
||||
case RDP_CAPSET_BMPCACHE: /* 4 */
|
||||
xrdp_process_capset_bmpcache(self, s, len);
|
||||
break;
|
||||
case RDP_CAPSET_POINTER: /* 8 */
|
||||
xrdp_process_capset_pointercache(self, s, len);
|
||||
break;
|
||||
}
|
||||
s->p = p + len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_data_pointer(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RDP_INPUT_SYNCHRONIZE */
|
||||
int xrdp_rdp_process_input_sync(struct xrdp_rdp* self, int device_flags,
|
||||
int key_flags)
|
||||
{
|
||||
DEBUG(("sync event flags %d key %d\n\r", device_flags, key_flags));
|
||||
if (!self->up_and_running)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
xrdp_wm_key_sync(self->pro_layer->wm, device_flags, key_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RDP_INPUT_SCANCODE */
|
||||
int xrdp_rdp_process_input_scancode(struct xrdp_rdp* self, int device_flags,
|
||||
int scan_code)
|
||||
{
|
||||
DEBUG(("key event flags %4.4x scan_code %d\n\r", device_flags, scan_code));
|
||||
if (!self->up_and_running)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
xrdp_wm_key(self->pro_layer->wm, device_flags, scan_code);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RDP_INPUT_MOUSE */
|
||||
int xrdp_rdp_process_input_mouse(struct xrdp_rdp* self, int device_flags,
|
||||
int x, int y)
|
||||
{
|
||||
DEBUG(("mouse event flags %4.4x x %d y %d\n\r", device_flags, x, y));
|
||||
if (!self->up_and_running)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_MOVE) /* 0x0800 */
|
||||
{
|
||||
xrdp_wm_mouse_move(self->pro_layer->wm, x, y);
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON1) /* 0x1000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 1, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON2) /* 0x2000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 2, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON3) /* 0x4000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 3, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 3, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags == MOUSE_FLAG_BUTTON4 || /* 0x0280 */
|
||||
device_flags == 0x0278)
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, 0, 0, 4, 0);
|
||||
}
|
||||
if (device_flags == MOUSE_FLAG_BUTTON5 || /* 0x0380 */
|
||||
device_flags == 0x0388)
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, 0, 0, 5, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RDP_DATA_PDU_INPUT */
|
||||
int xrdp_rdp_process_data_input(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int num_events;
|
||||
int index;
|
||||
int msg_type;
|
||||
int device_flags;
|
||||
int param1;
|
||||
int param2;
|
||||
|
||||
in_uint16_le(s, num_events);
|
||||
in_uint8s(s, 2); /* pad */
|
||||
DEBUG(("xrdp_rdp_process_data_input %d events\n\r", num_events));
|
||||
for (index = 0; index < num_events; index++)
|
||||
{
|
||||
in_uint8s(s, 4); /* time */
|
||||
in_uint16_le(s, msg_type);
|
||||
in_uint16_le(s, device_flags);
|
||||
in_sint16_le(s, param1);
|
||||
in_sint16_le(s, param2);
|
||||
switch (msg_type)
|
||||
{
|
||||
case RDP_INPUT_SYNCHRONIZE: /* 0 */
|
||||
xrdp_rdp_process_input_sync(self, device_flags, param1);
|
||||
break;
|
||||
case RDP_INPUT_SCANCODE: /* 4 */
|
||||
xrdp_rdp_process_input_scancode(self, device_flags, param1);
|
||||
break;
|
||||
case RDP_INPUT_MOUSE: /* 8001 */
|
||||
xrdp_rdp_process_input_mouse(self, device_flags, param1, param2);
|
||||
break;
|
||||
default:
|
||||
g_printf("unknown in xrdp_rdp_process_data_input\n\r");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send_synchronise(struct xrdp_rdp* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init_data(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint16_le(s, 1);
|
||||
out_uint16_le(s, 1002);
|
||||
s_mark_end(s);
|
||||
if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_SYNCHRONISE) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send_control(struct xrdp_rdp* self, int action)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init_data(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint16_le(s, action);
|
||||
out_uint16_le(s, 0); /* userid */
|
||||
out_uint32_le(s, 1002); /* control id */
|
||||
s_mark_end(s);
|
||||
if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_CONTROL) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_data_control(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int action;
|
||||
|
||||
in_uint16_le(s, action);
|
||||
in_uint8s(s, 2); /* user id */
|
||||
in_uint8s(s, 4); /* control id */
|
||||
if (action == RDP_CTL_REQUEST_CONTROL)
|
||||
{
|
||||
xrdp_rdp_send_synchronise(self);
|
||||
xrdp_rdp_send_control(self, RDP_CTL_COOPERATE);
|
||||
xrdp_rdp_send_control(self, RDP_CTL_GRANT_CONTROL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_data_sync(struct xrdp_rdp* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_screen_update(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int op;
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
int cx;
|
||||
int cy;
|
||||
struct xrdp_rect rect;
|
||||
|
||||
in_uint32_le(s, op);
|
||||
in_uint16_le(s, left);
|
||||
in_uint16_le(s, top);
|
||||
in_uint16_le(s, right);
|
||||
in_uint16_le(s, bottom);
|
||||
cx = (right - left) + 1;
|
||||
cy = (bottom - top) + 1;
|
||||
if (self->up_and_running && self->pro_layer->wm != 0)
|
||||
{
|
||||
MAKERECT(rect, left, top, cx, cy);
|
||||
xrdp_bitmap_invalidate(self->pro_layer->wm->screen, &rect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_send_unknown1(struct xrdp_rdp* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init_data(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8a(s, unknown1, 172);
|
||||
s_mark_end(s);
|
||||
if (xrdp_rdp_send_data(self, s, 0x28) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_process_data_font(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int seq;
|
||||
|
||||
in_uint8s(s, 2); /* num of fonts */
|
||||
in_uint8s(s, 2); /* unknown */
|
||||
in_uint16_le(s, seq);
|
||||
/* 419 client sends Seq 1, then 2 */
|
||||
/* 2600 clients sends only Seq 3 */
|
||||
if (seq == 2 || seq == 3) /* after second font message, we are up and */
|
||||
{ /* running */
|
||||
xrdp_rdp_send_unknown1(self);
|
||||
self->up_and_running = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* sent 37 pdu */
|
||||
int xrdp_rdp_send_disconnect_query_response(struct xrdp_rdp* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init_data(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
s_mark_end(s);
|
||||
if (xrdp_rdp_send_data(self, s, 37) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* sent RDP_DATA_PDU_DISCONNECT 47 pdu */
|
||||
int xrdp_rdp_send_disconnect_reason(struct xrdp_rdp* self, int reason)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_rdp_init_data(self, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint32_le(s, reason);
|
||||
s_mark_end(s);
|
||||
if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_DISCONNECT) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RDP_PDU_DATA */
|
||||
int xrdp_rdp_process_data(struct xrdp_rdp* self, struct stream* s)
|
||||
{
|
||||
int len;
|
||||
int data_type;
|
||||
int ctype;
|
||||
int clen;
|
||||
|
||||
in_uint8s(s, 6);
|
||||
in_uint16_le(s, len);
|
||||
in_uint8(s, data_type);
|
||||
in_uint8(s, ctype);
|
||||
in_uint16_le(s, clen);
|
||||
DEBUG(("xrdp_rdp_process_data code %d\n\r", data_type));
|
||||
switch (data_type)
|
||||
{
|
||||
case RDP_DATA_PDU_POINTER: /* 27 */
|
||||
xrdp_rdp_process_data_pointer(self, s);
|
||||
break;
|
||||
case RDP_DATA_PDU_INPUT: /* 28 */
|
||||
xrdp_rdp_process_data_input(self, s);
|
||||
break;
|
||||
case RDP_DATA_PDU_CONTROL: /* 20 */
|
||||
xrdp_rdp_process_data_control(self, s);
|
||||
break;
|
||||
case RDP_DATA_PDU_SYNCHRONISE: /* 31 */
|
||||
xrdp_rdp_process_data_sync(self);
|
||||
break;
|
||||
case 33: /* 33 ?? Invalidate an area I think */
|
||||
xrdp_rdp_process_screen_update(self, s);
|
||||
break;
|
||||
case 35:
|
||||
/* 35 ?? this comes when minimuzing a full screen mstsc.exe 2600 */
|
||||
/* I think this is saying the client no longer wants screen */
|
||||
/* updates and it will issue a 33 above to catch up */
|
||||
/* so minimized apps don't take bandwidth */
|
||||
break;
|
||||
case 36: /* 36 ?? disconnect query? */
|
||||
/* when this message comes, send a 37 back so the client */
|
||||
/* is sure the connection is alive and it can ask if user */
|
||||
/* really wants to disconnect */
|
||||
xrdp_rdp_send_disconnect_query_response(self); /* send a 37 back */
|
||||
break;
|
||||
case RDP_DATA_PDU_FONT2: /* 39 */
|
||||
xrdp_rdp_process_data_font(self, s);
|
||||
break;
|
||||
default:
|
||||
g_printf("unknown in xrdp_rdp_process_data %d\n\r", data_type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_rdp_disconnect(struct xrdp_rdp* self)
|
||||
{
|
||||
return xrdp_sec_disconnect(self->sec_layer);
|
||||
}
|
@ -24,40 +24,46 @@
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_region* xrdp_region_create(struct xrdp_wm* wm)
|
||||
struct xrdp_region* APP_CC
|
||||
xrdp_region_create(struct xrdp_wm* wm)
|
||||
{
|
||||
struct xrdp_region* self;
|
||||
|
||||
self = (struct xrdp_region*)g_malloc(sizeof(struct xrdp_region), 1);
|
||||
self->wm = wm;
|
||||
self->rects = xrdp_list_create();
|
||||
self->rects = list_create();
|
||||
self->rects->auto_free = 1;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_region_delete(struct xrdp_region* self)
|
||||
void APP_CC
|
||||
xrdp_region_delete(struct xrdp_region* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
xrdp_list_delete(self->rects);
|
||||
}
|
||||
list_delete(self->rects);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect)
|
||||
int APP_CC
|
||||
xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect)
|
||||
{
|
||||
struct xrdp_rect* r;
|
||||
|
||||
r = (struct xrdp_rect*)g_malloc(sizeof(struct xrdp_rect), 1);
|
||||
*r = *rect;
|
||||
xrdp_list_add_item(self->rects, (long)r);
|
||||
list_add_item(self->rects, (long)r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_region_insert_rect(struct xrdp_region* self, int i, int left,
|
||||
int top, int right, int bottom)
|
||||
int APP_CC
|
||||
xrdp_region_insert_rect(struct xrdp_region* self, int i, int left,
|
||||
int top, int right, int bottom)
|
||||
{
|
||||
struct xrdp_rect* r;
|
||||
|
||||
@ -66,13 +72,14 @@ int xrdp_region_insert_rect(struct xrdp_region* self, int i, int left,
|
||||
r->top = top;
|
||||
r->right = right;
|
||||
r->bottom = bottom;
|
||||
xrdp_list_insert_item(self->rects, i, (long)r);
|
||||
list_insert_item(self->rects, i, (long)r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
struct xrdp_rect* rect)
|
||||
int APP_CC
|
||||
xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
struct xrdp_rect* rect)
|
||||
{
|
||||
struct xrdp_rect* r;
|
||||
struct xrdp_rect rect1;
|
||||
@ -80,7 +87,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
|
||||
for (i = self->rects->count - 1; i >= 0; i--)
|
||||
{
|
||||
r = (struct xrdp_rect*)xrdp_list_get_item(self->rects, i);
|
||||
r = (struct xrdp_rect*)list_get_item(self->rects, i);
|
||||
rect1 = *r;
|
||||
r = &rect1;
|
||||
//g_printf("r is %d %d %d %d\n", r->left, r->top, r->right, r->bottom);
|
||||
@ -89,7 +96,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right >= r->right &&
|
||||
rect->bottom >= r->bottom)
|
||||
{ /* rect is not visible */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
}
|
||||
else if (rect->right < r->left ||
|
||||
rect->bottom < r->top ||
|
||||
@ -102,7 +109,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->bottom < r->bottom &&
|
||||
rect->top <= r->top)
|
||||
{ /* partially covered(whole top) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->bottom,
|
||||
r->right, r->bottom);
|
||||
}
|
||||
@ -111,7 +118,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right < r->right &&
|
||||
rect->left <= r->left)
|
||||
{ /* partially covered(left) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, rect->right, r->top,
|
||||
r->right, r->bottom);
|
||||
}
|
||||
@ -120,7 +127,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->top > r->top &&
|
||||
rect->bottom >= r->bottom)
|
||||
{ /* partially covered(bottom) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
}
|
||||
@ -129,7 +136,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->left > r->left &&
|
||||
rect->right >= r->right)
|
||||
{ /* partially covered(right) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
rect->left, r->bottom);
|
||||
}
|
||||
@ -138,7 +145,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right < r->right &&
|
||||
rect->bottom < r->bottom)
|
||||
{ /* partially covered(top left) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, rect->right, r->top,
|
||||
r->right, rect->bottom);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->bottom,
|
||||
@ -149,7 +156,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right < r->right &&
|
||||
rect->top > r->top)
|
||||
{ /* partially covered(bottom left) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, rect->right, rect->top,
|
||||
@ -160,7 +167,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->top <= r->top &&
|
||||
rect->bottom < r->bottom)
|
||||
{ /* partially covered(top right) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
rect->left, r->bottom);
|
||||
xrdp_region_insert_rect(self, i, rect->left, rect->bottom,
|
||||
@ -171,7 +178,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->top > r->top &&
|
||||
rect->bottom >= r->bottom)
|
||||
{ /* partially covered(bottom right) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->top,
|
||||
@ -182,7 +189,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right < r->right &&
|
||||
rect->bottom >= r->bottom)
|
||||
{ /* 2 rects, one on each end */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
rect->left, r->bottom);
|
||||
xrdp_region_insert_rect(self, i, rect->right, r->top,
|
||||
@ -193,7 +200,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right >= r->right &&
|
||||
rect->bottom < r->bottom)
|
||||
{ /* 2 rects, one on each end */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->bottom,
|
||||
@ -204,7 +211,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->top <= r->top &&
|
||||
rect->bottom < r->bottom)
|
||||
{ /* partially covered(top) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
rect->left, r->bottom);
|
||||
xrdp_region_insert_rect(self, i, rect->left, rect->bottom,
|
||||
@ -217,7 +224,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->left <= r->left &&
|
||||
rect->right < r->right)
|
||||
{ /* partially covered(left) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, rect->right, rect->top,
|
||||
@ -230,7 +237,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->bottom >= r->bottom &&
|
||||
rect->top > r->top)
|
||||
{ /* partially covered(bottom) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
rect->left, r->bottom);
|
||||
xrdp_region_insert_rect(self, i, rect->left, r->top,
|
||||
@ -243,7 +250,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right >= r->right &&
|
||||
rect->left > r->left)
|
||||
{ /* partially covered(right) */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->top,
|
||||
@ -256,7 +263,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
rect->right < r->right &&
|
||||
rect->bottom < r->bottom)
|
||||
{ /* totally contained, 4 rects */
|
||||
xrdp_list_remove_item(self->rects, i);
|
||||
list_remove_item(self->rects, i);
|
||||
xrdp_region_insert_rect(self, i, r->left, r->top,
|
||||
r->right, rect->top);
|
||||
xrdp_region_insert_rect(self, i, r->left, rect->top,
|
||||
@ -267,21 +274,25 @@ int xrdp_region_subtract_rect(struct xrdp_region* self,
|
||||
r->right, rect->bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printf("error in xrdp_region_subtract_rect\n\r");
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_region_get_rect(struct xrdp_region* self, int index,
|
||||
struct xrdp_rect* rect)
|
||||
int APP_CC
|
||||
xrdp_region_get_rect(struct xrdp_region* self, int index,
|
||||
struct xrdp_rect* rect)
|
||||
{
|
||||
struct xrdp_rect* r;
|
||||
|
||||
r = (struct xrdp_rect*)xrdp_list_get_item(self->rects, index);
|
||||
r = (struct xrdp_rect*)list_get_item(self->rects, index);
|
||||
if (r == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
*rect = *r;
|
||||
return 0;
|
||||
}
|
||||
|
587
xrdp/xrdp_sec.c
587
xrdp/xrdp_sec.c
@ -1,587 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
secure layer
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
char pad_54[40] =
|
||||
{ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
||||
54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
||||
54, 54, 54, 54, 54, 54, 54, 54 };
|
||||
|
||||
char pad_92[48] =
|
||||
{ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
|
||||
92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
|
||||
92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92 };
|
||||
|
||||
char pub_exp[4] = { 0x01, 0x00, 0x01, 0x00 };
|
||||
|
||||
char pub_mod[64] =
|
||||
{ 0x67, 0xab, 0x0e, 0x6a, 0x9f, 0xd6, 0x2b, 0xa3,
|
||||
0x32, 0x2f, 0x41, 0xd1, 0xce, 0xee, 0x61, 0xc3,
|
||||
0x76, 0x0b, 0x26, 0x11, 0x70, 0x48, 0x8a, 0x8d,
|
||||
0x23, 0x81, 0x95, 0xa0, 0x39, 0xf7, 0x5b, 0xaa,
|
||||
0x3e, 0xf1, 0xed, 0xb8, 0xc4, 0xee, 0xce, 0x5f,
|
||||
0x6a, 0xf5, 0x43, 0xce, 0x5f, 0x60, 0xca, 0x6c,
|
||||
0x06, 0x75, 0xae, 0xc0, 0xd6, 0xa4, 0x0c, 0x92,
|
||||
0xa4, 0xc6, 0x75, 0xea, 0x64, 0xb2, 0x50, 0x5b };
|
||||
|
||||
char pub_sig[64] =
|
||||
{ 0x6a, 0x41, 0xb1, 0x43, 0xcf, 0x47, 0x6f, 0xf1,
|
||||
0xe6, 0xcc, 0xa1, 0x72, 0x97, 0xd9, 0xe1, 0x85,
|
||||
0x15, 0xb3, 0xc2, 0x39, 0xa0, 0xa6, 0x26, 0x1a,
|
||||
0xb6, 0x49, 0x01, 0xfa, 0xa6, 0xda, 0x60, 0xd7,
|
||||
0x45, 0xf7, 0x2c, 0xee, 0xe4, 0x8e, 0x64, 0x2e,
|
||||
0x37, 0x49, 0xf0, 0x4c, 0x94, 0x6f, 0x08, 0xf5,
|
||||
0x63, 0x4c, 0x56, 0x29, 0x55, 0x5a, 0x63, 0x41,
|
||||
0x2c, 0x20, 0x65, 0x95, 0x99, 0xb1, 0x15, 0x7c };
|
||||
|
||||
char pri_exp[64] =
|
||||
{ 0x41, 0x93, 0x05, 0xB1, 0xF4, 0x38, 0xFC, 0x47,
|
||||
0x88, 0xC4, 0x7F, 0x83, 0x8C, 0xEC, 0x90, 0xDA,
|
||||
0x0C, 0x8A, 0xB5, 0xAE, 0x61, 0x32, 0x72, 0xF5,
|
||||
0x2B, 0xD1, 0x7B, 0x5F, 0x44, 0xC0, 0x7C, 0xBD,
|
||||
0x8A, 0x35, 0xFA, 0xAE, 0x30, 0xF6, 0xC4, 0x6B,
|
||||
0x55, 0xA7, 0x65, 0xEF, 0xF4, 0xB2, 0xAB, 0x18,
|
||||
0x4E, 0xAA, 0xE6, 0xDC, 0x71, 0x17, 0x3B, 0x4C,
|
||||
0xC2, 0x15, 0x4C, 0xF7, 0x81, 0xBB, 0xF0, 0x03 };
|
||||
|
||||
char lic1[322] =
|
||||
{ 0x80, 0x00, 0x3e, 0x01, 0x01, 0x02, 0x3e, 0x01,
|
||||
0x7b, 0x3c, 0x31, 0xa6, 0xae, 0xe8, 0x74, 0xf6,
|
||||
0xb4, 0xa5, 0x03, 0x90, 0xe7, 0xc2, 0xc7, 0x39,
|
||||
0xba, 0x53, 0x1c, 0x30, 0x54, 0x6e, 0x90, 0x05,
|
||||
0xd0, 0x05, 0xce, 0x44, 0x18, 0x91, 0x83, 0x81,
|
||||
0x00, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00,
|
||||
0x4d, 0x00, 0x69, 0x00, 0x63, 0x00, 0x72, 0x00,
|
||||
0x6f, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x66, 0x00,
|
||||
0x74, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6f, 0x00,
|
||||
0x72, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x72, 0x00,
|
||||
0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00,
|
||||
0x6e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x32, 0x00, 0x33, 0x00, 0x36, 0x00, 0x00, 0x00,
|
||||
0x0d, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0xb8, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x06, 0x00, 0x5c, 0x00, 0x52, 0x53, 0x41, 0x31,
|
||||
0x48, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
|
||||
0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
|
||||
0x01, 0xc7, 0xc9, 0xf7, 0x8e, 0x5a, 0x38, 0xe4,
|
||||
0x29, 0xc3, 0x00, 0x95, 0x2d, 0xdd, 0x4c, 0x3e,
|
||||
0x50, 0x45, 0x0b, 0x0d, 0x9e, 0x2a, 0x5d, 0x18,
|
||||
0x63, 0x64, 0xc4, 0x2c, 0xf7, 0x8f, 0x29, 0xd5,
|
||||
0x3f, 0xc5, 0x35, 0x22, 0x34, 0xff, 0xad, 0x3a,
|
||||
0xe6, 0xe3, 0x95, 0x06, 0xae, 0x55, 0x82, 0xe3,
|
||||
0xc8, 0xc7, 0xb4, 0xa8, 0x47, 0xc8, 0x50, 0x71,
|
||||
0x74, 0x29, 0x53, 0x89, 0x6d, 0x9c, 0xed, 0x70,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x48, 0x00, 0xa8, 0xf4, 0x31, 0xb9,
|
||||
0xab, 0x4b, 0xe6, 0xb4, 0xf4, 0x39, 0x89, 0xd6,
|
||||
0xb1, 0xda, 0xf6, 0x1e, 0xec, 0xb1, 0xf0, 0x54,
|
||||
0x3b, 0x5e, 0x3e, 0x6a, 0x71, 0xb4, 0xf7, 0x75,
|
||||
0xc8, 0x16, 0x2f, 0x24, 0x00, 0xde, 0xe9, 0x82,
|
||||
0x99, 0x5f, 0x33, 0x0b, 0xa9, 0xa6, 0x94, 0xaf,
|
||||
0xcb, 0x11, 0xc3, 0xf2, 0xdb, 0x09, 0x42, 0x68,
|
||||
0x29, 0x56, 0x58, 0x01, 0x56, 0xdb, 0x59, 0x03,
|
||||
0x69, 0xdb, 0x7d, 0x37, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x0e, 0x00, 0x0e, 0x00, 0x6d, 0x69, 0x63, 0x72,
|
||||
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x00 };
|
||||
|
||||
char lic2[20] =
|
||||
{ 0x80, 0x00, 0x10, 0x00, 0xff, 0x02, 0x10, 0x00,
|
||||
0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x28, 0x14, 0x00, 0x00 };
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_sec* xrdp_sec_create(struct xrdp_rdp* owner, int sck)
|
||||
{
|
||||
struct xrdp_sec* self;
|
||||
|
||||
self = (struct xrdp_sec*)g_malloc(sizeof(struct xrdp_sec), 1);
|
||||
self->rdp_layer = owner;
|
||||
self->rc4_key_size = 1;
|
||||
self->decrypt_rc4_info = g_rc4_info_create();
|
||||
self->encrypt_rc4_info = g_rc4_info_create();
|
||||
g_random(self->server_random, 32);
|
||||
self->mcs_layer = xrdp_mcs_create(self, sck, &self->client_mcs_data,
|
||||
&self->server_mcs_data);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_delete(struct xrdp_sec* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
xrdp_mcs_delete(self->mcs_layer);
|
||||
g_rc4_info_delete(self->decrypt_rc4_info);
|
||||
g_rc4_info_delete(self->encrypt_rc4_info);
|
||||
g_free(self->client_mcs_data.data);
|
||||
g_free(self->server_mcs_data.data);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_sec_init(struct xrdp_sec* self, struct stream* s)
|
||||
{
|
||||
if (xrdp_mcs_init(self->mcs_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
s_push_layer(s, sec_hdr, 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Reduce key entropy from 64 to 40 bits */
|
||||
void xrdp_sec_make_40bit(char* key)
|
||||
{
|
||||
key[0] = 0xd1;
|
||||
key[1] = 0x26;
|
||||
key[2] = 0x9e;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
/* update an encryption key */
|
||||
int xrdp_sec_update(char* key, char* update_key, int key_len)
|
||||
{
|
||||
char shasig[20];
|
||||
void* sha1_info;
|
||||
void* md5_info;
|
||||
void* rc4_info;
|
||||
|
||||
sha1_info = g_sha1_info_create();
|
||||
md5_info = g_md5_info_create();
|
||||
rc4_info = g_rc4_info_create();
|
||||
g_sha1_clear(sha1_info);
|
||||
g_sha1_transform(sha1_info, update_key, key_len);
|
||||
g_sha1_transform(sha1_info, pad_54, 40);
|
||||
g_sha1_transform(sha1_info, key, key_len);
|
||||
g_sha1_complete(sha1_info, shasig);
|
||||
g_md5_clear(md5_info);
|
||||
g_md5_transform(md5_info, update_key, key_len);
|
||||
g_md5_transform(md5_info, pad_92, 48);
|
||||
g_md5_transform(md5_info, shasig, 20);
|
||||
g_md5_complete(md5_info, key);
|
||||
g_rc4_set_key(rc4_info, key, key_len);
|
||||
g_rc4_crypt(rc4_info, key, key_len);
|
||||
if (key_len == 8)
|
||||
{
|
||||
xrdp_sec_make_40bit(key);
|
||||
}
|
||||
g_sha1_info_delete(sha1_info);
|
||||
g_md5_info_delete(md5_info);
|
||||
g_rc4_info_delete(rc4_info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_decrypt(struct xrdp_sec* self, char* data, int len)
|
||||
{
|
||||
if (self->decrypt_use_count == 4096)
|
||||
{
|
||||
xrdp_sec_update(self->decrypt_key, self->decrypt_update_key,
|
||||
self->rc4_key_len);
|
||||
g_rc4_set_key(self->decrypt_rc4_info, self->decrypt_key,
|
||||
self->rc4_key_len);
|
||||
self->decrypt_use_count = 0;
|
||||
}
|
||||
g_rc4_crypt(self->decrypt_rc4_info, data, len);
|
||||
self->decrypt_use_count++;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_sec_process_logon_info(struct xrdp_sec* self, struct stream* s)
|
||||
{
|
||||
int flags;
|
||||
int len_domain;
|
||||
int len_user;
|
||||
int len_password;
|
||||
int len_program;
|
||||
int len_directory;
|
||||
|
||||
in_uint8s(s, 4);
|
||||
in_uint32_le(s, flags);
|
||||
DEBUG(("in xrdp_sec_process_logon_info flags $%x\n\r", flags));
|
||||
/* this is the first test that the decrypt is working */
|
||||
if ((flags & RDP_LOGON_NORMAL) != RDP_LOGON_NORMAL) /* 0x33 */
|
||||
{ /* must be or error */
|
||||
return 1;
|
||||
}
|
||||
if (flags & RDP_LOGON_AUTO)
|
||||
{
|
||||
}
|
||||
if (flags & RDP_COMPRESSION)
|
||||
{
|
||||
}
|
||||
in_uint16_le(s, len_domain);
|
||||
in_uint16_le(s, len_user);
|
||||
in_uint16_le(s, len_password);
|
||||
in_uint16_le(s, len_program);
|
||||
in_uint16_le(s, len_directory);
|
||||
in_uint8s(s, len_domain + 2);
|
||||
in_uint8s(s, len_user + 2);
|
||||
in_uint8s(s, len_password + 2);
|
||||
in_uint8s(s, len_program + 2);
|
||||
in_uint8s(s, len_directory + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_sec_send_lic_initial(struct xrdp_sec* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_mcs_init(self->mcs_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8a(s, lic1, 322);
|
||||
s_mark_end(s);
|
||||
if (xrdp_mcs_send(self->mcs_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_sec_send_lic_response(struct xrdp_sec* self)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (xrdp_mcs_init(self->mcs_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
out_uint8a(s, lic2, 20);
|
||||
s_mark_end(s);
|
||||
if (xrdp_mcs_send(self->mcs_layer, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_reverse(char* p, int len)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char temp;
|
||||
|
||||
i = 0;
|
||||
j = len - 1;
|
||||
while (i < j)
|
||||
{
|
||||
temp = p[i];
|
||||
p[i] = p[j];
|
||||
p[j] = temp;
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_rsa_op(char* out, char* in, char* mod, char* exp)
|
||||
{
|
||||
char lexp[64];
|
||||
char lmod[64];
|
||||
char lin[64];
|
||||
char lout[64];
|
||||
int len;
|
||||
|
||||
g_memcpy(lexp, exp, 64);
|
||||
g_memcpy(lmod, mod, 64);
|
||||
g_memcpy(lin, in, 64);
|
||||
xrdp_sec_reverse(lexp, 64);
|
||||
xrdp_sec_reverse(lmod, 64);
|
||||
xrdp_sec_reverse(lin, 64);
|
||||
g_memset(lout, 0, 64);
|
||||
len = g_mod_exp(lout, lin, lmod, lexp);
|
||||
xrdp_sec_reverse(lout, len);
|
||||
g_memcpy(out, lout, 64);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_hash_48(char* out, char* in, char* salt1, char* salt2, int salt)
|
||||
{
|
||||
int i;
|
||||
void* sha1_info;
|
||||
void* md5_info;
|
||||
char pad[4];
|
||||
char sha1_sig[20];
|
||||
char md5_sig[16];
|
||||
|
||||
sha1_info = g_sha1_info_create();
|
||||
md5_info = g_md5_info_create();
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
g_memset(pad, salt + i, 4);
|
||||
g_sha1_clear(sha1_info);
|
||||
g_sha1_transform(sha1_info, pad, i + 1);
|
||||
g_sha1_transform(sha1_info, in, 48);
|
||||
g_sha1_transform(sha1_info, salt1, 32);
|
||||
g_sha1_transform(sha1_info, salt2, 32);
|
||||
g_sha1_complete(sha1_info, sha1_sig);
|
||||
g_md5_clear(md5_info);
|
||||
g_md5_transform(md5_info, in, 48);
|
||||
g_md5_transform(md5_info, sha1_sig, 20);
|
||||
g_md5_complete(md5_info, md5_sig);
|
||||
g_memcpy(out + i * 16, md5_sig, 16);
|
||||
}
|
||||
g_sha1_info_delete(sha1_info);
|
||||
g_md5_info_delete(md5_info);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_hash_16(char* out, char* in, char* salt1, char* salt2)
|
||||
{
|
||||
void* md5_info;
|
||||
|
||||
md5_info = g_md5_info_create();
|
||||
g_md5_clear(md5_info);
|
||||
g_md5_transform(md5_info, in, 16);
|
||||
g_md5_transform(md5_info, salt1, 32);
|
||||
g_md5_transform(md5_info, salt2, 32);
|
||||
g_md5_complete(md5_info, out);
|
||||
g_md5_info_delete(md5_info);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_sec_establish_keys(struct xrdp_sec* self)
|
||||
{
|
||||
char session_key[48];
|
||||
char temp_hash[48];
|
||||
char input[48];
|
||||
|
||||
g_memcpy(input, self->client_random, 24);
|
||||
g_memcpy(input + 24, self->server_random, 24);
|
||||
xrdp_sec_hash_48(temp_hash, input, self->client_random,
|
||||
self->server_random, 65);
|
||||
xrdp_sec_hash_48(session_key, temp_hash, self->client_random,
|
||||
self->server_random, 88);
|
||||
g_memcpy(self->sign_key, session_key, 16);
|
||||
xrdp_sec_hash_16(self->encrypt_key, session_key + 16, self->client_random,
|
||||
self->server_random);
|
||||
xrdp_sec_hash_16(self->decrypt_key, session_key + 32, self->client_random,
|
||||
self->server_random);
|
||||
if (self->rc4_key_size == 1)
|
||||
{
|
||||
xrdp_sec_make_40bit(self->sign_key);
|
||||
xrdp_sec_make_40bit(self->encrypt_key);
|
||||
xrdp_sec_make_40bit(self->decrypt_key);
|
||||
self->rc4_key_len = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->rc4_key_len = 16;
|
||||
}
|
||||
g_memcpy(self->decrypt_update_key, self->decrypt_key, 16);
|
||||
g_memcpy(self->encrypt_update_key, self->encrypt_key, 16);
|
||||
g_rc4_set_key(self->decrypt_rc4_info, self->decrypt_key, self->rc4_key_len);
|
||||
g_rc4_set_key(self->encrypt_rc4_info, self->encrypt_key, self->rc4_key_len);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_sec_recv(struct xrdp_sec* self, struct stream* s, int* chan)
|
||||
{
|
||||
int flags;
|
||||
int len;
|
||||
|
||||
DEBUG((" in xrdp_sec_recv\n\r"));
|
||||
if (xrdp_mcs_recv(self->mcs_layer, s, chan) != 0)
|
||||
{
|
||||
DEBUG((" out xrdp_sec_recv error\n\r"));
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, flags);
|
||||
DEBUG((" in xrdp_sec_recv flags $%x\n\r", flags));
|
||||
if (flags & SEC_ENCRYPT) /* 0x08 */
|
||||
{
|
||||
in_uint8s(s, 8); /* signature */
|
||||
xrdp_sec_decrypt(self, s->p, s->end - s->p);
|
||||
}
|
||||
if (flags & SEC_CLIENT_RANDOM) /* 0x01 */
|
||||
{
|
||||
in_uint32_le(s, len);
|
||||
in_uint8a(s, self->client_crypt_random, 64);
|
||||
xrdp_sec_rsa_op(self->client_random, self->client_crypt_random,
|
||||
pub_mod, pri_exp);
|
||||
xrdp_sec_establish_keys(self);
|
||||
*chan = 1; /* just set a non existing channel and exit */
|
||||
return 0;
|
||||
}
|
||||
if (flags & SEC_LOGON_INFO) /* 0x40 */
|
||||
{
|
||||
if (xrdp_sec_process_logon_info(self, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xrdp_sec_send_lic_initial(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
*chan = 1; /* just set a non existing channel and exit */
|
||||
return 0;
|
||||
}
|
||||
if (flags & SEC_LICENCE_NEG) /* 0x80 */
|
||||
{
|
||||
if (xrdp_sec_send_lic_response(self) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return -1; /* special error that means send demand active */
|
||||
}
|
||||
DEBUG((" out xrdp_sec_recv error\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
/* TODO needs outgoing encryption */
|
||||
int xrdp_sec_send(struct xrdp_sec* self, struct stream* s, int flags)
|
||||
{
|
||||
DEBUG((" in xrdp_sec_send\n\r"));
|
||||
s_pop_layer(s, sec_hdr);
|
||||
out_uint32_le(s, flags);
|
||||
if (xrdp_mcs_send(self->mcs_layer, s) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" out xrdp_sec_send\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* prepare server mcs data to send in mcs layer */
|
||||
void xrdp_sec_out_mcs_data(struct xrdp_sec* self)
|
||||
{
|
||||
struct stream* p;
|
||||
|
||||
p = &self->server_mcs_data;
|
||||
init_stream(p, 512);
|
||||
out_uint16_be(p, 5);
|
||||
out_uint16_be(p, 0x14);
|
||||
out_uint8(p, 0x7c);
|
||||
out_uint16_be(p, 1);
|
||||
out_uint8(p, 0x2a);
|
||||
out_uint8(p, 0x14);
|
||||
out_uint8(p, 0x76);
|
||||
out_uint8(p, 0x0a);
|
||||
out_uint8(p, 1);
|
||||
out_uint8(p, 1);
|
||||
out_uint8(p, 0);
|
||||
out_uint16_le(p, 0xc001);
|
||||
out_uint8(p, 0);
|
||||
out_uint8(p, 0x4d); /* M */
|
||||
out_uint8(p, 0x63); /* c */
|
||||
out_uint8(p, 0x44); /* D */
|
||||
out_uint8(p, 0x6e); /* n */
|
||||
out_uint16_be(p, 0x80fc);
|
||||
out_uint16_le(p, SEC_TAG_SRV_INFO);
|
||||
out_uint16_le(p, 8); /* len */
|
||||
out_uint8(p, 4); /* 4 = rdp5 1 = rdp4 */
|
||||
out_uint8(p, 0);
|
||||
out_uint8(p, 8);
|
||||
out_uint8(p, 0);
|
||||
out_uint16_le(p, SEC_TAG_SRV_CHANNELS);
|
||||
out_uint16_le(p, 8); /* len */
|
||||
out_uint8(p, 0xeb);
|
||||
out_uint8(p, 3);
|
||||
out_uint8(p, 0);
|
||||
out_uint8(p, 0);
|
||||
out_uint16_le(p, SEC_TAG_SRV_CRYPT);
|
||||
out_uint16_le(p, 0x00ec); /* len is 236 */
|
||||
out_uint32_le(p, 1); /* key len 1 = 40 bit 2 = 128 bit */
|
||||
out_uint32_le(p, 1); /* crypt level 1 = low 2 = medium 3 = high */
|
||||
out_uint32_le(p, 32); /* 32 bytes random len */
|
||||
out_uint32_le(p, 0xb8); /* 184 bytes rsa info(certificate) len */
|
||||
out_uint8a(p, self->server_random, 32);
|
||||
/* here to end is certificate */
|
||||
/* HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ */
|
||||
/* TermService\Parameters\Certificate */
|
||||
out_uint32_le(p, 1);
|
||||
out_uint32_le(p, 1);
|
||||
out_uint32_le(p, 1);
|
||||
out_uint16_le(p, SEC_TAG_PUBKEY);
|
||||
out_uint16_le(p, 0x005c); /* 92 bytes length of SEC_TAG_PUBKEY */
|
||||
out_uint32_le(p, SEC_RSA_MAGIC);
|
||||
out_uint32_le(p, 0x48); /* 72 bytes modulus len */
|
||||
out_uint32_be(p, 0x00020000);
|
||||
out_uint32_be(p, 0x3f000000);
|
||||
out_uint8a(p, pub_exp, 4); /* pub exp */
|
||||
out_uint8a(p, pub_mod, 64); /* pub mod */
|
||||
out_uint8s(p, 8); /* pad */
|
||||
out_uint16_le(p, SEC_TAG_KEYSIG);
|
||||
out_uint16_le(p, 72); /* len */
|
||||
out_uint8a(p, pub_sig, 64); /* pub sig */
|
||||
out_uint8s(p, 8); /* pad */
|
||||
/* end certificate */
|
||||
s_mark_end(p);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_sec_incoming(struct xrdp_sec* self)
|
||||
{
|
||||
DEBUG(("in xrdp_sec_incoming\n\r"));
|
||||
xrdp_sec_out_mcs_data(self);
|
||||
if (xrdp_mcs_incoming(self->mcs_layer) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#ifdef XRDP_DEBUG
|
||||
g_printf("client mcs data received\n\r");
|
||||
g_hexdump(self->client_mcs_data.data,
|
||||
self->client_mcs_data.end - self->client_mcs_data.data);
|
||||
g_printf("server mcs data sent\n\r");
|
||||
g_hexdump(self->server_mcs_data.data,
|
||||
self->server_mcs_data.end - self->server_mcs_data.data);
|
||||
#endif
|
||||
DEBUG(("out xrdp_sec_incoming\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_sec_disconnect(struct xrdp_sec* self)
|
||||
{
|
||||
return xrdp_mcs_disconnect(self->mcs_layer);
|
||||
}
|
150
xrdp/xrdp_tcp.c
150
xrdp/xrdp_tcp.c
@ -1,150 +0,0 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2005
|
||||
|
||||
tcp layer
|
||||
|
||||
*/
|
||||
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_tcp* xrdp_tcp_create(struct xrdp_iso* owner, int sck)
|
||||
{
|
||||
struct xrdp_tcp* self;
|
||||
|
||||
self = (struct xrdp_tcp*)g_malloc(sizeof(struct xrdp_tcp), 1);
|
||||
self->iso_layer = owner;
|
||||
self->sck = sck;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_tcp_delete(struct xrdp_tcp* self)
|
||||
{
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* get out stream ready for data */
|
||||
/* returns error */
|
||||
int xrdp_tcp_init(struct xrdp_tcp* self, struct stream* s)
|
||||
{
|
||||
init_stream(s, 8192);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len)
|
||||
{
|
||||
int rcvd;
|
||||
|
||||
if (self->sck_closed)
|
||||
{
|
||||
DEBUG((" in xrdp_tcp_recv, sck closed\n\r"));
|
||||
return 1;
|
||||
}
|
||||
DEBUG((" in xrdp_tcp_recv, gota get %d bytes\n\r", len));
|
||||
init_stream(s, len);
|
||||
while (len > 0)
|
||||
{
|
||||
if (g_is_term())
|
||||
{
|
||||
DEBUG((" out xrdp_tcp_recv, g_is_term is true\n\r"));
|
||||
return 1;
|
||||
}
|
||||
rcvd = g_tcp_recv(self->sck, s->end, len, 0);
|
||||
if (rcvd == -1)
|
||||
{
|
||||
if (g_tcp_last_error_would_block(self->sck))
|
||||
{
|
||||
g_sleep(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->sck_closed = 1;
|
||||
DEBUG((" error = -1 in xrdp_tcp_recv socket %d\n\r", self->sck));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (rcvd == 0)
|
||||
{
|
||||
self->sck_closed = 1;
|
||||
DEBUG((" error = 0 in xrdp_tcp_recv socket %d\n\r", self->sck));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->end += rcvd;
|
||||
len -= rcvd;
|
||||
}
|
||||
}
|
||||
DEBUG((" out xrdp_tcp_recv\n\r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s)
|
||||
{
|
||||
int len;
|
||||
int total;
|
||||
int sent;
|
||||
|
||||
if (self->sck_closed)
|
||||
{
|
||||
DEBUG((" in xrdp_tcp_send, sck closed\n\r"));
|
||||
return 1;
|
||||
}
|
||||
len = s->end - s->data;
|
||||
DEBUG((" in xrdp_tcp_send, gota send %d bytes\n\r", len));
|
||||
total = 0;
|
||||
while (total < len)
|
||||
{
|
||||
if (g_is_term())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
sent = g_tcp_send(self->sck, s->data + total, len - total, 0);
|
||||
if (sent == -1)
|
||||
{
|
||||
if (g_tcp_last_error_would_block(self->sck))
|
||||
{
|
||||
g_sleep(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->sck_closed = 1;
|
||||
DEBUG((" error = -1 in xrdp_tcp_send socket %d\n\r", self->sck));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (sent == 0)
|
||||
{
|
||||
self->sck_closed = 1;
|
||||
DEBUG((" error = 0 in xrdp_tcp_send socket %d\n\r", self->sck));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
total = total + sent;
|
||||
}
|
||||
}
|
||||
DEBUG((" out xrdp_tcp_send, sent %d bytes ok\n\r", len));
|
||||
return 0;
|
||||
}
|
@ -27,7 +27,8 @@ struct xrdp_mod
|
||||
/* client functions */
|
||||
int (*mod_start)(struct xrdp_mod* v, int w, int h, int bpp);
|
||||
int (*mod_connect)(struct xrdp_mod* v);
|
||||
int (*mod_event)(struct xrdp_mod* v, int msg, int param1, int param2);
|
||||
int (*mod_event)(struct xrdp_mod* v, int msg, long param1, long param2,
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct xrdp_mod* v);
|
||||
int (*mod_end)(struct xrdp_mod* v);
|
||||
int (*mod_set_param)(struct xrdp_mod* v, char* name, char* value);
|
||||
@ -51,13 +52,6 @@ struct xrdp_mod
|
||||
int sck;
|
||||
};
|
||||
|
||||
/* for memory debugging */
|
||||
struct xrdp_mem
|
||||
{
|
||||
int size;
|
||||
int id;
|
||||
};
|
||||
|
||||
/* header for bmp file */
|
||||
struct xrdp_bmp_header
|
||||
{
|
||||
@ -74,219 +68,6 @@ struct xrdp_bmp_header
|
||||
int clr_important;
|
||||
};
|
||||
|
||||
/* list */
|
||||
struct xrdp_list
|
||||
{
|
||||
long* items;
|
||||
int count;
|
||||
int alloc_size;
|
||||
int grow_by;
|
||||
int auto_free;
|
||||
};
|
||||
|
||||
/* rect */
|
||||
struct xrdp_rect
|
||||
{
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
};
|
||||
|
||||
/* bounds */
|
||||
struct xrdp_bounds
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int cx;
|
||||
int cy;
|
||||
};
|
||||
|
||||
/* brush */
|
||||
struct xrdp_brush
|
||||
{
|
||||
int x_orgin;
|
||||
int y_orgin;
|
||||
int style;
|
||||
char pattern[8];
|
||||
};
|
||||
|
||||
/* pen */
|
||||
struct xrdp_pen
|
||||
{
|
||||
int style;
|
||||
int width;
|
||||
int color;
|
||||
};
|
||||
|
||||
/* tcp */
|
||||
struct xrdp_tcp
|
||||
{
|
||||
int sck;
|
||||
int sck_closed;
|
||||
struct xrdp_iso* iso_layer; /* owner */
|
||||
};
|
||||
|
||||
/* iso */
|
||||
struct xrdp_iso
|
||||
{
|
||||
struct xrdp_mcs* mcs_layer; /* owner */
|
||||
struct xrdp_tcp* tcp_layer;
|
||||
};
|
||||
|
||||
/* mcs */
|
||||
struct xrdp_mcs
|
||||
{
|
||||
struct xrdp_sec* sec_layer; /* owner */
|
||||
struct xrdp_iso* iso_layer;
|
||||
int userid;
|
||||
int chanid;
|
||||
struct stream* client_mcs_data;
|
||||
struct stream* server_mcs_data;
|
||||
};
|
||||
|
||||
/* sec */
|
||||
struct xrdp_sec
|
||||
{
|
||||
struct xrdp_rdp* rdp_layer; /* owner */
|
||||
struct xrdp_mcs* mcs_layer;
|
||||
char server_random[32];
|
||||
char client_random[64];
|
||||
char client_crypt_random[72];
|
||||
struct stream client_mcs_data;
|
||||
struct stream server_mcs_data;
|
||||
int decrypt_use_count;
|
||||
int encrypt_use_count;
|
||||
char decrypt_key[16];
|
||||
char encrypt_key[16];
|
||||
char decrypt_update_key[16];
|
||||
char encrypt_update_key[16];
|
||||
int rc4_key_size;
|
||||
int rc4_key_len;
|
||||
char sign_key[16];
|
||||
void* decrypt_rc4_info;
|
||||
void* encrypt_rc4_info;
|
||||
};
|
||||
|
||||
/* client info */
|
||||
struct xrdp_client_info
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
int cache1_entries;
|
||||
int cache1_size;
|
||||
int cache2_entries;
|
||||
int cache2_size;
|
||||
int cache3_entries;
|
||||
int cache3_size;
|
||||
int pointer_cache_entries;
|
||||
int use_bitmap_comp;
|
||||
int use_bitmap_cache;
|
||||
int op1; /* use smaller bitmap header, todo */
|
||||
int desktop_cache;
|
||||
int use_compact_packets; /* rdp5 smaller packets */
|
||||
};
|
||||
|
||||
/* rdp */
|
||||
struct xrdp_rdp
|
||||
{
|
||||
struct xrdp_process* pro_layer; /* owner */
|
||||
struct xrdp_sec* sec_layer;
|
||||
int share_id;
|
||||
int mcs_channel;
|
||||
int up_and_running;
|
||||
struct xrdp_client_info client_info;
|
||||
};
|
||||
|
||||
/* orders */
|
||||
struct xrdp_orders
|
||||
{
|
||||
struct stream* out_s;
|
||||
struct xrdp_rdp* rdp_layer;
|
||||
struct xrdp_process* pro_layer; /* owner */
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
char* order_count_ptr; /* pointer to count, set when sending */
|
||||
int order_count;
|
||||
int order_level; /* inc for every call to xrdp_orders_init */
|
||||
|
||||
int last_order; /* last order sent */
|
||||
|
||||
int clip_left; /* RDP_ORDER_BOUNDS, RDP_ORDER_LASTBOUNDS */
|
||||
int clip_top;
|
||||
int clip_right;
|
||||
int clip_bottom;
|
||||
|
||||
int rect_x; /* RDP_ORDER_RECT */
|
||||
int rect_y;
|
||||
int rect_cx;
|
||||
int rect_cy;
|
||||
int rect_color;
|
||||
|
||||
int scr_blt_x; /* RDP_ORDER_SCREENBLT */
|
||||
int scr_blt_y;
|
||||
int scr_blt_cx;
|
||||
int scr_blt_cy;
|
||||
int scr_blt_rop;
|
||||
int scr_blt_srcx;
|
||||
int scr_blt_srcy;
|
||||
|
||||
int pat_blt_x; /* RDP_ORDER_PATBLT */
|
||||
int pat_blt_y;
|
||||
int pat_blt_cx;
|
||||
int pat_blt_cy;
|
||||
int pat_blt_rop;
|
||||
int pat_blt_bg_color;
|
||||
int pat_blt_fg_color;
|
||||
struct xrdp_brush pat_blt_brush;
|
||||
|
||||
int dest_blt_x; /* RDP_ORDER_DESTBLT */
|
||||
int dest_blt_y;
|
||||
int dest_blt_cx;
|
||||
int dest_blt_cy;
|
||||
int dest_blt_rop;
|
||||
|
||||
int line_mix_mode; /* RDP_ORDER_LINE */
|
||||
int line_startx;
|
||||
int line_starty;
|
||||
int line_endx;
|
||||
int line_endy;
|
||||
int line_bg_color;
|
||||
int line_rop;
|
||||
struct xrdp_pen line_pen;
|
||||
|
||||
int mem_blt_color_table; /* RDP_ORDER_MEMBLT */
|
||||
int mem_blt_cache_id;
|
||||
int mem_blt_x;
|
||||
int mem_blt_y;
|
||||
int mem_blt_cx;
|
||||
int mem_blt_cy;
|
||||
int mem_blt_rop;
|
||||
int mem_blt_srcx;
|
||||
int mem_blt_srcy;
|
||||
int mem_blt_cache_idx;
|
||||
|
||||
int text_font; /* RDP_ORDER_TEXT2 */
|
||||
int text_flags;
|
||||
int text_unknown;
|
||||
int text_mixmode;
|
||||
int text_fg_color;
|
||||
int text_bg_color;
|
||||
int text_clip_left;
|
||||
int text_clip_top;
|
||||
int text_clip_right;
|
||||
int text_clip_bottom;
|
||||
int text_box_left;
|
||||
int text_box_top;
|
||||
int text_box_right;
|
||||
int text_box_bottom;
|
||||
int text_x;
|
||||
int text_y;
|
||||
int text_len;
|
||||
char* text_data;
|
||||
};
|
||||
|
||||
struct xrdp_palette_item
|
||||
{
|
||||
int stamp;
|
||||
@ -299,20 +80,10 @@ struct xrdp_bitmap_item
|
||||
struct xrdp_bitmap* bitmap;
|
||||
};
|
||||
|
||||
struct xrdp_font_item
|
||||
{
|
||||
int offset;
|
||||
int baseline;
|
||||
int width;
|
||||
int height;
|
||||
int incby;
|
||||
char* data;
|
||||
};
|
||||
|
||||
struct xrdp_char_item
|
||||
{
|
||||
int stamp;
|
||||
struct xrdp_font_item font_item;
|
||||
struct xrdp_font_char font_item;
|
||||
};
|
||||
|
||||
struct xrdp_pointer_item
|
||||
@ -328,7 +99,7 @@ struct xrdp_pointer_item
|
||||
struct xrdp_cache
|
||||
{
|
||||
struct xrdp_wm* wm; /* owner */
|
||||
struct xrdp_orders* orders;
|
||||
struct xrdp_session* session;
|
||||
/* palette */
|
||||
int palette_stamp;
|
||||
struct xrdp_palette_item palette_items[6];
|
||||
@ -356,9 +127,8 @@ struct xrdp_wm
|
||||
{
|
||||
struct xrdp_process* pro_layer; /* owner */
|
||||
struct xrdp_bitmap* screen;
|
||||
struct xrdp_orders* orders;
|
||||
struct xrdp_session* session;
|
||||
struct xrdp_painter* painter;
|
||||
struct xrdp_rdp* rdp_layer;
|
||||
struct xrdp_cache* cache;
|
||||
int palette[256];
|
||||
struct xrdp_bitmap* login_window;
|
||||
@ -406,7 +176,7 @@ struct xrdp_wm
|
||||
/* client info */
|
||||
struct xrdp_client_info* client_info;
|
||||
/* session log */
|
||||
struct xrdp_list* log;
|
||||
struct list* log;
|
||||
struct xrdp_bitmap* log_wnd;
|
||||
};
|
||||
|
||||
@ -417,9 +187,8 @@ struct xrdp_process
|
||||
int sck;
|
||||
int term;
|
||||
struct xrdp_listen* lis_layer; /* owner */
|
||||
struct xrdp_rdp* rdp_layer;
|
||||
struct xrdp_session* session;
|
||||
/* create these when up and running */
|
||||
struct xrdp_orders* orders;
|
||||
struct xrdp_wm* wm;
|
||||
int app_sck;
|
||||
};
|
||||
@ -439,7 +208,7 @@ struct xrdp_listen
|
||||
struct xrdp_region
|
||||
{
|
||||
struct xrdp_wm* wm; /* owner */
|
||||
struct xrdp_list* rects;
|
||||
struct list* rects;
|
||||
};
|
||||
|
||||
/* painter */
|
||||
@ -452,7 +221,7 @@ struct xrdp_painter
|
||||
int bg_color;
|
||||
int fg_color;
|
||||
struct xrdp_brush brush;
|
||||
struct xrdp_orders* orders;
|
||||
struct xrdp_session* session;
|
||||
struct xrdp_wm* wm; /* owner */
|
||||
struct xrdp_font* font;
|
||||
};
|
||||
@ -492,15 +261,15 @@ struct xrdp_bitmap
|
||||
struct xrdp_bitmap* default_button; /* button when enter is pressed */
|
||||
struct xrdp_bitmap* esc_button; /* button when esc is pressed */
|
||||
/* list of child windows */
|
||||
struct xrdp_list* child_list;
|
||||
struct list* child_list;
|
||||
/* for edit */
|
||||
int edit_pos;
|
||||
int password_char;
|
||||
/* for button or combo */
|
||||
int state; /* for button 0 = normal 1 = down */
|
||||
/* for combo */
|
||||
struct xrdp_list* string_list;
|
||||
struct xrdp_list* data_list;
|
||||
struct list* string_list;
|
||||
struct list* data_list;
|
||||
/* for combo or popup */
|
||||
int item_index;
|
||||
/* for popup */
|
||||
@ -514,7 +283,7 @@ struct xrdp_bitmap
|
||||
struct xrdp_font
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_font_item font_items[256];
|
||||
struct xrdp_font_char font_items[256];
|
||||
int color;
|
||||
char name[32];
|
||||
int size;
|
||||
@ -526,6 +295,6 @@ struct xrdp_mod_data
|
||||
{
|
||||
char name[256];
|
||||
char lib[256];
|
||||
struct xrdp_list* names;
|
||||
struct xrdp_list* values;
|
||||
struct list* names;
|
||||
struct list* values;
|
||||
};
|
||||
|
490
xrdp/xrdp_wm.c
490
xrdp/xrdp_wm.c
@ -23,8 +23,9 @@
|
||||
#include "xrdp.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_wm* xrdp_wm_create(struct xrdp_process* owner,
|
||||
struct xrdp_client_info* client_info)
|
||||
struct xrdp_wm* APP_CC
|
||||
xrdp_wm_create(struct xrdp_process* owner,
|
||||
struct xrdp_client_info* client_info)
|
||||
{
|
||||
struct xrdp_wm* self;
|
||||
|
||||
@ -36,17 +37,17 @@ struct xrdp_wm* xrdp_wm_create(struct xrdp_process* owner,
|
||||
WND_TYPE_SCREEN, self);
|
||||
self->screen->wm = self;
|
||||
self->pro_layer = owner;
|
||||
self->orders = owner->orders;
|
||||
self->painter = xrdp_painter_create(self);
|
||||
self->rdp_layer = owner->rdp_layer;
|
||||
self->cache = xrdp_cache_create(self, self->orders, self->client_info);
|
||||
self->log = xrdp_list_create();
|
||||
self->session = owner->session;
|
||||
self->painter = xrdp_painter_create(self, self->session);
|
||||
self->cache = xrdp_cache_create(self, self->session, self->client_info);
|
||||
self->log = list_create();
|
||||
self->log->auto_free = 1;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void xrdp_wm_delete(struct xrdp_wm* self)
|
||||
void APP_CC
|
||||
xrdp_wm_delete(struct xrdp_wm* self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
@ -68,213 +69,30 @@ void xrdp_wm_delete(struct xrdp_wm* self)
|
||||
g_free_library(self->mod_handle);
|
||||
}
|
||||
/* free the log */
|
||||
xrdp_list_delete(self->log);
|
||||
list_delete(self->log);
|
||||
/* free self */
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_send_palette(struct xrdp_wm* self)
|
||||
int APP_CC
|
||||
xrdp_wm_send_palette(struct xrdp_wm* self)
|
||||
{
|
||||
int i;
|
||||
int color;
|
||||
struct stream* s;
|
||||
|
||||
if (self->client_info->bpp > 8)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
xrdp_orders_force_send(self->orders);
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
xrdp_rdp_init_data(self->rdp_layer, s);
|
||||
out_uint16_le(s, RDP_UPDATE_PALETTE);
|
||||
out_uint16_le(s, 0);
|
||||
out_uint16_le(s, 256); /* # of colors */
|
||||
out_uint16_le(s, 0);
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
color = self->palette[i];
|
||||
out_uint8(s, color >> 16);
|
||||
out_uint8(s, color >> 8);
|
||||
out_uint8(s, color);
|
||||
}
|
||||
s_mark_end(s);
|
||||
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_UPDATE);
|
||||
free_stream(s);
|
||||
xrdp_orders_init(self->orders);
|
||||
xrdp_orders_send_palette(self->orders, self->palette, 0);
|
||||
xrdp_orders_send(self->orders);
|
||||
return 0;
|
||||
return libxrdp_send_palette(self->session, self->palette);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
int APP_CC
|
||||
xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy)
|
||||
{
|
||||
int data_size;
|
||||
int line_size;
|
||||
int i;
|
||||
int j;
|
||||
int total_lines;
|
||||
int lines_sending;
|
||||
int Bpp;
|
||||
int e;
|
||||
int bufsize;
|
||||
int total_bufsize;
|
||||
int num_updates;
|
||||
char* p_num_updates;
|
||||
char* p;
|
||||
char* q;
|
||||
struct stream* s;
|
||||
struct stream* temp_s;
|
||||
|
||||
Bpp = (bitmap->bpp + 7) / 8;
|
||||
e = bitmap->width % 4;
|
||||
if (e != 0)
|
||||
{
|
||||
e = 4 - e;
|
||||
}
|
||||
line_size = bitmap->width * Bpp;
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
if (self->client_info->use_bitmap_comp)
|
||||
{
|
||||
make_stream(temp_s);
|
||||
init_stream(temp_s, 65536);
|
||||
i = 0;
|
||||
if (cy <= bitmap->height)
|
||||
{
|
||||
i = cy;
|
||||
}
|
||||
while (i > 0)
|
||||
{
|
||||
total_bufsize = 0;
|
||||
num_updates = 0;
|
||||
xrdp_rdp_init_data(self->rdp_layer, s);
|
||||
out_uint16_le(s, RDP_UPDATE_BITMAP);
|
||||
p_num_updates = s->p;
|
||||
out_uint8s(s, 2); /* num_updates set later */
|
||||
do
|
||||
{
|
||||
if (self->client_info->op1)
|
||||
{
|
||||
s_push_layer(s, channel_hdr, 18);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_push_layer(s, channel_hdr, 26);
|
||||
}
|
||||
p = s->p;
|
||||
lines_sending = xrdp_bitmap_compress(bitmap->data, bitmap->width,
|
||||
bitmap->height,
|
||||
s, bitmap->bpp,
|
||||
4096 - total_bufsize,
|
||||
i - 1, temp_s, e);
|
||||
if (lines_sending == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num_updates++;
|
||||
bufsize = s->p - p;
|
||||
total_bufsize += bufsize;
|
||||
i = i - lines_sending;
|
||||
s_mark_end(s);
|
||||
s_pop_layer(s, channel_hdr);
|
||||
out_uint16_le(s, x); /* left */
|
||||
out_uint16_le(s, y + i); /* top */
|
||||
out_uint16_le(s, (x + cx) - 1); /* right */
|
||||
out_uint16_le(s, (y + i + lines_sending) - 1); /* bottom */
|
||||
out_uint16_le(s, bitmap->width + e); /* width */
|
||||
out_uint16_le(s, lines_sending); /* height */
|
||||
out_uint16_le(s, bitmap->bpp); /* bpp */
|
||||
if (self->client_info->op1)
|
||||
{
|
||||
out_uint16_le(s, 0x401); /* compress */
|
||||
out_uint16_le(s, bufsize); /* compressed size */
|
||||
j = (bitmap->width + e) * Bpp;
|
||||
j = j * lines_sending;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_uint16_le(s, 0x1); /* compress */
|
||||
out_uint16_le(s, bufsize + 8);
|
||||
out_uint8s(s, 2); /* pad */
|
||||
out_uint16_le(s, bufsize); /* compressed size */
|
||||
j = (bitmap->width + e) * Bpp;
|
||||
out_uint16_le(s, j); /* line size */
|
||||
j = j * lines_sending;
|
||||
out_uint16_le(s, j); /* final size */
|
||||
}
|
||||
if (j > 32768)
|
||||
{
|
||||
g_printf("error, decompressed size too big, its %d\n\r", j);
|
||||
}
|
||||
if (bufsize > 8192)
|
||||
{
|
||||
g_printf("error, compressed size too big, its %d\n\r", bufsize);
|
||||
}
|
||||
s->p = s->end;
|
||||
} while (total_bufsize < 4096 && i > 0);
|
||||
p_num_updates[0] = num_updates;
|
||||
p_num_updates[1] = num_updates >> 8;
|
||||
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_UPDATE);
|
||||
if (total_bufsize > 8192)
|
||||
{
|
||||
g_printf("error, total compressed size too big, its %d\n\r",
|
||||
total_bufsize);
|
||||
}
|
||||
}
|
||||
free_stream(temp_s);
|
||||
}
|
||||
else
|
||||
{
|
||||
lines_sending = 0;
|
||||
data_size = bitmap->width * bitmap->height * Bpp;
|
||||
total_lines = bitmap->height;
|
||||
i = 0;
|
||||
p = bitmap->data;
|
||||
if (line_size > 0 && total_lines > 0)
|
||||
{
|
||||
while (i < total_lines)
|
||||
{
|
||||
lines_sending = 4096 / (line_size + e * Bpp);
|
||||
if (i + lines_sending > total_lines)
|
||||
{
|
||||
lines_sending = total_lines - i;
|
||||
}
|
||||
p = p + line_size * lines_sending;
|
||||
xrdp_rdp_init_data(self->rdp_layer, s);
|
||||
out_uint16_le(s, RDP_UPDATE_BITMAP);
|
||||
out_uint16_le(s, 1); /* num updates */
|
||||
out_uint16_le(s, x);
|
||||
out_uint16_le(s, y + i);
|
||||
out_uint16_le(s, (x + cx) - 1);
|
||||
out_uint16_le(s, (y + i + lines_sending) - 1);
|
||||
out_uint16_le(s, bitmap->width + e);
|
||||
out_uint16_le(s, lines_sending);
|
||||
out_uint16_le(s, bitmap->bpp); /* bpp */
|
||||
out_uint16_le(s, 0); /* compress */
|
||||
out_uint16_le(s, (line_size + e * Bpp) * lines_sending); /* bufsize */
|
||||
q = p;
|
||||
for (j = 0; j < lines_sending; j++)
|
||||
{
|
||||
q = q - line_size;
|
||||
out_uint8a(s, q, line_size)
|
||||
out_uint8s(s, e * Bpp);
|
||||
}
|
||||
s_mark_end(s);
|
||||
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_UPDATE);
|
||||
i = i + lines_sending;
|
||||
}
|
||||
}
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
return libxrdp_send_bitmap(self->session, bitmap->width, bitmap->height,
|
||||
bitmap->bpp, bitmap->data, x, y, cx, cy);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd)
|
||||
int APP_CC
|
||||
xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd)
|
||||
{
|
||||
struct xrdp_bitmap* focus_out_control;
|
||||
struct xrdp_bitmap* focus_in_control;
|
||||
@ -306,7 +124,8 @@ int xrdp_wm_set_focused(struct xrdp_wm* self, struct xrdp_bitmap* wnd)
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
int xrdp_wm_get_pixel(char* data, int x, int y, int width, int bpp)
|
||||
int APP_CC
|
||||
xrdp_wm_get_pixel(char* data, int x, int y, int width, int bpp)
|
||||
{
|
||||
int start;
|
||||
int shift;
|
||||
@ -336,9 +155,9 @@ int xrdp_wm_get_pixel(char* data, int x, int y, int width, int bpp)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y)
|
||||
int APP_CC
|
||||
xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y)
|
||||
{
|
||||
|
||||
struct xrdp_pointer_item pointer_item;
|
||||
|
||||
g_memset(&pointer_item, 0, sizeof(struct xrdp_pointer_item));
|
||||
@ -351,8 +170,9 @@ int xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_load_pointer(struct xrdp_wm* self, char* file_name, char* data,
|
||||
char* mask, int* x, int* y)
|
||||
int APP_CC
|
||||
xrdp_wm_load_pointer(struct xrdp_wm* self, char* file_name, char* data,
|
||||
char* mask, int* x, int* y)
|
||||
{
|
||||
int fd;
|
||||
int bpp;
|
||||
@ -423,67 +243,24 @@ int xrdp_wm_load_pointer(struct xrdp_wm* self, char* file_name, char* data,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
|
||||
char* data, char* mask, int x, int y)
|
||||
int APP_CC
|
||||
xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
|
||||
char* data, char* mask, int x, int y)
|
||||
{
|
||||
struct stream* s;
|
||||
char* p;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
xrdp_rdp_init_data(self->rdp_layer, s);
|
||||
out_uint16_le(s, RDP_POINTER_COLOR);
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
out_uint16_le(s, cache_idx); /* cache_idx */
|
||||
out_uint16_le(s, x);
|
||||
out_uint16_le(s, y);
|
||||
out_uint16_le(s, 32);
|
||||
out_uint16_le(s, 32);
|
||||
out_uint16_le(s, 128);
|
||||
out_uint16_le(s, 3072);
|
||||
p = data;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
for (j = 0; j < 32; j++)
|
||||
{
|
||||
out_uint8(s, *p);
|
||||
p++;
|
||||
out_uint8(s, *p);
|
||||
p++;
|
||||
out_uint8(s, *p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
out_uint8a(s, mask, 128); /* mask */
|
||||
s_mark_end(s);
|
||||
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_POINTER);
|
||||
free_stream(s);
|
||||
return 0;
|
||||
return libxrdp_send_pointer(self->session, cache_idx, data, mask, x, y);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx)
|
||||
int APP_CC
|
||||
xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
xrdp_rdp_init_data(self->rdp_layer, s);
|
||||
out_uint16_le(s, RDP_POINTER_CACHED);
|
||||
out_uint16_le(s, 0); /* pad */
|
||||
out_uint16_le(s, cache_idx); /* cache_idx */
|
||||
s_mark_end(s);
|
||||
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_POINTER);
|
||||
free_stream(s);
|
||||
return 0;
|
||||
return libxrdp_set_pointer(self->session, cache_idx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_init(struct xrdp_wm* self)
|
||||
int APP_CC
|
||||
xrdp_wm_init(struct xrdp_wm* self)
|
||||
{
|
||||
#ifndef XRDP_LIB /* if lib, dodn't create login screen */
|
||||
int bindex;
|
||||
int gindex;
|
||||
int rindex;
|
||||
@ -563,16 +340,16 @@ int xrdp_wm_init(struct xrdp_wm* self)
|
||||
|
||||
xrdp_wm_set_focused(self, self->login_window);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns the number for rects visible for an area relative to a drawable */
|
||||
/* putting the rects in region */
|
||||
int xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy,
|
||||
struct xrdp_region* region, int clip_children)
|
||||
int APP_CC
|
||||
xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
int x, int y, int cx, int cy,
|
||||
struct xrdp_region* region, int clip_children)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_bitmap* p;
|
||||
@ -597,7 +374,7 @@ int xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
/* loop through all windows in z order */
|
||||
for (i = 0; i < self->screen->child_list->count; i++)
|
||||
{
|
||||
p = (struct xrdp_bitmap*)xrdp_list_get_item(self->screen->child_list, i);
|
||||
p = (struct xrdp_bitmap*)list_get_item(self->screen->child_list, i);
|
||||
if (p == bitmap || p == bitmap->parent)
|
||||
{
|
||||
return 0;
|
||||
@ -611,8 +388,9 @@ int xrdp_wm_get_vis_region(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
|
||||
|
||||
/*****************************************************************************/
|
||||
/* return the window at x, y on the screen */
|
||||
struct xrdp_bitmap* xrdp_wm_at_pos(struct xrdp_bitmap* wnd, int x, int y,
|
||||
struct xrdp_bitmap** wnd1)
|
||||
static struct xrdp_bitmap* APP_CC
|
||||
xrdp_wm_at_pos(struct xrdp_bitmap* wnd, int x, int y,
|
||||
struct xrdp_bitmap** wnd1)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_bitmap* p;
|
||||
@ -621,7 +399,7 @@ struct xrdp_bitmap* xrdp_wm_at_pos(struct xrdp_bitmap* wnd, int x, int y,
|
||||
/* loop through all windows in z order */
|
||||
for (i = 0; i < wnd->child_list->count; i++)
|
||||
{
|
||||
p = (struct xrdp_bitmap*)xrdp_list_get_item(wnd->child_list, i);
|
||||
p = (struct xrdp_bitmap*)list_get_item(wnd->child_list, i);
|
||||
if (x >= p->left && y >= p->top && x < p->left + p->width &&
|
||||
y < p->top + p->height)
|
||||
{
|
||||
@ -644,7 +422,8 @@ struct xrdp_bitmap* xrdp_wm_at_pos(struct xrdp_bitmap* wnd, int x, int y,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_xor_pat(struct xrdp_wm* self, int x, int y, int cx, int cy)
|
||||
static int APP_CC
|
||||
xrdp_wm_xor_pat(struct xrdp_wm* self, int x, int y, int cx, int cy)
|
||||
{
|
||||
self->painter->clip_children = 0;
|
||||
self->painter->rop = 0x5a;
|
||||
@ -681,10 +460,11 @@ int xrdp_wm_xor_pat(struct xrdp_wm* self, int x, int y, int cx, int cy)
|
||||
/*****************************************************************************/
|
||||
/* this don't are about nothing, just copy the bits */
|
||||
/* no clipping rects, no windows in the way, nothing */
|
||||
int xrdp_wm_bitblt(struct xrdp_wm* self,
|
||||
struct xrdp_bitmap* dst, int dx, int dy,
|
||||
struct xrdp_bitmap* src, int sx, int sy,
|
||||
int sw, int sh, int rop)
|
||||
int APP_CC
|
||||
xrdp_wm_bitblt(struct xrdp_wm* self,
|
||||
struct xrdp_bitmap* dst, int dx, int dy,
|
||||
struct xrdp_bitmap* src, int sx, int sy,
|
||||
int sw, int sh, int rop)
|
||||
{
|
||||
// int i;
|
||||
// int line_size;
|
||||
@ -706,9 +486,9 @@ int xrdp_wm_bitblt(struct xrdp_wm* self,
|
||||
// s += src->width * Bpp;
|
||||
// d += dst->width * Bpp;
|
||||
// }
|
||||
xrdp_orders_init(self->orders);
|
||||
xrdp_orders_screen_blt(self->orders, dx, dy, sw, sh, sx, sy, rop, 0);
|
||||
xrdp_orders_send(self->orders);
|
||||
libxrdp_orders_init(self->session);
|
||||
libxrdp_orders_screen_blt(self->session, dx, dy, sw, sh, sx, sy, rop, 0);
|
||||
libxrdp_orders_send(self->session);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -716,8 +496,9 @@ int xrdp_wm_bitblt(struct xrdp_wm* self,
|
||||
/*****************************************************************************/
|
||||
/* return true is rect is totaly exposed going in reverse z order */
|
||||
/* from wnd up */
|
||||
int xrdp_wm_is_rect_vis(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
struct xrdp_rect* rect)
|
||||
int APP_CC
|
||||
xrdp_wm_is_rect_vis(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
struct xrdp_rect* rect)
|
||||
{
|
||||
struct xrdp_rect wnd_rect;
|
||||
struct xrdp_bitmap* b;
|
||||
@ -741,11 +522,11 @@ int xrdp_wm_is_rect_vis(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = xrdp_list_index_of(self->screen->child_list, (long)wnd);
|
||||
i = list_index_of(self->screen->child_list, (long)wnd);
|
||||
i--;
|
||||
while (i >= 0)
|
||||
{
|
||||
b = (struct xrdp_bitmap*)xrdp_list_get_item(self->screen->child_list, i);
|
||||
b = (struct xrdp_bitmap*)list_get_item(self->screen->child_list, i);
|
||||
MAKERECT(wnd_rect, b->left, b->top, b->width, b->height);
|
||||
if (rect_intersect(rect, &wnd_rect, 0))
|
||||
{
|
||||
@ -757,8 +538,9 @@ int xrdp_wm_is_rect_vis(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_move_window(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
int dx, int dy)
|
||||
int APP_CC
|
||||
xrdp_wm_move_window(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
int dx, int dy)
|
||||
{
|
||||
struct xrdp_rect rect1;
|
||||
struct xrdp_rect rect2;
|
||||
@ -798,7 +580,8 @@ int xrdp_wm_move_window(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y)
|
||||
int APP_CC
|
||||
xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y)
|
||||
{
|
||||
struct xrdp_bitmap* b;
|
||||
int boxx;
|
||||
@ -856,7 +639,7 @@ int xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y)
|
||||
{
|
||||
if (self->mod->mod_event != 0)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_MOUSEMOVE, x, y);
|
||||
self->mod->mod_event(self->mod, WM_MOUSEMOVE, x, y, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -898,7 +681,8 @@ int xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_clear_popup(struct xrdp_wm* self)
|
||||
static int APP_CC
|
||||
xrdp_wm_clear_popup(struct xrdp_wm* self)
|
||||
{
|
||||
int i;
|
||||
struct xrdp_rect rect;
|
||||
@ -908,8 +692,8 @@ int xrdp_wm_clear_popup(struct xrdp_wm* self)
|
||||
if (self->popup_wnd != 0)
|
||||
{
|
||||
//b = self->popup_wnd->popped_from;
|
||||
i = xrdp_list_index_of(self->screen->child_list, (long)self->popup_wnd);
|
||||
xrdp_list_remove_item(self->screen->child_list, i);
|
||||
i = list_index_of(self->screen->child_list, (long)self->popup_wnd);
|
||||
list_remove_item(self->screen->child_list, i);
|
||||
MAKERECT(rect, self->popup_wnd->left, self->popup_wnd->top,
|
||||
self->popup_wnd->width, self->popup_wnd->height);
|
||||
xrdp_bitmap_invalidate(self->screen, &rect);
|
||||
@ -920,7 +704,8 @@ int xrdp_wm_clear_popup(struct xrdp_wm* self)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
|
||||
int APP_CC
|
||||
xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
|
||||
{
|
||||
struct xrdp_bitmap* control;
|
||||
struct xrdp_bitmap* focus_out_control;
|
||||
@ -979,41 +764,41 @@ int xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
|
||||
{
|
||||
if (but == 1 && down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_LBUTTONDOWN, x, y);
|
||||
self->mod->mod_event(self->mod, WM_LBUTTONDOWN, x, y, 0, 0);
|
||||
}
|
||||
else if (but == 1 && !down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_LBUTTONUP, x, y);
|
||||
self->mod->mod_event(self->mod, WM_LBUTTONUP, x, y, 0, 0);
|
||||
}
|
||||
if (but == 2 && down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_RBUTTONDOWN, x, y);
|
||||
self->mod->mod_event(self->mod, WM_RBUTTONDOWN, x, y, 0, 0);
|
||||
}
|
||||
else if (but == 2 && !down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_RBUTTONUP, x, y);
|
||||
self->mod->mod_event(self->mod, WM_RBUTTONUP, x, y, 0, 0);
|
||||
}
|
||||
if (but == 3 && down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_BUTTON3DOWN, x, y);
|
||||
self->mod->mod_event(self->mod, WM_BUTTON3DOWN, x, y, 0, 0);
|
||||
}
|
||||
else if (but == 3 && !down)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_BUTTON3UP, x, y);
|
||||
self->mod->mod_event(self->mod, WM_BUTTON3UP, x, y, 0, 0);
|
||||
}
|
||||
if (but == 4)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_BUTTON4DOWN,
|
||||
self->mouse_x, self->mouse_y);
|
||||
self->mouse_x, self->mouse_y, 0, 0);
|
||||
self->mod->mod_event(self->mod, WM_BUTTON4UP,
|
||||
self->mouse_x, self->mouse_y);
|
||||
self->mouse_x, self->mouse_y, 0, 0);
|
||||
}
|
||||
if (but == 5)
|
||||
{
|
||||
self->mod->mod_event(self->mod, WM_BUTTON5DOWN,
|
||||
self->mouse_x, self->mouse_y);
|
||||
self->mouse_x, self->mouse_y, 0, 0);
|
||||
self->mod->mod_event(self->mod, WM_BUTTON5UP,
|
||||
self->mouse_x, self->mouse_y);
|
||||
self->mouse_x, self->mouse_y, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1126,7 +911,8 @@ int xrdp_wm_mouse_click(struct xrdp_wm* self, int x, int y, int but, int down)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
|
||||
int APP_CC
|
||||
xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
|
||||
{
|
||||
int msg;
|
||||
char c;
|
||||
@ -1163,11 +949,11 @@ int xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
|
||||
self->scroll_lock);
|
||||
if (c != 0)
|
||||
{
|
||||
self->mod->mod_event(self->mod, msg, c, 0xffff);
|
||||
self->mod->mod_event(self->mod, msg, c, 0xffff, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->mod->mod_event(self->mod, msg, scan_code, device_flags);
|
||||
self->mod->mod_event(self->mod, msg, scan_code, device_flags, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1181,7 +967,8 @@ int xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* happens when client gets focus and sends key modifier info */
|
||||
int xrdp_wm_key_sync(struct xrdp_wm* self, int device_flags, int key_flags)
|
||||
int APP_CC
|
||||
xrdp_wm_key_sync(struct xrdp_wm* self, int device_flags, int key_flags)
|
||||
{
|
||||
self->num_lock = 0;
|
||||
self->scroll_lock = 0;
|
||||
@ -1202,7 +989,8 @@ int xrdp_wm_key_sync(struct xrdp_wm* self, int device_flags, int key_flags)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control)
|
||||
int APP_CC
|
||||
xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
@ -1226,7 +1014,103 @@ int xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control)
|
||||
self->popup_wnd->left = x;
|
||||
self->popup_wnd->top = y + control->height;
|
||||
self->popup_wnd->item_index = control->item_index;
|
||||
xrdp_list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
|
||||
list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
|
||||
xrdp_bitmap_invalidate(self->popup_wnd, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
xrdp_wm_process_input_mouse(struct xrdp_wm* self, int device_flags,
|
||||
int x, int y)
|
||||
{
|
||||
DEBUG(("mouse event flags %4.4x x %d y %d\n\r", device_flags, x, y));
|
||||
if (device_flags & MOUSE_FLAG_MOVE) /* 0x0800 */
|
||||
{
|
||||
xrdp_wm_mouse_move(self->pro_layer->wm, x, y);
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON1) /* 0x1000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 1, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON2) /* 0x2000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 2, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags & MOUSE_FLAG_BUTTON3) /* 0x4000 */
|
||||
{
|
||||
if (device_flags & MOUSE_FLAG_DOWN) /* 0x8000 */
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 3, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, x, y, 3, 0);
|
||||
}
|
||||
}
|
||||
if (device_flags == MOUSE_FLAG_BUTTON4 || /* 0x0280 */
|
||||
device_flags == 0x0278)
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, 0, 0, 4, 0);
|
||||
}
|
||||
if (device_flags == MOUSE_FLAG_BUTTON5 || /* 0x0380 */
|
||||
device_flags == 0x0388)
|
||||
{
|
||||
xrdp_wm_mouse_click(self->pro_layer->wm, 0, 0, 5, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* this is the callbacks comming from libxrdp.so */
|
||||
int
|
||||
callback(long id, int msg, long param1, long param2, long param3, long param4)
|
||||
{
|
||||
int rv;
|
||||
struct xrdp_wm* wm;
|
||||
struct xrdp_rect rect;
|
||||
|
||||
if (id == 0) /* "id" should be "struct xrdp_process*" as long */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
wm = ((struct xrdp_process*)id)->wm;
|
||||
if (wm == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
rv = 0;
|
||||
switch (msg)
|
||||
{
|
||||
case 0: /* RDP_INPUT_SYNCHRONIZE */
|
||||
rv = xrdp_wm_key_sync(wm, param3, param1);
|
||||
break;
|
||||
case 4: /* RDP_INPUT_SCANCODE */
|
||||
rv = xrdp_wm_key(wm, param3, param1);
|
||||
break;
|
||||
case 0x8001: /* RDP_INPUT_MOUSE */
|
||||
rv = xrdp_wm_process_input_mouse(wm, param3, param1, param2);
|
||||
break;
|
||||
case 0x4444: /* invalidate, this is not from RDP_DATA_PDU_INPUT */
|
||||
/* like the rest, its from RDP_PDU_DATA with code 33 */
|
||||
/* its the rdp client asking for a screen update */
|
||||
MAKERECT(rect, param1, param2, param3, param4);
|
||||
rv = xrdp_bitmap_invalidate(wm->screen, &rect);
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user