本文整理汇总了C++中InStream::in_skip_bytes方法的典型用法代码示例。如果您正苦于以下问题:C++ InStream::in_skip_bytes方法的具体用法?C++ InStream::in_skip_bytes怎么用?C++ InStream::in_skip_bytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InStream
的用法示例。
在下文中一共展示了InStream::in_skip_bytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClientInputEventPDU_Recv
explicit ClientInputEventPDU_Recv(InStream & stream)
: numEvents(
[&stream](){
if (!stream.in_check_rem(2)) {
LOG(LOG_ERR, "SlowPath::ClientInputEventPDU: data truncated (numEvents)");
throw Error(ERR_RDP_SLOWPATH);
}
auto numEvents = stream.in_uint16_le();
const unsigned expected =
2 // pad(2)
+ numEvents * 12 // (time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2)) * 12
;
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR, "SlowPath::ClientInputEventPDU: data truncated, expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_SLOWPATH);
}
stream.in_skip_bytes(2); // pad
return numEvents;
}()
)
// (time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2)) * 12
, payload(stream.get_current(), this->numEvents * 12)
{
// This is the constructor body, we skip payload now that it is packaged
stream.in_skip_bytes(this->payload.get_capacity());
}
示例2: Error
explicit LogonInfoVersion1_Recv(InStream & stream) :
cbDomain(0),
cbUserName(0),
SessionId(0) {
memset(Domain, 0, sizeof(Domain));
memset(UserName, 0, sizeof(UserName));
unsigned expected = 4; // cbDomain(4)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated Logon Info Version 1 (data): expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
this->cbDomain = stream.in_uint32_le();
expected = 52 + // Domain(52)
4; // cbUserName(4)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated Logon Info Version 1 (data): expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
stream.in_uni_to_ascii_str(this->Domain, this->cbDomain,
sizeof(this->Domain));
stream.in_skip_bytes(52 - // Domain(52)
this->cbDomain);
this->cbUserName = stream.in_uint32_le();
expected = 512 + // UserName(512)
4; // SessionId(4)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated Logon Info Version 1 (data): expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
stream.in_uni_to_ascii_str(this->UserName, this->cbUserName,
sizeof(this->UserName));
stream.in_skip_bytes(512 - // UserName(512)
this->cbUserName);
this->SessionId = stream.in_uint32_le();
LOG(LOG_INFO,
"Logon Info Version 1 (data): Domain=\"%s\" UserName=\"%s\" SessionId=%d",
this->Domain, this->UserName, this->SessionId);
} // LogonInfoVersion1_Recv(InStream & stream)
示例3: recv
void recv(InStream & stream) {
// size_t size;
this->RespType = stream.in_uint8();
this->HiRespType = stream.in_uint8();
stream.in_skip_bytes(2);
stream.in_skip_bytes(4);
stream.in_copy_bytes(this->Timestamp, 8);
stream.in_copy_bytes(this->ClientChallenge, 8);
stream.in_skip_bytes(4);
this->AvPairList.recv(stream);
stream.in_skip_bytes(4);
}
示例4: recv
void recv(InStream & stream)
{
for (std::size_t i = 0; i < AV_ID_MAX; ++i) {
NTLM_AV_ID id = static_cast<NTLM_AV_ID>(stream.in_uint16_le());
uint16_t length = stream.in_uint16_le();
if (id == MsvAvEOL) {
// ASSUME last element is MsvAvEOL
stream.in_skip_bytes(length);
break;
}
this->add(id, stream.get_current(), length);
stream.in_skip_bytes(length);
}
}
示例5: receive
void receive(InStream & stream) {
{
const unsigned expected = 4; // allowDisplayUpdates(1) + Padding(3)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated SuppressOutputPDUData: expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
}
this->allowDisplayUpdates_ = stream.in_uint8();
stream.in_skip_bytes(3); // Padding(3)
if (ALLOW_DISPLAY_UPDATES == this->allowDisplayUpdates_) {
{
const unsigned expected = 8; // left(2) + top(2) + right(2) + bottom(2)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated SuppressOutputPDUData(2): expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
}
this->left_ = stream.in_uint16_le();
this->top_ = stream.in_uint16_le();
this->right_ = stream.in_uint16_le();
this->bottom_ = stream.in_uint16_le();
}
} // void receive(InStream & stream)
示例6: Error
static inline void prepare_compressed_data(InStream & compressed_data_stream, bool compressed,
uint16_t & MatchCount, uint8_t const * & MatchDetails, uint8_t const * & Literals,
size_t & literals_length)
{
if (compressed) {
unsigned expected = 2; // MatchCount(2)
if (!compressed_data_stream.in_check_rem(expected)) {
LOG(LOG_ERR, "RDP61_COMPRESSED_DATA: data truncated, expected=%u remains=%zu",
expected, compressed_data_stream.in_remain());
throw Error(ERR_RDP61_DECOMPRESS_DATA_TRUNCATED);
}
MatchCount = compressed_data_stream.in_uint16_le();
expected = MatchCount * 8; // MatchCount(2) * (MatchLength(2) + MatchOutputOffset(2) + MatchHistoryOffset(4))
if (!compressed_data_stream.in_check_rem(expected)) {
LOG(LOG_ERR, "RDP61_COMPRESSED_DATA: data truncated, expected=%u remains=%zu",
expected, compressed_data_stream.in_remain());
throw Error(ERR_RDP61_DECOMPRESS_DATA_TRUNCATED);
}
MatchDetails = compressed_data_stream.get_current();
compressed_data_stream.in_skip_bytes(expected);
}
else {
MatchCount = 0;
MatchDetails = nullptr;
}
literals_length = compressed_data_stream.in_remain();
Literals = (literals_length ? compressed_data_stream.get_current() : nullptr);
}
示例7: ShareData_Recv
explicit ShareData_Recv(InStream & stream, rdp_mppc_dec * dec = nullptr)
//==============================================================================
: CheckShareData_Recv(stream)
, share_id(stream.in_uint32_le())
, pad1(stream.in_uint8())
, streamid(stream.in_uint8())
, len(stream.in_uint16_le())
, pdutype2(stream.in_uint8())
, compressedType(stream.in_uint8())
, compressedLen(stream.in_uint16_le())
, payload([&stream, dec, this]() {
if (this->compressedType & PACKET_COMPRESSED) {
if (!dec) {
LOG(LOG_INFO, "ShareData_Recv: got unexpected compressed share data");
throw Error(ERR_SEC);
}
const uint8_t * rdata;
uint32_t rlen;
dec->decompress(stream.get_data()+stream.get_offset(), stream.in_remain(),
this->compressedType, rdata, rlen);
return InStream(rdata, 0, rlen);
}
else {
return InStream(stream.get_current(), stream.in_remain());
}
}())
// BEGIN CONSTRUCTOR
{
//LOG( LOG_INFO, "ShareData_Recv: pdutype2=%u len=%u compressedLen=%u payload_size=%u"
// , this->pdutype2, this->len, this->compressedLen, this->payload.size());
stream.in_skip_bytes(stream.in_remain());
} // END CONSTRUCTOR
示例8: process_filecontents_response
void process_filecontents_response(InStream& chunk, FieldIndex total_data_paste)
{
if (this->flag_filecontents == RDPECLIP::FILECONTENTS_SIZE) {
chunk.in_skip_bytes(4); // streamId(4 bytes)
uint32_t nPositionLow = chunk.in_uint32_le();
uint64_t nPositionHigh = chunk.in_uint32_le();
this->metrics->add_to_current_data(
total_data_paste, nPositionLow + (nPositionHigh << 32));
}
}
示例9: receive
void receive(InStream & stream, const RDPPrimaryOrderHeader & header) {
//LOG(LOG_INFO, "RDPMultiDstBlt::receive: header fields=0x%02X", header.fields);
header.receive_coord(stream, 0x0001, this->nLeftRect);
header.receive_coord(stream, 0x0002, this->nTopRect);
header.receive_coord(stream, 0x0004, this->nWidth);
header.receive_coord(stream, 0x0008, this->nHeight);
if (header.fields & 0x0010) {
this->bRop = stream.in_uint8();
}
if (header.fields & 0x0020) {
this->nDeltaEntries = stream.in_uint8();
}
if (header.fields & 0x0040) {
uint16_t cbData = stream.in_uint16_le();
//LOG(LOG_INFO, "cbData=%d", cbData);
InStream rgbData(stream.get_current(), cbData);
stream.in_skip_bytes(cbData);
//hexdump_d(rgbData.get_current(), rgbData.get_capacity());
uint8_t zeroBitsSize = ((this->nDeltaEntries + 1) / 2);
//LOG(LOG_INFO, "zeroBitsSize=%d", zeroBitsSize);
InStream zeroBits(rgbData.get_current(), zeroBitsSize);
rgbData.in_skip_bytes(zeroBitsSize);
uint8_t zeroBit = 0;
for (uint8_t i = 0, m2 = 0; i < this->nDeltaEntries; i++, m2++) {
if (m2 == 2) {
m2 = 0;
}
if (!m2) {
zeroBit = zeroBits.in_uint8();
//LOG(LOG_INFO, "0x%02X", zeroBit);
}
this->deltaEncodedRectangles[i].leftDelta = (!(zeroBit & 0x80) ? rgbData.in_DEP() : 0);
this->deltaEncodedRectangles[i].topDelta = (!(zeroBit & 0x40) ? rgbData.in_DEP() : 0);
this->deltaEncodedRectangles[i].width = (!(zeroBit & 0x20) ? rgbData.in_DEP() : 0);
this->deltaEncodedRectangles[i].height = (!(zeroBit & 0x10) ? rgbData.in_DEP() : 0);
//LOG(LOG_INFO, "RDPMultiDstBlt::receive: delta rectangle=(%d, %d, %d, %d)",
// this->deltaEncodedRectangles[i].leftDelta, this->deltaEncodedRectangles[i].topDelta,
// this->deltaEncodedRectangles[i].width, this->deltaEncodedRectangles[i].height);
zeroBit <<= 4;
}
}
} // void receive(InStream & stream, const RDPPrimaryOrderHeader & header)
示例10: UnusedEvent_Recv
explicit UnusedEvent_Recv(InStream & stream) {
const unsigned expected =
6; // pad4Octets(4) + pad2Octets(2)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR, "SlowPath::UnusedEvent: data truncated, expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_SLOWPATH);
}
stream.in_skip_bytes(6); // pad4Octets(4) + pad2Octets(2)
}
示例11: SaveSessionInfoPDUData_Recv
explicit SaveSessionInfoPDUData_Recv(InStream & stream) :
infoType([&stream](){
if (!stream.in_check_rem(4)) {
LOG(LOG_ERR,
"Truncated Save Session Info PDU (data): expected=4 remains=%zu",
stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
return stream.in_uint32_le();
}()),
payload(stream.get_current(), stream.in_remain())
{
stream.in_skip_bytes(this->payload.get_capacity());
}
示例12: SynchronizeEvent_Recv
explicit SynchronizeEvent_Recv(InStream & stream)
: toggleFlags(0) {
const unsigned expected =
6; // pad2Octets(2) + toggleFlags(2)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR, "SlowPath::SynchronizeEvent: data truncated, expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_SLOWPATH);
}
stream.in_skip_bytes(2); // pad2Octets
this->toggleFlags = stream.in_uint32_le();
}
示例13: LogonInfoField_Recv
explicit LogonInfoField_Recv(InStream & stream)
: cbFieldData([&stream](){
const unsigned expected = 4; // cbFieldData(4)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR,
"Truncated Logon Info Field (data): expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_DATA_TRUNCATED);
}
return stream.in_uint32_le();
}())
, payload(stream.get_current(), stream.in_remain())
{
stream.in_skip_bytes(this->payload.get_capacity());
}
示例14: UnicodeKeyboardEvent_Recv
explicit UnicodeKeyboardEvent_Recv(InStream & stream)
: keyboardFlags(0)
, unicodeCode(0) {
const unsigned expected =
6; // keyboardFlags(2) + unicodeCode(2) + pad2Octets(2)
if (!stream.in_check_rem(expected)) {
LOG(LOG_ERR, "SlowPath::UnicodeKeyboardEvent: data truncated, expected=%u remains=%zu",
expected, stream.in_remain());
throw Error(ERR_RDP_SLOWPATH);
}
this->keyboardFlags = stream.in_uint16_le();
this->unicodeCode = stream.in_uint16_le();
stream.in_skip_bytes(2); // pad2Octets
}
示例15: InputEvent_Recv
explicit InputEvent_Recv(InStream & stream)
: eventTime([&stream](){
// time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2)
if (!stream.in_check_rem(12)) {
LOG(LOG_ERR, "SlowPath::InputEvent: data truncated, expected=12 remains=%zu", stream.in_remain());
throw Error(ERR_RDP_SLOWPATH);
}
return stream.in_uint32_le();
}())
, messageType(stream.in_uint16_le())
// device_flags(2) + param1(2) + param2(2)
, payload(stream.get_current(), 6)
// Body of constructor
{
stream.in_skip_bytes(this->payload.get_capacity());
}