本文整理汇总了C++中Stream_Read_UINT8函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Read_UINT8函数的具体用法?C++ Stream_Read_UINT8怎么用?C++ Stream_Read_UINT8使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_Read_UINT8函数的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);
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;
IFCALL(update->SurfaceBits, update->context, cmd);
return 0;
}
示例2: rdpei_read_2byte_unsigned
BOOL rdpei_read_2byte_unsigned(wStream* s, UINT32* value)
{
BYTE byte;
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
Stream_Read_UINT8(s, byte);
if (byte & 0x80)
{
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
*value = (byte & 0x7F) << 8;
Stream_Read_UINT8(s, byte);
*value |= byte;
}
else
{
*value = (byte & 0x7F);
}
return TRUE;
}
示例3: rdp_recv_autodetect_request_packet
int rdp_recv_autodetect_request_packet(rdpRdp* rdp, wStream* s)
{
AUTODETECT_REQ_PDU autodetectReqPdu;
BOOL success = FALSE;
if (Stream_GetRemainingLength(s) < 6)
return -1;
Stream_Read_UINT8(s, autodetectReqPdu.headerLength); /* headerLength (1 byte) */
Stream_Read_UINT8(s, autodetectReqPdu.headerTypeId); /* headerTypeId (1 byte) */
Stream_Read_UINT16(s, autodetectReqPdu.sequenceNumber); /* sequenceNumber (2 bytes) */
Stream_Read_UINT16(s, autodetectReqPdu.requestType); /* requestType (2 bytes) */
WLog_VRB(AUTODETECT_TAG,
"rdp_recv_autodetect_request_packet: headerLength=%"PRIu8", headerTypeId=%"PRIu8", sequenceNumber=%"PRIu16", requestType=%04"PRIx16"",
autodetectReqPdu.headerLength, autodetectReqPdu.headerTypeId,
autodetectReqPdu.sequenceNumber, autodetectReqPdu.requestType);
if (autodetectReqPdu.headerTypeId != TYPE_ID_AUTODETECT_REQUEST)
return -1;
switch (autodetectReqPdu.requestType)
{
case RDP_RTT_REQUEST_TYPE_CONTINUOUS:
case RDP_RTT_REQUEST_TYPE_CONNECTTIME:
/* RTT Measure Request (RDP_RTT_REQUEST) - MS-RDPBCGR 2.2.14.1.1 */
success = autodetect_recv_rtt_measure_request(rdp, s, &autodetectReqPdu);
break;
case RDP_BW_START_REQUEST_TYPE_CONTINUOUS:
case RDP_BW_START_REQUEST_TYPE_TUNNEL:
case RDP_BW_START_REQUEST_TYPE_CONNECTTIME:
/* Bandwidth Measure Start (RDP_BW_START) - MS-RDPBCGR 2.2.14.1.2 */
success = autodetect_recv_bandwidth_measure_start(rdp, s, &autodetectReqPdu);
break;
case RDP_BW_PAYLOAD_REQUEST_TYPE:
/* Bandwidth Measure Payload (RDP_BW_PAYLOAD) - MS-RDPBCGR 2.2.14.1.3 */
success = autodetect_recv_bandwidth_measure_payload(rdp, s, &autodetectReqPdu);
break;
case RDP_BW_STOP_REQUEST_TYPE_CONNECTTIME:
case RDP_BW_STOP_REQUEST_TYPE_CONTINUOUS:
case RDP_BW_STOP_REQUEST_TYPE_TUNNEL:
/* Bandwidth Measure Stop (RDP_BW_STOP) - MS-RDPBCGR 2.2.14.1.4 */
success = autodetect_recv_bandwidth_measure_stop(rdp, s, &autodetectReqPdu);
break;
case 0x0840:
case 0x0880:
case 0x08C0:
/* Network Characteristics Result (RDP_NETCHAR_RESULT) - MS-RDPBCGR 2.2.14.1.5 */
success = autodetect_recv_netchar_result(rdp, s, &autodetectReqPdu);
break;
default:
break;
}
return success ? 0 : -1;
}
示例4: rfx_process_message_codec_versions
static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
{
BYTE numCodecs;
if (Stream_GetRemainingLength(s) < 1)
{
DEBUG_WARN("RfxCodecVersion packet too small");
return FALSE;
}
Stream_Read_UINT8(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */
if (numCodecs != 1)
{
DEBUG_WARN("numCodecs: %d, expected:1", numCodecs);
return FALSE;
}
if (Stream_GetRemainingLength(s) < 2 * numCodecs)
{
DEBUG_WARN("RfxCodecVersion packet too small for numCodecs=%d", numCodecs);
return FALSE;
}
/* RFX_CODEC_VERSIONT */
Stream_Read_UINT8(s, context->codec_id); /* codecId (1 byte) */
Stream_Read_UINT8(s, context->codec_version); /* version (2 bytes) */
DEBUG_RFX("id %d version 0x%X.", context->codec_id, context->codec_version);
return TRUE;
}
示例5: ber_read_length
BOOL ber_read_length(wStream* s, int* length)
{
BYTE byte;
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
Stream_Read_UINT8(s, byte);
if (byte & 0x80)
{
byte &= ~(0x80);
if (Stream_GetRemainingLength(s) < byte)
return FALSE;
if (byte == 1)
Stream_Read_UINT8(s, *length);
else if (byte == 2)
Stream_Read_UINT16_BE(s, *length);
else
return FALSE;
}
else
{
*length = byte;
}
return TRUE;
}
示例6: update_read_palette
BOOL update_read_palette(rdpUpdate* update, wStream* s, PALETTE_UPDATE* palette_update)
{
int i;
PALETTE_ENTRY* entry;
if (Stream_GetRemainingLength(s) < 6)
return FALSE;
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
Stream_Read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
if (palette_update->number > 256)
palette_update->number = 256;
if (Stream_GetRemainingLength(s) < palette_update->number * 3)
return FALSE;
/* paletteEntries */
for (i = 0; i < (int) palette_update->number; i++)
{
entry = &palette_update->entries[i];
Stream_Read_UINT8(s, entry->blue);
Stream_Read_UINT8(s, entry->green);
Stream_Read_UINT8(s, entry->red);
}
return TRUE;
}
示例7: ntlm_read_version_info
void ntlm_read_version_info(wStream* s, NTLM_VERSION_INFO* versionInfo)
{
Stream_Read_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */
Stream_Read_UINT8(s, versionInfo->ProductMinorVersion); /* ProductMinorVersion (1 byte) */
Stream_Read_UINT16(s, versionInfo->ProductBuild); /* ProductBuild (2 bytes) */
Stream_Read(s, versionInfo->Reserved, sizeof(versionInfo->Reserved)); /* Reserved (3 bytes) */
Stream_Read_UINT8(s, versionInfo->NTLMRevisionCurrent); /* NTLMRevisionCurrent (1 byte) */
}
示例8: rdpgfx_read_color32
int rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32)
{
Stream_Read_UINT8(s, color32->B); /* B (1 byte) */
Stream_Read_UINT8(s, color32->G); /* G (1 byte) */
Stream_Read_UINT8(s, color32->R); /* R (1 byte) */
Stream_Read_UINT8(s, color32->XA); /* XA (1 byte) */
return 0;
}
示例9: rfx_process_message_channels
static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
{
BYTE channelId;
BYTE numChannels;
context->decodedHeaderBlocks &= ~_RFX_DECODED_CHANNELS;
if (Stream_GetRemainingLength(s) < 1)
{
WLog_ERR(TAG, "RfxMessageChannels packet too small");
return FALSE;
}
Stream_Read_UINT8(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */
/* In RDVH sessions, numChannels will represent the number of virtual monitors
* configured and does not always be set to 0x01 as [MS-RDPRFX] said.
*/
if (numChannels < 1)
{
WLog_ERR(TAG, "no channels announced");
return FALSE;
}
if (Stream_GetRemainingLength(s) < (size_t) (numChannels * 5))
{
WLog_ERR(TAG, "RfxMessageChannels packet too small for numChannels=%d", numChannels);
return FALSE;
}
/* RFX_CHANNELT */
Stream_Read_UINT8(s, channelId); /* channelId (1 byte), must be set to 0x00 */
if (channelId != 0x00)
{
WLog_ERR(TAG, "channelId:0x%02X, expected:0x00", channelId);
return FALSE;
}
Stream_Read_UINT16(s, context->width); /* width (2 bytes) */
Stream_Read_UINT16(s, context->height); /* height (2 bytes) */
if (!context->width || !context->height)
{
WLog_ERR(TAG, "%s: invalid channel with/height: %ux%u", __FUNCTION__, context->width, context->height);
return FALSE;
}
/* Now, only the first monitor can be used, therefore the other channels will be ignored. */
Stream_Seek(s, 5 * (numChannels - 1));
WLog_Print(context->priv->log, WLOG_DEBUG, "numChannels %d id %d, %dx%d.",
numChannels, channelId, context->width, context->height);
context->decodedHeaderBlocks |= _RFX_DECODED_CHANNELS;
return TRUE;
}
示例10: rdpgfx_read_h264_metablock
int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METABLOCK* meta)
{
UINT32 index;
RDPGFX_RECT16* regionRect;
RDPGFX_H264_QUANT_QUALITY* quantQualityVal;
meta->regionRects = NULL;
meta->quantQualityVals = NULL;
if (Stream_GetRemainingLength(s) < 4)
return -1;
Stream_Read_UINT32(s, meta->numRegionRects); /* numRegionRects (4 bytes) */
if (Stream_GetRemainingLength(s) < (meta->numRegionRects * 8))
return -1;
meta->regionRects = (RDPGFX_RECT16*) malloc(meta->numRegionRects * sizeof(RDPGFX_RECT16));
if (!meta->regionRects)
return -1;
meta->quantQualityVals = (RDPGFX_H264_QUANT_QUALITY*) malloc(meta->numRegionRects * sizeof(RDPGFX_H264_QUANT_QUALITY));
if (!meta->quantQualityVals)
return -1;
WLog_DBG(TAG, "H264_METABLOCK: numRegionRects: %d", (int) meta->numRegionRects);
for (index = 0; index < meta->numRegionRects; index++)
{
regionRect = &(meta->regionRects[index]);
rdpgfx_read_rect16(s, regionRect);
WLog_DBG(TAG, "regionRects[%d]: left: %d top: %d right: %d bottom: %d",
index, regionRect->left, regionRect->top, regionRect->right, regionRect->bottom);
}
if (Stream_GetRemainingLength(s) < (meta->numRegionRects * 2))
return -1;
for (index = 0; index < meta->numRegionRects; index++)
{
quantQualityVal = &(meta->quantQualityVals[index]);
Stream_Read_UINT8(s, quantQualityVal->qpVal); /* qpVal (1 byte) */
Stream_Read_UINT8(s, quantQualityVal->qualityVal); /* qualityVal (1 byte) */
quantQualityVal->qp = quantQualityVal->qpVal & 0x3F;
quantQualityVal->r = (quantQualityVal->qpVal >> 6) & 1;
quantQualityVal->p = (quantQualityVal->qpVal >> 7) & 1;
WLog_DBG(TAG, "quantQualityVals[%d]: qp: %d r: %d p: %d qualityVal: %d",
index, quantQualityVal->qp, quantQualityVal->r, quantQualityVal->p, quantQualityVal->qualityVal);
}
return 1;
}
示例11: video_data_on_data_received
static UINT video_data_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream *s)
{
VIDEO_CHANNEL_CALLBACK* callback = (VIDEO_CHANNEL_CALLBACK*) pChannelCallback;
VIDEO_PLUGIN* video;
VideoClientContext *context;
UINT32 cbSize, packetType;
TSMM_VIDEO_DATA data;
video = (VIDEO_PLUGIN*) callback->plugin;
context = (VideoClientContext *)video->wtsPlugin.pInterface;
if (Stream_GetRemainingLength(s) < 4)
return ERROR_INVALID_DATA;
Stream_Read_UINT32(s, cbSize);
if (cbSize < 8 || Stream_GetRemainingLength(s) < (cbSize-4))
{
WLog_ERR(TAG, "invalid cbSize");
return ERROR_INVALID_DATA;
}
Stream_Read_UINT32(s, packetType);
if (packetType != TSMM_PACKET_TYPE_VIDEO_DATA)
{
WLog_ERR(TAG, "only expecting VIDEO_DATA on the data channel");
return ERROR_INVALID_DATA;
}
if (Stream_GetRemainingLength(s) < 32)
{
WLog_ERR(TAG, "not enough bytes for a TSMM_VIDEO_DATA");
return ERROR_INVALID_DATA;
}
Stream_Read_UINT8(s, data.PresentationId);
Stream_Read_UINT8(s, data.Version);
Stream_Read_UINT8(s, data.Flags);
Stream_Seek_UINT8(s); /* reserved */
Stream_Read_UINT64(s, data.hnsTimestamp);
Stream_Read_UINT64(s, data.hnsDuration);
Stream_Read_UINT16(s, data.CurrentPacketIndex);
Stream_Read_UINT16(s, data.PacketsInSample);
Stream_Read_UINT32(s, data.SampleNumber);
Stream_Read_UINT32(s, data.cbSample);
data.pSample = Stream_Pointer(s);
/*
WLog_DBG(TAG, "videoData: id:%"PRIu8" version:%"PRIu8" flags:0x%"PRIx8" timestamp=%"PRIu64" duration=%"PRIu64
" curPacketIndex:%"PRIu16" packetInSample:%"PRIu16" sampleNumber:%"PRIu32" cbSample:%"PRIu32"",
data.PresentationId, data.Version, data.Flags, data.hnsTimestamp, data.hnsDuration,
data.CurrentPacketIndex, data.PacketsInSample, data.SampleNumber, data.cbSample);
*/
return video_VideoData(context, &data);
}
示例12: license_read_preamble
BOOL license_read_preamble(wStream* s, BYTE* bMsgType, BYTE* flags, UINT16* wMsgSize)
{
/* preamble (4 bytes) */
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT8(s, *bMsgType); /* bMsgType (1 byte) */
Stream_Read_UINT8(s, *flags); /* flags (1 byte) */
Stream_Read_UINT16(s, *wMsgSize); /* wMsgSize (2 bytes) */
return TRUE;
}
示例13: nego_read_request
BOOL nego_read_request(rdpNego* nego, wStream* s)
{
BYTE li;
BYTE c;
BYTE type;
tpkt_read_header(s);
if (!tpdu_read_connection_request(s, &li))
return FALSE;
if (li != Stream_GetRemainingLength(s) + 6)
{
fprintf(stderr, "Incorrect TPDU length indicator.\n");
return FALSE;
}
if (Stream_GetRemainingLength(s) > 8)
{
/* Optional routingToken or cookie, ending with CR+LF */
while (Stream_GetRemainingLength(s) > 0)
{
Stream_Read_UINT8(s, c);
if (c != '\x0D')
continue;
Stream_Peek_UINT8(s, c);
if (c != '\x0A')
continue;
Stream_Seek_UINT8(s);
break;
}
}
if (Stream_GetRemainingLength(s) >= 8)
{
/* rdpNegData (optional) */
Stream_Read_UINT8(s, type); /* Type */
if (type != TYPE_RDP_NEG_REQ)
{
fprintf(stderr, "Incorrect negotiation request type %d\n", type);
return FALSE;
}
nego_process_negotiation_request(nego, s);
}
return TRUE;
}
示例14: rdpgfx_read_color32
int rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32)
{
if (Stream_GetRemainingLength(s) < 4)
return -1;
Stream_Read_UINT8(s, color32->B); /* B (1 byte) */
Stream_Read_UINT8(s, color32->G); /* G (1 byte) */
Stream_Read_UINT8(s, color32->R); /* R (1 byte) */
Stream_Read_UINT8(s, color32->XA); /* XA (1 byte) */
return 1;
}
示例15: ntlm_read_version_info
int ntlm_read_version_info(wStream* s, NTLM_VERSION_INFO* versionInfo)
{
if (Stream_GetRemainingLength(s) < 8)
return -1;
Stream_Read_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */
Stream_Read_UINT8(s, versionInfo->ProductMinorVersion); /* ProductMinorVersion (1 byte) */
Stream_Read_UINT16(s, versionInfo->ProductBuild); /* ProductBuild (2 bytes) */
Stream_Read(s, versionInfo->Reserved, sizeof(versionInfo->Reserved)); /* Reserved (3 bytes) */
Stream_Read_UINT8(s, versionInfo->NTLMRevisionCurrent); /* NTLMRevisionCurrent (1 byte) */
return 1;
}