RecorderTransportHeader read_recorder_transport_header(Transport& trans)
{
    char data[13];
	InStream headers_stream(data);

    trans.recv_boom(make_array_view(data));

	return {
        RecorderFile::PacketType(headers_stream.in_uint8()),
        std::chrono::milliseconds(headers_stream.in_uint64_le()),
        headers_stream.in_uint32_le()
    };
}
Exemple #2
0
RedCryptoKeyHandle * scytale_key_new(const char * masterkeyhex)
{
    SCOPED_TRACE;
    constexpr auto key_len = sizeof(HashHexArray) - 1;
    if (!masterkeyhex || strlen(masterkeyhex) != key_len){
        return nullptr;
    }
    for (char c : make_array_view(masterkeyhex, key_len)){
        if (not ((c >= '0' and c <= '9') or (c >= 'A' and c <= 'F') or (c >= 'a' and c <= 'f'))){
            return nullptr;
        }
    }
    return CREATE_HANDLE(RedCryptoKeyHandle(masterkeyhex));
}
void ProtectedGraphics::draw_impl(const RDPScrBlt & cmd, const Rect clip)
{
    const Rect drect = cmd.rect.intersect(clip);
    const int deltax = cmd.srcx - cmd.rect.x;
    const int deltay = cmd.srcy - cmd.rect.y;
    const int srcx = drect.x + deltax;
    const int srcy = drect.y + deltay;
    const Rect srect(srcx, srcy, drect.cx, drect.cy);

    const bool has_dest_intersec_fg = drect.has_intersection(this->protected_rect);
    const bool has_src_intersec_fg = srect.has_intersection(this->protected_rect);

    if (!has_dest_intersec_fg && !has_src_intersec_fg) {
        this->drawable.draw(cmd, clip);
    }
    else {
        this->drawable.begin_update();
        subrect4_t rects = subrect4(drect, this->protected_rect);
        auto e = std::remove_if(rects.begin(), rects.end(), [](const Rect & rect) { return rect.isempty(); });
        auto av = make_array_view(rects.begin(), e);
        this->refresh_rects(av);
        this->drawable.end_update();
    }
}
Exemple #4
0
Rect clip_from_cmd(RDPPolygonSC const & cmd) {
    return clip_from_delta_list(
        cmd.xStart, cmd.yStart,
        make_array_view(cmd.deltaPoints, cmd.NumDeltaEntries)
    );
}
Exemple #5
0
 array_view_const_u8 av() const noexcept
 {
     return make_array_view(this->array);
 }