Exemplo n.º 1
0
static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
{
	rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
	RDP_PLUGIN_DATA* data;
	RDP_PLUGIN_DATA default_data[2] = { { 0 }, { 0 } };

	DEBUG_SVC("connecting");

	plugin->interval_callback = rdpsnd_process_interval;

	rdpsnd->data_out_list = list_new();
	rdpsnd->latency = -1;

	data = (RDP_PLUGIN_DATA*)plugin->channel_entry_points.pExtendedData;

	while (data && data->size > 0)
	{
		rdpsnd_process_plugin_data(rdpsnd, data);
		data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size);
	}

	if (rdpsnd->device == NULL)
	{
		default_data[0].size = sizeof(RDP_PLUGIN_DATA);
		default_data[0].data[0] = "pulse";
		default_data[0].data[1] = "";
		if (!rdpsnd_load_device_plugin(rdpsnd, "pulse", default_data))
		{
			default_data[0].data[0] = "alsa";
			default_data[0].data[1] = "default";

			if (!rdpsnd_load_device_plugin(rdpsnd, "alsa", default_data))
			{
				default_data[0].data[0] = "macaudio";
				default_data[0].data[1] = "default";
				
				rdpsnd_load_device_plugin(rdpsnd, "macaudio", default_data);
			}
			else
			{
				printf("rdpsnd: successfully loaded alsa plugin\n");
			}
		}
		else
		{
			printf("rdpsnd: successfully loaded pulseaudio plugin\n");
		}
	}
	if (rdpsnd->device == NULL)
	{
		DEBUG_WARN("no sound device.");
	}
}
Exemplo n.º 2
0
int drdynvc_push_event(drdynvcPlugin* drdynvc, RDP_EVENT* event)
{
	int error;

	error = svc_plugin_send_event((rdpSvcPlugin*)drdynvc, event);
	if (error != CHANNEL_RC_OK)
	{
		DEBUG_WARN("pVirtualChannelEventPush failed %d", error);
		return 1;
	}
	return 0;
}
Exemplo n.º 3
0
static BOOL rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s)
{
	BYTE channelId;
	BYTE numChannels;

	if (stream_get_left(s) < 1)
	{
		DEBUG_WARN("RfxMessageChannels packet too small");
		return FALSE;
	}

	stream_read_BYTE(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */

	/* In RDVH sessions, numChannels will represent the number of virtual monitors 
	 * configured and does not always be set to 0x01 as [MS-RDPRFX] said.
	 */
	if (numChannels < 1)
	{
		DEBUG_WARN("numChannels:%d, expected:1", numChannels);
		return TRUE;
	}

	if (stream_get_left(s) < numChannels * 5)
	{
		DEBUG_WARN("RfxMessageChannels packet too small for numChannels=%d", numChannels);
		return FALSE;
	}

	/* RFX_CHANNELT */
	stream_read_BYTE(s, channelId); /* channelId (1 byte) */
	stream_read_UINT16(s, context->width); /* width (2 bytes) */
	stream_read_UINT16(s, context->height); /* height (2 bytes) */

	/* Now, only the first monitor can be used, therefore the other channels will be ignored. */
	stream_seek(s, 5 * (numChannels - 1));

	DEBUG_RFX("numChannels %d id %d, %dx%d.",
		numChannels, channelId, context->width, context->height);
	return TRUE;
}
Exemplo n.º 4
0
static BOOL smartcard_check_for_duplicate_id(SMARTCARD_DEVICE* smartcard, UINT32 CompletionId)
{
	BOOL duplicate;
	LIST_ITEM* item;
	COMPLETIONIDINFO* CompletionIdInfo;

	/*
	 * Search from the end of the LIST for one outstanding "CompletionID"
	 * that matches the one passed in.  Remove it from the list and free the
	 * memory associated with it.  Return whether or not it was marked
	 * as a duplicate.
	 */

	for (item = smartcard->CompletionIds->tail; item; item = item->prev)
	{
	        CompletionIdInfo = (COMPLETIONIDINFO*) item->data;

	        if (CompletionIdInfo->ID == CompletionId)
	        {
	                duplicate = CompletionIdInfo->duplicate;

	                if (duplicate)
	                {
	                        DEBUG_WARN("CompletionID number %u was previously marked as a duplicate.", CompletionId);
	                }

	                list_remove(smartcard->CompletionIds, CompletionIdInfo);
	                free(CompletionIdInfo);

	                return duplicate;
	        }
	}

	/* This function should only be called when there is
	 * at least one outstanding CompletionID item in the list.
	 */
	DEBUG_WARN("Error!!! No CompletionIDs (or no matching IDs) in the list!");

	return FALSE;
}
Exemplo n.º 5
0
void crypto_cert_print_info(X509* xcert)
{
	char* fp;
	char* issuer;
	char* subject;

	subject = crypto_cert_subject(xcert);
	issuer = crypto_cert_issuer(xcert);
	fp = crypto_cert_fingerprint(xcert);
	if (!fp)
	{
		DEBUG_WARN( "%s: error computing fingerprint\n", __FUNCTION__);
		goto out_free_issuer;
	}

	DEBUG_WARN( "Certificate details:\n");
	DEBUG_WARN( "\tSubject: %s\n", subject);
	DEBUG_WARN( "\tIssuer: %s\n", issuer);
	DEBUG_WARN( "\tThumbprint: %s\n", fp);
	DEBUG_WARN( "The above X.509 certificate could not be verified, possibly because you do not have "
			"the CA certificate in your certificate store, or the certificate has expired. "
			"Please look at the documentation on how to create local certificate store for a private CA.\n");

	free(fp);
out_free_issuer:
	free(issuer);
	free(subject);
}
Exemplo n.º 6
0
static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
{
	uint32 PathLength;
	char* path;
	UNICONV* uniconv;

	stream_seek(irp->input, 28);
	/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
	/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
	stream_read_uint32(irp->input, PathLength);

	uniconv = freerdp_uniconv_new();
	path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength);
	freerdp_uniconv_free(uniconv);

	parallel->id = irp->devman->id_sequence++;
	parallel->file = open(parallel->path, O_RDWR);
	if (parallel->file < 0)
	{
		irp->IoStatus = STATUS_ACCESS_DENIED;
		parallel->id = 0;

		DEBUG_WARN("failed to create %s: %s", parallel->path, strerror(errno));
	}
	else
	{
		/* all read and write operations should be non-blocking */
		if (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)
			DEBUG_WARN("%s fcntl %s", path, strerror(errno));

		DEBUG_SVC("%s(%d) created", parallel->path, parallel->file);
	}

	stream_write_uint32(irp->output, parallel->id);
	stream_write_uint8(irp->output, 0);

	xfree(path);

	irp->Complete(irp);
}
Exemplo n.º 7
0
void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
	if (wf_info_lock(wfi) > 0)
	{
		int i;
		int peerId;
		if (wfi->peerCount == WF_INFO_MAXPEERS)
		{
			context->socketClose = TRUE;
			wf_info_unlock(wfi);
			return;
		}

		context->info = wfi;
		context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

		//get the offset of the top left corner of selected screen
		EnumDisplayMonitors(NULL, NULL, wf_info_monEnumCB, 0);
		_IDcount = 0;

#ifdef WITH_DXGI_1_2
		if (wfi->peerCount == 0)
			wf_dxgi_init(wfi);
#else
		if (wf_mirror_driver_activate(wfi) == FALSE)
		{
			context->socketClose = TRUE;
			wf_info_unlock(wfi);
			return;
		}
#endif
		//look trhough the array of peers until an empty slot
		for(i=0; i<WF_INFO_MAXPEERS; ++i)
		{
			//empty index will be our peer id
			if (wfi->peers[i] == NULL)
			{
				peerId = i;
				break;
			}
		}

		wfi->peers[peerId] = ((rdpContext*) context)->peer;
		wfi->peers[peerId]->pId = peerId;
		wfi->peerCount++;
		DEBUG_WARN("Registering Peer: id=%d #=%d\n", peerId, wfi->peerCount);

		wf_info_unlock(wfi);

		wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_CONNECT);
	}
}
Exemplo n.º 8
0
int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size)
{
    DVCMAN_CHANNEL* channel;
    int error = 0;

    channel = dvcman_find_channel_by_id(pChannelMgr, ChannelId);
    if (channel == NULL)
    {
        DEBUG_WARN("ChannelId %d not found!", ChannelId);
        return 1;
    }

    if (channel->dvc_data)
    {
        /* Fragmented data */
        if (stream_get_length(channel->dvc_data) + data_size > stream_get_size(channel->dvc_data))
        {
            DEBUG_WARN("data exceeding declared length!");
            stream_free(channel->dvc_data);
            channel->dvc_data = NULL;
            return 1;
        }
        stream_write(channel->dvc_data, data, data_size);
        if (stream_get_length(channel->dvc_data) >= stream_get_size(channel->dvc_data))
        {
            error = channel->channel_callback->OnDataReceived(channel->channel_callback,
                    stream_get_size(channel->dvc_data), stream_get_data(channel->dvc_data));
            stream_free(channel->dvc_data);
            channel->dvc_data = NULL;
        }
    }
    else
    {
        error = channel->channel_callback->OnDataReceived(channel->channel_callback,
                data_size, data);
    }

    return error;
}
Exemplo n.º 9
0
static int dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
{
    DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*)pChannel;
    DVCMAN* dvcman = channel->dvcman;

    DEBUG_DVC("id=%d", channel->channel_id);

    if (list_remove(dvcman->channels, channel) == NULL)
        DEBUG_WARN("channel not found");
    dvcman_channel_free(channel);

    return 1;
}
Exemplo n.º 10
0
void region16_print(const REGION16 *region)
{
	const RECTANGLE_16 *rects;
	int nbRects, i;
	int currentBandY = -1;

	rects = region16_rects(region, &nbRects);
	DEBUG_WARN( "nrects=%d", nbRects);

	for (i = 0; i < nbRects; i++, rects++)
	{
		if (rects->top != currentBandY)
		{
			currentBandY = rects->top;
			DEBUG_WARN( "\nband %d: ", currentBandY);
		}

		DEBUG_WARN( "(%d,%d-%d,%d)", rects->left, rects->top, rects->right, rects->bottom);
	}

	DEBUG_WARN( "\n");
}
Exemplo n.º 11
0
static boolean tsmf_ffmpeg_init_context(ITSMFDecoder* decoder)
{
	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;

	mdecoder->codec_context = avcodec_alloc_context();
	if (!mdecoder->codec_context)
	{
		DEBUG_WARN("avcodec_alloc_context failed.");
		return False;
	}

	return True;
}
Exemplo n.º 12
0
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output)
{
	struct STAT st;

	if (STAT(file->fullpath, &st) != 0)
	{
		Stream_Write_UINT32(output, 0); /* Length */
		return FALSE;
	}

	switch (FsInformationClass)
	{
		case FileBasicInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
			Stream_Write_UINT32(output, 36); /* Length */
			Stream_EnsureRemainingCapacity(output, 36);
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
			Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
			Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			/* Reserved(4), MUST NOT be added! */
			break;

		case FileStandardInformation:
			/*  http://msdn.microsoft.com/en-us/library/cc232088.aspx */
			Stream_Write_UINT32(output, 22); /* Length */
			Stream_EnsureRemainingCapacity(output, 22);
			Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
			Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
			Stream_Write_UINT32(output, st.st_nlink); /* NumberOfLinks */
			Stream_Write_UINT8(output, file->delete_pending ? 1 : 0); /* DeletePending */
			Stream_Write_UINT8(output, file->is_dir ? 1 : 0); /* Directory */
			/* Reserved(2), MUST NOT be added! */
			break;

		case FileAttributeTagInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
			Stream_Write_UINT32(output, 8); /* Length */
			Stream_EnsureRemainingCapacity(output, 8);
			Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			Stream_Write_UINT32(output, 0); /* ReparseTag */
			break;

		default:
			Stream_Write_UINT32(output, 0); /* Length */
			DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
			return FALSE;
	}
	return TRUE;
}
Exemplo n.º 13
0
static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
{
	UINT16 msgType;
	UINT16 msgFlags;
	UINT32 dataLen;
	cliprdrPlugin* cliprdr = (cliprdrPlugin*) plugin;

	Stream_Read_UINT16(s, msgType);
	Stream_Read_UINT16(s, msgFlags);
	Stream_Read_UINT32(s, dataLen);

	DEBUG_CLIPRDR("msgType: %s (%d), msgFlags: %d dataLen: %d",
		CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen);

#ifdef WITH_DEBUG_CLIPRDR
	winpr_HexDump(Stream_Buffer(s), dataLen + 8);
#endif

	switch (msgType)
	{
		case CB_CLIP_CAPS:
			cliprdr_process_clip_caps(cliprdr, s, dataLen, msgFlags);
			break;

		case CB_MONITOR_READY:
			cliprdr_process_monitor_ready(cliprdr, s, dataLen, msgFlags);
			break;

		case CB_FORMAT_LIST:
			cliprdr_process_format_list(cliprdr, s, dataLen, msgFlags);
			break;

		case CB_FORMAT_LIST_RESPONSE:
			cliprdr_process_format_list_response(cliprdr, s, dataLen, msgFlags);
			break;

		case CB_FORMAT_DATA_REQUEST:
			cliprdr_process_format_data_request(cliprdr, s, dataLen, msgFlags);
			break;

		case CB_FORMAT_DATA_RESPONSE:
			cliprdr_process_format_data_response(cliprdr, s, dataLen, msgFlags);
			break;

		default:
			DEBUG_WARN("unknown msgType %d", msgType);
			break;
	}

	Stream_Free(s, TRUE);
}
Exemplo n.º 14
0
static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp)
{
	UINT32 timeout = 0;
	UINT32 itv_timeout = 0;
	SERIAL_TTY* tty;

	tty = serial->tty;
	if(!tty)
	{
		DEBUG_WARN("tty = %p", tty);
		return;
	}

	switch (irp->MajorFunction)
	{
		case IRP_MJ_WRITE:
			DEBUG_SVC("handling IRP_MJ_WRITE");
			break;

		case IRP_MJ_READ:
			DEBUG_SVC("handling IRP_MJ_READ");

			serial_get_timeouts(serial, irp, &timeout, &itv_timeout);

			/* Check if io request timeout is smaller than current (but not 0). */
			if (timeout && ((serial->select_timeout == 0) || (timeout < serial->select_timeout)))
			{
				serial->select_timeout = timeout;
				serial->tv.tv_sec = serial->select_timeout / 1000;
				serial->tv.tv_usec = (serial->select_timeout % 1000) * 1000;
				serial->timeout_id = tty->id;
			}
			if (itv_timeout && ((serial->select_timeout == 0) || (itv_timeout < serial->select_timeout)))
			{
				serial->select_timeout = itv_timeout;
				serial->tv.tv_sec = serial->select_timeout / 1000;
				serial->tv.tv_usec = (serial->select_timeout % 1000) * 1000;
				serial->timeout_id = tty->id;
			}
			DEBUG_SVC("select_timeout %u, tv_sec %lu tv_usec %lu, timeout_id %u",
				serial->select_timeout, serial->tv.tv_sec, serial->tv.tv_usec, serial->timeout_id);
			break;

		default:
			DEBUG_SVC("no need to handle %d", irp->MajorFunction);
			return;
	}

	irp->IoStatus = STATUS_PENDING;
	list_enqueue(serial->pending_irps, irp);
}
Exemplo n.º 15
0
static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, uint8* data, int size)
{
	rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
	int len;
	int ret;
	uint8* decoded_data;
	uint8* src;
	int decoded_size;

	if (!pulse->stream)
		return;

	if (pulse->format == 0x11)
	{
		decoded_data = dsp_decode_ima_adpcm(&pulse->adpcm,
			data, size, pulse->sample_spec.channels, pulse->block_size, &decoded_size);
		size = decoded_size;
		src = decoded_data;
	}
	else
	{
		decoded_data = NULL;
		src = data;
	}

	pa_threaded_mainloop_lock(pulse->mainloop);
	while (size > 0)
	{
		while ((len = pa_stream_writable_size(pulse->stream)) == 0)
		{
			pa_threaded_mainloop_wait(pulse->mainloop);
		}
		if (len < 0)
			break;
		if (len > size)
			len = size;
		ret = pa_stream_write(pulse->stream, src, len, NULL, 0LL, PA_SEEK_RELATIVE);
		if (ret < 0)
		{
			DEBUG_WARN("pa_stream_write failed (%d)",
				pa_context_errno(pulse->context));
			break;
		}
		src += len;
		size -= len;
	}
	pa_threaded_mainloop_unlock(pulse->mainloop);

	if (decoded_data)
		xfree(decoded_data);
}
Exemplo n.º 16
0
static int dvcman_create_listener(IWTSVirtualChannelManager *pChannelMgr,
								  const char *pszChannelName, UINT32 ulFlags,
								  IWTSListenerCallback *pListenerCallback, IWTSListener **ppListener)
{
	DVCMAN *dvcman = (DVCMAN *) pChannelMgr;
	DVCMAN_LISTENER *listener;
	assert(dvcman);

	if (dvcman->num_listeners < MAX_PLUGINS)
	{
		DEBUG_DVC("%d.%s.", dvcman->num_listeners, pszChannelName);
		listener = (DVCMAN_LISTENER *) calloc(1, sizeof(DVCMAN_LISTENER));

		if (!listener)
		{
			DEBUG_WARN("calloc failed %s (%d)!", strerror(errno), errno);
			return 2;
		}

		listener->iface.GetConfiguration = dvcman_get_configuration;
		listener->iface.pInterface = NULL;
		listener->dvcman = dvcman;
		listener->channel_name = _strdup(pszChannelName);
		listener->flags = ulFlags;
		listener->listener_callback = pListenerCallback;

		if (ppListener)
			*ppListener = (IWTSListener *) listener;

		dvcman->listeners[dvcman->num_listeners++] = (IWTSListener *) listener;
		return 0;
	}
	else
	{
		DEBUG_WARN("Maximum DVC listener number reached.");
		return 1;
	}
}
Exemplo n.º 17
0
static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
{
	SERIAL_TTY* tty;
	UINT32 Length;
	UINT64 Offset;

	Stream_Read_UINT32(irp->input, Length);
	Stream_Read_UINT64(irp->input, Offset);
	Stream_Seek(irp->input, 20); /* Padding */

	DEBUG_SVC("length %u offset %llu", Length, Offset);

	tty = serial->tty;

	if (tty == NULL)
	{
		irp->IoStatus = STATUS_UNSUCCESSFUL;
		Length = 0;

		DEBUG_WARN("tty not valid.");
	}
	else if (!serial_tty_write(tty, Stream_Pointer(irp->input), Length))
	{
		irp->IoStatus = STATUS_UNSUCCESSFUL;
		Length = 0;

		DEBUG_WARN("write %s(%d) failed.", serial->path, tty->id);
	}
	else
	{
		DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, serial->path, tty->id);
	}

	Stream_Write_UINT32(irp->output, Length);
	Stream_Write_UINT8(irp->output, 0); /* Padding */

	irp->Complete(irp);
}
Exemplo n.º 18
0
static BOOL tsmf_ffmpeg_prepare(ITSMFDecoder* decoder)
{
	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;

	if (avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0)
	{
		DEBUG_WARN("avcodec_open2 failed.");
		return FALSE;
	}

	mdecoder->prepared = 1;

	return TRUE;
}
Exemplo n.º 19
0
static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* data_in)
{
	UINT16 versionMajor;
	UINT16 versionMinor;
	UINT32 clientID;

	stream_read_UINT16(data_in, versionMajor);
	stream_read_UINT16(data_in, versionMinor);
	stream_read_UINT32(data_in, clientID);

	if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor)
	{
		DEBUG_WARN("unmatched version %d.%d", versionMajor, versionMinor);
		rdpdr->versionMajor = versionMajor;
		rdpdr->versionMinor = versionMinor;
	}

	if (clientID != rdpdr->clientID)
	{
		DEBUG_WARN("unmatched clientID %d", clientID);
		rdpdr->clientID = clientID;
	}
}
Exemplo n.º 20
0
tbool tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback,
	RDP_EVENT* event)
{
	int error;
	TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback;

	error = callback->channel_mgr->PushEvent(callback->channel_mgr, event);
	if (error)
	{
		DEBUG_WARN("response error %d", error);
		return false;
	}
	return true;
}
Exemplo n.º 21
0
static void rfx_process_message_codec_versions(RFX_CONTEXT* context, STREAM* s)
{
	uint8 numCodecs;

	rfx_parse_message_codec_versions(s, &numCodecs, &context->codec_id, &context->codec_version);

	if (numCodecs != 1)
	{
		DEBUG_WARN("numCodecs: %d, expected:1", numCodecs);
		return;
	}

	DEBUG_RFX("id %d version 0x%X.", context->codec_id, context->codec_version);
}
Exemplo n.º 22
0
static boolean tsmf_ffmpeg_prepare(ITSMFDecoder* decoder)
{
	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;

	if (avcodec_open(mdecoder->codec_context, mdecoder->codec) < 0)
	{
		DEBUG_WARN("avcodec_open failed.");
		return False;
	}

	mdecoder->prepared = 1;

	return True;
}
Exemplo n.º 23
0
int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event)
{
	int status;

	status = svc_plugin_send_event((rdpSvcPlugin*) drdynvc, event);

	if (status != CHANNEL_RC_OK)
	{
		DEBUG_WARN("pVirtualChannelEventPush failed %d", status);
		return 1;
	}

	return 0;
}
Exemplo n.º 24
0
int tsmf_platform_register_handler(TSMFGstreamerDecoder *decoder)
{
	assert(decoder);
	assert(decoder->pipe);
	GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(decoder->pipe));

	if (!bus)
	{
		DEBUG_WARN("gst_pipeline_get_bus failed!");
		return 1;
	}

	return 0;
}
Exemplo n.º 25
0
static void rfx_process_message_sync(RFX_CONTEXT* context, STREAM* s)
{
	UINT32 magic;

	/* RFX_SYNC */
	stream_read_UINT32(s, magic); /* magic (4 bytes), 0xCACCACCA */

	if (magic != WF_MAGIC)
	{
		DEBUG_WARN("invalid magic number 0x%X", magic);
		return;
	}

	stream_read_UINT16(s, context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */

	if (context->version != WF_VERSION_1_0)
	{
		DEBUG_WARN("unknown version number 0x%X", context->version);
		return;
	}

	DEBUG_RFX("version 0x%X", context->version);
}
Exemplo n.º 26
0
boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output)
{
	struct stat st;

	if (stat(file->fullpath, &st) != 0)
	{
		stream_write_uint32(output, 0); /* Length */
		return false;
	}
	switch (FsInformationClass)
	{
		case FileBasicInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
			stream_write_uint32(output, 36); /* Length */
			stream_check_size(output, 36);
			stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
			stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
			stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
			stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
			stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			/* Reserved(4), MUST NOT be added! */
			break;

		case FileStandardInformation:
			/*  http://msdn.microsoft.com/en-us/library/cc232088.aspx */
			stream_write_uint32(output, 22); /* Length */
			stream_check_size(output, 22);
			stream_write_uint64(output, st.st_size); /* AllocationSize */
			stream_write_uint64(output, st.st_size); /* EndOfFile */
			stream_write_uint32(output, st.st_nlink); /* NumberOfLinks */
			stream_write_uint8(output, file->delete_pending ? 1 : 0); /* DeletePending */
			stream_write_uint8(output, file->is_dir ? 1 : 0); /* Directory */
			/* Reserved(2), MUST NOT be added! */
			break;

		case FileAttributeTagInformation:
			/* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
			stream_write_uint32(output, 8); /* Length */
			stream_check_size(output, 8);
			stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
			stream_write_uint32(output, 0); /* ReparseTag */
			break;

		default:
			stream_write_uint32(output, 0); /* Length */
			DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
			return false;
	}
	return true;
}
Exemplo n.º 27
0
static BOOL tsmf_ffmpeg_init_context(ITSMFDecoder* decoder)
{
	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;

	mdecoder->codec_context = avcodec_alloc_context3(NULL);

	if (!mdecoder->codec_context)
	{
		DEBUG_WARN("avcodec_alloc_context failed.");
		return FALSE;
	}

	return TRUE;
}
Exemplo n.º 28
0
static boolean tsmf_alsa_open_device(TSMFALSAAudioDevice* alsa)
{
	int error;

	error = snd_pcm_open(&alsa->out_handle, alsa->device, SND_PCM_STREAM_PLAYBACK, 0);
	if (error < 0)
	{
		DEBUG_WARN("failed to open device %s", alsa->device);
		return false;
	}

	DEBUG_DVC("open device %s", alsa->device);
	return true;
}
Exemplo n.º 29
0
int tsmf_window_create(TSMFGstreamerDecoder *decoder)
{
	if (decoder->media_type != TSMF_MAJOR_TYPE_VIDEO)
	{
		decoder->ready = TRUE;
		return -3;
	}
	else
	{
#if GST_VERSION_MAJOR > 0
		GstVideoOverlay *overlay = GST_VIDEO_OVERLAY(decoder->outsink);
#else
		GstXOverlay *overlay = GST_X_OVERLAY(decoder->outsink);
#endif
		struct X11Handle *hdl = (struct X11Handle *)decoder->platform;
		assert(decoder);
		assert(hdl);

		if (!hdl->subwin)
		{
			int event, error;
			hdl->subwin = XCreateSimpleWindow(hdl->disp, *(int *)hdl->xfwin, 0, 0, 1, 1, 0, 0, 0);

			if (!hdl->subwin)
			{
				DEBUG_WARN("Could not create subwindow!");
			}

			XMapWindow(hdl->disp, hdl->subwin);
			XSync(hdl->disp, FALSE);
#if GST_VERSION_MAJOR > 0
			gst_video_overlay_set_window_handle(overlay, hdl->subwin);
#else
			gst_x_overlay_set_window_handle(overlay, hdl->subwin);
#endif
			decoder->ready = TRUE;
#if defined(WITH_XEXT)
			hdl->has_shape = XShapeQueryExtension(hdl->disp, &event, &error);
#endif
		}

#if GST_VERSION_MAJOR > 0
		gst_video_overlay_handle_events(overlay, TRUE);
#else
		gst_x_overlay_handle_events(overlay, TRUE);
#endif
		return 0;
	}
}
Exemplo n.º 30
0
static void drive_process_irp(DRIVE_DEVICE* disk, IRP* irp)
{
	irp->IoStatus = STATUS_SUCCESS;

	switch (irp->MajorFunction)
	{
		case IRP_MJ_CREATE:
			drive_process_irp_create(disk, irp);
			break;

		case IRP_MJ_CLOSE:
			drive_process_irp_close(disk, irp);
			break;

		case IRP_MJ_READ:
			drive_process_irp_read(disk, irp);
			break;

		case IRP_MJ_WRITE:
			drive_process_irp_write(disk, irp);
			break;

		case IRP_MJ_QUERY_INFORMATION:
			drive_process_irp_query_information(disk, irp);
			break;

		case IRP_MJ_SET_INFORMATION:
			drive_process_irp_set_information(disk, irp);
			break;

		case IRP_MJ_QUERY_VOLUME_INFORMATION:
			drive_process_irp_query_volume_information(disk, irp);
			break;

		case IRP_MJ_DIRECTORY_CONTROL:
			drive_process_irp_directory_control(disk, irp);
			break;

		case IRP_MJ_DEVICE_CONTROL:
			drive_process_irp_device_control(disk, irp);
			break;

		default:
			DEBUG_WARN("MajorFunction 0x%X not supported", irp->MajorFunction);
			irp->IoStatus = STATUS_NOT_SUPPORTED;
			irp->Complete(irp);
			break;
	}
}