コード例 #1
0
ファイル: mppc_61.hpp プロジェクト: pykoder/redemption
    void get_compressed_data(OutStream & stream) const override
    {
        if (stream.tailroom() <
            static_cast<size_t>(2) + // Level1ComprFlags(1) + Level2ComprFlags(1)
                this->bytes_in_output_buffer) {
            LOG(LOG_ERR, "rdp_mppc_61_enc::get_compressed_data: Buffer too small");
            throw Error(ERR_BUFFER_TOO_SMALL);
        }

        stream.out_uint8(this->Level1ComprFlags);
        stream.out_uint8(this->Level2ComprFlags);
        stream.out_copy_bytes(this->outputBuffer, this->bytes_in_output_buffer);
    }
コード例 #2
0
ファイル: bitmapupdate.hpp プロジェクト: wallix/redemption
    void emit(OutStream & stream) const {
        unsigned expected;

        if (    (this->flags & BITMAP_COMPRESSION)
            && !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
            expected = 26; /* destLeft(2) + destTop(2) + destRight(2) +
                              destBottom(2) + width(2) + height(2) +
                              bitsPerPixel(2) + flags(2) + bitmapLength(2) +
                              cbCompFirstRowSize(2) + cbCompMainBodySize(2) +
                              cbScanWidth(2) + cbUncompressedSize(2) */
        }
        else {
            expected = 18; /* destLeft(2) + destTop(2) + destRight(2) +
                              destBottom(2) + width(2) + height(2) +
                              bitsPerPixel(2) + flags(2) + bitmapLength(2) */
        }

        if (!stream.has_room(expected)) {
            LOG( LOG_ERR
               , "BitmapData::emit - stream too small, need=%u, remains=%zu"
               , expected, stream.tailroom());
            throw Error(ERR_STREAM_MEMORY_TOO_SMALL);
        }

        stream.out_uint16_le(this->dest_left);
        stream.out_uint16_le(this->dest_top);
        stream.out_uint16_le(this->dest_right);
        stream.out_uint16_le(this->dest_bottom);
        stream.out_uint16_le(this->width);
        stream.out_uint16_le(this->height);
        stream.out_uint16_le(this->bits_per_pixel);
        stream.out_uint16_le(this->flags);
        stream.out_uint16_le(this->bitmap_length);

        if (    (this->flags & BITMAP_COMPRESSION)
            && !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
            stream.out_uint16_le(0x0000);   /* cbCompFirstRowSize (2 bytes) */
            stream.out_uint16_le(this->cb_comp_main_body_size);
            stream.out_uint16_le(this->cb_scan_width);
            stream.out_uint16_le(this->cb_uncompressed_size);
        }
    }