void emit(OutStream & stream) /* TODO const*/ {
        // ULONG length;

        this->RespType = 0x01;
        this->HiRespType = 0x01;
        stream.out_uint8(this->RespType);
        stream.out_uint8(this->HiRespType);
        stream.out_clear_bytes(2);
        stream.out_clear_bytes(4);
        stream.out_copy_bytes(this->Timestamp, 8);
        stream.out_copy_bytes(this->ClientChallenge, 8);
        stream.out_clear_bytes(4);
        this->AvPairList.emit(stream);
        stream.out_clear_bytes(4);
    }
Exemplo n.º 2
0
// TODO simplify and enhance compression using 1 pixel orders BLACK or WHITE.
void Bitmap::compress(BitsPerPixel session_color_depth, OutStream & outbuffer) const
{
    if (this->data_bitmap->compressed_size()) {
        outbuffer.out_copy_bytes(this->data_bitmap->compressed_data(), this->data_bitmap->compressed_size());
        return;
    }

    uint8_t * tmp_data_compressed = outbuffer.get_current();

    ConstImageDataView const image_view{
        this->data(),
        this->cx(),
        this->cy(),
        this->line_size(),
        this->bpp(),
        ConstImageDataView::Storage::BottomToTop
    };

    if ((session_color_depth == BitsPerPixel{32}) && ((this->bpp() == BitsPerPixel{24}) || (this->bpp() == BitsPerPixel{32}))) {
        rle_compress60(image_view, outbuffer);
    }
    else {
        rle_compress(image_view, outbuffer);
    }

    // Memoize result of compression
    this->data_bitmap->copy_compressed_buffer(
        tmp_data_compressed, outbuffer.get_current() - tmp_data_compressed);
}
Exemplo n.º 3
0
 void emit(OutStream & stream)override {
     stream.out_uint16_le(this->capabilityType);
     stream.out_uint16_le(this->len);
     stream.out_copy_bytes(this->terminalDescriptor, 16);
     stream.out_uint32_be(this->pad4octetsA);
     stream.out_uint16_le(this->desktopSaveXGranularity);
     stream.out_uint16_le(this->desktopSaveYGranularity);
     stream.out_uint16_le(this->pad2octetsA);
     stream.out_uint16_le(this->maximumOrderLevel);
     stream.out_uint16_le(this->numberFonts);
     stream.out_uint16_le(this->orderFlags);
     stream.out_copy_bytes(this->orderSupport, NB_ORDER_SUPPORT);
     stream.out_uint16_le(this->textFlags);
     stream.out_uint16_le(this->orderSupportExFlags);
     stream.out_uint32_le(this->pad4octetsB);
     stream.out_uint32_le(this->desktopSaveSize);
     stream.out_uint16_le(this->pad2octetsC);
     stream.out_uint16_le(this->pad2octetsD);
     stream.out_uint16_le(this->textANSICodePage);
     stream.out_uint16_le(this->pad2octetsE);
 }
Exemplo n.º 4
0
    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);
    }
    void emit(OutStream & stream) /* TODO const*/ {
        uint32_t currentOffset = this->PayloadOffset;
        if (this->version.ignore_version) {
            currentOffset -= 8;
        }
        if (this->has_mic) {
            currentOffset += 16;
        }
        this->message.emit(stream);
        currentOffset += this->LmChallengeResponse.emit(stream, currentOffset);
        currentOffset += this->NtChallengeResponse.emit(stream, currentOffset);
        currentOffset += this->DomainName.emit(stream, currentOffset);
        currentOffset += this->UserName.emit(stream, currentOffset);
        currentOffset += this->Workstation.emit(stream, currentOffset);
        currentOffset += this->EncryptedRandomSessionKey.emit(stream, currentOffset);
        (void)currentOffset;
        this->negoFlags.emit(stream);
        this->version.emit(stream);

        if (this->has_mic) {
            if (this->ignore_mic) {
                stream.out_clear_bytes(16);
            }
            else {
                stream.out_copy_bytes(this->MIC, 16);
            }
        }

        // PAYLOAD
        this->LmChallengeResponse.write_payload(stream);
        this->NtChallengeResponse.write_payload(stream);
        this->DomainName.write_payload(stream);
        this->UserName.write_payload(stream);
        this->Workstation.write_payload(stream);
        this->EncryptedRandomSessionKey.write_payload(stream);
    }
 void emit(OutStream & stream) /* TODO const*/ {
     stream.out_copy_bytes(this->Response, 16);
     this->Challenge.emit(stream);
 }
 void emit(OutStream & stream) const {
     stream.out_copy_bytes(this->Response, 16);
     stream.out_copy_bytes(this->ClientChallenge, 8);
 }
Exemplo n.º 8
0
 void emit(NTLM_AV_ID avId, OutStream & stream) const
 {
     stream.out_uint16_le(avId);
     stream.out_uint16_le(this->avLen);
     stream.out_copy_bytes(this->data.get(), this->avLen);
 }