本文整理汇总了C++中Stream_GetPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_GetPosition函数的具体用法?C++ Stream_GetPosition怎么用?C++ Stream_GetPosition使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_GetPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_recv_surfcmd_surface_bits
static int update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s, UINT32* length)
{
int pos;
SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command;
if (Stream_GetRemainingLength(s) < 20)
return -1;
Stream_Read_UINT16(s, cmd->destLeft);
Stream_Read_UINT16(s, cmd->destTop);
Stream_Read_UINT16(s, cmd->destRight);
Stream_Read_UINT16(s, cmd->destBottom);
Stream_Read_UINT8(s, cmd->bpp);
if ((cmd->bpp < 1) || (cmd->bpp > 32))
{
WLog_ERR(TAG, "invalid bpp value %d", cmd->bpp);
return FALSE;
}
Stream_Seek(s, 2); /* reserved1, reserved2 */
Stream_Read_UINT8(s, cmd->codecID);
Stream_Read_UINT16(s, cmd->width);
Stream_Read_UINT16(s, cmd->height);
Stream_Read_UINT32(s, cmd->bitmapDataLength);
if (Stream_GetRemainingLength(s) < cmd->bitmapDataLength)
return -1;
pos = Stream_GetPosition(s) + cmd->bitmapDataLength;
cmd->bitmapData = Stream_Pointer(s);
Stream_SetPosition(s, pos);
*length = 20 + cmd->bitmapDataLength;
WLog_Print(update->log, WLOG_DEBUG,
"SurfaceBits: destLeft: %d destTop: %d destRight: %d destBottom: %d "
"bpp: %d codecId: %d width: %d height: %d bitmapDataLength: %d",
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
IFCALL(update->SurfaceBits, update->context, cmd);
return 0;
}
示例2: wf_update_encode
void wf_update_encode(wfInfo* wfi)
{
RFX_RECT rect;
long height, width;
BYTE* pDataBits = NULL;
int stride;
SURFACE_BITS_COMMAND* cmd;
wf_info_find_invalid_region(wfi);
cmd = &wfi->cmd;
Stream_SetPosition(wfi->s, 0);
wf_info_getScreenData(wfi, &width, &height, &pDataBits, &stride);
rect.x = 0;
rect.y = 0;
rect.width = (UINT16) width;
rect.height = (UINT16) height;
//printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height);
Stream_Clear(wfi->s);
rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
pDataBits, width, height, stride);
wfi->frame_idx = wfi->rfx_context->frameIdx;
cmd->destLeft = wfi->invalid.left;
cmd->destTop = wfi->invalid.top;
cmd->destRight = wfi->invalid.left + width;
cmd->destBottom = wfi->invalid.top + height;
cmd->bpp = 32;
cmd->codecID = 3;
cmd->width = width;
cmd->height = height;
cmd->bitmapDataLength = Stream_GetPosition(wfi->s);
cmd->bitmapData = Stream_Buffer(wfi->s);
}
示例3: rdpsnd_server_close
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_server_close(RdpsndServerContext* context)
{
int pos;
BOOL status;
ULONG written;
wStream* s = context->priv->rdpsnd_pdu;
UINT error = CHANNEL_RC_OK;
EnterCriticalSection(&context->priv->lock);
if (context->priv->out_pending_frames > 0)
{
if (context->selected_client_format < 0)
{
WLog_ERR(TAG, "Pending audio frame exists while no format selected.");
error = ERROR_INVALID_DATA;
}
else if ((error = rdpsnd_server_send_audio_pdu(context, 0)))
{
WLog_ERR(TAG, "rdpsnd_server_send_audio_pdu failed with error %lu", error);
}
}
LeaveCriticalSection(&context->priv->lock);
if (error)
return error;
context->selected_client_format = -1;
Stream_Write_UINT8(s, SNDC_CLOSE);
Stream_Write_UINT8(s, 0);
Stream_Seek_UINT16(s);
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 ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
}
示例4: ntlm_read_ntlm_v2_client_challenge
int ntlm_read_ntlm_v2_client_challenge(wStream* s, NTLMv2_CLIENT_CHALLENGE* challenge)
{
size_t size;
Stream_Read_UINT8(s, challenge->RespType);
Stream_Read_UINT8(s, challenge->HiRespType);
Stream_Read_UINT16(s, challenge->Reserved1);
Stream_Read_UINT32(s, challenge->Reserved2);
Stream_Read(s, challenge->Timestamp, 8);
Stream_Read(s, challenge->ClientChallenge, 8);
Stream_Read_UINT32(s, challenge->Reserved3);
size = Stream_Length(s) - Stream_GetPosition(s);
challenge->AvPairs = (NTLM_AV_PAIR*) malloc(size);
if (!challenge->AvPairs)
return -1;
Stream_Read(s, challenge->AvPairs, size);
return 1;
}
示例5: svc_plugin_process_received
static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength,
UINT32 totalLength, UINT32 dataFlags)
{
wStream* s;
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);
}
s = plugin->data_in;
Stream_EnsureRemainingCapacity(s, (int) dataLength);
Stream_Write(s, pData, dataLength);
if (dataFlags & CHANNEL_FLAG_LAST)
{
if (Stream_Capacity(s) != Stream_GetPosition(s))
{
fprintf(stderr, "svc_plugin_process_received: read error\n");
}
plugin->data_in = NULL;
Stream_SealLength(s);
Stream_SetPosition(s, 0);
MessageQueue_Post(plugin->MsgPipe->In, NULL, 0, (void*) s, NULL);
}
}
示例6: 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++;
}
示例7: cliprdr_server_packet_send
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT cliprdr_server_packet_send(CliprdrServerPrivate* cliprdr, wStream* s)
{
UINT32 pos;
BOOL status;
UINT32 dataLen;
UINT32 written;
pos = Stream_GetPosition(s);
dataLen = pos - 8;
Stream_SetPosition(s, 4);
Stream_Write_UINT32(s, dataLen);
Stream_SetPosition(s, pos);
status = WTSVirtualChannelWrite(cliprdr->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_Length(s), &written);
Stream_Free(s, TRUE);
return status ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
}
示例8: update_check_flush
static BOOL update_check_flush(rdpContext* context, int size)
{
wStream* s;
rdpUpdate* update = context->update;
s = update->us;
if (!update->us)
{
update->BeginPaint(context);
return FALSE;
}
if (Stream_GetPosition(s) + size + 64 >= 0x3FFF)
{
update_flush(context);
return TRUE;
}
return FALSE;
}
示例9: update_write_order_info
int update_write_order_info(rdpContext* context, wStream* s, ORDER_INFO* orderInfo, int offset)
{
int position;
position = Stream_GetPosition(s);
Stream_SetPosition(s, offset);
Stream_Write_UINT8(s, orderInfo->controlFlags); /* controlFlags (1 byte) */
if (orderInfo->controlFlags & ORDER_TYPE_CHANGE)
Stream_Write_UINT8(s, orderInfo->orderType); /* orderType (1 byte) */
update_write_field_flags(s, orderInfo->fieldFlags, orderInfo->controlFlags,
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType]);
update_write_bounds(s, orderInfo);
Stream_SetPosition(s, position);
return 0;
}
示例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: assert_stream
void assert_stream(wStream* s, BYTE* data, int length, const char* func, int line)
{
int i;
int actual_length;
BYTE* actual_data;
actual_data = s->buffer;
actual_length = Stream_GetPosition(s);
if (actual_length != length)
{
printf("\n %s (%d): length mismatch, actual:%d, expected:%d\n", func, line, actual_length, length);
printf("\nActual:\n");
winpr_HexDump(TAG, WLOG_ERR, actual_data, actual_length);
printf("Expected:\n");
winpr_HexDump(TAG, WLOG_ERR, data, length);
CU_FAIL("assert_stream, length mismatch");
return;
}
for (i = 0; i < length; i++)
{
if (actual_data[i] != data[i])
{
printf("\n %s (%d): buffer mismatch:\n", func, line);
printf("\nActual:\n");
winpr_HexDump(TAG, WLOG_ERR, actual_data, length);
printf("Expected:\n");
winpr_HexDump(TAG, WLOG_ERR, data, length);
CU_FAIL("assert_stream, buffer mismatch");
return;
}
}
}
示例13: license_send
BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
{
int length;
BYTE flags;
UINT16 wMsgSize;
UINT16 sec_flags;
DEBUG_LICENSE("Sending %s Packet", LICENSE_MESSAGE_STRINGS[type & 0x1F]);
length = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
sec_flags = SEC_LICENSE_PKT;
wMsgSize = length - LICENSE_PACKET_HEADER_MAX_LENGTH + 4;
/**
* Using EXTENDED_ERROR_MSG_SUPPORTED here would cause mstsc to crash when
* running in server mode! This flag seems to be incorrectly documented.
*/
flags = PREAMBLE_VERSION_3_0;
rdp_write_header(license->rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
rdp_write_security_header(s, sec_flags);
license_write_preamble(s, type, flags, wMsgSize);
#ifdef WITH_DEBUG_LICENSE
fprintf(stderr, "Sending %s Packet, length %d\n", LICENSE_MESSAGE_STRINGS[type & 0x1F], wMsgSize);
winpr_HexDump(Stream_Pointer(s) - 4, wMsgSize);
#endif
Stream_SetPosition(s, length);
Stream_SealLength(s);
if (transport_write(license->rdp->transport, s) < 0)
return FALSE;
Stream_Free(s, TRUE);
return TRUE;
}
示例14: 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;
if (!Stream_EnsureRemainingCapacity(s, 18))
return;
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)
{
if (!Stream_EnsureRemainingCapacity(s, audin->context.server_formats[i].cbSize))
return;
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);
}
示例15: rdpsnd_server_set_volume
static BOOL rdpsnd_server_set_volume(RdpsndServerContext* context, int left, int right)
{
int pos;
BOOL status;
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), NULL);
Stream_SetPosition(s, 0);
return status;
}