Beispiel #1
0
UINT rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* s)
{
	UINT status = CHANNEL_RC_OK;
	UINT16 i;
	UINT16 numCapabilities;
	UINT16 capabilityType;

	if (!rdpdr || !s)
		return CHANNEL_RC_NULL_DATA;

	if (Stream_GetRemainingLength(s) < 4)
		return ERROR_INVALID_DATA;

	Stream_Read_UINT16(s, numCapabilities);
	Stream_Seek(s, 2); /* pad (2 bytes) */

	for (i = 0; i < numCapabilities; i++)
	{
		if (Stream_GetRemainingLength(s) < sizeof(UINT16))
			return ERROR_INVALID_DATA;

		Stream_Read_UINT16(s, capabilityType);

		switch (capabilityType)
		{
		case CAP_GENERAL_TYPE:
			status = rdpdr_process_general_capset(rdpdr, s);
			break;

		case CAP_PRINTER_TYPE:
			status = rdpdr_process_printer_capset(rdpdr, s);
			break;

		case CAP_PORT_TYPE:
			status = rdpdr_process_port_capset(rdpdr, s);
			break;

		case CAP_DRIVE_TYPE:
			status = rdpdr_process_drive_capset(rdpdr, s);
			break;

		case CAP_SMARTCARD_TYPE:
			status = rdpdr_process_smartcard_capset(rdpdr, s);
			break;

		default:
			break;
		}

		if (status != CHANNEL_RC_OK)
			return status;
	}

	return CHANNEL_RC_OK;
}
Beispiel #2
0
void
rdpdr_process_capabilities(char* data, int size)
{
	int i;
	int offset;
	uint16 numCapabilities;
	uint16 capabilityType;

	numCapabilities = GET_UINT16(data, 0); /* numCapabilities */
	/* pad (2 bytes) */
	offset = 4;

	for(i = 0; i < numCapabilities; i++)
	{
		capabilityType = GET_UINT16(data, offset);

		switch (capabilityType)
		{
			case CAP_GENERAL_TYPE:
				offset += rdpdr_process_general_capset(&data[offset], size - offset);
				break;

			case CAP_PRINTER_TYPE:
				offset += rdpdr_process_printer_capset(&data[offset], size - offset);
				break;

			case CAP_PORT_TYPE:
				offset += rdpdr_process_port_capset(&data[offset], size - offset);
				break;

			case CAP_DRIVE_TYPE:
				offset += rdpdr_process_drive_capset(&data[offset], size - offset);
				break;

			case CAP_SMARTCARD_TYPE:
				offset += rdpdr_process_smartcard_capset(&data[offset], size - offset);
				break;

			default:
				//fprintf(stderr, "unimpl: Device redirection capability set type %d\n", capabilityType);
				break;
		}
	}
}