当前位置: 首页>>代码示例>>C++>>正文


C++ Stream_Write_UINT16函数代码示例

本文整理汇总了C++中Stream_Write_UINT16函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Write_UINT16函数的具体用法?C++ Stream_Write_UINT16怎么用?C++ Stream_Write_UINT16使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Stream_Write_UINT16函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rdpgfx_send_delete_surface_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_send_delete_surface_pdu(RdpgfxServerContext* context,
        RDPGFX_DELETE_SURFACE_PDU* pdu)
{
	wStream* s = rdpgfx_server_single_packet_new(RDPGFX_CMDID_DELETESURFACE, 2);

	if (!s)
	{
		WLog_ERR(TAG, "rdpgfx_server_single_packet_new failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	Stream_Write_UINT16(s, pdu->surfaceId); /* surfaceId (2 bytes) */
	return rdpgfx_server_single_packet_send(context, s);
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:19,代码来源:rdpgfx_main.c

示例2: cliprdr_client_format_list

int cliprdr_client_format_list(CliprdrClientContext* context, CLIPRDR_FORMAT_LIST* formatList)
{
	wStream* s;
	UINT32 index;
	int length = 0;
	int formatNameSize;
	CLIPRDR_FORMAT* format;
	cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;

	for (index = 0; index < formatList->numFormats; index++)
	{
		format = (CLIPRDR_FORMAT*) &(formatList->formats[index]);
		length += 4;
		formatNameSize = 2;

		if (format->formatName)
			formatNameSize = MultiByteToWideChar(CP_UTF8, 0, format->formatName, -1, NULL, 0) * 2;

		length += formatNameSize;
	}

	s = cliprdr_packet_new(CB_FORMAT_LIST, 0, length);

	for (index = 0; index < formatList->numFormats; index++)
	{
		format = (CLIPRDR_FORMAT*) &(formatList->formats[index]);
		Stream_Write_UINT32(s, format->formatId); /* formatId (4 bytes) */

		if (format->formatName)
		{
			int cchWideChar;
			LPWSTR lpWideCharStr;
			lpWideCharStr = (LPWSTR) Stream_Pointer(s);
			cchWideChar = (Stream_Capacity(s) - Stream_GetPosition(s)) / 2;
			formatNameSize = MultiByteToWideChar(CP_UTF8, 0,
				format->formatName, -1, lpWideCharStr, cchWideChar) * 2;
			Stream_Seek(s, formatNameSize);
		}
		else
		{
			Stream_Write_UINT16(s, 0);
		}
	}

	WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatList: numFormats: %d",
			formatList->numFormats);
	cliprdr_packet_send(cliprdr, s);

	return 0;
}
开发者ID:akallabeth,项目名称:FreeRDP,代码行数:50,代码来源:cliprdr_main.c

示例3: rdpsnd_server_set_volume

static BOOL rdpsnd_server_set_volume(RdpsndServerContext* context, int left, int right)
{
	int pos;
	BOOL status;
	ULONG written;
	wStream* s = context->priv->rdpsnd_pdu;

	Stream_Write_UINT8(s, SNDC_SETVOLUME);
	Stream_Write_UINT8(s, 0);
	Stream_Seek_UINT16(s);

	Stream_Write_UINT16(s, left);
	Stream_Write_UINT16(s, right);

	pos = Stream_GetPosition(s);
	Stream_SetPosition(s, 2);
	Stream_Write_UINT16(s, pos - 4);
	Stream_SetPosition(s, pos);
	status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), &written);
	Stream_SetPosition(s, 0);

	return status;
}
开发者ID:MrRecovery,项目名称:FreeRDP,代码行数:23,代码来源:rdpsnd_main.c

示例4: rdpgfx_send_evict_cache_entry_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_send_evict_cache_entry_pdu(RdpgfxServerContext* context,
        RDPGFX_EVICT_CACHE_ENTRY_PDU* pdu)
{
	wStream* s = rdpgfx_server_single_packet_new(RDPGFX_CMDID_EVICTCACHEENTRY, 2);

	if (!s)
	{
		WLog_ERR(TAG, "rdpgfx_server_single_packet_new failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	Stream_Write_UINT16(s, pdu->cacheSlot); /* cacheSlot (2 bytes) */
	return rdpgfx_server_single_packet_send(context, s);
}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:19,代码来源:rdpgfx_main.c

示例5: ntlm_write_ntlm_v2_client_challenge

int ntlm_write_ntlm_v2_client_challenge(wStream* s, NTLMv2_CLIENT_CHALLENGE* challenge)
{
	ULONG length;
	Stream_Write_UINT8(s, challenge->RespType);
	Stream_Write_UINT8(s, challenge->HiRespType);
	Stream_Write_UINT16(s, challenge->Reserved1);
	Stream_Write_UINT32(s, challenge->Reserved2);
	Stream_Write(s, challenge->Timestamp, 8);
	Stream_Write(s, challenge->ClientChallenge, 8);
	Stream_Write_UINT32(s, challenge->Reserved3);
	length = ntlm_av_pair_list_length(challenge->AvPairs);
	Stream_Write(s, challenge->AvPairs, length);
	return 1;
}
开发者ID:Devolutions,项目名称:FreeRDP,代码行数:14,代码来源:ntlm_compute.c

示例6: audin_server_send_formats

static void audin_server_send_formats(audin_server* audin, wStream* s)
{
	int i;
	UINT32 nAvgBytesPerSec;
	ULONG written;

	Stream_SetPosition(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_EnsureRemainingCapacity(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_EnsureRemainingCapacity(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, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), &written);
}
开发者ID:Auto-Droid,项目名称:FreeRDP,代码行数:37,代码来源:audin.c

示例7: rdpdr_server_send_core_capability_request

static int rdpdr_server_send_core_capability_request(RdpdrServerContext* context)
{
	wStream* s;
	BOOL status;
	RDPDR_HEADER header;
	UINT16 numCapabilities;
	ULONG written;

	CLOG_DBG("RdpdrServerSendCoreCapabilityRequest\n");

	header.Component = RDPDR_CTYP_CORE;
	header.PacketId = PAKID_CORE_SERVER_CAPABILITY;

	numCapabilities = 5;

	s = Stream_New(NULL, RDPDR_HEADER_LENGTH + 512);

	Stream_Write_UINT16(s, header.Component); /* Component (2 bytes) */
	Stream_Write_UINT16(s, header.PacketId); /* PacketId (2 bytes) */

	Stream_Write_UINT16(s, numCapabilities); /* numCapabilities (2 bytes) */
	Stream_Write_UINT16(s, 0); /* Padding (2 bytes) */

	rdpdr_server_write_general_capability_set(context, s);
	rdpdr_server_write_printer_capability_set(context, s);
	rdpdr_server_write_port_capability_set(context, s);
	rdpdr_server_write_drive_capability_set(context, s);
	rdpdr_server_write_smartcard_capability_set(context, s);

	Stream_SealLength(s);

	status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_Length(s), &written);

	Stream_Free(s, TRUE);

	return 0;
}
开发者ID:JozLes77,项目名称:FreeRDP,代码行数:37,代码来源:rdpdr_main.c

示例8: rdg_write_data_packet

int rdg_write_data_packet(rdpRdg* rdg, BYTE* buf, int size)
{
	int status;
	wStream* sChunk;
	int packetSize = size + 10;
	char chunkSize[11];

	if (size < 1)
		return 0;

	sprintf_s(chunkSize, sizeof(chunkSize), "%X\r\n", packetSize);

	sChunk = Stream_New(NULL, strlen(chunkSize) + packetSize + 2);

	if (!sChunk)
		return -1;

	Stream_Write(sChunk, chunkSize, strlen(chunkSize));

	Stream_Write_UINT16(sChunk, PKT_TYPE_DATA);   /* Type */
	Stream_Write_UINT16(sChunk, 0);   /* Reserved */
	Stream_Write_UINT32(sChunk, packetSize);   /* Packet length */

	Stream_Write_UINT16(sChunk, size);   /* Data size */
	Stream_Write(sChunk, buf, size);   /* Data */

	Stream_Write(sChunk, "\r\n", 2);
	Stream_SealLength(sChunk);

	status = tls_write_all(rdg->tlsIn, Stream_Buffer(sChunk), Stream_Length(sChunk));
	Stream_Free(sChunk, TRUE);

	if (status < 0)
		return -1;

	return size;
}
开发者ID:BrianChangchien,项目名称:FiWoRDC,代码行数:37,代码来源:rdg.c

示例9: update_write_surfcmd_surface_bits_header

void update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND* cmd)
{
	Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH);

	Stream_Write_UINT16(s, CMDTYPE_STREAM_SURFACE_BITS);

	Stream_Write_UINT16(s, cmd->destLeft);
	Stream_Write_UINT16(s, cmd->destTop);
	Stream_Write_UINT16(s, cmd->destRight);
	Stream_Write_UINT16(s, cmd->destBottom);
	Stream_Write_UINT8(s, cmd->bpp);
	Stream_Write_UINT16(s, 0); /* reserved1, reserved2 */
	Stream_Write_UINT8(s, cmd->codecID);
	Stream_Write_UINT16(s, cmd->width);
	Stream_Write_UINT16(s, cmd->height);
	Stream_Write_UINT32(s, cmd->bitmapDataLength);
}
开发者ID:pevik,项目名称:debian-freerdp,代码行数:17,代码来源:surface.c

示例10: rdpgfx_send_cache_import_reply_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_send_cache_import_reply_pdu(RdpgfxServerContext* context,
        RDPGFX_CACHE_IMPORT_REPLY_PDU* pdu)
{
	UINT16 index;
	wStream* s = rdpgfx_server_single_packet_new(
	                 RDPGFX_CMDID_CACHEIMPORTREPLY,
	                 2 + 2 * pdu->importedEntriesCount);

	if (!s)
	{
		WLog_ERR(TAG, "rdpgfx_server_single_packet_new failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	/* importedEntriesCount (2 bytes) */
	Stream_Write_UINT16(s, pdu->importedEntriesCount);

	for (index = 0; index < pdu->importedEntriesCount; index++)
	{
		Stream_Write_UINT16(s, pdu->cacheSlots[index]); /* cacheSlot (2 bytes) */
	}

	return rdpgfx_server_single_packet_send(context, s);
}
开发者ID:dcatonR1,项目名称:FreeRDP,代码行数:29,代码来源:rdpgfx_main.c

示例11: update_send_cache_bitmap_v3

static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
{
	wStream* s;
	int bm, em;
	BYTE orderType;
	int headerLength;
	UINT16 extraFlags;
	INT16 orderLength;
	rdpUpdate* update = context->update;

	extraFlags = 0;
	headerLength = 6;
	orderType = ORDER_TYPE_BITMAP_COMPRESSED_V3;

	update_check_flush(context, headerLength + update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, &extraFlags));

	s = update->us;
	bm = Stream_GetPosition(s);

	Stream_EnsureRemainingCapacity(s, headerLength);
	Stream_Seek(s, headerLength);

	update_write_cache_bitmap_v3_order(s, cache_bitmap_v3, &extraFlags);
	em = Stream_GetPosition(s);

	orderLength = (em - bm) - 13;

	Stream_SetPosition(s, bm);
	Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY); /* controlFlags (1 byte) */
	Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
	Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
	Stream_Write_UINT8(s, orderType); /* orderType (1 byte) */
	Stream_SetPosition(s, em);

	update->numberOrders++;
}
开发者ID:Gilsondc,项目名称:FreeRDP,代码行数:36,代码来源:update.c

示例12: rdpgfx_send_cache_to_surface_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_send_cache_to_surface_pdu(RdpgfxServerContext* context,
        RDPGFX_CACHE_TO_SURFACE_PDU* pdu)
{
	UINT error = CHANNEL_RC_OK;
	UINT16 index;
	RDPGFX_POINT16* destPt;
	wStream* s = rdpgfx_server_single_packet_new(
	                 RDPGFX_CMDID_CACHETOSURFACE,
	                 6 + 4 * pdu->destPtsCount);

	if (!s)
	{
		WLog_ERR(TAG, "rdpgfx_server_single_packet_new failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	Stream_Write_UINT16(s, pdu->cacheSlot); /* cacheSlot (2 bytes) */
	Stream_Write_UINT16(s, pdu->surfaceId); /* surfaceId (2 bytes) */
	Stream_Write_UINT16(s, pdu->destPtsCount); /* destPtsCount (2 bytes) */

	for (index = 0; index < pdu->destPtsCount; index++)
	{
		destPt = &(pdu->destPts[index]);

		if ((error = rdpgfx_write_point16(s, destPt)))
		{
			WLog_ERR(TAG, "rdpgfx_write_point16 failed with error %u", error);
			goto error;
		}
	}

	return rdpgfx_server_single_packet_send(context, s);
error:
	Stream_Free(s, TRUE);
	return error;
}
开发者ID:dcatonR1,项目名称:FreeRDP,代码行数:41,代码来源:rdpgfx_main.c

示例13: rdp_send_deactivate_all

BOOL rdp_send_deactivate_all(rdpRdp* rdp)
{
	wStream* s = rdp_send_stream_pdu_init(rdp);
	BOOL status;

	if (!s)
		return FALSE;

	Stream_Write_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
	Stream_Write_UINT16(s, 1); /* lengthSourceDescriptor (2 bytes) */
	Stream_Write_UINT8(s, 0); /* sourceDescriptor (should be 0x00) */
	status = rdp_send_pdu(rdp, s, PDU_TYPE_DEACTIVATE_ALL, rdp->mcs->userId);
	Stream_Release(s);
	return status;
}
开发者ID:RangeeGmbH,项目名称:FreeRDP,代码行数:15,代码来源:activation.c

示例14: nego_send_preconnection_pdu

BOOL nego_send_preconnection_pdu(rdpNego* nego)
{
	wStream* s;
	UINT32 cbSize;
	UINT16 cchPCB = 0;
	WCHAR* wszPCB = NULL;

	WLog_DBG(TAG, "Sending preconnection PDU");

	if (!nego_tcp_connect(nego))
		return FALSE;

	/* it's easier to always send the version 2 PDU, and it's just 2 bytes overhead */
	cbSize = PRECONNECTION_PDU_V2_MIN_SIZE;

	if (nego->PreconnectionBlob)
	{
		cchPCB = (UINT16) ConvertToUnicode(CP_UTF8, 0, nego->PreconnectionBlob, -1, &wszPCB, 0);
		cchPCB += 1; /* zero-termination */
		cbSize += cchPCB * 2;
	}

	s = Stream_New(NULL, cbSize);

	Stream_Write_UINT32(s, cbSize); /* cbSize */
	Stream_Write_UINT32(s, 0); /* Flags */
	Stream_Write_UINT32(s, PRECONNECTION_PDU_V2); /* Version */
	Stream_Write_UINT32(s, nego->PreconnectionId); /* Id */
	Stream_Write_UINT16(s, cchPCB); /* cchPCB */

	if (wszPCB)
	{
		Stream_Write(s, wszPCB, cchPCB * 2); /* wszPCB */
		free(wszPCB);
	}

	Stream_SealLength(s);

	if (transport_write(nego->transport, s) < 0)
	{
		Stream_Free(s, TRUE);
		return FALSE;
	}

	Stream_Free(s, TRUE);

	return TRUE;
}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:48,代码来源:nego.c

示例15: rdpgfx_send_delete_encoding_context_pdu

/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT rdpgfx_send_delete_encoding_context_pdu(RdpgfxServerContext*
        context,
        RDPGFX_DELETE_ENCODING_CONTEXT_PDU* pdu)
{
	wStream* s = rdpgfx_server_single_packet_new(
	                 RDPGFX_CMDID_DELETEENCODINGCONTEXT, 6);

	if (!s)
	{
		WLog_ERR(TAG, "rdpgfx_server_single_packet_new failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	Stream_Write_UINT16(s, pdu->surfaceId); /* surfaceId (2 bytes) */
	Stream_Write_UINT32(s, pdu->codecContextId); /* codecContextId (4 bytes) */
	return rdpgfx_server_single_packet_send(context, s);
}
开发者ID:dcatonR1,项目名称:FreeRDP,代码行数:22,代码来源:rdpgfx_main.c


注:本文中的Stream_Write_UINT16函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。