예제 #1
0
static void printer_irp_request(DEVICE* device, IRP* irp)
{
    PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;

    InterlockedPushEntrySList(printer_dev->pIrpList, &(irp->ItemEntry));

    freerdp_thread_signal(printer_dev->thread);
}
예제 #2
0
static void parallel_irp_request(DEVICE* device, IRP* irp)
{
	PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;

	InterlockedPushEntrySList(parallel->pIrpList, &(irp->ItemEntry));

	freerdp_thread_signal(parallel->thread);
}
예제 #3
0
static void printer_irp_request(DEVICE* device, IRP* irp) {
	PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;

	freerdp_thread_lock(printer_dev->thread);
	list_enqueue(printer_dev->irp_list, irp);
	freerdp_thread_unlock(printer_dev->thread);

	freerdp_thread_signal(printer_dev->thread);
}
예제 #4
0
static void serial_irp_request(DEVICE* device, IRP* irp)
{
    SERIAL_DEVICE* serial = (SERIAL_DEVICE*)device;

    freerdp_thread_lock(serial->thread);
    list_enqueue(serial->irp_list, irp);
    freerdp_thread_unlock(serial->thread);

    freerdp_thread_signal(serial->thread);
}
예제 #5
0
static void parallel_irp_request(DEVICE* device, IRP* irp)
{
    PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;

    freerdp_thread_lock(parallel->thread);
    list_enqueue(parallel->irp_list, irp);
    freerdp_thread_unlock(parallel->thread);

    freerdp_thread_signal(parallel->thread);
}
예제 #6
0
static void svc_plugin_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event_in)
{
	svc_data_in_item* item;

	item = xnew(svc_data_in_item);
	item->event_in = event_in;

	freerdp_thread_lock(plugin->priv->thread);
	list_enqueue(plugin->priv->data_in_list, item);
	freerdp_thread_unlock(plugin->priv->thread);

	freerdp_thread_signal(plugin->priv->thread);
}
예제 #7
0
static void
scard_irp_request(DEVICE* device, IRP* irp)
{
	COMPLETIONIDINFO* CompletionIdInfo;

	SCARD_DEVICE* scard = (SCARD_DEVICE*)device;

	/* Begin TS Client defect workaround. */
	CompletionIdInfo= xnew(COMPLETIONIDINFO);
	CompletionIdInfo->ID = irp->CompletionId;/* "duplicate" member is set 
	                                          * to false by "xnew()"
	                                          */
	freerdp_mutex_lock(scard->CompletionIdsMutex);
	scard_mark_duplicate_id(scard, irp->CompletionId);
	list_enqueue(scard->CompletionIds, CompletionIdInfo);
	freerdp_mutex_unlock(scard->CompletionIdsMutex);

	irp->Complete = scard_irp_complete;	/* Overwrite the previous
						 * assignment made in 
						 * "irp_new()".
						 */
	/* End TS Client defect workaround. */

	if (irp->MajorFunction == IRP_MJ_DEVICE_CONTROL &&
			scard_async_op(irp))
	{
		/*
		 * certain potentially long running operations
		 * get their own thread
		 * TODO: revise this mechanism.. maybe worker pool
		 */
		struct scard_irp_thread_args *args = xmalloc(sizeof(struct scard_irp_thread_args));


		args->thread = freerdp_thread_new();
		args->scard = scard;
		args->irp = irp;
		freerdp_thread_start(args->thread, scard_process_irp_thread_func, args);

		return;
	}

	freerdp_thread_lock(scard->thread);
	list_enqueue(scard->irp_list, irp);
	freerdp_thread_unlock(scard->thread);

	freerdp_thread_signal(scard->thread);
}
예제 #8
0
static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, uint32 dataLength,
	uint32 totalLength, uint32 dataFlags)
{
	STREAM* data_in;
	svc_data_in_item* item;
	
	if ( (dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
	{
		/* According to MS-RDPBCGR 2.2.6.1, "All virtual channel traffic MUST be suspended.
		This flag is only valid in server-to-client virtual channel traffic. It MUST be
		ignored in client-to-server data." Thus it would be best practice to cease data
		transmission. However, simply returing here avoids a crash. */
		return;
	}

	if (dataFlags & CHANNEL_FLAG_FIRST)
	{
		if (plugin->priv->data_in != NULL)
			stream_free(plugin->priv->data_in);
		plugin->priv->data_in = stream_new(totalLength);
	}

	data_in = plugin->priv->data_in;
	stream_check_size(data_in, (int) dataLength);
	stream_write(data_in, pData, dataLength);

	if (dataFlags & CHANNEL_FLAG_LAST)
	{
		if (stream_get_size(data_in) != stream_get_length(data_in))
		{
			printf("svc_plugin_process_received: read error\n");
		}

		plugin->priv->data_in = NULL;
		stream_set_pos(data_in, 0);

		item = xnew(svc_data_in_item);
		item->data_in = data_in;

		freerdp_thread_lock(plugin->priv->thread);
		list_enqueue(plugin->priv->data_in_list, item);
		freerdp_thread_unlock(plugin->priv->thread);

		freerdp_thread_signal(plugin->priv->thread);
	}
}
예제 #9
0
static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, uint32 dataLength,
	uint32 totalLength, uint32 dataFlags)
{
	STREAM* data_in;
	svc_data_in_item* item;

	if (dataFlags & CHANNEL_FLAG_FIRST)
	{
		if (plugin->priv->data_in != NULL)
			stream_free(plugin->priv->data_in);
		plugin->priv->data_in = stream_new(totalLength);
	}

	data_in = plugin->priv->data_in;
	stream_check_size(data_in, (int) dataLength);
	stream_write(data_in, pData, dataLength);

	if (dataFlags & CHANNEL_FLAG_LAST)
	{
		if (stream_get_size(data_in) != stream_get_length(data_in))
		{
			printf("svc_plugin_process_received: read error\n");
		}

		plugin->priv->data_in = NULL;
		stream_set_pos(data_in, 0);

		item = xnew(svc_data_in_item);
		item->data_in = data_in;

		freerdp_thread_lock(plugin->priv->thread);
		list_enqueue(plugin->priv->data_in_list, item);
		freerdp_thread_unlock(plugin->priv->thread);

		freerdp_thread_signal(plugin->priv->thread);
	}
}