本文整理汇总了C++中Stream_EnsureRemainingCapacity函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_EnsureRemainingCapacity函数的具体用法?C++ Stream_EnsureRemainingCapacity怎么用?C++ Stream_EnsureRemainingCapacity使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_EnsureRemainingCapacity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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) */
}
示例2: license_write_encrypted_premaster_secret_blob
void license_write_encrypted_premaster_secret_blob(wStream* s, LICENSE_BLOB* blob, UINT32 ModulusLength)
{
UINT32 length;
length = ModulusLength + 8;
if (blob->length > ModulusLength)
{
WLog_ERR(TAG, "license_write_encrypted_premaster_secret_blob: invalid blob");
return;
}
Stream_EnsureRemainingCapacity(s, length + 4);
Stream_Write_UINT16(s, blob->type); /* wBlobType (2 bytes) */
Stream_Write_UINT16(s, length); /* wBlobLen (2 bytes) */
if (blob->length > 0)
Stream_Write(s, blob->data, blob->length); /* blobData */
Stream_Zero(s, length - blob->length);
}
示例3: svc_plugin_process_received
static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength,
UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
if ((dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
{
/*
* According to MS-RDPBCGR 2.2.6.1, "All virtual channel traffic MUST be suspended.
* This flag is only valid in server-to-client virtual channel traffic. It MUST be
* ignored in client-to-server data." Thus it would be best practice to cease data
* transmission. However, simply returning here avoids a crash.
*/
return;
}
if (dataFlags & CHANNEL_FLAG_FIRST)
{
if (plugin->data_in != NULL)
Stream_Free(plugin->data_in, TRUE);
plugin->data_in = Stream_New(NULL, totalLength);
}
data_in = plugin->data_in;
Stream_EnsureRemainingCapacity(data_in, (int) dataLength);
Stream_Write(data_in, pData, dataLength);
if (dataFlags & CHANNEL_FLAG_LAST)
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
fprintf(stderr, "svc_plugin_process_received: read error\n");
}
plugin->data_in = NULL;
Stream_SetPosition(data_in, 0);
MessageQueue_Post(plugin->MsgPipe->In, NULL, 0, (void*) data_in, NULL);
}
}
示例4: 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;
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 | ORDER_TYPE_CHANGE); /* 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++;
/**
* temporary workaround to avoid PDUs exceeding maximum size
*/
update->EndPaint(context);
update->BeginPaint(context);
}
示例5: update_send_cache_bitmap_v2
static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
{
wStream* s;
int bm, em;
BYTE orderType;
int headerLength;
UINT16 extraFlags;
INT16 orderLength;
rdpUpdate* update = context->update;
extraFlags = 0;
headerLength = 6;
orderType = cache_bitmap_v2->compressed ?
ORDER_TYPE_BITMAP_COMPRESSED_V2 : ORDER_TYPE_BITMAP_UNCOMPRESSED_V2;
if (context->settings->NoBitmapCompressionHeader)
cache_bitmap_v2->flags |= CBR2_NO_BITMAP_COMPRESSION_HDR;
update_check_flush(context, headerLength + update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags));
s = update->us;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
Stream_Seek(s, headerLength);
update_write_cache_bitmap_v2_order(s, cache_bitmap_v2, cache_bitmap_v2->compressed, &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++;
}
示例6: rfx_compose_message_tile
static void rfx_compose_message_tile(RFX_CONTEXT* context, wStream* s,
BYTE* tile_data, int tile_width, int tile_height, int rowstride,
const UINT32* quantVals, int quantIdxY, int quantIdxCb, int quantIdxCr,
int xIdx, int yIdx)
{
int YLen = 0;
int CbLen = 0;
int CrLen = 0;
int start_pos, end_pos;
Stream_EnsureRemainingCapacity(s, 19);
start_pos = Stream_GetPosition(s);
Stream_Write_UINT16(s, CBT_TILE); /* BlockT.blockType */
Stream_Seek_UINT32(s); /* set BlockT.blockLen later */
Stream_Write_UINT8(s, quantIdxY);
Stream_Write_UINT8(s, quantIdxCb);
Stream_Write_UINT8(s, quantIdxCr);
Stream_Write_UINT16(s, xIdx);
Stream_Write_UINT16(s, yIdx);
Stream_Seek(s, 6); /* YLen, CbLen, CrLen */
rfx_encode_rgb(context, tile_data, tile_width, tile_height, rowstride,
quantVals + quantIdxY * 10, quantVals + quantIdxCb * 10, quantVals + quantIdxCr * 10,
s, &YLen, &CbLen, &CrLen);
DEBUG_RFX("xIdx=%d yIdx=%d width=%d height=%d YLen=%d CbLen=%d CrLen=%d",
xIdx, yIdx, tile_width, tile_height, YLen, CbLen, CrLen);
end_pos = Stream_GetPosition(s);
Stream_SetPosition(s, start_pos + 2);
Stream_Write_UINT32(s, 19 + YLen + CbLen + CrLen); /* BlockT.blockLen */
Stream_SetPosition(s, start_pos + 13);
Stream_Write_UINT16(s, YLen);
Stream_Write_UINT16(s, CbLen);
Stream_Write_UINT16(s, CrLen);
Stream_SetPosition(s, end_pos);
}
示例7: update_write_surfcmd_surface_bits_header
BOOL update_write_surfcmd_surface_bits_header(wStream* s,
const SURFACE_BITS_COMMAND* cmd)
{
if (!Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH))
return FALSE;
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);
return TRUE;
}
示例8: update_send_memblt
static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
wStream* s;
int offset;
int headerLength;
ORDER_INFO orderInfo;
rdpUpdate* update = context->update;
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_MEMBLT);
s = update->us;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
Stream_Seek(s, headerLength);
update_write_memblt_order(s, &orderInfo, memblt);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
}
示例9: rfx_write_tile
static void rfx_write_tile(RFX_CONTEXT* context, wStream* s, RFX_TILE* tile)
{
UINT32 blockLen;
blockLen = rfx_tile_length(tile);
Stream_EnsureRemainingCapacity(s, blockLen);
Stream_Write_UINT16(s, CBT_TILE); /* BlockT.blockType (2 bytes) */
Stream_Write_UINT32(s, blockLen); /* BlockT.blockLen (4 bytes) */
Stream_Write_UINT8(s, tile->quantIdxY); /* quantIdxY (1 byte) */
Stream_Write_UINT8(s, tile->quantIdxCb); /* quantIdxCb (1 byte) */
Stream_Write_UINT8(s, tile->quantIdxCr); /* quantIdxCr (1 byte) */
Stream_Write_UINT16(s, tile->xIdx); /* xIdx (2 bytes) */
Stream_Write_UINT16(s, tile->yIdx); /* yIdx (2 bytes) */
Stream_Write_UINT16(s, tile->YLen); /* YLen (2 bytes) */
Stream_Write_UINT16(s, tile->CbLen); /* CbLen (2 bytes) */
Stream_Write_UINT16(s, tile->CrLen); /* CrLen (2 bytes) */
Stream_Write(s, tile->YData, tile->YLen); /* YData */
Stream_Write(s, tile->CbData, tile->CbLen); /* CbData */
Stream_Write(s, tile->CrData, tile->CrLen); /* CrData */
}
示例10: update_send_glyph_index
static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
{
wStream* s;
int offset;
int headerLength;
ORDER_INFO orderInfo;
rdpUpdate* update = context->update;
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_GLYPH_INDEX);
s = update->us;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
Stream_Seek(s, headerLength);
update_write_glyph_index_order(s, &orderInfo, glyph_index);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
}
示例11: update_send_line_to
static void update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
{
wStream* s;
int offset;
int headerLength;
ORDER_INFO orderInfo;
rdpUpdate* update = context->update;
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_LINE_TO);
s = update->us;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
Stream_Seek(s, headerLength);
update_write_line_to_order(s, &orderInfo, line_to);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
}
示例12: audio_format_write
BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format)
{
if (!s || !format)
return FALSE;
if (!Stream_EnsureRemainingCapacity(s, 18 + format->cbSize))
return FALSE;
Stream_Write_UINT16(s, format->wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
Stream_Write_UINT16(s, format->nChannels); /* nChannels */
Stream_Write_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
Stream_Write_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
Stream_Write_UINT16(s, format->nBlockAlign); /* nBlockAlign */
Stream_Write_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
Stream_Write_UINT16(s, format->cbSize); /* cbSize */
if (format->cbSize > 0)
Stream_Write(s, format->data, format->cbSize);
return TRUE;
}
示例13: 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;
update_force_flush(context);
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 | ORDER_TYPE_CHANGE); /* 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++;
update_force_flush(context);
}
示例14: parallel_process_irp_read
static void 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);
status = read(parallel->file, buffer, Length);
if (status < 0)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
free(buffer);
buffer = NULL;
Length = 0;
DEBUG_WARN("read %s(%d) failed", parallel->path, parallel->id);
}
else
{
DEBUG_SVC("read %llu-%llu from %d", Offset, Offset + Length, parallel->id);
}
Stream_Write_UINT32(irp->output, Length);
if (Length > 0)
{
Stream_EnsureRemainingCapacity(irp->output, Length);
Stream_Write(irp->output, buffer, Length);
}
free(buffer);
irp->Complete(irp);
}
示例15: rfx_write_message_tileset
static void rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
{
int i;
RFX_TILE* tile;
UINT32 blockLen;
UINT32* quantVals;
blockLen = 22 + (message->numQuant * 5) + message->tilesDataSize;
Stream_EnsureRemainingCapacity(s, blockLen);
Stream_Write_UINT16(s, WBT_EXTENSION); /* CodecChannelT.blockType (2 bytes) */
Stream_Write_UINT32(s, blockLen); /* set CodecChannelT.blockLen (4 bytes) */
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId (1 byte) */
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId (1 byte) */
Stream_Write_UINT16(s, CBT_TILESET); /* subtype (2 bytes) */
Stream_Write_UINT16(s, 0); /* idx (2 bytes) */
Stream_Write_UINT16(s, context->properties); /* properties (2 bytes) */
Stream_Write_UINT8(s, message->numQuant); /* numQuant (1 byte) */
Stream_Write_UINT8(s, 0x40); /* tileSize (1 byte) */
Stream_Write_UINT16(s, message->numTiles); /* numTiles (2 bytes) */
Stream_Write_UINT32(s, message->tilesDataSize); /* tilesDataSize (4 bytes) */
quantVals = message->quantVals;
for (i = 0; i < message->numQuant * 5; i++)
{
Stream_Write_UINT8(s, quantVals[0] + (quantVals[1] << 4));
quantVals += 2;
}
for (i = 0; i < message->numTiles; i++)
{
tile = message->tiles[i];
rfx_write_tile(context, s, tile);
}
WLog_Print(context->priv->log, WLOG_DEBUG, "numQuant: %d numTiles: %d tilesDataSize: %d",
message->numQuant, message->numTiles, message->tilesDataSize);
}