libfreerdp-core: fix encoding of confirm active pdu

This commit is contained in:
Marc-André Moreau 2011-07-21 20:06:28 -04:00
parent c42cccd9e3
commit 66ddfd5a60
3 changed files with 109 additions and 17 deletions

View File

@ -1540,7 +1540,7 @@ void rdp_write_confirm_active(STREAM* s, rdpSettings* settings)
stream_write_uint32(s, settings->share_id); /* shareId (4 bytes) */
stream_write_uint16(s, 0x03EA); /* originatorId (2 bytes) */
stream_write_uint16(s, sizeof(SOURCE_DESCRIPTOR));/* lengthSourceDescriptor (2 bytes) */
stream_write_uint16(s, lengthSourceDescriptor);/* lengthSourceDescriptor (2 bytes) */
stream_get_mark(s, lm);
stream_seek_uint16(s); /* lengthCombinedCapabilities (2 bytes) */
@ -1581,26 +1581,12 @@ void rdp_write_confirm_active(STREAM* s, rdpSettings* settings)
void rdp_send_confirm_active(rdpRdp* rdp)
{
STREAM* s;
uint8 *bm, *em;
uint16 totalLength;
s = rdp_send_stream_init(rdp);
stream_get_mark(s, bm);
stream_seek(s, RDP_SHARE_CONTROL_HEADER_LENGTH);
s = rdp_pdu_init(rdp);
rdp_write_confirm_active(s, rdp->settings);
stream_get_mark(s, em);
totalLength = (em - bm);
stream_set_mark(s, bm); /* go back to share control header */
rdp_write_share_control_header(s, totalLength, PDU_TYPE_CONFIRM_ACTIVE,
MCS_BASE_CHANNEL_ID + rdp->mcs->user_id);
stream_set_mark(s, em);
rdp_write_header(rdp, s, totalLength);
transport_write(rdp->transport, s);
rdp_send_pdu(rdp, s, PDU_TYPE_CONFIRM_ACTIVE, MCS_BASE_CHANNEL_ID + rdp->mcs->user_id);
}
void rdp_read_deactivate_all(STREAM* s, rdpSettings* settings)

View File

@ -101,6 +101,15 @@ STREAM* rdp_send_stream_init(rdpRdp* rdp)
return s;
}
STREAM* rdp_pdu_init(rdpRdp* rdp)
{
STREAM* s;
s = transport_send_stream_init(rdp->transport, 2048);
stream_seek(s, RDP_PACKET_HEADER_LENGTH);
stream_seek(s, RDP_SHARE_CONTROL_HEADER_LENGTH);
return s;
}
STREAM* rdp_data_pdu_init(rdpRdp* rdp)
{
STREAM* s;
@ -145,6 +154,20 @@ void rdp_send(rdpRdp* rdp, STREAM* s)
transport_write(rdp->transport, s);
}
void rdp_send_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id)
{
int length;
length = stream_get_length(s);
stream_set_pos(s, 0);
rdp_write_header(rdp, s, length);
rdp_write_share_control_header(s, length, PDU_TYPE_DATA, channel_id);
stream_set_pos(s, length);
transport_write(rdp->transport, s);
}
void rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id)
{
int length;

View File

@ -118,6 +118,86 @@ typedef struct rdp_rdp rdpRdp;
#define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES 0x00000008
#define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED 0x0000000A
#define ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER 0x0000000B
#define ERRINFO_LICENSE_INTERNAL 0x00000100
#define ERRINFO_LICENSE_NO_LICENSE_SERVER 0x00000101
#define ERRINFO_LICENSE_NO_LICENSE 0x00000102
#define ERRINFO_LICENSE_BAD_CLIENT_MSG 0x00000103
#define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE 0x00000104
#define ERRINFO_LICENSE_BAD_CLIENT_LICENSE 0x00000105
#define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL 0x00000106
#define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL 0x00000107
#define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION 0x00000108
#define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE 0x00000109
#define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS 0x0000010A
#define ERRINFO_UNKNOWN_DATA_PDU_TYPE 0x000010C9
#define ERRINFO_UNKNOWN_PDU_TYPE 0x000010CA
#define ERRINFO_DATA_PDU_SEQUENCE 0x000010CB
#define ERRINFO_CONTROL_PDU_SEQUENCE 0x000010CD
#define ERRINFO_INVALID_CONTROL_PDU_ACTION 0x000010CE
#define ERRINFO_INVALID_INPUT_PDU_TYPE 0x000010CF
#define ERRINFO_INVALID_INPUT_PDU_MOUSE 0x000010D0
#define ERRINFO_INVALID_REFRESH_RECT_PDU 0x000010D1
#define ERRINFO_CREATE_USER_DATA_FAILED 0x000010D2
#define ERRINFO_CONNECT_FAILED 0x000010D3
#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_SHAREID 0x000010D4
#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR 0x000010D5
#define ERRINFO_PERSISTENT_KEY_PDU_BAD_LENGTH 0x000010DA
#define ERRINFO_PERSISTENT_KEY_PDU_ILLEGAL_FIRST 0x000010DB
#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS 0x000010DC
#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS 0x000010DD
#define ERRINFO_INPUT_PDU_BAD_LENGTH 0x000010DE
#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH 0x000010DF
#define ERRINFO_SECURITY_DATA_TOO_SHORT 0x000010E0
#define ERRINFO_VCHANNEL_DATA_TOO_SHORT 0x000010E1
#define ERRINFO_SHARE_DATA_TOO_SHORT 0x000010E2
#define ERRINFO_BAD_SUPPRESS_OUTPUT_PDU 0x000010E3
#define ERRINFO_CONFIRM_ACTIVE_PDU_TOO_SHORT 0x000010E5
#define ERRINFO_CAPABILITY_SET_TOO_SMALL 0x000010E7
#define ERRINFO_CAPABILITY_SET_TOO_LARGE 0x000010E8
#define ERRINFO_NO_CURSOR_CACHE 0x000010E9
#define ERRINFO_BAD_CAPABILITIES 0x000010EA
#define ERRINFO_VIRTUAL_CHANNEL_DECOMPRESSION 0x000010EC
#define ERRINFO_INVALID_VC_COMPRESSION_TYPE 0x000010ED
#define ERRINFO_INVALID_CHANNEL_ID 0x000010EF
#define ERRINFO_VCHANNELS_TOO_MANY 0x000010F0
#define ERRINFO_REMOTEAPP_NOT_ENABLED 0x000010F3
#define ERRINFO_CACHE_CAP_NOT_SET 0x000010F4
#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2 0x000010F5
#define ERRINFO_OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F6
#define ERRINFO_DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F7
#define ERRINFO_GDI_PLUS_PDU_BAD_LENGTH 0x000010F8
#define ERRINFO_SECURITY_DATA_TOO_SHORT2 0x00001111
#define ERRINFO_SECURITY_DATA_TOO_SHORT3 0x00001112
#define ERRINFO_SECURITY_DATA_TOO_SHORT4 0x00001113
#define ERRINFO_SECURITY_DATA_TOO_SHORT5 0x00001114
#define ERRINFO_SECURITY_DATA_TOO_SHORT6 0x00001115
#define ERRINFO_SECURITY_DATA_TOO_SHORT7 0x00001116
#define ERRINFO_SECURITY_DATA_TOO_SHORT8 0x00001117
#define ERRINFO_SECURITY_DATA_TOO_SHORT9 0x00001118
#define ERRINFO_SECURITY_DATA_TOO_SHORT10 0x00001119
#define ERRINFO_SECURITY_DATA_TOO_SHORT11 0x0000111A
#define ERRINFO_SECURITY_DATA_TOO_SHORT12 0x0000111B
#define ERRINFO_SECURITY_DATA_TOO_SHORT13 0x0000111C
#define ERRINFO_SECURITY_DATA_TOO_SHORT14 0x0000111D
#define ERRINFO_SECURITY_DATA_TOO_SHORT15 0x0000111E
#define ERRINFO_SECURITY_DATA_TOO_SHORT16 0x0000111F
#define ERRINFO_SECURITY_DATA_TOO_SHORT17 0x00001120
#define ERRINFO_SECURITY_DATA_TOO_SHORT18 0x00001121
#define ERRINFO_SECURITY_DATA_TOO_SHORT19 0x00001122
#define ERRINFO_SECURITY_DATA_TOO_SHORT20 0x00001123
#define ERRINFO_SECURITY_DATA_TOO_SHORT21 0x00001124
#define ERRINFO_SECURITY_DATA_TOO_SHORT22 0x00001125
#define ERRINFO_SECURITY_DATA_TOO_SHORT23 0x00001126
#define ERRINFO_BAD_MONITOR_DATA 0x00001129
#define ERRINFO_VC_DECOMPRESSED_REASSEMBLE_FAILED 0x0000112A
#define ERRINFO_VC_DATA_TOO_LONG 0x0000112B
#define ERRINFO_GRAPHICS_MODE_NOT_SUPPORTED 0x0000112D
#define ERRINFO_GRAPHICS_SUBSYSTEM_RESET_FAILED 0x0000112E
#define ERRINFO_UPDATE_SESSION_KEY_FAILED 0x00001191
#define ERRINFO_DECRYPT_FAILED 0x00001192
#define ERRINFO_ENCRYPT_FAILED 0x00001193
#define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH 0x00001194
#define ERRINFO_DECRYPT_FAILED2 0x00001195
struct rdp_rdp
{
@ -142,6 +222,9 @@ void rdp_write_share_data_header(STREAM* s, uint16 length, uint8 type, uint32 sh
STREAM* rdp_send_stream_init(rdpRdp* rdp);
void rdp_write_header(rdpRdp* rdp, STREAM* s, int length);
STREAM* rdp_pdu_init(rdpRdp* rdp);
void rdp_send_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id);
STREAM* rdp_data_pdu_init(rdpRdp* rdp);
void rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id);