本文整理汇总了C++中Stream_Write函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Write函数的具体用法?C++ Stream_Write怎么用?C++ Stream_Write使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_Write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: license_write_binary_blob
void license_write_binary_blob(wStream* s, LICENSE_BLOB* blob)
{
Stream_EnsureRemainingCapacity(s, blob->length + 4);
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 */
}
示例2: cliprdr_client_format_data_response
int cliprdr_client_format_data_response(CliprdrClientContext* context, CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
formatDataResponse->msgType = CB_FORMAT_DATA_RESPONSE;
s = cliprdr_packet_new(formatDataResponse->msgType, formatDataResponse->msgFlags, formatDataResponse->dataLen);
Stream_Write(s, formatDataResponse->requestedFormatData, formatDataResponse->dataLen);
cliprdr_packet_send(cliprdr, s);
return 0;
}
示例3: rail_send_channel_data
void rail_send_channel_data(void* rail_object, void* data, size_t length)
{
wStream* s = NULL;
railPlugin* plugin = (railPlugin*) rail_object;
s = Stream_New(NULL, length);
Stream_Write(s, data, length);
svc_plugin_send((rdpSvcPlugin*) plugin, s);
}
示例4: rdp_write_client_auto_reconnect_cookie
void rdp_write_client_auto_reconnect_cookie(wStream* s, rdpSettings* settings)
{
ARC_CS_PRIVATE_PACKET* autoReconnectCookie;
autoReconnectCookie = settings->ClientAutoReconnectCookie;
Stream_Write_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
Stream_Write_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
Stream_Write_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
Stream_Write(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */
}
示例5: rdp_write_extended_info_packet
static void rdp_write_extended_info_packet(rdpRdp* rdp, wStream* s)
{
int clientAddressFamily;
WCHAR* clientAddress = NULL;
int cbClientAddress;
WCHAR* clientDir = NULL;
int cbClientDir;
int cbAutoReconnectCookie;
rdpSettings* settings = rdp->settings;
clientAddressFamily = settings->IPv6Enabled ? ADDRESS_FAMILY_INET6 : ADDRESS_FAMILY_INET;
cbClientAddress = ConvertToUnicode(CP_UTF8, 0, settings->ClientAddress, -1, &clientAddress, 0) * 2;
cbClientDir = ConvertToUnicode(CP_UTF8, 0, settings->ClientDir, -1, &clientDir, 0) * 2;
cbAutoReconnectCookie = (int) settings->ServerAutoReconnectCookie->cbLen;
Stream_Write_UINT16(s, clientAddressFamily); /* clientAddressFamily (2 bytes) */
Stream_Write_UINT16(s, cbClientAddress + 2); /* cbClientAddress (2 bytes) */
if (cbClientAddress > 0)
Stream_Write(s, clientAddress, cbClientAddress); /* clientAddress */
Stream_Write_UINT16(s, 0);
Stream_Write_UINT16(s, cbClientDir + 2); /* cbClientDir (2 bytes) */
if (cbClientDir > 0)
Stream_Write(s, clientDir, cbClientDir); /* clientDir */
Stream_Write_UINT16(s, 0);
rdp_write_client_time_zone(s, settings); /* clientTimeZone (172 bytes) */
Stream_Write_UINT32(s, 0); /* clientSessionId (4 bytes), should be set to 0 */
freerdp_performance_flags_make(settings);
Stream_Write_UINT32(s, settings->PerformanceFlags); /* performanceFlags (4 bytes) */
Stream_Write_UINT16(s, cbAutoReconnectCookie); /* cbAutoReconnectCookie (2 bytes) */
if (cbAutoReconnectCookie > 0)
{
rdp_compute_client_auto_reconnect_cookie(rdp);
rdp_write_client_auto_reconnect_cookie(rdp, s); /* autoReconnectCookie */
Stream_Write_UINT16(s, 0); /* reserved1 (2 bytes) */
Stream_Write_UINT16(s, 0); /* reserved2 (2 bytes) */
}
free(clientAddress);
free(clientDir);
}
示例6: drdynvc_virtual_channel_event_data_received
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc,
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
if ((dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
{
return CHANNEL_RC_OK;
}
if (dataFlags & CHANNEL_FLAG_FIRST)
{
if (drdynvc->data_in)
Stream_Free(drdynvc->data_in, TRUE);
drdynvc->data_in = Stream_New(NULL, totalLength);
}
if (!(data_in = drdynvc->data_in))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_New failed!");
return CHANNEL_RC_NO_MEMORY;
}
if (!Stream_EnsureRemainingCapacity(data_in, dataLength))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_EnsureRemainingCapacity failed!");
Stream_Free(drdynvc->data_in, TRUE);
drdynvc->data_in = NULL;
return ERROR_INTERNAL_ERROR;
}
Stream_Write(data_in, pData, dataLength);
if (dataFlags & CHANNEL_FLAG_LAST)
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_plugin_process_received: read error");
return ERROR_INVALID_DATA;
}
drdynvc->data_in = NULL;
Stream_SealLength(data_in);
Stream_SetPosition(data_in, 0);
if (!MessageQueue_Post(drdynvc->queue, NULL, 0, (void*) data_in, NULL))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_Post failed!");
return ERROR_INTERNAL_ERROR;
}
}
return CHANNEL_RC_OK;
}
示例7: drive_process_irp_read
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT drive_process_irp_read(DRIVE_DEVICE* drive, IRP* irp)
{
DRIVE_FILE* file;
UINT32 Length;
UINT64 Offset;
BYTE* buffer = NULL;
Stream_Read_UINT32(irp->input, Length);
Stream_Read_UINT64(irp->input, Offset);
file = drive_get_file_by_id(drive, irp->FileId);
if (!file)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
Length = 0;
}
else if (!drive_file_seek(file, Offset))
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
Length = 0;
}
else
{
buffer = (BYTE*) malloc(Length);
if (!buffer)
{
WLog_ERR(TAG, "malloc failed!");
return CHANNEL_RC_OK;
}
if (!drive_file_read(file, buffer, &Length))
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
free(buffer);
buffer = NULL;
Length = 0;
}
}
Stream_Write_UINT32(irp->output, Length);
if (Length > 0)
{
if (!Stream_EnsureRemainingCapacity(irp->output, (int) Length))
{
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
return ERROR_INTERNAL_ERROR;
}
Stream_Write(irp->output, buffer, Length);
}
free(buffer);
return irp->Complete(irp);
}
示例8: wts_write_drdynvc_create_request
static BOOL wts_write_drdynvc_create_request(wStream *s, UINT32 ChannelId, const char *ChannelName)
{
UINT32 len;
wts_write_drdynvc_header(s, CREATE_REQUEST_PDU, ChannelId);
len = strlen(ChannelName) + 1;
if (!Stream_EnsureRemainingCapacity(s, (int) len))
return FALSE;
Stream_Write(s, ChannelName, len);
return TRUE;
}
示例9: rail_write_unicode_string_value
static BOOL rail_write_unicode_string_value(wStream* s, RAIL_UNICODE_STRING* unicode_string)
{
if (unicode_string->length > 0)
{
if (!Stream_EnsureRemainingCapacity(s, unicode_string->length))
return FALSE;
Stream_Write(s, unicode_string->string, unicode_string->length); /* string */
}
return TRUE;
}
示例10: update_write_pointer_color
static void update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
{
Stream_EnsureRemainingCapacity(s, 15 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask);
Stream_Write_UINT16(s, pointer_color->cacheIndex);
Stream_Write_UINT16(s, pointer_color->xPos);
Stream_Write_UINT16(s, pointer_color->yPos);
Stream_Write_UINT16(s, pointer_color->width);
Stream_Write_UINT16(s, pointer_color->height);
Stream_Write_UINT16(s, pointer_color->lengthAndMask);
Stream_Write_UINT16(s, pointer_color->lengthXorMask);
if (pointer_color->lengthXorMask > 0)
Stream_Write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
if (pointer_color->lengthAndMask > 0)
Stream_Write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
Stream_Write_UINT8(s, 0); /* pad (1 byte) */
}
示例11: update_send_surface_command
static void update_send_surface_command(rdpContext* context, wStream* s)
{
wStream* update;
rdpRdp* rdp = context->rdp;
update = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(update, Stream_GetPosition(s));
Stream_Write(update, Stream_Buffer(s), Stream_GetPosition(s));
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update);
Stream_Release(update);
}
示例12: FDSAPI_EncodeString
static void FDSAPI_EncodeString(wStream* s, const char* stringValue)
{
UINT16 stringSize = (stringValue ? strlen(stringValue) : 0);
Stream_Write_UINT16(s, stringSize);
if (stringSize > 0)
{
Stream_Write(s, stringValue, stringSize);
}
}
示例13: rdp_write_client_time_zone
BOOL rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
{
LPTIME_ZONE_INFORMATION tz;
DWORD rc;
tz = settings->ClientTimeZone;
if (!tz)
return FALSE;
rc = GetTimeZoneInformation(tz);
/* Bias */
Stream_Write_UINT32(s, tz->Bias);
/* standardName (64 bytes) */
Stream_Write(s, tz->StandardName, sizeof(tz->StandardName));
/* StandardDate */
rdp_write_system_time(s, &tz->StandardDate);
DEBUG_TIMEZONE("bias=%d stdName='%s' dlName='%s'", tz->Bias,
tz->StandardName, tz->DaylightName);
/* Note that StandardBias is ignored if no valid standardDate is provided. */
/* StandardBias */
Stream_Write_UINT32(s, tz->StandardBias);
DEBUG_TIMEZONE("StandardBias=%d", tz->StandardBias);
/* daylightName (64 bytes) */
Stream_Write(s, tz->DaylightName, sizeof(tz->DaylightName));
/* DaylightDate */
rdp_write_system_time(s, &tz->DaylightDate);
/* Note that DaylightBias is ignored if no valid daylightDate is provided. */
/* DaylightBias */
Stream_Write_UINT32(s, tz->DaylightBias);
DEBUG_TIMEZONE("DaylightBias=%d", tz->DaylightBias);
return TRUE;
}
示例14: update_send_surface_bits
static void update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command)
{
wStream* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surface_bits_command->bitmapDataLength);
update_write_surfcmd_surface_bits_header(s, surface_bits_command);
Stream_Write(s, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
Stream_Release(s);
}
示例15: 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);
if (!s)
{
free(wszPCB);
WLog_ERR(TAG, "Stream_New failed!");
return FALSE;
}
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;
}