Пример #1
0
/* Send a client window information PDU */
BOOL
rdp_send_client_window_status(RDPCLIENT * This, int status)
{
	STREAM s;

	if (This->rdp.current_status == status)
		return True;

	s = rdp_init_data(This, 12);

	if(s == NULL)
		return False;

	out_uint32_le(s, status);

	switch (status)
	{
		case 0:	/* shut the server up */
			break;

		case 1:	/* receive data again */
			out_uint32_le(s, 0);	/* unknown */
			out_uint16_le(s, This->width);
			out_uint16_le(s, This->height);
			break;
	}

	s_mark_end(s);
	This->rdp.current_status = status;
	return rdp_send_data(This, s, RDP_DATA_PDU_CLIENT_WINDOW_STATUS);
}
Пример #2
0
/* Output brush cache capability set */
static void
rdp_out_brushcache_caps(STREAM s)
{
    out_uint16_le(s, RDP_CAPSET_BRUSHCACHE);
    out_uint16_le(s, RDP_CAPLEN_BRUSHCACHE);
    out_uint32_le(s, 1);	/* cache type */
}
Пример #3
0
/* flags can contain WINDOW_ORDER_STATE_NEW and/or
   WINDOW_ORDER_FIELD_ICON_BIG */
int
xrdp_orders_send_window_cached_icon(struct xrdp_orders *self,
                                    int window_id, int cache_entry,
                                    int cache_id, int flags)
{
    int order_size;
    int order_flags;
    int field_present_flags;

    order_size = 14;
    if (xrdp_orders_check(self, order_size) != 0)
    {
        return 1;
    }
    self->order_count++;
    order_flags = RDP_ORDER_SECONDARY;
    order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
    out_uint8(self->out_s, order_flags);
    /* orderSize (2 bytes) */
    out_uint16_le(self->out_s, order_size);
    /* FieldsPresentFlags (4 bytes) */
    field_present_flags = flags | WINDOW_ORDER_TYPE_WINDOW |
                          WINDOW_ORDER_CACHED_ICON;
    out_uint32_le(self->out_s, field_present_flags);
    /* windowId (4 bytes) */
    out_uint32_le(self->out_s, window_id);
    /* CacheEntry (2 bytes) */
    out_uint16_le(self->out_s, cache_entry);
    /* CacheId (1 byte) */
    out_uint8(self->out_s, cache_id);
    return 0;
}
Пример #4
0
/* returns error */
static int
xrdp_orders_send_as_unicode(struct stream *s, const char *text)
{
    int str_chars;
    int index;
    int i32;
    int len;
    twchar *wdst;

    len = g_strlen(text) + 1;

    wdst = (twchar *) g_malloc(sizeof(twchar) * len, 1);
    if (wdst == 0)
    {
        return 1;
    }
    str_chars = g_mbstowcs(wdst, text, len);
    if (str_chars > 0)
    {
        i32 = str_chars * 2;
        out_uint16_le(s, i32);
        for (index = 0; index < str_chars; index++)
        {
            i32 = wdst[index];
            out_uint16_le(s, i32);
        }
    }
    else
    {
        out_uint16_le(s, 0);
    }
    g_free(wdst);
    return 0;
}
Пример #5
0
/* Send a platform challenge response packet */
static void
licence_send_platform_challenge_response(uint8 * token, uint8 * crypt_hwid, uint8 * signature)
{
	uint32 sec_flags = SEC_LICENSE_PKT;
	uint16 length = 58;
	STREAM s;

	s = sec_init(sec_flags, length + 2);

	out_uint8(s, LICENCE_TAG_PLATFORM_CHALLENGE_RESPONSE);
	out_uint8(s, ((g_rdp_version >= RDP_V5) ? 3 : 2));	/* version */
	out_uint16_le(s, length);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_TOKEN_SIZE);
	out_uint8p(s, token, LICENCE_TOKEN_SIZE);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_HWID_SIZE);
	out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);

	out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);

	s_mark_end(s);
	sec_send(s, sec_flags);
}
Пример #6
0
/* Send a client window information PDU */
void
rdp_send_client_window_status(int status)
{
    STREAM s;
    static int current_status = 1;

    if (current_status == status)
        return;

    s = rdp_init_data(12);

    out_uint32_le(s, status);

    switch (status)
    {
    case 0:	/* shut the server up */
        break;

    case 1:	/* receive data again */
        out_uint32_le(s, 0);	/* unknown */
        out_uint16_le(s, g_width);
        out_uint16_le(s, g_height);
        break;
    }

    s_mark_end(s);
    rdp_send_data(s, RDP_DATA_PDU_CLIENT_WINDOW_STATUS);
    current_status = status;
}
Пример #7
0
bool APP_CC
xrdp_emt_send_request(struct xrdp_rdp* self, struct xrdp_emt* emt, int type)
{
  struct stream* s;

  if (emt == NULL)
  {
    printf("emt is null\n");
    return false;
  }

  make_stream(s);
  init_stream(s, 40);
  xrdp_sec_init(self->sec_layer, s);

  out_uint8(s, SEC_AUTODETECT_REQ_LENGTH);               // headerLength
  out_uint8(s, TYPE_ID_AUTODETECT_REQUEST);              // headerTypeId
  out_uint16_le(s, emt->seq_number++);                   // sequenceNumber
  out_uint16_le(s, type);                                // responseType
  s_mark_end(s);

  xrdp_emt_send_packet(self, emt, s);
  free_stream(s);

  return true;
}
Пример #8
0
static int
sound_send_training(void)
{
    struct stream *s;
    int bytes;
    int time;
    char *size_ptr;

    print_got_here();

    make_stream(s);
    init_stream(s, 8182);
    out_uint16_le(s, SNDC_TRAINING);
    size_ptr = s->p;
    out_uint16_le(s, 0); /* size, set later */
    time = g_time2();
    g_training_sent_time = time;
    out_uint16_le(s, time);
    out_uint16_le(s, 1024);
    out_uint8s(s, (1024 - 4));
    s_mark_end(s);
    bytes = (int)((s->end - s->data) - 4);
    size_ptr[0] = bytes;
    size_ptr[1] = bytes >> 8;
    bytes = (int)(s->end - s->data);
    send_channel_data(g_rdpsnd_chan_id, s->data, bytes);
    free_stream(s);
    return 0;
}
Пример #9
0
/* Send an authentication response packet */
static void
licence_send_authresp(uint8 * token, uint8 * crypt_hwid, uint8 * signature)
{
	uint32 sec_flags = SEC_LICENCE_NEG;
	uint16 length = 58;
	STREAM s;

	s = sec_init(sec_flags, length + 2);

	out_uint8(s, LICENCE_TAG_AUTHRESP);
	out_uint8(s, 2);	/* version */
	out_uint16_le(s, length);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_TOKEN_SIZE);
	out_uint8p(s, token, LICENCE_TOKEN_SIZE);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_HWID_SIZE);
	out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);

	out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);

	s_mark_end(s);
	sec_send(s, sec_flags);
}
Пример #10
0
void cliprdr_send_capability()
{
	/* this message is ignored by rdp applet */
	struct stream* s;

	make_stream(s);
	init_stream(s,1024);

	log_message(l_config, LOG_LEVEL_DEBUG, "vchannel_cliprdr[cliprdr_send_capability]:");
	/* clip header */
	out_uint16_le(s, CB_CLIP_CAPS);                        /* msg type */
	out_uint16_le(s, 0x00);                                /* msg flag */
	out_uint32_le(s, 0);                                   /* msg size */
	/* we only support one capability for now */
	out_uint16_le(s, 1);                                   /* cCapabilitiesSets */
	out_uint8s(s, 16);                                     /* pad */
	/* CLIPRDR_CAPS_SET */
	out_uint16_le(s, CB_CAPSTYPE_GENERAL);                 /* capabilitySetType */
	out_uint16_le(s, 92);                                  /* lengthCapability */
	out_uint32_le(s, CB_CAPS_VERSION_1);                   /* version */
	out_uint32_le(s, 0);                                   /* general flags */


	s_mark_end(s);
	cliprdr_send(s);
	free_stream(s);

}
Пример #11
0
void cliprdr_send_data(int request_type)
{
	struct stream* s;
	int clipboard_size = clipboard_get_current_clipboard_data_size(&clipboard, format_utf8_string_atom);
	char* clipboard_data = (char*)clipboard_get_current_clipboard_data(&clipboard, format_utf8_string_atom);

	int uni_clipboard_len = (clipboard_size+1)*2;
	int packet_len = uni_clipboard_len + 12;
	char* temp;

	make_stream(s);
	init_stream(s,packet_len);

	log_message(l_config, LOG_LEVEL_DEBUG, "vchannel_cliprdr[cliprdr_send_data]:");
	/* clip header */
	out_uint16_le(s, CB_FORMAT_DATA_RESPONSE);             /* msg type */
	out_uint16_le(s, 0);                                   /* msg flag */
	out_uint32_le(s, uni_clipboard_len);                   /* msg size */
	temp = s->p;
	uni_rdp_out_str(s, clipboard_data, uni_clipboard_len);


	s_mark_end(s);
	cliprdr_send(s);
	free_stream(s);

}
Пример #12
0
/* ask the client to send the file size */
int
clipboard_request_file_size(int stream_id, int lindex)
{
    struct stream *s;
    int size;
    int rv;

    log_debug("clipboard_request_file_size:");
    if (g_file_request_sent_type != 0)
    {
        log_error("clipboard_request_file_size: warning, still waiting "
                   "for CB_FILECONTENTS_RESPONSE");
    }
    make_stream(s);
    init_stream(s, 8192);
    out_uint16_le(s, CB_FILECONTENTS_REQUEST); /* 8 */
    out_uint16_le(s, 0);
    out_uint32_le(s, 28);
    out_uint32_le(s, stream_id);
    out_uint32_le(s, lindex);
    out_uint32_le(s, CB_FILECONTENTS_SIZE);
    out_uint32_le(s, 0); /* nPositionLow */
    out_uint32_le(s, 0); /* nPositionHigh */
    out_uint32_le(s, 0); /* cbRequested */
    out_uint32_le(s, 0); /* clipDataId */
    out_uint32_le(s, 0);
    s_mark_end(s);
    size = (int)(s->end - s->data);
    rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
    free_stream(s);
    g_file_request_sent_type = CB_FILECONTENTS_SIZE;
    return rv;
}
Пример #13
0
void
rdp_send_client_execute_pdu(rdpRdp * rdp)
{
    STREAM s;
    size_t application_name_len, working_directory_len, arguments_len;
    char * application_name, * working_directory, * arguments;

    /* Still lacking proper packet initialization */
    s = NULL;
    rdp_out_rail_pdu_header(s, RDP_RAIL_ORDER_EXEC, 12);

    application_name = xstrdup_out_unistr(rdp,
                                          rdp->app->application_name, &application_name_len);
    working_directory = xstrdup_out_unistr(rdp,
                                           rdp->app->working_directory, &working_directory_len);
    arguments = xstrdup_out_unistr(rdp,
                                   rdp->app->arguments, &arguments_len);

    out_uint16_le(s,
                  RAIL_EXEC_FLAG_EXPAND_WORKINGDIRECTORY |
                  RAIL_EXEC_FLAG_EXPAND_ARGUMENTS); // flags
    out_uint16_le(s, application_name_len); // ExeOrFileLength
    out_uint16_le(s, working_directory_len); // WorkingDirLength
    out_uint16_le(s, arguments_len); // ArgumentsLength
    out_uint8a(s, application_name, application_name_len + 2); // ExeOrFile
    out_uint8a(s, working_directory, working_directory_len + 2); // WorkingDir
    out_uint8a(s, arguments, arguments_len + 2); // Arguments

    xfree(application_name);
    xfree(working_directory);
    xfree(arguments);

    s_mark_end(s);
    sec_send(rdp->sec, s, rdp->settings->encryption ? SEC_ENCRYPT : 0);
}
Пример #14
0
void rdp_out_glyphcache_capset(STREAM s)
{
	capsetHeaderRef header;

	header = rdp_skip_capset_header(s);
	/*
		glyphCache (40 bytes):
		An array of 10 cache definition structures
		Maximum number of cache entries: 254
		Maximum size of a cache element: 2048
	 */
	rdp_out_cache_definition(s, 0x00FE, 0x0004);
	rdp_out_cache_definition(s, 0x00FE, 0x0004);
	rdp_out_cache_definition(s, 0x00FE, 0x0008);
	rdp_out_cache_definition(s, 0x00FE, 0x0008);
	rdp_out_cache_definition(s, 0x00FE, 0x0010);
	rdp_out_cache_definition(s, 0x00FE, 0x0020);
	rdp_out_cache_definition(s, 0x00FE, 0x0040);
	rdp_out_cache_definition(s, 0x00FE, 0x0080);
	rdp_out_cache_definition(s, 0x00FE, 0x0100);
	rdp_out_cache_definition(s, 0x0040, 0x0800);

	/*
		fragCache (4 bytes):
		Fragment cache data (one cache definition structure)
		Maximum number of cache entries: 256
		Maximum size of a cache element: 256
	*/
	rdp_out_cache_definition(s, 0x0040, 0x0800); /* fragCache */

	out_uint16_le(s, GLYPH_SUPPORT_FULL); /* glyphSupportLevel */
	out_uint16_le(s, 0); /* pad */
	rdp_out_capset_header(s, header, CAPSET_TYPE_GLYPHCACHE);
}
Пример #15
0
int APP_CC
dev_redir_process_close_io_request(int completion_id)
{
	struct stream* s;

	log_message(&log_conf, LOG_LEVEL_DEBUG, "chansrv[dev_redir_process_close_io_request]:"
	  		"close file : %s",actions[completion_id].path);
	make_stream(s);
	init_stream(s,1100);
	actions[completion_id].last_req = IRP_MJ_CLOSE;
	out_uint16_le(s, RDPDR_CTYP_CORE);
	out_uint16_le(s, PAKID_CORE_DEVICE_IOREQUEST);
	out_uint32_le(s, actions[completion_id].device);
	out_uint32_le(s, actions[completion_id].file_id);
	out_uint32_le(s, completion_id);
	out_uint32_le(s, IRP_MJ_CLOSE);   	/* major version */
	out_uint32_le(s, 0);								/* minor version */
	out_uint8s(s,32);
	s_mark_end(s);
	dev_redir_send(s);
	actions[completion_id].message_id++;
	free_stream(s);
	return 0;
	free_stream(s);
}
Пример #16
0
/* Send an authentication response packet */
static BOOL
licence_send_authresp(RDPCLIENT * This, uint8 * token, uint8 * crypt_hwid, uint8 * signature)
{
	uint32 sec_flags = SEC_LICENCE_NEG;
	uint16 length = 58;
	STREAM s;

	s = sec_init(This, sec_flags, length + 2);

	if(s == NULL)
		return False;

	out_uint8(s, LICENCE_TAG_AUTHRESP);
	out_uint8(s, 2);	/* version */
	out_uint16_le(s, length);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_TOKEN_SIZE);
	out_uint8p(s, token, LICENCE_TOKEN_SIZE);

	out_uint16_le(s, 1);
	out_uint16_le(s, LICENCE_HWID_SIZE);
	out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);

	out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);

	s_mark_end(s);
	return sec_send(This, s, sec_flags);
}
Пример #17
0
bool APP_CC
xrdp_emt_send_result(struct xrdp_rdp* self, struct xrdp_emt* emt)
{
  struct stream* s;

  if (emt == NULL)
  {
    printf("emt is null\n");
    return false;
  }

  make_stream(s);
  init_stream(s, 40);
  xrdp_sec_init(self->sec_layer, s);

  out_uint8(s, SEC_AUTODETECT_REQ_LENGTH);               // headerLength
  out_uint8(s, TYPE_ID_AUTODETECT_REQUEST);              // headerTypeId
  out_uint16_le(s, emt->seq_number++);                   // sequenceNumber
  out_uint16_le(s, field_all);                           // responseType

  out_uint32_le(s, self->session->base_RTT);
  out_uint32_le(s, self->session->bandwidth);
  out_uint32_le(s, self->session->average_RTT);

  s_mark_end(s);

  xrdp_emt_send_packet(self, emt, s);
  free_stream(s);

  return true;
}
Пример #18
0
/* Output unknown capability sets */
static void rdp_out_unknown_caps(STREAM s, uint16 id, uint16 length,
		uint8 * caps) {
	out_uint16_le(s, id);
	out_uint16_le(s, length);

	out_uint8p(s, caps, length - 4);
}
Пример #19
0
/* Output bitmap capability set */
static void rdp_out_bitmap_caps(STREAM s) {
	out_uint16_le(s, RDP_CAPSET_BITMAP);
	out_uint16_le(s, RDP_CAPLEN_BITMAP);

	out_uint16_le(s, g_server_depth);
	/* Preferred colour depth */
	out_uint16_le(s, 1);
	/* Receive 1 BPP */
	out_uint16_le(s, 1);
	/* Receive 4 BPP */
	out_uint16_le(s, 1);
	/* Receive 8 BPP */
	out_uint16_le(s, 800);
	/* Desktop width */
	out_uint16_le(s, 600);
	/* Desktop height */
	out_uint16(s, 0);
	/* Pad */
	out_uint16(s, 1);
	/* Allow resize */
	out_uint16_le(s, g_bitmap_compression ? 1 : 0);
	/* Support compression */
	out_uint16(s, 0);
	/* Unknown */
	out_uint16_le(s, 1);
	/* Unknown */
	out_uint16(s, 0);
	/* Pad */
}
Пример #20
0
static int
rdpup_send_msg(struct stream* s)
{
  int len;
  int rv;

  rv = 1;
  if (s != 0)
  {
    len = s->end - s->data;
    if (len > s->size)
    {
      rdpLog("overrun error len %d count %d\n", len, g_count);
    }
    s_pop_layer(s, iso_hdr);
    out_uint16_le(s, 1);
    out_uint16_le(s, g_count);
    out_uint32_le(s, len - 8);
    rv = rdpup_send(s->data, len);
  }
  if (rv != 0)
  {
    rdpLog("error in rdpup_send_msg\n");
  }
  return rv;
}
Пример #21
0
/* Send a Licensing packet with Platform Challenge Response */
static void
licence_send_authresp(rdpLicence * licence, uint8 * token, uint8 * crypt_hwid, uint8 * signature)
{
    uint32 sec_flags = SEC_LICENSE_PKT;
    uint16 length = 58;
    STREAM s;

    s = sec_init(licence->sec, sec_flags, length + 2);

    /* Licensing Preamble (LICENSE_PREAMBLE) */
    out_uint8(s, PLATFORM_CHALLENGE_RESPONSE);	/* PLATFORM_CHALLENGE_RESPONSE */
    out_uint8(s, 2);	/* PREAMBLE_VERSION_2_0 */
    out_uint16_le(s, length);

    /* Licensing Binary BLOB with EncryptedPlatformChallengeResponse: */
    out_uint16_le(s, 1);	/* wBlobType should be 0x0009 (BB_ENCRYPTED_DATA_BLOB) */
    out_uint16_le(s, LICENCE_TOKEN_SIZE);	/* wBlobLen */
    out_uint8p(s, token, LICENCE_TOKEN_SIZE);	/* RC4-encrypted challenge data */

    /* Licensing Binary BLOB with EncryptedHWID: */
    out_uint16_le(s, 1);	/* wBlobType should be 0x0009 (BB_ENCRYPTED_DATA_BLOB) */
    out_uint16_le(s, LICENCE_HWID_SIZE);	/* wBlobLen */
    out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);	/* RC4-encrypted Client Hardware Identification */

    out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);	/* MACData */

    s_mark_end(s);
    sec_send(licence->sec, s, sec_flags);
}
Пример #22
0
void rdp_out_gdiplus_cache_chunk_size(STREAM s)
{
	out_uint16_le(s, 512); /* gdipGraphicsCacheChunkSize */
	out_uint16_le(s, 2048); /* gdipObjectBrushCacheChunkSize */
	out_uint16_le(s, 1024); /* gdipObjectPenCacheChunkSize */
	out_uint16_le(s, 64); /* gdipObjectImageAttributesCacheChunkSize */
}
Пример #23
0
static int APP_CC
rdp_iso_send_msg(struct rdp_iso *self, struct stream *s, int code)
{
    if (rdp_tcp_init(self->tcp_layer, s) != 0)
    {
        return 1;
    }

    out_uint8(s, 3);
    out_uint8(s, 0);
    out_uint16_be(s, 11); /* length */
    out_uint8(s, 6);
    out_uint8(s, code);
    out_uint16_le(s, 0);
    out_uint16_le(s, 0);
    out_uint8(s, 0);
    s_mark_end(s);

    if (rdp_tcp_send(self->tcp_layer, s) != 0)
    {
        return 1;
    }

    return 0;
}
Пример #24
0
static int APP_CC
sound_send_server_formats(void)
{
    struct stream *s;
    int bytes;
    char *size_ptr;

    print_got_here();

    make_stream(s);
    init_stream(s, 8182);
    out_uint16_le(s, SNDC_FORMATS);
    size_ptr = s->p;
    out_uint16_le(s, 0);        /* size, set later */
    out_uint32_le(s, 0);        /* dwFlags */
    out_uint32_le(s, 0);        /* dwVolume */
    out_uint32_le(s, 0);        /* dwPitch */
    out_uint16_le(s, 0);        /* wDGramPort */
    out_uint16_le(s, 1);        /* wNumberOfFormats */
    out_uint8(s, g_cBlockNo);   /* cLastBlockConfirmed */
    out_uint16_le(s, 2);        /* wVersion */
    out_uint8(s, 0);            /* bPad */

    /* sndFormats */
    /*
        wFormatTag      2 byte offset 0
        nChannels       2 byte offset 2
        nSamplesPerSec  4 byte offset 4
        nAvgBytesPerSec 4 byte offset 8
        nBlockAlign     2 byte offset 12
        wBitsPerSample  2 byte offset 14
        cbSize          2 byte offset 16
        data            variable offset 18
    */

    /*  examples
        01 00 02 00 44 ac 00 00 10 b1 02 00 04 00 10 00 ....D...........
        00 00
        01 00 02 00 22 56 00 00 88 58 01 00 04 00 10 00 ...."V...X......
        00 00
    */

    out_uint16_le(s, 1);         // wFormatTag - WAVE_FORMAT_PCM
    out_uint16_le(s, 2);         // num of channels
    out_uint32_le(s, 44100);     // samples per sec
    out_uint32_le(s, 176400);    // avg bytes per sec
    out_uint16_le(s, 4);         // block align
    out_uint16_le(s, 16);        // bits per sample
    out_uint16_le(s, 0);         // size

    s_mark_end(s);
    bytes = (int)((s->end - s->data) - 4);
    size_ptr[0] = bytes;
    size_ptr[1] = bytes >> 8;
    bytes = (int)(s->end - s->data);
    send_channel_data(g_rdpsnd_chan_id, s->data, bytes);
    free_stream(s);
    return 0;
}
Пример #25
0
static STREAM rdpsnd_init_packet(uint16 type, uint16 size) {
	STREAM s;

	s = channel_init(rdpsnd_channel, size + 4);
	out_uint16_le(s, type);
	out_uint16_le(s, size);
	return s;
}
Пример #26
0
/* Output unknown capability sets (number 13, 12, 14 and 16) */
static void
rdp_out_unknown_caps(STREAM s)
{
	out_uint16_le(s, RDP_CAPSET_UNKNOWN);
	out_uint16_le(s, 0x58);

	out_uint8p(s, canned_caps, RDP_CAPLEN_UNKNOWN - 4);
}
Пример #27
0
void rdp_out_gdiplus_cache_entries(STREAM s)
{
	out_uint16_le(s, 10); /* gdipGraphicsCacheEntries */
	out_uint16_le(s, 5); /* gdipBrushCacheEntries */
	out_uint16_le(s, 5); /* gdipPenCacheEntries */
	out_uint16_le(s, 10); /* gdipImageCacheEntries */
	out_uint16_le(s, 2); /* gdipImageAttributesCacheEntries */
}
Пример #28
0
/* send a chunk of the file from server to client */
static int 
clipboard_send_file_data(int streamId, int lindex,
                         int nPositionLow, int cbRequested)
{
    struct stream *s;
    int size;
    int rv;
    int fd;
    char full_fn[256];
    struct cb_file_info *cfi;

    if (g_files_list == 0)
    {
        LLOGLN(10, ("clipboard_send_file_data: error g_files_list is nil"));
        return 1;
    }
    cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
    if (cfi == 0)
    {
        LLOGLN(10, ("clipboard_send_file_data: error cfi is nil"));
        return 1;
    }
    LLOGLN(10, ("clipboard_send_file_data: streamId %d lindex %d "
                "nPositionLow %d cbRequested %d", streamId, lindex,
                nPositionLow, cbRequested));
    g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
    fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
    if (fd == -1)
    {
        LLOGLN(0, ("clipboard_send_file_data: file open [%s] failed",
                   full_fn));
        return 1;
    }
    g_file_seek(fd, nPositionLow);
    make_stream(s);
    init_stream(s, cbRequested + 64);
    size = g_file_read(fd, s->data + 12, cbRequested);
    if (size < 1)
    {
        LLOGLN(0, ("clipboard_send_file_data: read error, want %d got %d",
                   cbRequested, size));
        free_stream(s);
        g_file_close(fd);
        return 1;
    }
    out_uint16_le(s, CB_FILECONTENTS_RESPONSE); /* 9 */
    out_uint16_le(s, CB_RESPONSE_OK); /* 1 status */
    out_uint32_le(s, size + 4);
    out_uint32_le(s, streamId);
    s->p += size;
    out_uint32_le(s, 0);
    s_mark_end(s);
    size = (int)(s->end - s->data);
    rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
    free_stream(s);
    g_file_close(fd);
    return rv;
}
Пример #29
0
/* Output colour cache capability set */
static void
rdp_out_colcache_caps(STREAM s)
{
    out_uint16_le(s, RDP_CAPSET_COLCACHE);
    out_uint16_le(s, RDP_CAPLEN_COLCACHE);

    out_uint16_le(s, 6);	/* cache size */
    out_uint16(s, 0);	/* pad */
}
Пример #30
0
/* Output share capability set */
static void
rdp_out_share_caps(STREAM s)
{
    out_uint16_le(s, RDP_CAPSET_SHARE);
    out_uint16_le(s, RDP_CAPLEN_SHARE);

    out_uint16(s, 0);	/* userid */
    out_uint16(s, 0);	/* pad */
}