本文整理汇总了C++中Stream_Write_UINT32函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Write_UINT32函数的具体用法?C++ Stream_Write_UINT32怎么用?C++ Stream_Write_UINT32使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_Write_UINT32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: remdesk_send_ctl_version_info_pdu
static int remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk)
{
wStream* s;
REMDESK_CTL_VERSION_INFO_PDU pdu;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_VERSIONINFO, 8);
pdu.versionMajor = 1;
pdu.versionMinor = 2;
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
Stream_Write_UINT32(s, pdu.versionMajor); /* versionMajor (4 bytes) */
Stream_Write_UINT32(s, pdu.versionMinor); /* versionMinor (4 bytes) */
Stream_SealLength(s);
remdesk_virtual_channel_write(remdesk, s);
return 1;
}
示例3: remdesk_write_ctl_header
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_write_ctl_header(wStream* s, REMDESK_CTL_HEADER* ctlHeader)
{
UINT error;
if ((error = remdesk_write_channel_header(s,
(REMDESK_CHANNEL_HEADER*) ctlHeader)))
{
WLog_ERR(TAG, "remdesk_write_channel_header failed with error %"PRIu32"!", error);
return error;
}
Stream_Write_UINT32(s, ctlHeader->msgType); /* msgType (4 bytes) */
return CHANNEL_RC_OK;
}
示例4: guac_rdpdr_fs_process_query_full_size_info
void guac_rdpdr_fs_process_query_full_size_info(guac_rdpdr_device* device, wStream* input_stream,
int file_id, int completion_id) {
guac_rdp_fs_info info = {0};
guac_rdp_fs_get_info((guac_rdp_fs*) device->data, &info);
wStream* output_stream = guac_rdpdr_new_io_completion(device,
completion_id, STATUS_SUCCESS, 36);
guac_client_log(device->rdpdr->client, GUAC_LOG_DEBUG,
"%s: [file_id=%i]",
__func__, file_id);
Stream_Write_UINT32(output_stream, 32);
Stream_Write_UINT64(output_stream, info.blocks_total); /* TotalAllocationUnits */
Stream_Write_UINT64(output_stream, info.blocks_available); /* CallerAvailableAllocationUnits */
Stream_Write_UINT64(output_stream, info.blocks_available); /* ActualAvailableAllocationUnits */
Stream_Write_UINT32(output_stream, 1); /* SectorsPerAllocationUnit */
Stream_Write_UINT32(output_stream, info.block_size); /* BytesPerSector */
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
}
示例5: WLog_BinaryAppender_WriteMessage
int WLog_BinaryAppender_WriteMessage(wLog* log, wLogBinaryAppender* appender, wLogMessage* message)
{
FILE* fp;
wStream* s;
int MessageLength;
int FileNameLength;
int FunctionNameLength;
int TextStringLength;
if (message->Level > log->Level)
return 0;
fp = appender->FileDescriptor;
if (!fp)
return -1;
FileNameLength = strlen(message->FileName);
FunctionNameLength = strlen(message->FunctionName);
TextStringLength = strlen(message->TextString);
MessageLength = 16 +
(4 + FileNameLength + 1) +
(4 + FunctionNameLength + 1) +
(4 + TextStringLength + 1);
s = Stream_New(NULL, MessageLength);
Stream_Write_UINT32(s, MessageLength);
Stream_Write_UINT32(s, message->Type);
Stream_Write_UINT32(s, message->Level);
Stream_Write_UINT32(s, message->LineNumber);
Stream_Write_UINT32(s, FileNameLength);
Stream_Write(s, message->FileName, FileNameLength + 1);
Stream_Write_UINT32(s, FunctionNameLength);
Stream_Write(s, message->FunctionName, FunctionNameLength + 1);
Stream_Write_UINT32(s, TextStringLength);
Stream_Write(s, message->TextString, TextStringLength + 1);
Stream_SealLength(s);
fwrite(Stream_Buffer(s), MessageLength, 1, fp);
Stream_Free(s, TRUE);
return 1;
}
示例6: rdpgfx_send_frame_acknowledge_pdu
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_send_frame_acknowledge_pdu(RDPGFX_CHANNEL_CALLBACK* callback, RDPGFX_FRAME_ACKNOWLEDGE_PDU* pdu)
{
UINT error;
wStream* s;
RDPGFX_HEADER header;
header.flags = 0;
header.cmdId = RDPGFX_CMDID_FRAMEACKNOWLEDGE;
header.pduLength = RDPGFX_HEADER_SIZE + 12;
WLog_DBG(TAG, "SendFrameAcknowledgePdu: %d", pdu->frameId);
s = Stream_New(NULL, header.pduLength);
if (!s)
{
WLog_ERR(TAG, "Stream_New failed!");
return CHANNEL_RC_NO_MEMORY;
}
if ((error = rdpgfx_write_header(s, &header)))
{
WLog_ERR(TAG, "rdpgfx_write_header failed with error %lu!", error);
return error;
}
/* RDPGFX_FRAME_ACKNOWLEDGE_PDU */
Stream_Write_UINT32(s, pdu->queueDepth); /* queueDepth (4 bytes) */
Stream_Write_UINT32(s, pdu->frameId); /* frameId (4 bytes) */
Stream_Write_UINT32(s, pdu->totalFramesDecoded); /* totalFramesDecoded (4 bytes) */
error = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s), Stream_Buffer(s), NULL);
Stream_Free(s, TRUE);
return error;
}
示例7: 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);
}
示例8: xf_cliprdr_process_dib
static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
{
wStream* s;
UINT16 bpp;
UINT32 offset;
UINT32 ncolors;
/* size should be at least sizeof(BITMAPINFOHEADER) */
if (size < 40)
{
DEBUG_X11_CLIPRDR("dib size %d too short", size);
return;
}
s = Stream_New(data, size);
Stream_Seek(s, 14);
Stream_Read_UINT16(s, bpp);
Stream_Read_UINT32(s, ncolors);
offset = 14 + 40 + (bpp <= 8 ? (ncolors == 0 ? (1 << bpp) : ncolors) * 4 : 0);
Stream_Free(s, FALSE);
DEBUG_X11_CLIPRDR("offset=%d bpp=%d ncolors=%d", offset, bpp, ncolors);
s = Stream_New(NULL, 14 + size);
Stream_Write_UINT8(s, 'B');
Stream_Write_UINT8(s, 'M');
Stream_Write_UINT32(s, 14 + size);
Stream_Write_UINT32(s, 0);
Stream_Write_UINT32(s, offset);
Stream_Write(s, data, size);
cb->data = Stream_Buffer(s);
cb->data_length = Stream_GetPosition(s);
Stream_Free(s, FALSE);
}
示例9: video_control_send_presentation_response
static UINT video_control_send_presentation_response(VideoClientContext *context, TSMM_PRESENTATION_RESPONSE *resp)
{
BYTE buf[12];
wStream *s;
VIDEO_PLUGIN* video = (VIDEO_PLUGIN *)context->handle;
IWTSVirtualChannel* channel;
UINT ret;
s = Stream_New(buf, 12);
if (!s)
return CHANNEL_RC_NO_MEMORY;
Stream_Write_UINT32(s, 12); /* cbSize */
Stream_Write_UINT32(s, TSMM_PACKET_TYPE_PRESENTATION_RESPONSE); /* PacketType */
Stream_Write_UINT8(s, resp->PresentationId);
Stream_Zero(s, 3);
Stream_SealLength(s);
channel = video->control_callback->channel_callback->channel;
ret = channel->Write(channel, 12, buf, NULL);
Stream_Free(s, FALSE);
return ret;
}
示例10: cliprdr_packet_send
void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
{
int pos;
UINT32 dataLen;
pos = Stream_GetPosition(s);
dataLen = pos - 8;
Stream_SetPosition(s, 4);
Stream_Write_UINT32(s, dataLen);
Stream_SetPosition(s, pos);
#ifdef WITH_DEBUG_CLIPRDR
WLog_DBG(TAG, "Cliprdr Sending (%d bytes)", dataLen + 8);
winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), dataLen + 8);
#endif
svc_plugin_send((rdpSvcPlugin*) cliprdr, s);
}
示例11: rdp_write_share_data_header
void rdp_write_share_data_header(wStream* s, UINT16 length, BYTE type, UINT32 share_id)
{
length -= RDP_PACKET_HEADER_MAX_LENGTH;
length -= RDP_SHARE_CONTROL_HEADER_LENGTH;
length -= RDP_SHARE_DATA_HEADER_LENGTH;
/* 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) */
}
示例12: 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;
}
示例13: parallel_process_irp_read
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
{
UINT32 Length;
UINT64 Offset;
ssize_t status;
BYTE* buffer = NULL;
Stream_Read_UINT32(irp->input, Length);
Stream_Read_UINT64(irp->input, Offset);
buffer = (BYTE*) malloc(Length);
if (!buffer)
{
WLog_ERR(TAG, "malloc failed!");
return CHANNEL_RC_NO_MEMORY;
}
status = read(parallel->file, buffer, Length);
if (status < 0)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
free(buffer);
buffer = NULL;
Length = 0;
}
else
{
}
Stream_Write_UINT32(irp->output, Length);
if (Length > 0)
{
if (!Stream_EnsureRemainingCapacity(irp->output, Length))
{
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
free(buffer);
return CHANNEL_RC_NO_MEMORY;
}
Stream_Write(irp->output, buffer, Length);
}
free(buffer);
return irp->Complete(irp);
}
示例14: cliprdr_client_unlock_clipboard_data
int cliprdr_client_unlock_clipboard_data(CliprdrClientContext* context, CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
s = cliprdr_packet_new(CB_UNLOCK_CLIPDATA, 0, 4);
Stream_Write_UINT32(s, unlockClipboardData->clipDataId); /* clipDataId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientUnlockClipboardData: clipDataId: 0x%04X",
unlockClipboardData->clipDataId);
cliprdr_packet_send(cliprdr, s);
return 1;
}
示例15: guac_rdpdr_process_print_job_create
void guac_rdpdr_process_print_job_create(guac_rdpdr_device* device,
wStream* input_stream, int completion_id) {
guac_rdpdr_printer_data* printer_data =
(guac_rdpdr_printer_data*) device->data;
wStream* output_stream = guac_rdpdr_new_io_completion(device,
completion_id, STATUS_SUCCESS, 4);
/* No bytes received yet */
printer_data->bytes_received = 0;
Stream_Write_UINT32(output_stream, 0); /* fileId */
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
}