当前位置: 首页>>代码示例>>C++>>正文


C++ InStream::in_uint16_le方法代码示例

本文整理汇总了C++中InStream::in_uint16_le方法的典型用法代码示例。如果您正苦于以下问题:C++ InStream::in_uint16_le方法的具体用法?C++ InStream::in_uint16_le怎么用?C++ InStream::in_uint16_le使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InStream的用法示例。


在下文中一共展示了InStream::in_uint16_le方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: recv

    void recv(InStream & stream, uint16_t len) override {
        this->len = len;

        /* terminalDescriptor(16) + pad4octetsA(4) + desktopSaveXGranularity(2) + desktopSaveYGranularity(2) +
         * pad2octetsA(2) + maximumOrderLevel(2) + numberFonts(2) + orderFlags(2) + orderSupport(NB_ORDER_SUPPORT) +
         * textFlags(2) + orderSupportExFlags(2) + pad4octetsB(4) + desktopSaveSize(4) + pad2octetsC(2) +
         * pad2octetsD(2) + textANSICodePage(2) + pad2octetsE(2)
         */
        const unsigned expected = 32 + NB_ORDER_SUPPORT + 20;
        if (!stream.in_check_rem(expected)){
            LOG(LOG_ERR, "Truncated OrderCaps, need=%u remains=%zu",
                expected, stream.in_remain());
            throw Error(ERR_MCS_PDU_TRUNCATED);
        }

        stream.in_copy_bytes(this->terminalDescriptor, 16);
        this->pad4octetsA = stream.in_uint32_le();
        this->desktopSaveXGranularity = stream.in_uint16_le();
        this->desktopSaveYGranularity = stream.in_uint16_le();
        this->pad2octetsA = stream.in_uint16_le();
        this->maximumOrderLevel = stream.in_uint16_le();
        this->numberFonts = stream.in_uint16_le();
        this->orderFlags = stream.in_uint16_le();
        stream.in_copy_bytes(this->orderSupport, NB_ORDER_SUPPORT);
        this->textFlags = stream.in_uint16_le();
        this->orderSupportExFlags = stream.in_uint16_le();
        this->pad4octetsB = stream.in_uint32_le();
        this->desktopSaveSize = stream.in_uint32_le();
        this->pad2octetsC = stream.in_uint16_le();
        this->pad2octetsD = stream.in_uint16_le();
        this->textANSICodePage = stream.in_uint16_le();
        this->pad2octetsE = stream.in_uint16_le();
    }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: ShareFlow_Recv

    explicit ShareFlow_Recv(InStream & stream)
    : flowMarker([&stream]{
        if (!stream.in_check_rem(2+1+1+1+1+2)){
            LOG(LOG_ERR,
                "Truncated "
                "[2: ShareFlow PDU packet]"
                "[1: ShareFlow pad]"
                "[1: ShareFlow PDU type]"
                "[1: flow Identifier]"
                "[1: flow number]"
                "[2: ShareFlow PDU packet] , remains=%zu", stream.in_remain());
            throw Error(ERR_SEC);
        }
        return stream.in_uint16_le();
    }())
    , pad(stream.in_uint8())
    , pduTypeFlow(stream.in_uint8())
    , flowIdentifier(stream.in_uint8())
    , flowNumber(stream.in_uint8())
    , mcs_channel(stream.in_uint16_le())
    {
        LOG(LOG_INFO, "Flow control packet %.4x (offset=%zu)", this->flowMarker, stream.get_offset());
        if (this->flowMarker != 0x8000) {
            LOG(LOG_ERR, "Expected flow control packet, got %.4x", this->flowMarker);
            throw Error(ERR_SEC);
        }

        LOG(LOG_INFO, "PDUTypeFlow=%u", this->pduTypeFlow);
        if (stream.in_remain()) {
            LOG(LOG_INFO, "trailing bytes in FlowPDU, remains %zu bytes", stream.in_remain());
        }
    }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例3: 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)
开发者ID:pykoder,项目名称:redemption,代码行数:34,代码来源:SuppressOutputPDU.hpp

示例4: recv

    void recv(InStream & stream)
    {
        if (!stream.in_check_rem(8)){
            LOG(LOG_ERR, "SC_CORE short header");
            throw Error(ERR_GCC);
        }

        this->userDataType = stream.in_uint16_le();
        this->length = stream.in_uint16_le();
        this->version = stream.in_uint32_le();
        if (this->length < 12) {
            if (this->length != 8) {
                LOG(LOG_ERR, "SC_CORE invalid length (%u)", this->length);
                throw Error(ERR_GCC);
            }
            return;
        }
        this->clientRequestedProtocols = stream.in_uint32_le();
        if (this->length < 16) {
            if (this->length != 12) {
                LOG(LOG_ERR, "SC_CORE invalid length (%u)", this->length);
                throw Error(ERR_GCC);
            }
            return;
        }
        this->earlyCapabilityFlags = stream.in_uint32_le();
        if (this->length != 16) {
            LOG(LOG_ERR, "SC_CORE invalid length (%u)", this->length);
            throw Error(ERR_GCC);
        }
    }
开发者ID:pykoder,项目名称:redemption,代码行数:31,代码来源:sc_core.hpp

示例5: 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
开发者ID:,项目名称:,代码行数:35,代码来源:

示例6: recv

 void recv(InStream & stream, uint16_t len)
 {
     this->len               = len;
     for (auto & glyph : this->GlyphCache) {
         glyph.CacheEntries         = stream.in_uint16_le();
         glyph.CacheMaximumCellSize = stream.in_uint16_le();
     }
     this->FragCache         = stream.in_uint32_le();
     this->GlyphSupportLevel = stream.in_uint16_le();
     this->pad2octets        = stream.in_uint16_le();
 }
开发者ID:wallix,项目名称:redemption,代码行数:11,代码来源:cap_glyphcache.hpp

示例7: 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);
     }
 }
开发者ID:pykoder,项目名称:redemption,代码行数:14,代码来源:ntlm_avpair.hpp

示例8: 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);
    }
开发者ID:pykoder,项目名称:redemption,代码行数:30,代码来源:mppc_61.hpp

示例9: recv

 void recv(InStream & stream, uint16_t len)
 {
     this->len = len;
     this->cacheVersion = stream.in_uint8();
     this->pad1 = stream.in_uint8();
     this->pad2 = stream.in_uint16_le();
 }
开发者ID:wallix,项目名称:redemption,代码行数:7,代码来源:bitmapcachehostsupport.hpp

示例10: 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());
        }
开发者ID:wallix,项目名称:redemption,代码行数:31,代码来源:slowpath.hpp

示例11: ExtendedMouseEvent_Recv

        explicit ExtendedMouseEvent_Recv(InStream & stream)
        : pointerFlags(0)
        , xPos(0)
        , yPos(0) {
            const unsigned expected =
                6; // pointerFlags(2) + xPos(2) + yPos(2)
            if (!stream.in_check_rem(expected)) {
                LOG(LOG_ERR, "SlowPath::ExtendedMouseEvent: data truncated, expected=%u remains=%zu",
                    expected, stream.in_remain());
                throw Error(ERR_RDP_SLOWPATH);
            }

            this->pointerFlags = stream.in_uint16_le();
            this->xPos         = stream.in_uint16_le();
            this->yPos         = stream.in_uint16_le();
        }
开发者ID:wallix,项目名称:redemption,代码行数:16,代码来源:slowpath.hpp

示例12: recv

 void recv(InStream & stream, uint16_t len)
 {
     this->len = len;
     this->WndSupportLevel = stream.in_uint32_le();
     this->NumIconCaches = stream.in_uint8();
     this->NumIconCacheEntries = stream.in_uint16_le();
 }
开发者ID:pykoder,项目名称:redemption,代码行数:7,代码来源:window.hpp

示例13: process_glyphcache

inline void process_glyphcache(GlyphCache & gly_cache, InStream & stream) {
    const uint8_t cacheId = stream.in_uint8();
    const uint8_t nglyphs = stream.in_uint8();
    for (uint8_t i = 0; i < nglyphs; i++) {
        const uint16_t cacheIndex = stream.in_uint16_le();
        const int16_t  offset     = stream.in_sint16_le();
        const int16_t  baseline   = stream.in_sint16_le();
        const uint16_t width      = stream.in_uint16_le();
        const uint16_t height     = stream.in_uint16_le();

        const unsigned int   datasize = (height * nbbytes(width) + 3) & ~3;
        const uint8_t      * data     = stream.in_uint8p(datasize);

        server_add_char(gly_cache, cacheId, cacheIndex, offset, baseline, width, height, data);
    }
}
开发者ID:pykoder,项目名称:redemption,代码行数:16,代码来源:test_RDPDrawable.cpp

示例14: ShareControl_Recv

    explicit ShareControl_Recv(InStream & stream)
    : totalLength([&stream]() {
        if (!stream.in_check_rem(2+2)){
            LOG(LOG_ERR,
                "Truncated [4: ShareControl packet] , remains=%zu", stream.in_remain());
            throw Error(ERR_SEC);
        }
        return stream.in_uint16_le();
    }())
    , pduType(stream.in_uint16_le() & 0xF)
    , PDUSource([&stream, this]() {
        if (this->pduType == PDUTYPE_DEACTIVATEALLPDU && this->totalLength == 4) {
            // should not happen
            // but DEACTIVATEALLPDU seems to be broken on windows 2000
            return static_cast<uint16_t>(0);
        }
        return stream.in_uint16_le();
    }())
    , payload([&stream, this]() {
        if (this->pduType == PDUTYPE_DEACTIVATEALLPDU && this->totalLength == 4) {
            // should not happen
            // but DEACTIVATEALLPDU seems to be broken on windows 2000
            return InStream(stream.get_current(), 0);
        }

        if (this->totalLength < 6) {
            LOG(LOG_ERR, "ShareControl packet too short totalLength=%u pduType=%u mcs_channel=%u",
                this->totalLength, this->pduType, this->PDUSource);
            throw Error(ERR_SEC);
        }

        if (!stream.in_check_rem(this->totalLength - 6)) {
            LOG(LOG_ERR, "Truncated ShareControl packet, need=%u remains=%zu",
                this->totalLength - 6,
                stream.in_remain());
            throw Error(ERR_SEC);
        }
        return InStream(stream.get_current(), this->totalLength - 6);
    }())
    // body of constructor
    {
        if (this->totalLength == 0x8000) {
            LOG(LOG_ERR, "Expected ShareControl header, got flowMarker");
            throw Error(ERR_SEC);
        }
        stream.in_skip_bytes(this->payload.get_capacity());
    }
开发者ID:,项目名称:,代码行数:47,代码来源:

示例15: 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)
开发者ID:,项目名称:,代码行数:55,代码来源:


注:本文中的InStream::in_uint16_le方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。