Esempio n. 1
0
void gcc_read_server_data_blocks(STREAM* s, rdpSettings *settings, int length)
{
	uint16 type;
	uint16 offset = 0;
	uint16 blockLength;

	while (offset < length)
	{
		gcc_read_user_data_header(s, &type, &blockLength);

		switch (type)
		{
			case SC_CORE:
				gcc_read_server_core_data(s, settings);
				break;

			case SC_SECURITY:
				gcc_read_server_security_data(s, settings);
				break;

			case SC_NET:
				gcc_read_server_network_data(s, settings);
				break;

			default:
				break;
		}

		offset += blockLength;
	}
}
Esempio n. 2
0
BOOL gcc_read_server_data_blocks(wStream* s, rdpSettings* settings, int length)
{
	UINT16 type;
	UINT16 offset = 0;
	UINT16 blockLength;
	BYTE* holdp;

	while (offset < length)
	{
		holdp = Stream_Pointer(s);

		if (!gcc_read_user_data_header(s, &type, &blockLength))
		{
			fprintf(stderr, "gcc_read_server_data_blocks: gcc_read_user_data_header failed\n");
			return FALSE;
		}

		switch (type)
		{
			case SC_CORE:
				if (!gcc_read_server_core_data(s, settings))
				{
					fprintf(stderr, "gcc_read_server_data_blocks: gcc_read_server_core_data failed\n");
					return FALSE;
				}
				break;

			case SC_SECURITY:
				if (!gcc_read_server_security_data(s, settings))
				{
					fprintf(stderr, "gcc_read_server_data_blocks: gcc_read_server_security_data failed\n");
					return FALSE;
				}
				break;

			case SC_NET:
				if (!gcc_read_server_network_data(s, settings))
				{
					fprintf(stderr, "gcc_read_server_data_blocks: gcc_read_server_network_data failed\n");
					return FALSE;
				}
				break;

			default:
				fprintf(stderr, "gcc_read_server_data_blocks: ignoring type=%hu\n", type);
				break;
		}
		offset += blockLength;
		Stream_Pointer(s) = holdp + blockLength;
	}

	return TRUE;
}
Esempio n. 3
0
boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length)
{
	uint16 type;
	uint16 offset = 0;
	uint16 blockLength;
	uint8* holdp;

	while (offset < length)
	{
		holdp = s->p;

		if (!gcc_read_user_data_header(s, &type, &blockLength))
		{
			printf("gcc_read_server_data_blocks: gcc_read_user_data_header failed\n");
			return false;
		}

		switch (type)
		{
			case SC_CORE:
				if (!gcc_read_server_core_data(s, settings))
				{
					printf("gcc_read_server_data_blocks: gcc_read_server_core_data failed\n");
					return false;
				}
				break;

			case SC_SECURITY:
				if (!gcc_read_server_security_data(s, settings))
				{
					printf("gcc_read_server_data_blocks: gcc_read_server_security_data failed\n");
					return false;
				}
				break;

			case SC_NET:
				if (!gcc_read_server_network_data(s, settings))
				{
					printf("gcc_read_server_data_blocks: gcc_read_server_network_data failed\n");
					return false;
				}
				break;

			default:
				printf("gcc_read_server_data_blocks: ignoring type=%hu\n", type);
				break;
		}
		offset += blockLength;
		s->p = holdp + blockLength;
	}

	return true;
}
Esempio n. 4
0
BOOL gcc_read_client_data_blocks(wStream* s, rdpSettings* settings, int length)
{
	UINT16 type;
	UINT16 blockLength;
	int pos;

	while (length > 0)
	{
		pos = Stream_GetPosition(s);
		if(!gcc_read_user_data_header(s, &type, &blockLength))
			return FALSE;

		switch (type)
		{
			case CS_CORE:
				if (!gcc_read_client_core_data(s, settings, blockLength - 4))
					return FALSE;
				break;

			case CS_SECURITY:
				if (!gcc_read_client_security_data(s, settings, blockLength - 4))
					return FALSE;
				break;

			case CS_NET:
				if (!gcc_read_client_network_data(s, settings, blockLength - 4))
					return FALSE;
				break;

			case CS_CLUSTER:
				if (!gcc_read_client_cluster_data(s, settings, blockLength - 4))
					return FALSE;
				break;

			case CS_MONITOR:
				if (!gcc_read_client_monitor_data(s, settings, blockLength - 4))
					return FALSE;
				break;

			default:
				break;
		}

		length -= blockLength;
		Stream_SetPosition(s, pos + blockLength);
	}

	return TRUE;
}
Esempio n. 5
0
boolean gcc_read_client_data_blocks(STREAM* s, rdpSettings *settings, int length)
{
	uint16 type;
	uint16 blockLength;
	int pos;

	while (length > 0)
	{
		pos = stream_get_pos(s);
		gcc_read_user_data_header(s, &type, &blockLength);

		switch (type)
		{
			case CS_CORE:
				if (!gcc_read_client_core_data(s, settings, blockLength - 4))
					return false;
				break;

			case CS_SECURITY:
				if (!gcc_read_client_security_data(s, settings, blockLength - 4))
					return false;
				break;

			case CS_NET:
				if (!gcc_read_client_network_data(s, settings, blockLength - 4))
					return false;
				break;

			case CS_CLUSTER:
				if (!gcc_read_client_cluster_data(s, settings, blockLength - 4))
					return false;
				break;

			case CS_MONITOR:
				if (!gcc_read_client_monitor_data(s, settings, blockLength - 4))
					return false;
				break;

			default:
				break;
		}

		length -= blockLength;
		stream_set_pos(s, pos + blockLength);
	}

	return true;
}
Esempio n. 6
0
BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length)
{
	UINT16 type;
	UINT16 offset = 0;
	UINT16 blockLength;
	BYTE* holdp;

	while (offset < length)
	{
		holdp = Stream_Pointer(s);

		if (!gcc_read_user_data_header(s, &type, &blockLength))
		{
			WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_user_data_header failed");
			return FALSE;
		}

		switch (type)
		{
			case SC_CORE:
				if (!gcc_read_server_core_data(s, mcs))
				{
					WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_server_core_data failed");
					return FALSE;
				}
				break;

			case SC_SECURITY:
				if (!gcc_read_server_security_data(s, mcs))
				{
					WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_server_security_data failed");
					return FALSE;
				}
				break;

			case SC_NET:
				if (!gcc_read_server_network_data(s, mcs))
				{
					WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_server_network_data failed");
					return FALSE;
				}
				break;

			case SC_MCS_MSGCHANNEL:
				if (!gcc_read_server_message_channel_data(s, mcs))
				{
					WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_server_message_channel_data failed");
					return FALSE;
				}
				break;

			case SC_MULTITRANSPORT:
				if (!gcc_read_server_multitransport_channel_data(s, mcs))
				{
					WLog_ERR(TAG,  "gcc_read_server_data_blocks: gcc_read_server_multitransport_channel_data failed");
					return FALSE;
				}
				break;

			default:
				WLog_ERR(TAG,  "gcc_read_server_data_blocks: ignoring type=%hu", type);
				break;
		}
		offset += blockLength;
		Stream_Pointer(s) = holdp + blockLength;
	}

	return TRUE;
}
Esempio n. 7
0
BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
{
	UINT16 type;
	UINT16 blockLength;
	int begPos, endPos;

	while (length > 0)
	{
		begPos = Stream_GetPosition(s);

		if (!gcc_read_user_data_header(s, &type, &blockLength))
			return FALSE;

		if (Stream_GetRemainingLength(s) < (size_t) (blockLength - 4))
			return FALSE;

		switch (type)
		{
			case CS_CORE:
				if (!gcc_read_client_core_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_SECURITY:
				if (!gcc_read_client_security_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_NET:
				if (!gcc_read_client_network_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_CLUSTER:
				if (!gcc_read_client_cluster_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_MONITOR:
				if (!gcc_read_client_monitor_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_MCS_MSGCHANNEL:
				if (!gcc_read_client_message_channel_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case CS_MONITOR_EX:
				if (!gcc_read_client_monitor_extended_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			case 0xC009:
			case CS_MULTITRANSPORT:
				if (!gcc_read_client_multitransport_channel_data(s, mcs, blockLength - 4))
					return FALSE;
				break;

			default:
				WLog_ERR(TAG,  "Unknown GCC client data block: 0x%04X", type);
				Stream_Seek(s, blockLength - 4);
				break;
		}

		endPos = Stream_GetPosition(s);

		if (endPos != (begPos + blockLength))
		{
			WLog_ERR(TAG,  "Error parsing GCC client data block 0x%04X: Actual Offset: %d Expected Offset: %d",
					type, endPos, begPos + blockLength);
		}

		length -= blockLength;
		Stream_SetPosition(s, begPos + blockLength);
	}

	return TRUE;
}