Cleanup, add constants.

This commit is contained in:
Michael Jumper 2013-06-21 13:03:11 -07:00
parent c066763ec4
commit 8c8779937c
2 changed files with 71 additions and 14 deletions

View File

@ -97,30 +97,34 @@ static void guac_rdpdr_send_client_capability(guac_rdpdrPlugin* rdpdr) {
stream_write_uint16(output_stream, RDPDR_CTYP_CORE); stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
stream_write_uint16(output_stream, PAKID_CORE_CLIENT_CAPABILITY); stream_write_uint16(output_stream, PAKID_CORE_CLIENT_CAPABILITY);
/* Write content */ /* Capability count + padding */
stream_write_uint16(output_stream, 2); stream_write_uint16(output_stream, 2);
stream_write_uint16(output_stream, 0); /* Padding */ stream_write_uint16(output_stream, 0); /* Padding */
/* General capability */ /* General capability header */
stream_write_uint16(output_stream, 1 /* CAP_GENERAL_TYPE */); stream_write_uint16(output_stream, CAP_GENERAL_TYPE);
stream_write_uint16(output_stream, 44); stream_write_uint16(output_stream, 44);
stream_write_uint32(output_stream, 2 /* GENERAL_CAPABILITY_VERSION_02 */); stream_write_uint32(output_stream, GENERAL_CAPABILITY_VERSION_02);
stream_write_uint32(output_stream, *((uint32_t*) "GUAC")); /* osType - required to be ignored */ /* General capability data */
stream_write_uint32(output_stream, GUAC_OS_TYPE); /* osType - required to be ignored */
stream_write_uint32(output_stream, 0); /* osVersion */ stream_write_uint32(output_stream, 0); /* osVersion */
stream_write_uint16(output_stream, 1); /* protocolMajor */ stream_write_uint16(output_stream, RDP_CLIENT_MAJOR_ALL); /* protocolMajor */
stream_write_uint16(output_stream, 0xA); /* protocolMinor */ stream_write_uint16(output_stream, RDP_CLIENT_MINOR_5_2); /* protocolMinor */
stream_write_uint32(output_stream, 0xFFFF); /* ioCode1 */ stream_write_uint32(output_stream, 0xFFFF); /* ioCode1 */
stream_write_uint32(output_stream, 0); /* ioCode2 */ stream_write_uint32(output_stream, 0); /* ioCode2 */
stream_write_uint32(output_stream, 7); /* extendedPDU */ stream_write_uint32(output_stream,
RDPDR_DEVICE_REMOVE_PDUS
| RDPDR_CLIENT_DISPLAY_NAME
| RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */
stream_write_uint32(output_stream, 0); /* extraFlags1 */ stream_write_uint32(output_stream, 0); /* extraFlags1 */
stream_write_uint32(output_stream, 0); /* extraFlags2 */ stream_write_uint32(output_stream, 0); /* extraFlags2 */
stream_write_uint32(output_stream, 0); /* SpecialTypeDeviceCap */ stream_write_uint32(output_stream, 0); /* SpecialTypeDeviceCap */
/* Printer support */ /* Printer support header */
stream_write_uint16(output_stream, 2 /* CAP_PRINTER_TYPE */); stream_write_uint16(output_stream, CAP_PRINTER_TYPE);
stream_write_uint16(output_stream, 8); stream_write_uint16(output_stream, 8);
stream_write_uint32(output_stream, 1 /* PRINT_CAPABILITY_VERSION_01 */); stream_write_uint32(output_stream, PRINT_CAPABILITY_VERSION_01);
svc_plugin_send((rdpSvcPlugin*) rdpdr, output_stream); svc_plugin_send((rdpSvcPlugin*) rdpdr, output_stream);
guac_client_log_info(rdpdr->client, "Capabilities sent."); guac_client_log_info(rdpdr->client, "Capabilities sent.");

View File

@ -68,6 +68,59 @@
#define PAKID_CORE_USER_LOGGEDON 0x554C #define PAKID_CORE_USER_LOGGEDON 0x554C
#define PAKID_PRN_USING_XPS 0x5543 #define PAKID_PRN_USING_XPS 0x5543
/**
* A 32-bit arbitrary value for the osType field of certain requests. As this
* value is defined as completely arbitrary and required to be ignored by the
* server, we send "GUAC" as an integer.
*/
#define GUAC_OS_TYPE (*((uint32_t*) "GUAC"))
/*
* Capability types
*/
#define CAP_GENERAL_TYPE 1
#define CAP_PRINTER_TYPE 2
#define CAP_PORT_TYPE 3
#define CAP_DRIVE_TYPE 4
#define CAP_SMARTCARD_TYPE 5
/*
* General capability header versions.
*/
#define GENERAL_CAPABILITY_VERSION_01 1
#define GENERAL_CAPABILITY_VERSION_02 2
/*
* Print capability header versions.
*/
#define PRINT_CAPABILITY_VERSION_01 1
/*
* Legal client major version numbers.
*/
#define RDP_CLIENT_MAJOR_ALL 1
/*
* Legal client minor version numbers.
*/
#define RDP_CLIENT_MINOR_6_1 0xC
#define RDP_CLIENT_MINOR_5_2 0xA
#define RDP_CLIENT_MINOR_5_1 0x5
#define RDP_CLIENT_MINOR_5_0 0x2
/*
* PDU flags used by the extendedPDU field.
*/
#define RDPDR_DEVICE_REMOVE_PDUS 0x1
#define RDPDR_CLIENT_DISPLAY_NAME 0x2
#define RDPDR_USER_LOGGEDON_PDU 0x4
/* /*
* Message handlers. * Message handlers.
*/ */