Beispiel #1
0
void wf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
{
	wfInfo* wfi;
	rdpSettings* settings;

	wfi = ((wfContext*) context)->wfi;
	settings = wfi->instance->settings;
	if (surface_frame_marker->frameAction == SURFACECMD_FRAMEACTION_END && settings->FrameAcknowledge > 0)
	{
		IFCALL(wfi->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId);
	}
}
Beispiel #2
0
void update_post_connect(rdpUpdate* update)
{
	update->asynchronous = update->context->settings->AsyncUpdate;

	if (update->asynchronous)
		update->proxy = update_message_proxy_new(update);

	update->altsec->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
	IFCALL(update->altsec->SwitchSurface, update->context, &(update->altsec->switch_surface));

	update->initialState = FALSE;
}
Beispiel #3
0
static BOOL audin_server_recv_open_reply(audin_server* audin, STREAM* s, UINT32 length)
{
	UINT32 Result;

	if (length < 4)
		return FALSE;
	stream_read_UINT32(s, Result);

	IFCALL(audin->context.OpenResult, &audin->context, Result);

	return TRUE;
}
Beispiel #4
0
BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_INFO* orderInfo)
{
	rdpContext* context = update->context;
	rdpWindowUpdate* window = update->window;

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_NONE)
	{
		update_read_desktop_non_monitored_order(s, orderInfo);
		WLog_Print(update->log, WLOG_DEBUG, "NonMonitoredDesktop");
		IFCALL(window->NonMonitoredDesktop, context, orderInfo);
	}
	else
	{
		if (!update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop))
			return FALSE;
		WLog_Print(update->log, WLOG_DEBUG, "ActivelyMonitoredDesktop");
		IFCALL(window->MonitoredDesktop, context, orderInfo, &window->monitored_desktop);
	}

	return TRUE;
}
Beispiel #5
0
static boolean rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
{
	IRP* irp;

	irp = irp_new(rdpdr->devman, data_in);
	if (irp == NULL)
		return False;

	IFCALL(irp->device->IRPRequest, irp->device, irp);

	return True;
}
Beispiel #6
0
static boolean audin_server_recv_open_reply(audin_server* audin, STREAM* s, uint32 length)
{
	uint32 Result;

	if (length < 4)
		return false;
	stream_read_uint32(s, Result);

	IFCALL(audin->context.OpenResult, &audin->context, Result);

	return true;
}
Beispiel #7
0
void update_recv_pointer(rdpUpdate* update, STREAM* s)
{
	UINT16 messageType;
	rdpContext* context = update->context;
	rdpPointerUpdate* pointer = update->pointer;

	stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
	stream_seek_UINT16(s); /* pad2Octets (2 bytes) */

	switch (messageType)
	{
		case PTR_MSG_TYPE_POSITION:
			update_read_pointer_position(s, &pointer->pointer_position);
			IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
			break;

		case PTR_MSG_TYPE_SYSTEM:
			update_read_pointer_system(s, &pointer->pointer_system);
			IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
			break;

		case PTR_MSG_TYPE_COLOR:
			update_read_pointer_color(s, &pointer->pointer_color);
			IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
			break;

		case PTR_MSG_TYPE_POINTER:
			update_read_pointer_new(s, &pointer->pointer_new);
			IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
			break;

		case PTR_MSG_TYPE_CACHED:
			update_read_pointer_cached(s, &pointer->pointer_cached);
			IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
			break;

		default:
			break;
	}
}
Beispiel #8
0
int shadow_client_send_surface_frame_marker(rdpShadowClient* client, UINT32 action, UINT32 id)
{
	SURFACE_FRAME_MARKER surfaceFrameMarker;
	rdpContext* context = (rdpContext*) client;
	rdpUpdate* update = context->update;

	surfaceFrameMarker.frameAction = action;
	surfaceFrameMarker.frameId = id;

	IFCALL(update->SurfaceFrameMarker, context, &surfaceFrameMarker);

	return 1;
}
Beispiel #9
0
static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
{
	IRP* irp;

	irp = irp_new(rdpdr->devman, data_in);

	if (irp == NULL)
		return FALSE;

	IFCALL(irp->device->IRPRequest, irp->device, irp);

	return TRUE;
}
Beispiel #10
0
/** Deallocator function for a rdp context.
 *  The function will deallocate the resources from the 'instance' parameter that were allocated from a call
 *  to freerdp_context_new().
 *  If the ContextFree callback is set in the 'instance' parameter, it will be called before deallocation occurs.
 *
 *  @param instance - Pointer to the rdp_freerdp structure that was initialized by a call to freerdp_context_new().
 *  				  On return, the fields associated to the context are invalid.
 */
void freerdp_context_free(freerdp* instance)
{
	if (instance->context == NULL)
		return;

	IFCALL(instance->ContextFree, instance, instance->context);

	rdp_free(instance->context->rdp);
	graphics_free(instance->context->graphics);

	free(instance->context);
	instance->context = NULL;
}
Beispiel #11
0
int freerds_set_system_pointer(rdsConnection* connection, RDS_MSG_SET_SYSTEM_POINTER* msg)
{
    POINTER_SYSTEM_UPDATE *pointer_system;
    rdpPointerUpdate* pointer = connection->client->update->pointer;

    WLog_VRB(TAG, "%s", __FUNCTION__);

    pointer_system = &(pointer->pointer_system);
    pointer_system->type = msg->ptrType;
    IFCALL(pointer->PointerSystem, (rdpContext *)connection, pointer_system);

    return 0;
}
Beispiel #12
0
void update_recv_notification_icon_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */
	stream_read_uint32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
	{
		DEBUG_WND("Delete Notification Icon Deleted Order");
		update_read_notification_icon_delete_order(s, orderInfo);
		IFCALL(update->NotifyIconDelete, update, orderInfo);
	}
	else
	{
		DEBUG_WND("Notification Icon State Order");
		update_read_notification_icon_state_order(s, orderInfo, &update->notify_icon_state);

		if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
			IFCALL(update->NotifyIconCreate, update, orderInfo, &update->notify_icon_state);
		else
			IFCALL(update->NotifyIconUpdate, update, orderInfo, &update->notify_icon_state);
	}
}
Beispiel #13
0
void update_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
{
	rdpBrush* brush = &patblt->brush;
	rdpCache* cache = update->context->cache;

	if (brush->style & CACHED_BRUSH)
	{
		brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
		brush->style = 0x03;
	}

	IFCALL(cache->brush->PatBlt, update, patblt);
}
Beispiel #14
0
void freerdp_context_new(freerdp* instance)
{
	rdpRdp* rdp;
	uint32 size = sizeof(rdpContext);

	rdp = rdp_new(instance);
	instance->input = rdp->input;
	instance->update = rdp->update;
	instance->settings = rdp->settings;

	IFCALL(instance->ContextSize, instance, &size);

	instance->context = (rdpContext*) xzalloc(size);
	instance->context->instance = instance;
	instance->context->rdp = rdp;

	instance->update->context = instance->context;
	instance->input->context = instance->context;
	input_register_client_callbacks(rdp->input);

	IFCALL(instance->ContextNew, instance, instance->context);
}
Beispiel #15
0
int freerds_orders_send_switch_os_surface(rdsConnection* connection, int id)
{
	SWITCH_SURFACE_ORDER switch_surface;
	rdpAltSecUpdate* altsec = connection->client->update->altsec;

	//printf("%s: id: %d\n", __FUNCTION__, id);

	switch_surface.bitmapId = id & 0xFFFF;

	IFCALL(altsec->SwitchSurface, (rdpContext*) connection, &switch_surface);

	return 0;
}
Beispiel #16
0
int freerds_set_pointer(rdsConnection* connection, RDS_MSG_SET_POINTER* msg)
{
	POINTER_NEW_UPDATE pointerNew;
	POINTER_COLOR_UPDATE* pointerColor;
	POINTER_CACHED_UPDATE pointerCached;
	rdpPointerUpdate* pointer = connection->client->update->pointer;

	//printf("%s\n", __FUNCTION__);

	pointerColor = &(pointerNew.colorPtrAttr);

	pointerColor->cacheIndex = 0;
	pointerColor->xPos = msg->xPos;
	pointerColor->yPos = msg->yPos;
	pointerColor->width = 32;
	pointerColor->height = 32;
	pointerColor->lengthAndMask = 128;
	pointerColor->lengthXorMask = 0;
	pointerColor->xorMaskData = msg->xorMaskData;
	pointerColor->andMaskData = msg->andMaskData;

	if (!msg->xorBpp)
	{
		pointerColor->lengthXorMask = 3072;
		IFCALL(pointer->PointerColor, (rdpContext*) connection, pointerColor);
	}
	else
	{
		pointerNew.xorBpp = msg->xorBpp;
		pointerColor->lengthXorMask = ((msg->xorBpp + 7) / 8) * 32 * 32;
		IFCALL(pointer->PointerNew, (rdpContext*) connection, &pointerNew);
	}

	pointerCached.cacheIndex = pointerColor->cacheIndex;

	IFCALL(pointer->PointerCached, (rdpContext*) connection, &pointerCached);

	return 0;
}
Beispiel #17
0
void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id)
{
	uint32 length;
	uint32 flags;
	int chunk_length;

	stream_read_uint32(s, length);
	stream_read_uint32(s, flags);
	chunk_length = stream_get_left(s);

	IFCALL(vchan->instance->ReceiveChannelData, vchan->instance,
		channel_id, stream_get_tail(s), chunk_length, flags, length);
}
void wf_gdi_surface_frame_marker(wfContext* wfc, SURFACE_FRAME_MARKER* surface_frame_marker)
{
	rdpContext* context;
	rdpSettings* settings;

	context = (rdpContext*) wfc;
	settings = wfc->instance->settings;

	if (surface_frame_marker->frameAction == SURFACECMD_FRAMEACTION_END && settings->FrameAcknowledge > 0)
	{
		IFCALL(context->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId);
	}
}
Beispiel #19
0
void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
    rdpBitmap* bitmap;
    rdpCache* cache = context->cache;

    if (mem3blt->cacheId == 0xFF)
        bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex);
    else
        bitmap = bitmap_cache_get(cache->bitmap, (uint8) mem3blt->cacheId, mem3blt->cacheIndex);

    mem3blt->bitmap = bitmap;
    IFCALL(cache->bitmap->Mem3Blt, context, mem3blt);
}
Beispiel #20
0
void freerdp_channel_process(freerdp* instance, STREAM* s, uint16 channel_id)
{
	uint32 length;
	uint32 flags;
	int chunk_length;

	stream_read_uint32(s, length);
	stream_read_uint32(s, flags);
	chunk_length = stream_get_left(s);

	IFCALL(instance->ReceiveChannelData, instance,
		channel_id, stream_get_tail(s), chunk_length, flags, length);
}
Beispiel #21
0
void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, uint16 channel_id)
{
	uint32 length;
	uint32 flags;
	int chunk_length;

	stream_read_uint32(s, length);
	stream_read_uint32(s, flags);
	chunk_length = stream_get_left(s);

	IFCALL(client->ReceiveChannelData, client,
		channel_id, stream_get_tail(s), chunk_length, flags, length);
}
Beispiel #22
0
tbool rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s)
{
	uint8* mark;
	uint16 width;
	uint16 height;
	uint16 channelId;

	width = rdp->settings->width;
	height = rdp->settings->height;

	stream_get_mark(s, mark);

	if (!rdp_recv_demand_active(rdp, s))
	{
		stream_set_mark(s, mark);
		rdp_recv_get_active_header(rdp, s, &channelId);
		/* Was stream_seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
		 * but the headers aren't always that length,
		 * so that could result in a bad offset.
		 */

		if (rdp_recv_out_of_sequence_pdu(rdp, s) == false)
			return false;

		return true;
	}

	if (rdp->disconnect)
		return true;

	if (!rdp_send_confirm_active(rdp))
		return false;

	input_register_client_callbacks(rdp->input);

	/**
	 * The server may request a different desktop size during Deactivation-Reactivation sequence.
	 * In this case, the UI should be informed and do actual window resizing at this point.
	 */
	if (width != rdp->settings->width || height != rdp->settings->height)
	{
		IFCALL(rdp->update->DesktopResize, rdp->update->context);
	}

	rdp->state = CONNECTION_STATE_FINALIZATION;
	update_reset_state(rdp->update);

	rdp_client_connect_finalize(rdp);

	return true;
}
Beispiel #23
0
void update_recv_pointer(rdpUpdate* update, STREAM* s)
{
	uint16 messageType;

	stream_read_uint16(s, messageType); /* messageType (2 bytes) */
	stream_seek_uint16(s); /* pad2Octets (2 bytes) */

	switch (messageType)
	{
		case PTR_MSG_TYPE_POSITION:
			update_read_pointer_position(s, &update->pointer_position);
			IFCALL(update->PointerPosition, update, &update->pointer_position);
			break;

		case PTR_MSG_TYPE_SYSTEM:
			update_read_pointer_system(s, &update->pointer_system);
			IFCALL(update->PointerSystem, update, &update->pointer_system);
			break;

		case PTR_MSG_TYPE_COLOR:
			update_read_pointer_color(s, &update->pointer_color);
			IFCALL(update->PointerColor, update, &update->pointer_color);
			break;

		case PTR_MSG_TYPE_POINTER:
			update_read_pointer_new(s, &update->pointer_new);
			IFCALL(update->PointerNew, update, &update->pointer_new);
			break;

		case PTR_MSG_TYPE_CACHED:
			update_read_pointer_cached(s, &update->pointer_cached);
			IFCALL(update->PointerCached, update, &update->pointer_cached);
			break;

		default:
			break;
	}
}
Beispiel #24
0
static void* svc_plugin_thread_func(void* arg)
{
	wStream* data;
	wMessage* event;
	wMessage message;
	rdpSvcPlugin* plugin = (rdpSvcPlugin*) arg;

	DEBUG_SVC("in");

	IFCALL(plugin->connect_callback, plugin);

	while (1)
	{
		if (!MessageQueue_Wait(plugin->MsgPipe->In))
			break;

		if (MessageQueue_Peek(plugin->MsgPipe->In, &message, TRUE))
		{
			if (message.id == WMQ_QUIT)
				break;

			if (message.id == 0)
			{
				data = (wStream*) message.wParam;
				IFCALL(plugin->receive_callback, plugin, data);
			}
			else if (message.id == 1)
			{
				event = (wMessage*) message.wParam;
				IFCALL(plugin->event_callback, plugin, event);
			}
		}
	}

	DEBUG_SVC("out");

	return 0;
}
Beispiel #25
0
BOOL rail_recv_langbar_info_order(railPlugin* rail, RAIL_LANGBAR_INFO_ORDER* langBarInfo, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_langbar_info_order(s, langBarInfo))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ServerLanguageBarInfo, context, langBarInfo);
	}

	return TRUE;
}
Beispiel #26
0
BOOL rail_recv_server_get_appid_resp_order(railPlugin* rail, RAIL_GET_APPID_RESP_ORDER* getAppIdResp, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_server_get_appid_resp_order(s, getAppIdResp))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ServerGetAppIdResponse, context, getAppIdResp);
	}

	return TRUE;
}
Beispiel #27
0
BOOL rail_recv_server_localmovesize_order(railPlugin* rail, RAIL_LOCALMOVESIZE_ORDER* localMoveSize, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_server_localmovesize_order(s, localMoveSize))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ServerLocalMoveSize, context, localMoveSize);
	}

	return TRUE;
}
Beispiel #28
0
BOOL rail_recv_server_minmaxinfo_order(railPlugin* rail, RAIL_MINMAXINFO_ORDER* minMaxInfo, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_server_minmaxinfo_order(s, minMaxInfo))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ServerMinMaxInfo, context, minMaxInfo);
	}

	return TRUE;
}
Beispiel #29
0
BOOL rail_recv_server_sysparam_order(railPlugin* rail, RAIL_SYSPARAM_ORDER* sysparam, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_server_sysparam_order(s, sysparam))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ServerSystemParam, context, sysparam);
	}

	return TRUE;
}
Beispiel #30
0
BOOL rail_recv_handshake_ex_order(railPlugin* rail, RAIL_HANDSHAKE_EX_ORDER* handshakeEx, wStream* s)
{
	RailClientContext* context = rail_get_client_interface(rail);

	if (!rail_read_handshake_ex_order(s, handshakeEx))
		return FALSE;

	if (context->custom)
	{
		IFCALL(context->ClientHandshakeEx, context, handshakeEx);
	}

	return TRUE;
}