예제 #1
0
static void rfx_compose_message_sync(RFX_CONTEXT* context, STREAM* s)
{
	stream_write_uint16(s, WBT_SYNC); /* BlockT.blockType */
	stream_write_uint32(s, 12); /* BlockT.blockLen */
	stream_write_uint32(s, WF_MAGIC); /* magic */
	stream_write_uint16(s, WF_VERSION_1_0); /* version */
}
예제 #2
0
파일: audin.c 프로젝트: ArthurGodoy/FreeRDP
static void audin_server_send_formats(audin_server* audin, STREAM* s)
{
	int i;
	uint32 nAvgBytesPerSec;

	stream_set_pos(s, 0);
	stream_write_uint8(s, MSG_SNDIN_FORMATS);
	stream_write_uint32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
	stream_write_uint32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */

	for (i = 0; i < audin->context.num_server_formats; i++)
	{
		nAvgBytesPerSec = audin->context.server_formats[i].nSamplesPerSec *
			audin->context.server_formats[i].nChannels *
			audin->context.server_formats[i].wBitsPerSample / 8;
		stream_check_size(s, 18);
		stream_write_uint16(s, audin->context.server_formats[i].wFormatTag);
		stream_write_uint16(s, audin->context.server_formats[i].nChannels);
		stream_write_uint32(s, audin->context.server_formats[i].nSamplesPerSec);
		stream_write_uint32(s, nAvgBytesPerSec);
		stream_write_uint16(s, audin->context.server_formats[i].nBlockAlign);
		stream_write_uint16(s, audin->context.server_formats[i].wBitsPerSample);
		stream_write_uint16(s, audin->context.server_formats[i].cbSize);
		if (audin->context.server_formats[i].cbSize)
		{
			stream_check_size(s, audin->context.server_formats[i].cbSize);
			stream_write(s, audin->context.server_formats[i].data,
				audin->context.server_formats[i].cbSize);
		}
	}

	WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
}
예제 #3
0
void rdp_write_input_capability_set(STREAM* s, rdpSettings* settings)
{
	uint8* header;
	uint16 inputFlags;

	header = rdp_capability_set_start(s);

	inputFlags = INPUT_FLAG_SCANCODES | INPUT_FLAG_MOUSEX | INPUT_FLAG_UNICODE;

	if (settings->fast_path_input)
	{
		inputFlags |= INPUT_FLAG_FASTPATH_INPUT;
		inputFlags |= INPUT_FLAG_FASTPATH_INPUT2;
	}

	stream_write_uint16(s, inputFlags); /* inputFlags (2 bytes) */
	stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */
	stream_write_uint32(s, settings->kbd_layout); /* keyboardLayout (4 bytes) */
	stream_write_uint32(s, settings->kbd_type); /* keyboardType (4 bytes) */
	stream_write_uint32(s, settings->kbd_subtype); /* keyboardSubType (4 bytes) */
	stream_write_uint32(s, settings->kbd_fn_keys); /* keyboardFunctionKeys (4 bytes) */
	stream_write_zero(s, 64); /* imeFileName (64 bytes) */

	rdp_capability_set_finish(s, header, CAPSET_TYPE_INPUT);
}
예제 #4
0
파일: rdp.c 프로젝트: mwu406/FreeRDP-1.0
void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id)
{
	/* Share Control Header */
	stream_write_uint16(s, length); /* totalLength */
	stream_write_uint16(s, type | 0x10); /* pduType */
	stream_write_uint16(s, channel_id); /* pduSource */
}
예제 #5
0
void rdp_write_client_font_list_pdu(STREAM* s, uint16 flags)
{
	stream_write_uint16(s, 0); /* numberFonts (2 bytes) */
	stream_write_uint16(s, 0); /* totalNumFonts (2 bytes) */
	stream_write_uint16(s, flags); /* listFlags (2 bytes) */
	stream_write_uint16(s, 50); /* entrySize (2 bytes) */
}
예제 #6
0
static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* data_in)
{
	STREAM* data_out;
	int error;

	DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId);
	stream_seek(data_in, 1); /* pad */
	stream_read_uint16(data_in, drdynvc->version);
	if (drdynvc->version == 2)
	{
		stream_read_uint16(data_in, drdynvc->PriorityCharge0);
		stream_read_uint16(data_in, drdynvc->PriorityCharge1);
		stream_read_uint16(data_in, drdynvc->PriorityCharge2);
		stream_read_uint16(data_in, drdynvc->PriorityCharge3);
	}
	data_out = stream_new(4);
	stream_write_uint16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
	stream_write_uint16(data_out, drdynvc->version);
	error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
	if (error != CHANNEL_RC_OK)
	{
		DEBUG_WARN("VirtualChannelWrite failed %d", error);
		return 1;
	}
	return 0;
}
예제 #7
0
void rdp_write_gdiplus_cache_chunk_size(STREAM* s, uint16 gccs, uint16 obccs, uint16 opccs, uint16 oiaccs)
{
	stream_write_uint16(s, gccs); /* gdipGraphicsCacheChunkSize (2 bytes) */
	stream_write_uint16(s, obccs); /* gdipObjectBrushCacheChunkSize (2 bytes) */
	stream_write_uint16(s, opccs); /* gdipObjectPenCacheChunkSize (2 bytes) */
	stream_write_uint16(s, oiaccs); /* gdipObjectImageAttributesCacheChunkSize (2 bytes) */
}
예제 #8
0
파일: audin.c 프로젝트: ArthurGodoy/FreeRDP
static void audin_server_send_open(audin_server* audin, STREAM* s)
{
	if (audin->context.selected_client_format < 0)
		return;

	audin->opened = true;

	stream_set_pos(s, 0);
	stream_write_uint8(s, MSG_SNDIN_OPEN);
	stream_write_uint32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
	stream_write_uint32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
	/*
	 * [MS-RDPEAI] 3.2.5.1.6
	 * The second format specify the format that SHOULD be used to capture data from
	 * the actual audio input device.
	 */
	stream_write_uint16(s, 1); /* wFormatTag = PCM */
	stream_write_uint16(s, 2); /* nChannels */
	stream_write_uint32(s, 44100); /* nSamplesPerSec */
	stream_write_uint32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
	stream_write_uint16(s, 4); /* nBlockAlign */
	stream_write_uint16(s, 16); /* wBitsPerSample */
	stream_write_uint16(s, 0); /* cbSize */

	WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
}
예제 #9
0
static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
{
	STREAM* data_out;
	size_t computerNameLenW;
	UNICONV* uniconv;
	char* s;

	uniconv = freerdp_uniconv_new();
	if (!rdpdr->computerName[0])
		gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1);
	s = freerdp_uniconv_out(uniconv, rdpdr->computerName, &computerNameLenW);
	data_out = stream_new(16 + computerNameLenW + 2);

	stream_write_uint16(data_out, RDPDR_CTYP_CORE);
	stream_write_uint16(data_out, PAKID_CORE_CLIENT_NAME);

	stream_write_uint32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
	stream_write_uint32(data_out, 0); /* codePage, must be set to zero */
	stream_write_uint32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */
	stream_write(data_out, s, computerNameLenW);
	stream_write_uint16(data_out, 0); /* null terminator */
	xfree(s);
	freerdp_uniconv_free(uniconv);

	svc_plugin_send((rdpSvcPlugin*)rdpdr, data_out);
}
예제 #10
0
파일: rect.c 프로젝트: ArvidNorr/FreeRDP
void freerdp_write_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16)
{
	stream_write_uint16(s, rectangle_16->left); /* left (2 bytes) */
	stream_write_uint16(s, rectangle_16->top); /* top (2 bytes) */
	stream_write_uint16(s, rectangle_16->right); /* right (2 bytes) */
	stream_write_uint16(s, rectangle_16->bottom); /* bottom (2 bytes) */
}
예제 #11
0
파일: rpch.c 프로젝트: cocoon/NeutrinoRDP
tbool rpch_in_send_ping(rdpRpch* rpch)
{
	STREAM* pdu = stream_new(20);

	uint8 rpc_vers = 0x05;
	uint8 rpc_vers_minor = 0x00;
	uint8 ptype = PTYPE_RTS;
	uint8 pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG;
	uint32 packet_drep = 0x00000010;
	uint16 frag_length = 56;
	uint16 auth_length = 0;
	uint32 call_id = 0x00000000;
	uint16 flags = 0x0001;
	uint16 num_commands = 0x0000;

	stream_write_uint8(pdu, rpc_vers);
	stream_write_uint8(pdu, rpc_vers_minor);
	stream_write_uint8(pdu, ptype);
	stream_write_uint8(pdu, pfc_flags);
	stream_write_uint32(pdu, packet_drep);
	stream_write_uint16(pdu, frag_length);
	stream_write_uint16(pdu, auth_length);
	stream_write_uint32(pdu, call_id);
	stream_write_uint16(pdu, flags);
	stream_write_uint16(pdu, num_commands);

	rpch_in_write(rpch, pdu->data, pdu->p - pdu->data);

	stream_free(pdu);

	return true;
}
예제 #12
0
static void rfx_compose_message_context(RFX_CONTEXT* context, STREAM* s)
{
	uint16 properties;

	stream_write_uint16(s, WBT_CONTEXT); /* CodecChannelT.blockType */
	stream_write_uint32(s, 13); /* CodecChannelT.blockLen */
	stream_write_uint8(s, 1); /* CodecChannelT.codecId */
	stream_write_uint8(s, 0); /* CodecChannelT.channelId */
	stream_write_uint8(s, 0); /* ctxId */
	stream_write_uint16(s, CT_TILE_64x64); /* tileSize */

	/* properties */
	properties = context->flags; /* flags */
	properties |= (COL_CONV_ICT << 3); /* cct */
	properties |= (CLW_XFORM_DWT_53_A << 5); /* xft */
	properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3) << 9); /* et */
	properties |= (SCALAR_QUANTIZATION << 13); /* qt */
	stream_write_uint16(s, properties);

	/* properties in tilesets: note that this has different format from the one in TS_RFX_CONTEXT */
	properties = 1; /* lt */
	properties |= (context->flags << 1); /* flags */
	properties |= (COL_CONV_ICT << 4); /* cct */
	properties |= (CLW_XFORM_DWT_53_A << 6); /* xft */
	properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3) << 10); /* et */
	properties |= (SCALAR_QUANTIZATION << 14); /* qt */
	context->properties = properties;
}
예제 #13
0
void rdp_write_gdiplus_cache_entries(STREAM* s, uint16 gce, uint16 bce, uint16 pce, uint16 ice, uint16 ace)
{
	stream_write_uint16(s, gce); /* gdipGraphicsCacheEntries (2 bytes) */
	stream_write_uint16(s, bce); /* gdipBrushCacheEntries (2 bytes) */
	stream_write_uint16(s, pce); /* gdipPenCacheEntries (2 bytes) */
	stream_write_uint16(s, ice); /* gdipImageCacheEntries (2 bytes) */
	stream_write_uint16(s, ace); /* gdipImageAttributesCacheEntries (2 bytes) */
}
예제 #14
0
void rail_write_client_window_move_order(STREAM* s, RAIL_WINDOW_MOVE_ORDER* window_move)
{
	stream_write_uint32(s, window_move->windowId); /* windowId (4 bytes) */
	stream_write_uint16(s, window_move->left); /* left (2 bytes) */
	stream_write_uint16(s, window_move->top); /* top (2 bytes) */
	stream_write_uint16(s, window_move->right); /* right (2 bytes) */
	stream_write_uint16(s, window_move->bottom); /* bottom (2 bytes) */
}
예제 #15
0
파일: license.c 프로젝트: Cyclic/FreeRDP
void license_write_binary_blob(STREAM* s, LICENSE_BLOB* blob)
{
	stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */
	stream_write_uint16(s, blob->length); /* wBlobLen (2 bytes) */

	if (blob->length > 0)
		stream_write(s, blob->data, blob->length); /* blobData */
}
예제 #16
0
static void rfx_compose_message_codec_versions(RFX_CONTEXT* context, STREAM* s)
{
	stream_write_uint16(s, WBT_CODEC_VERSIONS); /* BlockT.blockType */
	stream_write_uint32(s, 10); /* BlockT.blockLen */
	stream_write_uint8(s, 1); /* numCodecs */
	stream_write_uint8(s, 1); /* codecs.codecId */
	stream_write_uint16(s, WF_VERSION_1_0); /* codecs.version */
}
예제 #17
0
void update_write_surfcmd_frame_marker(STREAM* s, uint16 frameAction, uint32 frameId)
{
	stream_check_size(s, SURFCMD_FRAME_MARKER_LENGTH);

	stream_write_uint16(s, CMDTYPE_FRAME_MARKER);

	stream_write_uint16(s, frameAction);
	stream_write_uint32(s, frameId);
}
예제 #18
0
static void rfx_compose_message_channels(RFX_CONTEXT* context, STREAM* s)
{
	stream_write_uint16(s, WBT_CHANNELS); /* BlockT.blockType */
	stream_write_uint32(s, 12); /* BlockT.blockLen */
	stream_write_uint8(s, 1); /* numChannels */
	stream_write_uint8(s, 0); /* Channel.channelId */
	stream_write_uint16(s, context->width); /* Channel.width */
	stream_write_uint16(s, context->height); /* Channel.height */
}
예제 #19
0
void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id)
{
	length -= RDP_PACKET_HEADER_MAX_LENGTH;

	/* Share Control Header */
	stream_write_uint16(s, length); /* totalLength */
	stream_write_uint16(s, type | 0x10); /* pduType */
	stream_write_uint16(s, channel_id); /* pduSource */
}
예제 #20
0
파일: license.c 프로젝트: ryotous/FreeRDP
void license_write_padded_binary_blob(STREAM* s, LICENSE_BLOB* blob)
{
	stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */
	stream_write_uint16(s, blob->length + LICENSING_PADDING_SIZE); /* wBlobLen (2 bytes) */

	if (blob->length > 0)
		stream_write(s, blob->data, blob->length); /* blobData */

	stream_write_zero(s, LICENSING_PADDING_SIZE);
}
예제 #21
0
void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec)
{
	stream_write_uint16(s, exec->flags); /* flags (2 bytes) */
	stream_write_uint16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
	stream_write_uint16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
	stream_write_uint16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
	rail_write_unicode_string_value(s, &exec->exeOrFile); /* exeOrFile */
	rail_write_unicode_string_value(s, &exec->workingDir); /* workingDir */
	rail_write_unicode_string_value(s, &exec->arguments); /* arguments */
}
예제 #22
0
void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings)
{
	uint8* header;
	uint16 extraFlags;

	header = rdp_capability_set_start(s);

	extraFlags = LONG_CREDENTIALS_SUPPORTED | NO_BITMAP_COMPRESSION_HDR;

	if (settings->auto_reconnection)
		extraFlags |= AUTORECONNECT_SUPPORTED;

	if (settings->fast_path_input)
		extraFlags |= FASTPATH_OUTPUT_SUPPORTED;

	stream_write_uint16(s, 0); /* osMajorType (2 bytes) */
	stream_write_uint16(s, 0); /* osMinorType (2 bytes) */
	stream_write_uint16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */
	stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */
	stream_write_uint16(s, 0); /* generalCompressionTypes (2 bytes) */
	stream_write_uint16(s, 0); /* extraFlags (2 bytes) */
	stream_write_uint16(s, 0); /* updateCapabilityFlag (2 bytes) */
	stream_write_uint16(s, 0); /* remoteUnshareFlag (2 bytes) */
	stream_write_uint16(s, 0); /* generalCompressionLevel (2 bytes) */
	stream_write_uint8(s, settings->refresh_rect); /* refreshRectSupport (1 byte) */
	stream_write_uint8(s, settings->suppress_output); /* suppressOutputSupport (1 byte) */

	rdp_capability_set_finish(s, header, CAPSET_TYPE_GENERAL);
}
예제 #23
0
void rdp_write_color_cache_capability_set(STREAM* s, rdpSettings* settings)
{
	uint8* header;

	header = rdp_capability_set_start(s);

	stream_write_uint16(s, 6); /* colorTableCacheSize (2 bytes) */
	stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */

	rdp_capability_set_finish(s, header, CAPSET_TYPE_COLOR_CACHE);
}
예제 #24
0
void rdp_write_font_capability_set(STREAM* s, rdpSettings* settings)
{
	uint8* header;

	header = rdp_capability_set_start(s);

	stream_write_uint16(s, FONTSUPPORT_FONTLIST); /* fontSupportFlags (2 bytes) */
	stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */

	rdp_capability_set_finish(s, header, CAPSET_TYPE_FONT);
}
예제 #25
0
void rdp_write_share_capability_set(STREAM* s, rdpSettings* settings)
{
	uint8* header;

	header = rdp_capability_set_start(s);

	stream_write_uint16(s, 0); /* nodeId (2 bytes) */
	stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */

	rdp_capability_set_finish(s, header, CAPSET_TYPE_SHARE);
}
예제 #26
0
파일: rdp.c 프로젝트: mwu406/FreeRDP-1.0
void rdp_write_share_data_header(STREAM* s, uint16 length, uint8 type, uint32 share_id)
{
	/* Share Data Header */
	stream_write_uint32(s, share_id); /* shareId (4 bytes) */
	stream_write_uint8(s, 0); /* pad1 (1 byte) */
	stream_write_uint8(s, STREAM_LOW); /* streamId (1 byte) */
	stream_write_uint16(s, length); /* uncompressedLength (2 bytes) */
	stream_write_uint8(s, type); /* pduType2, Data PDU Type (1 byte) */
	stream_write_uint8(s, 0); /* compressedType (1 byte) */
	stream_write_uint16(s, 0); /* compressedLength (2 bytes) */
}
예제 #27
0
파일: rdpsnd.c 프로젝트: felfert/FreeRDP
static boolean rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right)
{
	rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
	STREAM* s = rdpsnd->rdpsnd_pdu;

	RDPSND_PDU_INIT(s, SNDC_SETVOLUME);

	stream_write_uint16(s, left);
	stream_write_uint16(s, right);
	
	RDPSND_PDU_FINISH(s);
}
예제 #28
0
STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen)
{
	STREAM* s;

	s = stream_new(dataLen + 8);
	stream_write_uint16(s, msgType);
	stream_write_uint16(s, msgFlags);
	/* Write actual length after the entire packet has been constructed. */
	stream_seek(s, 4);

	return s;
}
예제 #29
0
파일: license.c 프로젝트: Cyclic/FreeRDP
void license_write_padded_binary_blob(STREAM* s, LICENSE_BLOB* blob)
{
	uint16 pad_len;

	pad_len = 72 % blob->length;
	stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */
	stream_write_uint16(s, blob->length + pad_len); /* wBlobLen (2 bytes) */

	if (blob->length > 0)
		stream_write(s, blob->data, blob->length); /* blobData */

	stream_write_zero(s, pad_len);
}
예제 #30
0
boolean rdp_send_server_font_map_pdu(rdpRdp* rdp)
{
	STREAM* s;

	s = rdp_data_pdu_init(rdp);

	stream_write_uint16(s, 0); /* numberEntries (2 bytes) */
	stream_write_uint16(s, 0); /* totalNumEntries (2 bytes) */
	stream_write_uint16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */
	stream_write_uint16(s, 4); /* entrySize (2 bytes) */

	return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_MAP, rdp->mcs->user_id);
}