Merge pull request #2544 from bmiklautz/boolenization

change return types of callbacks to BOOL
This commit is contained in:
Hardening 2015-04-22 11:01:27 +02:00
commit 6cd7713e12
68 changed files with 1910 additions and 901 deletions

View File

@ -66,7 +66,7 @@ endif()
set(WITH_LIBRARY_VERSIONING "ON")
set(FREERDP_VERSION_MAJOR "1")
set(FREERDP_VERSION_MINOR "2")
set(FREERDP_VERSION_REVISION "1")
set(FREERDP_VERSION_REVISION "2")
set(FREERDP_VERSION_SUFFIX "dev")
set(FREERDP_API_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}")
set(FREERDP_VERSION "${FREERDP_API_VERSION}.${FREERDP_VERSION_REVISION}")

View File

@ -102,14 +102,15 @@ void android_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisco
}
}
void android_begin_paint(rdpContext* context)
BOOL android_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void android_end_paint(rdpContext* context)
BOOL android_end_paint(rdpContext* context)
{
int i;
int ninvalid;
@ -126,7 +127,7 @@ void android_end_paint(rdpContext* context)
if (ninvalid == 0)
{
DEBUG_ANDROID("ui_update: ninvalid=%d", ninvalid);
return;
return TRUE;
}
cinvalid = ctx->rdpCtx.gdi->primary->hdc->hwnd->cinvalid;
@ -149,9 +150,10 @@ void android_end_paint(rdpContext* context)
freerdp_callback("OnGraphicsUpdate", "(IIIII)V", context->instance,
x1, y1, x2 - x1, y2 - y1);
return TRUE;
}
void android_desktop_resize(rdpContext* context)
BOOL android_desktop_resize(rdpContext* context)
{
DEBUG_ANDROID("ui_desktop_resize");
@ -162,6 +164,7 @@ void android_desktop_resize(rdpContext* context)
freerdp_callback("OnGraphicsResize", "(IIII)V",
context->instance, context->settings->DesktopWidth,
context->settings->DesktopHeight, context->settings->ColorDepth);
return TRUE;
}
BOOL android_pre_connect(freerdp* instance)

View File

@ -46,15 +46,15 @@
#define TAG CLIENT_TAG("mac")
void mf_Pointer_New(rdpContext* context, rdpPointer* pointer);
BOOL mf_Pointer_New(rdpContext* context, rdpPointer* pointer);
void mf_Pointer_Free(rdpContext* context, rdpPointer* pointer);
void mf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
void mf_Pointer_SetNull(rdpContext* context);
void mf_Pointer_SetDefault(rdpContext* context);
BOOL mf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
BOOL mf_Pointer_SetNull(rdpContext* context);
BOOL mf_Pointer_SetDefault(rdpContext* context);
void mac_begin_paint(rdpContext* context);
void mac_end_paint(rdpContext* context);
void mac_desktop_resize(rdpContext* context);
BOOL mac_begin_paint(rdpContext* context);
BOOL mac_end_paint(rdpContext* context);
BOOL mac_desktop_resize(rdpContext* context);
static void update_activity_cb(freerdp* instance);
static void input_activity_cb(freerdp* instance);
@ -1000,7 +1000,7 @@ BOOL mac_authenticate(freerdp* instance, char** username, char** password, char*
return ok;
}
void mf_Pointer_New(rdpContext* context, rdpPointer* pointer)
BOOL mf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
NSRect rect;
NSImage* image;
@ -1019,6 +1019,8 @@ void mf_Pointer_New(rdpContext* context, rdpPointer* pointer)
rect.origin.y = pointer->yPos;
cursor_data = (BYTE*) malloc(rect.size.width * rect.size.height * 4);
if (!cursor_data)
return FALSE;
mrdpCursor->cursor_data = cursor_data;
freerdp_image_copy_from_pointer_data(cursor_data, PIXEL_FORMAT_ARGB32,
@ -1056,6 +1058,7 @@ void mf_Pointer_New(rdpContext* context, rdpPointer* pointer)
/* save cursor for later use in mf_Pointer_Set() */
ma = view->cursors;
[ma addObject:mrdpCursor];
return TRUE;
}
void mf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
@ -1078,7 +1081,7 @@ void mf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
}
}
void mf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
BOOL mf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
{
mfContext* mfc = (mfContext*) context;
MRDPView* view = (MRDPView*) mfc->view;
@ -1090,23 +1093,25 @@ void mf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
if (cursor->pointer == pointer)
{
[view setCursor:cursor->nsCursor];
return;
return TRUE;
}
}
NSLog(@"Cursor not found");
return TRUE;
}
void mf_Pointer_SetNull(rdpContext* context)
BOOL mf_Pointer_SetNull(rdpContext* context)
{
return TRUE;
}
void mf_Pointer_SetDefault(rdpContext* context)
BOOL mf_Pointer_SetDefault(rdpContext* context)
{
mfContext* mfc = (mfContext*) context;
MRDPView* view = (MRDPView*) mfc->view;
[view setCursor:[NSCursor arrowCursor]];
return TRUE;
}
CGContextRef mac_create_bitmap_context(rdpContext* context)
@ -1134,17 +1139,18 @@ CGContextRef mac_create_bitmap_context(rdpContext* context)
return bitmap_context;
}
void mac_begin_paint(rdpContext* context)
BOOL mac_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
if (!gdi)
return;
return FALSE;
gdi->primary->hdc->hwnd->invalid->null = 1;
return TRUE;
}
void mac_end_paint(rdpContext* context)
BOOL mac_end_paint(rdpContext* context)
{
rdpGdi* gdi;
HGDI_RGN invalid;
@ -1156,7 +1162,7 @@ void mac_end_paint(rdpContext* context)
gdi = context->gdi;
if (!gdi)
return;
return FALSE;
ww = mfc->client_width;
wh = mfc->client_height;
@ -1164,10 +1170,10 @@ void mac_end_paint(rdpContext* context)
dh = mfc->context.settings->DesktopHeight;
if ((!context) || (!context->gdi))
return;
return FALSE;
if (context->gdi->primary->hdc->hwnd->invalid->null)
return;
return TRUE;
invalid = gdi->primary->hdc->hwnd->invalid;
@ -1196,9 +1202,10 @@ void mac_end_paint(rdpContext* context)
[view setNeedsDisplayInRect:newDrawRect];
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void mac_desktop_resize(rdpContext* context)
BOOL mac_desktop_resize(rdpContext* context)
{
mfContext* mfc = (mfContext*) context;
MRDPView* view = (MRDPView*) mfc->view;
@ -1220,6 +1227,9 @@ void mac_desktop_resize(rdpContext* context)
gdi_resize(context->gdi, mfc->width, mfc->height);
view->bitmap_context = mac_create_bitmap_context(context);
if (!view->bitmap_context)
return FALSE;
return TRUE;
}
static void update_activity_cb(freerdp* instance)

View File

@ -30,9 +30,10 @@
* Client Interface
*/
void mfreerdp_client_global_init()
BOOL mfreerdp_client_global_init()
{
freerdp_handle_signals();
return TRUE;
}
void mfreerdp_client_global_uninit()

View File

@ -60,18 +60,20 @@ static void tf_context_free(freerdp* instance, rdpContext* context)
}
}
static void tf_begin_paint(rdpContext* context)
static BOOL tf_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
return TRUE;
}
static void tf_end_paint(rdpContext* context)
static BOOL tf_end_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
if (gdi->primary->hdc->hwnd->invalid->null)
return;
return TRUE;
return TRUE;
}
static BOOL tf_pre_connect(freerdp* instance)

View File

@ -81,9 +81,11 @@ wlfDisplay* wlf_CreateDisplay(void)
return display;
}
void wlf_RefreshDisplay(wlfDisplay* display)
BOOL wlf_RefreshDisplay(wlfDisplay* display)
{
wl_display_dispatch(display->display);
if (wl_display_dispatch(display->display) == -1)
return FALSE;
return TRUE;
}
void wlf_DestroyDisplay(wlfContext* wlfc, wlfDisplay* display)

View File

@ -37,7 +37,7 @@ struct wlf_display
};
wlfDisplay* wlf_CreateDisplay(void);
void wlf_RefreshDisplay(wlfDisplay* display);
BOOL wlf_RefreshDisplay(wlfDisplay* display);
void wlf_DestroyDisplay(wlfContext* wlfc, wlfDisplay* display);
#endif /* __WLF_DISPLAY_H */

View File

@ -38,15 +38,16 @@ void wl_context_free(freerdp* instance, rdpContext* context)
}
void wl_begin_paint(rdpContext* context)
BOOL wl_begin_paint(rdpContext* context)
{
rdpGdi* gdi;
gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
return TRUE;
}
void wl_end_paint(rdpContext* context)
BOOL wl_end_paint(rdpContext* context)
{
rdpGdi* gdi;
wlfDisplay* display;
@ -58,7 +59,7 @@ void wl_end_paint(rdpContext* context)
gdi = context->gdi;
if (gdi->primary->hdc->hwnd->invalid->null)
return;
return TRUE;
x = gdi->primary->hdc->hwnd->invalid->x;
y = gdi->primary->hdc->hwnd->invalid->y;
@ -74,7 +75,7 @@ void wl_end_paint(rdpContext* context)
gdi->primary_buffer + ((i+y)*(gdi->width*4)) + x*4,
w*4);
wlf_RefreshDisplay(display);
return wlf_RefreshDisplay(display);
}
BOOL wl_pre_connect(freerdp* instance)

View File

@ -69,14 +69,15 @@ int wf_create_console(void)
return 0;
}
void wf_sw_begin_paint(wfContext* wfc)
BOOL wf_sw_begin_paint(wfContext* wfc)
{
rdpGdi* gdi = ((rdpContext*) wfc)->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void wf_sw_end_paint(wfContext* wfc)
BOOL wf_sw_end_paint(wfContext* wfc)
{
int i;
rdpGdi* gdi;
@ -94,7 +95,7 @@ void wf_sw_end_paint(wfContext* wfc)
cinvalid = gdi->primary->hdc->hwnd->cinvalid;
if (ninvalid < 1)
return;
return TRUE;
region16_init(&invalidRegion);
@ -124,9 +125,10 @@ void wf_sw_end_paint(wfContext* wfc)
}
region16_uninit(&invalidRegion);
return TRUE;
}
void wf_sw_desktop_resize(wfContext* wfc)
BOOL wf_sw_desktop_resize(wfContext* wfc)
{
rdpGdi* gdi;
rdpContext* context;
@ -149,20 +151,22 @@ void wf_sw_desktop_resize(wfContext* wfc)
gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, wfc->primary->pdata);
gdi = instance->context->gdi;
wfc->hdc = gdi->primary->hdc;
return TRUE;
}
void wf_hw_begin_paint(wfContext* wfc)
BOOL wf_hw_begin_paint(wfContext* wfc)
{
wfc->hdc->hwnd->invalid->null = 1;
wfc->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void wf_hw_end_paint(wfContext* wfc)
BOOL wf_hw_end_paint(wfContext* wfc)
{
return TRUE;
}
void wf_hw_desktop_resize(wfContext* wfc)
BOOL wf_hw_desktop_resize(wfContext* wfc)
{
BOOL same;
RECT rect;
@ -196,6 +200,7 @@ void wf_hw_desktop_resize(wfContext* wfc)
GetWindowRect(wfc->hwnd, &rect);
InvalidateRect(wfc->hwnd, &rect, TRUE);
}
return TRUE;
}
BOOL wf_pre_connect(freerdp* instance)
@ -980,7 +985,7 @@ void wf_size_scrollbars(wfContext* wfc, UINT32 client_width, UINT32 client_heigh
wf_update_canvas_diff(wfc);
}
void wfreerdp_client_global_init(void)
BOOL wfreerdp_client_global_init(void)
{
WSADATA wsaData;
@ -999,6 +1004,7 @@ void wfreerdp_client_global_init(void)
#endif
freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0);
return TRUE;
}
void wfreerdp_client_global_uninit(void)

View File

@ -342,7 +342,7 @@ void wf_toggle_fullscreen(wfContext* wfc)
}
}
void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
BOOL wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
{
HDC hdc;
int status;
@ -366,6 +366,8 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
wfContext* wfc = (wfContext*) context;
hdc = CreateCompatibleDC(GetDC(NULL));
if (!hdc)
return FALSE;
for (index = 0; index < bitmapUpdate->number; index++)
{
@ -395,7 +397,7 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
wfc->bitmap_buffer = (BYTE*) _aligned_realloc(wfc->bitmap_buffer, wfc->bitmap_size, 16);
if (!wfc->bitmap_buffer)
return;
return FALSE;
}
if (compressed)
@ -420,7 +422,7 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
if (status < 0)
{
WLog_ERR(TAG, "bitmap decompression failure");
return;
return FALSE;
}
pSrcData = wfc->bitmap_buffer;
@ -440,6 +442,7 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
}
ReleaseDC(NULL, hdc);
return TRUE;
}
void wf_gdi_palette_update(wfContext* wfc, PALETTE_UPDATE* palette)

View File

@ -31,7 +31,7 @@ void wf_update_offset(wfContext* wfc);
void wf_resize_window(wfContext* wfc);
void wf_toggle_fullscreen(wfContext* wfc);
void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate);
BOOL wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate);
void wf_gdi_register_update_callbacks(rdpUpdate* update);
void wf_update_canvas_diff(wfContext* wfc);

View File

@ -420,7 +420,7 @@ LRESULT CALLBACK wf_RailWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
WS_OVERLAPPED | WS_VSCROLL | WS_HSCROLL | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
#define RAIL_DISABLED_EXTENDED_WINDOW_STYLES (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE)
static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
static BOOL wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
{
wfRailWindow* railWindow = NULL;
wfContext* wfc = (wfContext*) context;
@ -438,7 +438,7 @@ static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
railWindow = (wfRailWindow*) calloc(1, sizeof(wfRailWindow));
if (!railWindow)
return;
return FALSE;
railWindow->wfc = wfc;
@ -509,7 +509,7 @@ static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
UpdateWindow(railWindow->hWnd);
return;
return TRUE;
}
else
{
@ -518,7 +518,7 @@ static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
}
if (!railWindow)
return;
return TRUE;
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
(fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
@ -643,9 +643,10 @@ static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
}
UpdateWindow(railWindow->hWnd);
return TRUE;
}
static void wf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL wf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
wfRailWindow* railWindow = NULL;
wfContext* wfc = (wfContext*) context;
@ -657,16 +658,17 @@ static void wf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderI
(void*) (UINT_PTR) orderInfo->windowId);
if (!railWindow)
return;
return TRUE;
HashTable_Remove(wfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId);
DestroyWindow(railWindow->hWnd);
free(railWindow);
return TRUE;
}
static void wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
static BOOL wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
{
HDC hDC;
int bpp;
@ -689,7 +691,7 @@ static void wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInf
(void*) (UINT_PTR) orderInfo->windowId);
if (!railWindow)
return;
return TRUE;
bigIcon = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE;
@ -747,11 +749,13 @@ static void wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInf
{
/* icon should be cached */
}
return TRUE;
}
static void wf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
static BOOL wf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
{
WLog_DBG(TAG, "RailWindowCachedIcon");
return TRUE;
}
static void wf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
@ -789,7 +793,7 @@ static void wf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* o
}
}
static void wf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
static BOOL wf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail;
@ -797,9 +801,10 @@ static void wf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* o
WLog_DBG(TAG, "RailNotifyIconCreate");
wf_rail_notify_icon_common(context, orderInfo, notifyIconState);
return TRUE;
}
static void wf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
static BOOL wf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail;
@ -807,30 +812,34 @@ static void wf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* o
WLog_DBG(TAG, "RailNotifyIconUpdate");
wf_rail_notify_icon_common(context, orderInfo, notifyIconState);
return TRUE;
}
static void wf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL wf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail;
WLog_DBG(TAG, "RailNotifyIconDelete");
return TRUE;
}
static void wf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
static BOOL wf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
{
wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail;
WLog_DBG(TAG, "RailMonitorDesktop");
return TRUE;
}
static void wf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL wf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail;
WLog_DBG(TAG, "RailNonMonitorDesktop");
return TRUE;
}
void wf_rail_register_update_callbacks(rdpUpdate* update)

View File

@ -267,14 +267,15 @@ static void xf_desktop_resize(rdpContext* context)
}
}
void xf_sw_begin_paint(rdpContext* context)
BOOL xf_sw_begin_paint(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void xf_sw_end_paint(rdpContext* context)
BOOL xf_sw_end_paint(rdpContext* context)
{
int i;
INT32 x, y;
@ -297,7 +298,7 @@ void xf_sw_end_paint(rdpContext* context)
if (!xfc->complex_regions)
{
if (gdi->primary->hdc->hwnd->invalid->null)
return;
return TRUE;
xf_lock_x11(xfc, FALSE);
@ -310,7 +311,7 @@ void xf_sw_end_paint(rdpContext* context)
else
{
if (gdi->primary->hdc->hwnd->ninvalid < 1)
return;
return TRUE;
xf_lock_x11(xfc, FALSE);
@ -334,7 +335,7 @@ void xf_sw_end_paint(rdpContext* context)
else
{
if (gdi->primary->hdc->hwnd->invalid->null)
return;
return TRUE;
xf_lock_x11(xfc, FALSE);
@ -342,9 +343,10 @@ void xf_sw_end_paint(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
}
return TRUE;
}
void xf_sw_desktop_resize(rdpContext* context)
BOOL xf_sw_desktop_resize(rdpContext* context)
{
rdpGdi* gdi = context->gdi;
xfContext* xfc = (xfContext*) context;
@ -368,16 +370,18 @@ void xf_sw_desktop_resize(rdpContext* context)
xf_desktop_resize(context);
xf_unlock_x11(xfc, TRUE);
return TRUE;
}
void xf_hw_begin_paint(rdpContext* context)
BOOL xf_hw_begin_paint(rdpContext* context)
{
xfContext* xfc = (xfContext*) context;
xfc->hdc->hwnd->invalid->null = 1;
xfc->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void xf_hw_end_paint(rdpContext* context)
BOOL xf_hw_end_paint(rdpContext* context)
{
INT32 x, y;
UINT32 w, h;
@ -388,7 +392,7 @@ void xf_hw_end_paint(rdpContext* context)
if (!xfc->complex_regions)
{
if (xfc->hdc->hwnd->invalid->null)
return;
return TRUE;
x = xfc->hdc->hwnd->invalid->x;
y = xfc->hdc->hwnd->invalid->y;
@ -408,7 +412,7 @@ void xf_hw_end_paint(rdpContext* context)
HGDI_RGN cinvalid;
if (xfc->hdc->hwnd->ninvalid < 1)
return;
return TRUE;
ninvalid = xfc->hdc->hwnd->ninvalid;
cinvalid = xfc->hdc->hwnd->cinvalid;
@ -433,7 +437,7 @@ void xf_hw_end_paint(rdpContext* context)
else
{
if (xfc->hdc->hwnd->invalid->null)
return;
return TRUE;
x = xfc->hdc->hwnd->invalid->x;
y = xfc->hdc->hwnd->invalid->y;
@ -446,9 +450,10 @@ void xf_hw_end_paint(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
}
return TRUE;
}
void xf_hw_desktop_resize(rdpContext* context)
BOOL xf_hw_desktop_resize(rdpContext* context)
{
xfContext* xfc = (xfContext*) context;
rdpSettings* settings = xfc->settings;
@ -461,6 +466,7 @@ void xf_hw_desktop_resize(rdpContext* context)
xf_desktop_resize(context);
xf_unlock_x11(xfc, TRUE);
return TRUE;
}
BOOL xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount)
@ -879,10 +885,11 @@ int _xf_error_handler(Display* d, XErrorEvent* ev)
return xf_error_handler(d, ev);
}
static void xf_play_sound(rdpContext* context, PLAY_SOUND_UPDATE* play_sound)
static BOOL xf_play_sound(rdpContext* context, PLAY_SOUND_UPDATE* play_sound)
{
xfContext* xfc = (xfContext*) context;
XkbBell(xfc->display, None, 100, 0);
return TRUE;
}
void xf_check_extensions(xfContext* context)
@ -1590,10 +1597,12 @@ static void xf_PanningChangeEventHandler(rdpContext* context, PanningChangeEvent
* Client Interface
*/
static void xfreerdp_client_global_init()
static BOOL xfreerdp_client_global_init()
{
setlocale(LC_ALL, "");
freerdp_handle_signals();
if (freerdp_handle_signals() != 0)
return FALSE;
return TRUE;
}
static void xfreerdp_client_global_uninit()

View File

@ -325,7 +325,7 @@ Pixmap xf_mono_bitmap_new(xfContext* xfc, int width, int height, BYTE* data)
return bitmap;
}
void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
BOOL xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
{
int status;
int nXDst;
@ -346,6 +346,7 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
BITMAP_DATA* bitmap;
rdpCodecs* codecs = context->codecs;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
for (index = 0; index < bitmapUpdate->number; index++)
{
@ -375,7 +376,7 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
if (!xfc->bitmap_buffer)
return;
return FALSE;
}
if (compressed)
@ -400,7 +401,7 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
if (status < 0)
{
WLog_ERR(TAG, "bitmap decompression failure");
return;
return FALSE;
}
pSrcData = xfc->bitmap_buffer;
@ -421,6 +422,11 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) pSrcData, nWidth, nHeight, xfc->scanline_pad, 0);
if (!image)
{
xf_unlock_x11(xfc, FALSE);
return FALSE;
}
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
@ -430,13 +436,17 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
XFree(image);
gdi_InvalidateRegion(xfc->hdc, nXDst, nYDst, nWidth, nHeight);
ret = gdi_InvalidateRegion(xfc->hdc, nXDst, nYDst, nWidth, nHeight);
xf_unlock_x11(xfc, FALSE);
if (!ret)
break;
}
return ret;
}
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
static BOOL xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
int index;
PALETTE_ENTRY* pe;
@ -454,9 +464,10 @@ void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
}
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
static BOOL xf_gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
{
XRectangle clip;
xfContext* xfc = (xfContext*) context;
@ -477,11 +488,13 @@ void xf_gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
}
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
static BOOL xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
{
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -493,22 +506,22 @@ void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
dstblt->nWidth, dstblt->nHeight);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight);
}
ret = gdi_InvalidateRegion(xfc->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight);
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
Pixmap pattern;
rdpBrush* brush;
UINT32 foreColor;
UINT32 backColor;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -580,18 +593,18 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
}
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
}
ret = gdi_InvalidateRegion(xfc->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
static BOOL xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
{
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -601,19 +614,19 @@ void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight);
}
ret = gdi_InvalidateRegion(xfc->hdc, scrblt->nLeftRect, scrblt->nTopRect, scrblt->nWidth, scrblt->nHeight);
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
BOOL xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
{
UINT32 color;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -628,20 +641,20 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
opaque_rect->nWidth, opaque_rect->nHeight);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect,
ret = gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight);
}
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
BOOL xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
{
int i;
UINT32 color;
DELTA_RECT* rectangle;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -661,11 +674,13 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height);
if (!(ret = gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height)))
break;
}
}
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid)
@ -673,10 +688,11 @@ void xf_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_
WLog_ERR(TAG, "DrawNineGrid");
}
void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
BOOL xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
{
UINT32 color;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -699,15 +715,16 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
w = abs(line_to->nXEnd - line_to->nXStart) + 1;
h = abs(line_to->nYEnd - line_to->nYStart) + 1;
gdi_InvalidateRegion(xfc->hdc, x, y, w, h);
ret = gdi_InvalidateRegion(xfc->hdc, x, y, w, h);
}
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
static void xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int npoints, BOOL autoclose)
static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int npoints, BOOL autoclose)
{
int i, x, y, x1, y1, x2, y2, w, h;
@ -742,17 +759,20 @@ static void xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int np
x1 = x2;
y1 = y2;
gdi_InvalidateRegion(xfc->hdc, x, y, w, h);
if (!gdi_InvalidateRegion(xfc->hdc, x, y, w, h))
return FALSE;
}
return TRUE;
}
void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
BOOL xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
{
int i;
int npoints;
UINT32 color;
XPoint* points;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -764,6 +784,11 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
npoints = polyline->numDeltaEntries + 1;
points = malloc(sizeof(XPoint) * npoints);
if (!points)
{
xf_unlock_x11(xfc, FALSE);
return FALSE;
}
points[0].x = polyline->xStart;
points[0].y = polyline->yStart;
@ -778,19 +803,22 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
if (xfc->drawing == xfc->primary)
{
xf_gdi_invalidate_poly_region(xfc, points, npoints, FALSE);
if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, FALSE))
ret = FALSE;
}
XSetFunction(xfc->display, xfc->gc, GXcopy);
free(points);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
BOOL xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
xfBitmap* bitmap;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -802,16 +830,15 @@ void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
memblt->nLeftRect, memblt->nTopRect);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
}
ret = gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
BOOL xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
rdpBrush* brush;
xfBitmap* bitmap;
@ -819,6 +846,7 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
UINT32 backColor;
Pixmap pattern = 0;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -867,9 +895,7 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
mem3blt->nLeftRect, mem3blt->nTopRect);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, mem3blt->nLeftRect, mem3blt->nTopRect, mem3blt->nWidth, mem3blt->nHeight);
}
ret = gdi_InvalidateRegion(xfc->hdc, mem3blt->nLeftRect, mem3blt->nTopRect, mem3blt->nWidth, mem3blt->nHeight);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetTSOrigin(xfc->display, xfc->gc, 0, 0);
@ -880,14 +906,16 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
XSetFunction(xfc->display, xfc->gc, GXcopy);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
BOOL xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
int i, npoints;
XPoint* points;
UINT32 brush_color;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -896,6 +924,11 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
npoints = polygon_sc->numPoints + 1;
points = malloc(sizeof(XPoint) * npoints);
if (!points)
{
xf_unlock_x11(xfc, FALSE);
return FALSE;
}
points[0].x = polygon_sc->xStart;
points[0].y = polygon_sc->yStart;
@ -929,16 +962,18 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
if (xfc->drawing == xfc->primary)
{
xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE);
if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE))
ret = FALSE;
}
XSetFunction(xfc->display, xfc->gc, GXcopy);
free(points);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
BOOL xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
{
int i, npoints;
XPoint* points;
@ -947,6 +982,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
UINT32 foreColor;
UINT32 backColor;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -957,6 +993,11 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
npoints = polygon_cb->numPoints + 1;
points = malloc(sizeof(XPoint) * npoints);
if (!points)
{
xf_unlock_x11(xfc, FALSE);
return FALSE;
}
points[0].x = polygon_cb->xStart;
points[0].y = polygon_cb->yStart;
@ -1017,7 +1058,8 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
if (xfc->drawing == xfc->primary)
{
xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE);
if (!xf_gdi_invalidate_poly_region(xfc, points, npoints, TRUE))
ret = FALSE;
}
}
else
@ -1029,29 +1071,35 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
free(points);
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc)
BOOL xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc)
{
WLog_ERR(TAG, "EllipseSC");
WLog_ERR(TAG, "Not implemented: EllipseSC");
return TRUE;
}
void xf_gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb)
BOOL xf_gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb)
{
WLog_ERR(TAG, "EllipseCB");
WLog_ERR(TAG, "Not implemented: EllipseCB");
return TRUE;
}
void xf_gdi_frame_marker(rdpContext* context, FRAME_MARKER_ORDER* frameMarker)
BOOL xf_gdi_frame_marker(rdpContext* context, FRAME_MARKER_ORDER* frameMarker)
{
return TRUE;
}
void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
BOOL xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
{
rdpSettings* settings;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
settings = xfc->instance->settings;
xf_lock_x11(xfc, FALSE);
switch (surface_frame_marker->frameAction)
@ -1067,10 +1115,8 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf
case SURFACECMD_FRAMEACTION_END:
xfc->frame_begin = FALSE;
if ((xfc->frame_x2 > xfc->frame_x1) && (xfc->frame_y2 > xfc->frame_y1))
{
gdi_InvalidateRegion(xfc->hdc, xfc->frame_x1, xfc->frame_y1,
ret = gdi_InvalidateRegion(xfc->hdc, xfc->frame_x1, xfc->frame_y1,
xfc->frame_x2 - xfc->frame_x1, xfc->frame_y2 - xfc->frame_y1);
}
if (settings->FrameAcknowledge > 0)
{
IFCALL(xfc->instance->update->SurfaceFrameAcknowledge, context, surface_frame_marker->frameId);
@ -1079,10 +1125,12 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf
}
xf_unlock_x11(xfc, FALSE);
return ret;
}
static void xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty, UINT16 width, UINT16 height)
static BOOL xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty, UINT16 width, UINT16 height)
{
BOOL ret = TRUE;
if (!xfc->remote_app)
{
if (xfc->frame_begin)
@ -1104,16 +1152,17 @@ static void xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty, UI
}
else
{
gdi_InvalidateRegion(xfc->hdc, tx, ty, width, height);
ret = gdi_InvalidateRegion(xfc->hdc, tx, ty, width, height);
}
}
else
{
gdi_InvalidateRegion(xfc->hdc, tx, ty, width, height);
ret = gdi_InvalidateRegion(xfc->hdc, tx, ty, width, height);
}
return ret;
}
void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
BOOL xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
{
int i, tx, ty;
XImage* image;
@ -1121,6 +1170,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
BYTE* pDstData;
RFX_MESSAGE* message;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
@ -1142,7 +1192,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
if (!xfc->bitmap_buffer)
return;
return FALSE;
}
/* Draw the tiles to primary surface, each is 64x64. */
@ -1175,7 +1225,11 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
tx = message->rects[i].x + cmd->destLeft;
ty = message->rects[i].y + cmd->destTop;
xf_gdi_surface_update_frame(xfc, tx, ty, message->rects[i].width, message->rects[i].height);
if (!xf_gdi_surface_update_frame(xfc, tx, ty, message->rects[i].width, message->rects[i].height))
{
ret = FALSE;
break;
}
}
XSetClipMask(xfc->display, xfc->gc, None);
@ -1196,7 +1250,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
if (!xfc->bitmap_buffer)
return;
return FALSE;
}
pSrcData = xfc->codecs->nsc->BitmapData;
@ -1213,7 +1267,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
XFree(image);
xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
XSetClipMask(xfc->display, xfc->gc, None);
}
@ -1228,7 +1282,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
xfc->bitmap_buffer = (BYTE*) _aligned_realloc(xfc->bitmap_buffer, xfc->bitmap_size, 16);
if (!xfc->bitmap_buffer)
return;
return FALSE;
}
pSrcData = cmd->bitmapData;
@ -1245,7 +1299,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
cmd->width, cmd->height);
XFree(image);
xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
XSetClipMask(xfc->display, xfc->gc, None);
}
@ -1255,6 +1309,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
}
xf_unlock_x11(xfc, FALSE);
return ret;
}
void xf_gdi_register_update_callbacks(rdpUpdate* update)

View File

@ -26,7 +26,7 @@
#include "xfreerdp.h"
void xf_gdi_register_update_callbacks(rdpUpdate* update);
void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate);
BOOL xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate);
UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color);
#endif /* __XF_GDI_H */

View File

@ -42,7 +42,7 @@
/* Bitmap Class */
void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
int depth;
BYTE* data;
@ -67,7 +67,7 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16);
if (!data)
return;
return FALSE;
SrcFormat = gdi_get_pixel_format(bitmap->bpp, TRUE);
@ -91,6 +91,7 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
((xfBitmap*) bitmap)->pixmap = pixmap;
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
@ -105,11 +106,12 @@ void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
xf_unlock_x11(xfc, FALSE);
}
void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
BOOL xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
XImage* image;
int width, height;
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
width = bitmap->right - bitmap->left + 1;
height = bitmap->bottom - bitmap->top + 1;
@ -126,12 +128,13 @@ void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
XFree(image);
gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BYTE* data, int width, int height, int bpp, int length,
BOOL compressed, int codecId)
{
@ -148,6 +151,8 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
size = width * height * 4;
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
if (!bitmap->data)
return FALSE;
pSrcData = data;
SrcSize = (UINT32) length;
@ -173,7 +178,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
if (status < 0)
{
WLog_ERR(TAG, "Bitmap Decompression Failed");
return;
return FALSE;
}
}
else
@ -187,9 +192,10 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
bitmap->compressed = FALSE;
bitmap->length = size;
bitmap->bpp = (xfc->depth >= 24) ? 32 : xfc->depth;
return TRUE;
}
void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
xfContext* xfc = (xfContext*) context;
@ -201,11 +207,12 @@ void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
xfc->drawing = ((xfBitmap*) bitmap)->pixmap;
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
/* Pointer Class */
void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
XcursorImage ci;
@ -224,7 +231,7 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
ci.pixels = (XcursorPixel*) calloc(1, ci.width * ci.height * 4);
if (!ci.pixels)
return;
return FALSE;
if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0))
{
@ -239,6 +246,7 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
xf_unlock_x11(xfc, FALSE);
#endif
return TRUE;
}
void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
@ -255,7 +263,7 @@ void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
#endif
}
void xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
BOOL xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
xfContext* xfc = (xfContext*) context;
@ -271,9 +279,10 @@ void xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
xf_unlock_x11(xfc, FALSE);
#endif
return TRUE;
}
void xf_Pointer_SetNull(rdpContext* context)
BOOL xf_Pointer_SetNull(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfContext* xfc = (xfContext*) context;
@ -301,9 +310,10 @@ void xf_Pointer_SetNull(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
#endif
return TRUE;
}
void xf_Pointer_SetDefault(rdpContext* context)
BOOL xf_Pointer_SetDefault(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfContext* xfc = (xfContext*) context;
@ -317,16 +327,18 @@ void xf_Pointer_SetDefault(rdpContext* context)
xf_unlock_x11(xfc, FALSE);
#endif
return TRUE;
}
void xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
{
xfContext* xfc = (xfContext*) context;
XWindowAttributes current;
XSetWindowAttributes tmp;
BOOL ret = FALSE;
if (!xfc->focused || !xfc->window)
return;
return TRUE;
xf_lock_x11(xfc, FALSE);
@ -342,15 +354,16 @@ void xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
tmp.event_mask = current.your_event_mask;
XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp);
ret = TRUE;
out:
xf_unlock_x11(xfc, FALSE);
return;
xf_unlock_x11(xfc, FALSE);
return ret;
}
/* Glyph Class */
void xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
BOOL xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
{
int scanline;
XImage* image;
@ -376,6 +389,7 @@ void xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
XFree(image);
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
@ -390,7 +404,7 @@ void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
xf_unlock_x11(xfc, FALSE);
}
void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
BOOL xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
{
xfGlyph* xf_glyph;
xfContext* xfc = (xfContext*) context;
@ -405,9 +419,10 @@ void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
XSetStipple(xfc->display, xfc->gc, xfc->bitmap_mono);
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
BOOL xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
{
xfContext* xfc = (xfContext*) context;
@ -431,20 +446,21 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
XSetFillStyle(xfc->display, xfc->gc, fOpRedundant ? FillOpaqueStippled : FillStippled);
xf_unlock_x11(xfc, FALSE);
return TRUE;
}
void xf_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
BOOL xf_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
xfContext* xfc = (xfContext*) context;
BOOL ret = TRUE;
xf_lock_x11(xfc, FALSE);
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfc->hdc, x, y, width, height);
}
ret = gdi_InvalidateRegion(xfc->hdc, x, y, width, height);
xf_unlock_x11(xfc, FALSE);
return ret;
}
/* Graphics Module */

View File

@ -550,11 +550,10 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym)
}
#endif /* WITH_XRENDER defined */
#endif /* pinch/zoom/pan simulation */
return FALSE;
}
void xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags)
BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags)
{
xfContext* xfc = (xfContext*) context;
@ -562,4 +561,5 @@ void xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags)
xf_keyboard_set_key_state(xfc, led_flags & KBD_SYNC_NUM_LOCK, XK_Num_Lock);
xf_keyboard_set_key_state(xfc, led_flags & KBD_SYNC_CAPS_LOCK, XK_Caps_Lock);
xf_keyboard_set_key_state(xfc, led_flags & KBD_SYNC_KANA_LOCK, XK_Kana_Lock);
return TRUE;
}

View File

@ -57,6 +57,6 @@ BOOL xf_keyboard_get_key_state(xfContext* xfc, int state, int keysym);
UINT32 xf_keyboard_get_toggle_keys_state(xfContext* xfc);
void xf_keyboard_focus_in(xfContext* xfc);
BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym);
void xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
BOOL xf_keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
#endif /* __XF_KEYBOARD_H */

View File

@ -272,7 +272,7 @@ void xf_rail_paint(xfContext* xfc, INT32 uleft, INT32 utop, UINT32 uright, UINT3
/* RemoteApp Core Protocol Extension */
static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
static BOOL xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
{
xfAppWindow* appWindow = NULL;
xfContext* xfc = (xfContext*) context;
@ -283,7 +283,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
appWindow = (xfAppWindow*) calloc(1, sizeof(xfAppWindow));
if (!appWindow)
return;
return FALSE;
appWindow->xfc = xfc;
@ -317,7 +317,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
xf_AppWindowInit(xfc, appWindow);
return;
return TRUE;
}
else
{
@ -326,7 +326,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
}
if (!appWindow)
return;
return FALSE;
/* Update Parameters */
@ -421,7 +421,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
appWindow->windowRects = (RECTANGLE_16*) calloc(appWindow->numWindowRects, sizeof(RECTANGLE_16));
if (!appWindow->windowRects)
return;
return FALSE;
CopyMemory(appWindow->windowRects, windowState->windowRects,
appWindow->numWindowRects * sizeof(RECTANGLE_16));
@ -449,7 +449,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
appWindow->visibilityRects = (RECTANGLE_16*) calloc(appWindow->numVisibilityRects, sizeof(RECTANGLE_16));
if (!appWindow->visibilityRects)
return;
return FALSE;
CopyMemory(appWindow->visibilityRects, windowState->visibilityRects,
appWindow->numVisibilityRects * sizeof(RECTANGLE_16));
@ -482,7 +482,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
* update our local window when that rail window state is minimized
*/
if (appWindow->rail_state == WINDOW_SHOW_MINIMIZED)
return;
return TRUE;
/* Do nothing if window is already in the correct position */
if (appWindow->x == (appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX) &&
@ -491,7 +491,7 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
appWindow->height == appWindow->windowHeight)
{
xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth, appWindow->windowHeight);
return;
return TRUE;
}
xf_MoveWindow(xfc, appWindow, appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX, appWindow->windowOffsetY - appWindow->localWindowOffsetCorrY,
@ -507,9 +507,10 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
{
xf_SetWindowVisibilityRects(xfc, appWindow, appWindow->visibilityRects, appWindow->numVisibilityRects);
}
return TRUE;
}
static void xf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL xf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
xfAppWindow* appWindow = NULL;
xfContext* xfc = (xfContext*) context;
@ -518,14 +519,15 @@ static void xf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderI
(void*) (UINT_PTR) orderInfo->windowId);
if (!appWindow)
return;
return TRUE;
HashTable_Remove(xfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId);
xf_DestroyWindow(xfc, appWindow);
return TRUE;
}
static void xf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
static BOOL xf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
{
BOOL bigIcon;
xfAppWindow* railWindow;
@ -535,17 +537,19 @@ static void xf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInf
(void*) (UINT_PTR) orderInfo->windowId);
if (!railWindow)
return;
return FALSE;
bigIcon = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE;
return TRUE;
}
static void xf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
static BOOL xf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
{
return TRUE;
}
static void xf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
static BOOL xf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
{
@ -576,32 +580,34 @@ static void xf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* o
{
}
return TRUE;
}
static void xf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
static BOOL xf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
return xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
}
static void xf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
static BOOL xf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
return xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
}
static void xf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL xf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
return TRUE;
}
static void xf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
static BOOL xf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
{
return TRUE;
}
static void xf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
static BOOL xf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
{
xfContext* xfc = (xfContext*) context;
xf_rail_disable_remoteapp_mode(xfc);
return TRUE;
}
void xf_rail_register_update_callbacks(rdpUpdate* update)

View File

@ -303,3 +303,8 @@ void ios_uninit_freerdp()
}
/* compatibilty functions */
size_t fwrite$UNIX2003( const void *ptr, size_t size, size_t nmemb, FILE *stream )
{
return fwrite(ptr, size , nmemb, stream);
}

View File

@ -9,9 +9,9 @@
#import "ios_freerdp.h"
void ios_ui_begin_paint(rdpContext * context);
void ios_ui_end_paint(rdpContext * context);
void ios_ui_resize_window(rdpContext * context);
BOOL ios_ui_begin_paint(rdpContext * context);
BOOL ios_ui_end_paint(rdpContext * context);
BOOL ios_ui_resize_window(rdpContext * context);
BOOL ios_ui_authenticate(freerdp * instance, char** username, char** password, char** domain);
BOOL ios_ui_check_certificate(freerdp * instance, char * subject, char * issuer, char * fingerprint);

View File

@ -94,13 +94,14 @@ BOOL ios_ui_check_changed_certificate(freerdp * instance, char * subject, char *
#pragma mark -
#pragma mark Graphics updates
void ios_ui_begin_paint(rdpContext * context)
BOOL ios_ui_begin_paint(rdpContext * context)
{
rdpGdi *gdi = context->gdi;
gdi->primary->hdc->hwnd->invalid->null = 1;
return TRUE;
}
void ios_ui_end_paint(rdpContext * context)
BOOL ios_ui_end_paint(rdpContext * context)
{
mfInfo* mfi = MFI_FROM_INSTANCE(context->instance);
rdpGdi *gdi = context->gdi;
@ -108,12 +109,14 @@ void ios_ui_end_paint(rdpContext * context)
if (gdi->primary->hdc->hwnd->invalid->null == 0)
[mfi->session performSelectorOnMainThread:@selector(setNeedsDisplayInRectAsValue:) withObject:[NSValue valueWithCGRect:dirty_rect] waitUntilDone:NO];
return TRUE;
}
void ios_ui_resize_window(rdpContext * context)
BOOL ios_ui_resize_window(rdpContext * context)
{
ios_resize_display_buffer(MFI_FROM_INSTANCE(context->instance));
return TRUE;
}

View File

@ -47,11 +47,10 @@ if (CMAKE_UNAME)
endif (CMAKE_UNAME)
# Force the compilers to gcc for iOS
if(NOT CMAKE_C_COMPILER)
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (gcc GNU)
CMAKE_FORCE_CXX_COMPILER (g++ GNU)
endif()
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (/usr/bin/clang Apple)
CMAKE_FORCE_CXX_COMPILER (/usr/bin/clang++ Apple)
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
# Skip the platform compiler checks for cross compiling
#set (CMAKE_CXX_COMPILER_WORKS TRUE)
@ -72,7 +71,7 @@ set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# Hidden visibilty is required for cxx on iOS
set (CMAKE_C_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_INIT "-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden")
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden -isysroot ${CMAKE_OSX_SYSROOT}")
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")

View File

@ -165,18 +165,18 @@ struct _DRAW_GDIPLUS_CACHE_END_ORDER
};
typedef struct _DRAW_GDIPLUS_CACHE_END_ORDER DRAW_GDIPLUS_CACHE_END_ORDER;
typedef void (*pCreateOffscreenBitmap)(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
typedef void (*pSwitchSurface)(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface);
typedef void (*pCreateNineGridBitmap)(rdpContext* context, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap);
typedef void (*pFrameMarker)(rdpContext* context, FRAME_MARKER_ORDER* frame_marker);
typedef void (*pStreamBitmapFirst)(rdpContext* context, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first);
typedef void (*pStreamBitmapNext)(rdpContext* context, STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next);
typedef void (*pDrawGdiPlusFirst)(rdpContext* context, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first);
typedef void (*pDrawGdiPlusNext)(rdpContext* context, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next);
typedef void (*pDrawGdiPlusEnd)(rdpContext* context, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end);
typedef void (*pDrawGdiPlusCacheFirst)(rdpContext* context, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first);
typedef void (*pDrawGdiPlusCacheNext)(rdpContext* context, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
typedef void (*pDrawGdiPlusCacheEnd)(rdpContext* context, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
typedef BOOL (*pCreateOffscreenBitmap)(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
typedef BOOL (*pSwitchSurface)(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface);
typedef BOOL (*pCreateNineGridBitmap)(rdpContext* context, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap);
typedef BOOL (*pFrameMarker)(rdpContext* context, FRAME_MARKER_ORDER* frame_marker);
typedef BOOL (*pStreamBitmapFirst)(rdpContext* context, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first);
typedef BOOL (*pStreamBitmapNext)(rdpContext* context, STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next);
typedef BOOL (*pDrawGdiPlusFirst)(rdpContext* context, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first);
typedef BOOL (*pDrawGdiPlusNext)(rdpContext* context, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next);
typedef BOOL (*pDrawGdiPlusEnd)(rdpContext* context, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end);
typedef BOOL (*pDrawGdiPlusCacheFirst)(rdpContext* context, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first);
typedef BOOL (*pDrawGdiPlusCacheNext)(rdpContext* context, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
typedef BOOL (*pDrawGdiPlusCacheEnd)(rdpContext* context, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
struct rdp_altsec_update
{

View File

@ -66,5 +66,6 @@
#define IFCALL(_cb, ...) do { if (_cb != NULL) { _cb( __VA_ARGS__ ); } } while (0)
#define IFCALLRET(_cb, _ret, ...) do { if (_cb != NULL) { _ret = _cb( __VA_ARGS__ ); } } while (0)
#define IFCALLRESULT(_default_return, _cb, ...) (_cb != NULL) ? _cb( __VA_ARGS__ ) : (_default_return)
#endif /* FREERDP_API */

View File

@ -31,7 +31,7 @@ extern "C" {
* Client Entry Points
*/
typedef void (*pRdpGlobalInit)(void);
typedef BOOL (*pRdpGlobalInit)(void);
typedef void (*pRdpGlobalUninit)(void);
typedef int (*pRdpClientNew)(freerdp* instance, rdpContext* context);

View File

@ -44,7 +44,7 @@ FREERDP_API int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int n
FREERDP_API int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2);
FREERDP_API int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src);
FREERDP_API int gdi_PtInRect(HGDI_RECT rc, int x, int y);
FREERDP_API int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h);
FREERDP_API BOOL gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h);
#ifdef __cplusplus
}

View File

@ -35,13 +35,13 @@ extern "C" {
/* Bitmap Class */
typedef void (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap);
typedef BOOL (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap);
typedef void (*pBitmap_Free)(rdpContext* context, rdpBitmap* bitmap);
typedef void (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap);
typedef void (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap,
typedef BOOL (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap);
typedef BOOL (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap,
BYTE* data, int width, int height, int bpp, int length,
BOOL compressed, int codec_id);
typedef void (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
typedef BOOL (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
struct rdp_bitmap
{
@ -71,24 +71,24 @@ struct rdp_bitmap
};
FREERDP_API rdpBitmap* Bitmap_Alloc(rdpContext* context);
FREERDP_API void Bitmap_New(rdpContext* context, rdpBitmap* bitmap);
FREERDP_API BOOL Bitmap_New(rdpContext* context, rdpBitmap* bitmap);
FREERDP_API void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap);
FREERDP_API void Bitmap_Register(rdpContext* context, rdpBitmap* bitmap);
FREERDP_API void Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
FREERDP_API BOOL Bitmap_Register(rdpContext* context, rdpBitmap* bitmap);
FREERDP_API BOOL Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BYTE* data, int width, int height, int bpp, int length, BOOL compressed);
FREERDP_API void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap,
UINT16 left, UINT16 top, UINT16 right, UINT16 bottom);
FREERDP_API void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width, UINT16 height);
FREERDP_API void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
FREERDP_API BOOL Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
/* Pointer Class */
typedef void (*pPointer_New)(rdpContext* context, rdpPointer* pointer);
typedef BOOL (*pPointer_New)(rdpContext* context, rdpPointer* pointer);
typedef void (*pPointer_Free)(rdpContext* context, rdpPointer* pointer);
typedef void (*pPointer_Set)(rdpContext* context, rdpPointer* pointer);
typedef void (*pPointer_SetNull)(rdpContext* context);
typedef void (*pPointer_SetDefault)(rdpContext* context);
typedef void (*pPointer_SetPosition)(rdpContext* context, UINT32 x, UINT32 y);
typedef BOOL (*pPointer_Set)(rdpContext* context, rdpPointer* pointer);
typedef BOOL (*pPointer_SetNull)(rdpContext* context);
typedef BOOL (*pPointer_SetDefault)(rdpContext* context);
typedef BOOL (*pPointer_SetPosition)(rdpContext* context, UINT32 x, UINT32 y);
struct rdp_pointer
{
@ -114,20 +114,20 @@ struct rdp_pointer
};
FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context);
FREERDP_API void Pointer_New(rdpContext* context, rdpPointer* pointer);
FREERDP_API BOOL Pointer_New(rdpContext* context, rdpPointer* pointer);
FREERDP_API void Pointer_Free(rdpContext* context, rdpPointer* pointer);
FREERDP_API void Pointer_Set(rdpContext* context, rdpPointer* pointer);
FREERDP_API void Pointer_SetNull(rdpContext* context);
FREERDP_API void Pointer_SetDefault(rdpContext* context);
FREERDP_API void Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y);
FREERDP_API BOOL Pointer_Set(rdpContext* context, rdpPointer* pointer);
FREERDP_API BOOL Pointer_SetNull(rdpContext* context);
FREERDP_API BOOL Pointer_SetDefault(rdpContext* context);
FREERDP_API BOOL Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y);
/* Glyph Class */
typedef void (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph);
typedef BOOL (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph);
typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph);
typedef void (*pGlyph_Draw)(rdpContext* context, rdpGlyph* glyph, int x, int y);
typedef void (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
typedef void (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
typedef BOOL (*pGlyph_Draw)(rdpContext* context, rdpGlyph* glyph, int x, int y);
typedef BOOL (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
typedef BOOL (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
struct rdp_glyph
{
@ -149,11 +149,11 @@ struct rdp_glyph
};
FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context);
FREERDP_API void Glyph_New(rdpContext* context, rdpGlyph* glyph);
FREERDP_API BOOL Glyph_New(rdpContext* context, rdpGlyph* glyph);
FREERDP_API void Glyph_Free(rdpContext* context, rdpGlyph* glyph);
FREERDP_API void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y);
FREERDP_API void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
FREERDP_API void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
FREERDP_API BOOL Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y);
FREERDP_API BOOL Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant);
FREERDP_API BOOL Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor);
/* Graphics Module */

View File

@ -62,13 +62,13 @@ typedef struct rdp_input_proxy rdpInputProxy;
/* Input Interface */
typedef void (*pSynchronizeEvent)(rdpInput* input, UINT32 flags);
typedef void (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pFocusInEvent)(rdpInput* input, UINT16 toggleStates);
typedef void (*pKeyboardPauseEvent)(rdpInput* input);
typedef BOOL (*pSynchronizeEvent)(rdpInput* input, UINT32 flags);
typedef BOOL (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef BOOL (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef BOOL (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef BOOL (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef BOOL (*pFocusInEvent)(rdpInput* input, UINT16 toggleStates);
typedef BOOL (*pKeyboardPauseEvent)(rdpInput* input);
struct rdp_input
{
@ -97,14 +97,14 @@ struct rdp_input
extern "C" {
#endif
FREERDP_API void freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags);
FREERDP_API void freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode);
FREERDP_API void freerdp_input_send_keyboard_pause_event(rdpInput* input);
FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API void freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates);
FREERDP_API BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags);
FREERDP_API BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API BOOL freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode);
FREERDP_API BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input);
FREERDP_API BOOL freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API BOOL freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API BOOL freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API BOOL freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates);
#ifdef __cplusplus
}

View File

@ -71,11 +71,11 @@ struct _POINTER_CACHED_UPDATE
};
typedef struct _POINTER_CACHED_UPDATE POINTER_CACHED_UPDATE;
typedef void (*pPointerPosition)(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position);
typedef void (*pPointerSystem)(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system);
typedef void (*pPointerColor)(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color);
typedef void (*pPointerNew)(rdpContext* context, POINTER_NEW_UPDATE* pointer_new);
typedef void (*pPointerCached)(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached);
typedef BOOL (*pPointerPosition)(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position);
typedef BOOL (*pPointerSystem)(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system);
typedef BOOL (*pPointerColor)(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color);
typedef BOOL (*pPointerNew)(rdpContext* context, POINTER_NEW_UPDATE* pointer_new);
typedef BOOL (*pPointerCached)(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached);
struct rdp_pointer_update
{

View File

@ -438,28 +438,28 @@ struct _ELLIPSE_CB_ORDER
};
typedef struct _ELLIPSE_CB_ORDER ELLIPSE_CB_ORDER;
typedef void (*pDstBlt)(rdpContext* context, DSTBLT_ORDER* dstblt);
typedef void (*pPatBlt)(rdpContext* context, PATBLT_ORDER* patblt);
typedef void (*pScrBlt)(rdpContext* context, SCRBLT_ORDER* scrblt);
typedef void (*pOpaqueRect)(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
typedef void (*pDrawNineGrid)(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid);
typedef void (*pMultiDstBlt)(rdpContext* context, MULTI_DSTBLT_ORDER* multi_dstblt);
typedef void (*pMultiPatBlt)(rdpContext* context, MULTI_PATBLT_ORDER* multi_patblt);
typedef void (*pMultiScrBlt)(rdpContext* context, MULTI_SCRBLT_ORDER* multi_scrblt);
typedef void (*pMultiOpaqueRect)(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
typedef void (*pMultiDrawNineGrid)(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
typedef void (*pLineTo)(rdpContext* context, LINE_TO_ORDER* line_to);
typedef void (*pPolyline)(rdpContext* context, POLYLINE_ORDER* polyline);
typedef void (*pMemBlt)(rdpContext* context, MEMBLT_ORDER* memblt);
typedef void (*pMem3Blt)(rdpContext* context, MEM3BLT_ORDER* memblt);
typedef void (*pSaveBitmap)(rdpContext* context, SAVE_BITMAP_ORDER* save_bitmap);
typedef void (*pGlyphIndex)(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index);
typedef void (*pFastIndex)(rdpContext* context, FAST_INDEX_ORDER* fast_index);
typedef void (*pFastGlyph)(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph);
typedef void (*pPolygonSC)(rdpContext* context, POLYGON_SC_ORDER* polygon_sc);
typedef void (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb);
typedef void (*pEllipseSC)(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc);
typedef void (*pEllipseCB)(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb);
typedef BOOL (*pDstBlt)(rdpContext* context, DSTBLT_ORDER* dstblt);
typedef BOOL (*pPatBlt)(rdpContext* context, PATBLT_ORDER* patblt);
typedef BOOL (*pScrBlt)(rdpContext* context, SCRBLT_ORDER* scrblt);
typedef BOOL (*pOpaqueRect)(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
typedef BOOL (*pDrawNineGrid)(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid);
typedef BOOL (*pMultiDstBlt)(rdpContext* context, MULTI_DSTBLT_ORDER* multi_dstblt);
typedef BOOL (*pMultiPatBlt)(rdpContext* context, MULTI_PATBLT_ORDER* multi_patblt);
typedef BOOL (*pMultiScrBlt)(rdpContext* context, MULTI_SCRBLT_ORDER* multi_scrblt);
typedef BOOL (*pMultiOpaqueRect)(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
typedef BOOL (*pMultiDrawNineGrid)(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
typedef BOOL (*pLineTo)(rdpContext* context, LINE_TO_ORDER* line_to);
typedef BOOL (*pPolyline)(rdpContext* context, POLYLINE_ORDER* polyline);
typedef BOOL (*pMemBlt)(rdpContext* context, MEMBLT_ORDER* memblt);
typedef BOOL (*pMem3Blt)(rdpContext* context, MEM3BLT_ORDER* memblt);
typedef BOOL (*pSaveBitmap)(rdpContext* context, SAVE_BITMAP_ORDER* save_bitmap);
typedef BOOL (*pGlyphIndex)(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index);
typedef BOOL (*pFastIndex)(rdpContext* context, FAST_INDEX_ORDER* fast_index);
typedef BOOL (*pFastGlyph)(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph);
typedef BOOL (*pPolygonSC)(rdpContext* context, POLYGON_SC_ORDER* polygon_sc);
typedef BOOL (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb);
typedef BOOL (*pEllipseSC)(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc);
typedef BOOL (*pEllipseCB)(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb);
struct rdp_primary_update
{

View File

@ -163,13 +163,13 @@ struct _CACHE_BRUSH_ORDER
};
typedef struct _CACHE_BRUSH_ORDER CACHE_BRUSH_ORDER;
typedef void (*pCacheBitmap)(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap_order);
typedef void (*pCacheBitmapV2)(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order);
typedef void (*pCacheBitmapV3)(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order);
typedef void (*pCacheColorTable)(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table_order);
typedef void (*pCacheGlyph)(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph_order);
typedef void (*pCacheGlyphV2)(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
typedef void (*pCacheBrush)(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush_order);
typedef BOOL (*pCacheBitmap)(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap_order);
typedef BOOL (*pCacheBitmapV2)(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order);
typedef BOOL (*pCacheBitmapV3)(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order);
typedef BOOL (*pCacheColorTable)(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table_order);
typedef BOOL (*pCacheGlyph)(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph_order);
typedef BOOL (*pCacheGlyphV2)(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
typedef BOOL (*pCacheBrush)(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush_order);
struct rdp_secondary_update
{

View File

@ -135,25 +135,25 @@ typedef struct rdp_update_proxy rdpUpdateProxy;
/* Update Interface */
typedef void (*pBeginPaint)(rdpContext* context);
typedef void (*pEndPaint)(rdpContext* context);
typedef void (*pSetBounds)(rdpContext* context, rdpBounds* bounds);
typedef BOOL (*pBeginPaint)(rdpContext* context);
typedef BOOL (*pEndPaint)(rdpContext* context);
typedef BOOL (*pSetBounds)(rdpContext* context, rdpBounds* bounds);
typedef void (*pSynchronize)(rdpContext* context);
typedef void (*pDesktopResize)(rdpContext* context);
typedef void (*pBitmapUpdate)(rdpContext* context, BITMAP_UPDATE* bitmap);
typedef void (*pPalette)(rdpContext* context, PALETTE_UPDATE* palette);
typedef void (*pPlaySound)(rdpContext* context, PLAY_SOUND_UPDATE* play_sound);
typedef void (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags);
typedef BOOL (*pSynchronize)(rdpContext* context);
typedef BOOL (*pDesktopResize)(rdpContext* context);
typedef BOOL (*pBitmapUpdate)(rdpContext* context, BITMAP_UPDATE* bitmap);
typedef BOOL (*pPalette)(rdpContext* context, PALETTE_UPDATE* palette);
typedef BOOL (*pPlaySound)(rdpContext* context, PLAY_SOUND_UPDATE* play_sound);
typedef BOOL (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags);
typedef void (*pRefreshRect)(rdpContext* context, BYTE count, RECTANGLE_16* areas);
typedef void (*pSuppressOutput)(rdpContext* context, BYTE allow, RECTANGLE_16* area);
typedef BOOL (*pRefreshRect)(rdpContext* context, BYTE count, RECTANGLE_16* areas);
typedef BOOL (*pSuppressOutput)(rdpContext* context, BYTE allow, RECTANGLE_16* area);
typedef void (*pSurfaceCommand)(rdpContext* context, wStream* s);
typedef void (*pSurfaceBits)(rdpContext* context, SURFACE_BITS_COMMAND* surfaceBitsCommand);
typedef void (*pSurfaceFrameMarker)(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker);
typedef void (*pSurfaceFrameBits)(rdpContext* context, SURFACE_BITS_COMMAND* cmd, BOOL first, BOOL last, UINT32 frameId);
typedef void (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId);
typedef BOOL (*pSurfaceCommand)(rdpContext* context, wStream* s);
typedef BOOL (*pSurfaceBits)(rdpContext* context, SURFACE_BITS_COMMAND* surfaceBitsCommand);
typedef BOOL (*pSurfaceFrameMarker)(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker);
typedef BOOL (*pSurfaceFrameBits)(rdpContext* context, SURFACE_BITS_COMMAND* cmd, BOOL first, BOOL last, UINT32 frameId);
typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId);
struct rdp_update
{

View File

@ -226,16 +226,16 @@ struct _MONITORED_DESKTOP_ORDER
};
typedef struct _MONITORED_DESKTOP_ORDER MONITORED_DESKTOP_ORDER;
typedef void (*pWindowCreate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
typedef void (*pWindowUpdate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
typedef void (*pWindowIcon)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon);
typedef void (*pWindowCachedIcon)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon);
typedef void (*pWindowDelete)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
typedef void (*pNotifyIconCreate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
typedef void (*pNotifyIconUpdate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
typedef void (*pNotifyIconDelete)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
typedef void (*pMonitoredDesktop)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
typedef void (*pNonMonitoredDesktop)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
typedef BOOL (*pWindowCreate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
typedef BOOL (*pWindowUpdate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
typedef BOOL (*pWindowIcon)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon);
typedef BOOL (*pWindowCachedIcon)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon);
typedef BOOL (*pWindowDelete)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
typedef BOOL (*pNotifyIconCreate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
typedef BOOL (*pNotifyIconUpdate)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
typedef BOOL (*pNotifyIconDelete)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
typedef BOOL (*pMonitoredDesktop)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
typedef BOOL (*pNonMonitoredDesktop)(rdpContext* context, WINDOW_ORDER_INFO* orderInfo);
struct rdp_window_update
{

View File

@ -34,7 +34,7 @@
#define TAG FREERDP_TAG("cache.bitmap")
void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
BOOL update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
rdpBitmap* bitmap;
rdpCache* cache = context->cache;
@ -44,18 +44,20 @@ void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
else
bitmap = bitmap_cache_get(cache->bitmap, (BYTE) memblt->cacheId, memblt->cacheIndex);
/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
if (bitmap == NULL) return;
if (bitmap == NULL)
return TRUE;
memblt->bitmap = bitmap;
IFCALL(cache->bitmap->MemBlt, context, memblt);
return IFCALLRESULT(TRUE, cache->bitmap->MemBlt, context, memblt);
}
void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
BOOL update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
BYTE style;
rdpBitmap* bitmap;
rdpCache* cache = context->cache;
rdpBrush* brush = &mem3blt->brush;
BOOL ret = TRUE;
if (mem3blt->cacheId == 0xFF)
bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex);
@ -64,35 +66,45 @@ void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
if (!bitmap)
return;
return TRUE;
style = brush->style;
if (brush->style & CACHED_BRUSH)
{
brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
if (!brush->data)
return FALSE;
brush->style = 0x03;
}
mem3blt->bitmap = bitmap;
IFCALL(cache->bitmap->Mem3Blt, context, mem3blt);
IFCALLRET(cache->bitmap->Mem3Blt, ret, context, mem3blt);
brush->style = style;
return ret;
}
void update_gdi_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cacheBitmap)
BOOL update_gdi_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cacheBitmap)
{
rdpBitmap* bitmap;
rdpBitmap* prevBitmap;
rdpCache* cache = context->cache;
bitmap = Bitmap_Alloc(context);
if (!bitmap)
return FALSE;
Bitmap_SetDimensions(context, bitmap, cacheBitmap->bitmapWidth, cacheBitmap->bitmapHeight);
bitmap->Decompress(context, bitmap,
if (!bitmap->Decompress(context, bitmap,
cacheBitmap->bitmapDataStream, cacheBitmap->bitmapWidth, cacheBitmap->bitmapHeight,
cacheBitmap->bitmapBpp, cacheBitmap->bitmapLength,
cacheBitmap->compressed, RDP_CODEC_ID_NONE);
cacheBitmap->compressed, RDP_CODEC_ID_NONE))
{
Bitmap_Free(context, bitmap);
return FALSE;
}
bitmap->New(context, bitmap);
@ -102,9 +114,11 @@ void update_gdi_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cacheBitma
Bitmap_Free(context, prevBitmap);
bitmap_cache_put(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex, bitmap);
return TRUE;
}
void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2)
BOOL update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2)
{
rdpBitmap* bitmap;
rdpBitmap* prevBitmap;
@ -112,6 +126,8 @@ void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cach
rdpSettings* settings = context->settings;
bitmap = Bitmap_Alloc(context);
if (!bitmap)
return FALSE;
Bitmap_SetDimensions(context, bitmap, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight);
@ -121,10 +137,14 @@ void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cach
if ((settings->ColorDepth == 15) && (cacheBitmapV2->bitmapBpp == 16))
cacheBitmapV2->bitmapBpp = settings->ColorDepth;
bitmap->Decompress(context, bitmap,
if (!bitmap->Decompress(context, bitmap,
cacheBitmapV2->bitmapDataStream, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight,
cacheBitmapV2->bitmapBpp, cacheBitmapV2->bitmapLength,
cacheBitmapV2->compressed, RDP_CODEC_ID_NONE);
cacheBitmapV2->compressed, RDP_CODEC_ID_NONE))
{
Bitmap_Free(context, bitmap);
return FALSE;
}
bitmap->New(context, bitmap);
@ -134,9 +154,10 @@ void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cach
Bitmap_Free(context, prevBitmap);
bitmap_cache_put(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex, bitmap);
return TRUE;
}
void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3)
BOOL update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3)
{
rdpBitmap* bitmap;
rdpBitmap* prevBitmap;
@ -146,6 +167,8 @@ void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cach
BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData;
bitmap = Bitmap_Alloc(context);
if (!bitmap)
return FALSE;
Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height);
@ -167,9 +190,10 @@ void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cach
Bitmap_Free(context, prevBitmap);
bitmap_cache_put(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex, bitmap);
return TRUE;
}
void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
BOOL update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
{
int i;
BOOL reused = TRUE;
@ -214,6 +238,7 @@ void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
bitmap->Paint(context, bitmap);
}
return TRUE;
}
rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index)

View File

@ -34,9 +34,10 @@
#define TAG FREERDP_TAG("cache.brush")
void update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
BOOL update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
BYTE style;
BOOL ret = TRUE;
rdpBrush* brush = &patblt->brush;
rdpCache* cache = context->cache;
@ -48,21 +49,23 @@ void update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
brush->style = 0x03;
}
IFCALL(cache->brush->PatBlt, context, patblt);
IFCALLRET(cache->brush->PatBlt, ret, context, patblt);
brush->style = style;
return ret;
}
void update_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
BOOL update_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
rdpCache* cache = context->cache;
IFCALL(cache->brush->PolygonSC, context, polygon_sc);
return IFCALLRESULT(TRUE, cache->brush->PolygonSC, context, polygon_sc);
}
void update_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
BOOL update_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
{
BYTE style;
rdpBrush* brush = &polygon_cb->brush;
rdpCache* cache = context->cache;
BOOL ret = TRUE;
style = brush->style;
@ -72,11 +75,12 @@ void update_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
brush->style = 0x03;
}
IFCALL(cache->brush->PolygonCB, context, polygon_cb);
IFCALLRET(cache->brush->PolygonCB, ret, context, polygon_cb);
brush->style = style;
return ret;
}
static void update_gdi_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cacheBrush)
static BOOL update_gdi_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cacheBrush)
{
int length;
void* data = NULL;
@ -85,9 +89,12 @@ static void update_gdi_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache
length = cacheBrush->bpp * 64 / 8;
data = malloc(length);
if (!data)
return FALSE;
CopyMemory(data, cacheBrush->data, length);
brush_cache_put(cache->brush, cacheBrush->index, data, cacheBrush->bpp);
return TRUE;
}
void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp)

View File

@ -199,7 +199,7 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
Glyph_EndDraw(context, bkX, bkY, bkWidth, bkHeight, bgcolor, fgcolor);
}
void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
BOOL update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
{
rdpGlyphCache* glyph_cache;
int bkWidth, bkHeight, opWidth, opHeight;
@ -217,9 +217,11 @@ void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
glyphIndex->bkLeft, glyphIndex->bkTop, bkWidth, bkHeight,
glyphIndex->opLeft, glyphIndex->opTop, opWidth, opHeight,
glyphIndex->fOpRedundant);
return TRUE;
}
void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
BOOL update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
{
INT32 x, y;
INT32 opLeft, opTop;
@ -269,9 +271,10 @@ void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
opLeft, opTop,
opRight - opLeft, opBottom - opTop,
FALSE);
return TRUE;
}
void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
BOOL update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
{
INT32 x, y;
rdpGlyph* glyph;
@ -343,9 +346,10 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
opLeft, opTop,
opRight - opLeft, opBottom - opTop,
FALSE);
return TRUE;
}
void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
BOOL update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
{
int i;
rdpGlyph* glyph;
@ -357,6 +361,11 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
glyph_data = &cacheGlyph->glyphData[i];
glyph = Glyph_Alloc(context);
if (!glyph)
{
/* TODO: cleanup previously allocated memory */
return FALSE;
}
glyph->x = glyph_data->x;
glyph->y = glyph_data->y;
@ -368,9 +377,10 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph)
glyph_cache_put(cache->glyph, cacheGlyph->cacheId, glyph_data->cacheIndex, glyph);
}
return TRUE;
}
void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheGlyphV2)
BOOL update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheGlyphV2)
{
int i;
rdpGlyph* glyph;
@ -382,6 +392,11 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheG
glyphData = &cacheGlyphV2->glyphData[i];
glyph = Glyph_Alloc(context);
if (!glyph)
{
/* TODO: cleanup perviosly allocated glyph memory in error case */
return FALSE;
}
glyph->x = glyphData->x;
glyph->y = glyphData->y;
@ -393,6 +408,7 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheG
glyph_cache_put(cache->glyph, cacheGlyphV2->cacheId, glyphData->cacheIndex, glyph);
}
return TRUE;
}
rdpGlyph* glyph_cache_get(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index)

View File

@ -35,16 +35,16 @@
#define TAG FREERDP_TAG("cache.nine_grid")
void update_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid)
BOOL update_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid)
{
rdpCache* cache = context->cache;
IFCALL(cache->nine_grid->DrawNineGrid, context, draw_nine_grid);
return IFCALLRESULT(TRUE, cache->nine_grid->DrawNineGrid, context, draw_nine_grid);
}
void update_gdi_multi_draw_nine_grid(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
BOOL update_gdi_multi_draw_nine_grid(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
{
rdpCache* cache = context->cache;
IFCALL(cache->nine_grid->MultiDrawNineGrid, context, multi_draw_nine_grid);
return IFCALLRESULT(TRUE, cache->nine_grid->MultiDrawNineGrid, context, multi_draw_nine_grid);
}
void nine_grid_cache_register_callbacks(rdpUpdate* update)

View File

@ -32,7 +32,7 @@
#define TAG FREERDP_TAG("cache.offscreen")
void update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
BOOL update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
{
int i;
UINT16 index;
@ -40,11 +40,17 @@ void update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BI
rdpCache* cache = context->cache;
bitmap = Bitmap_Alloc(context);
if (!bitmap)
return FALSE;
bitmap->width = createOffscreenBitmap->cx;
bitmap->height = createOffscreenBitmap->cy;
bitmap->New(context, bitmap);
if (!bitmap->New(context, bitmap))
{
free(bitmap);
return FALSE;
}
offscreen_cache_delete(cache->offscreen, createOffscreenBitmap->id);
offscreen_cache_put(cache->offscreen, createOffscreenBitmap->id, bitmap);
@ -57,9 +63,10 @@ void update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BI
index = createOffscreenBitmap->deleteList.indices[i];
offscreen_cache_delete(cache->offscreen, index);
}
return TRUE;
}
void update_gdi_switch_surface(rdpContext* context, SWITCH_SURFACE_ORDER* switchSurface)
BOOL update_gdi_switch_surface(rdpContext* context, SWITCH_SURFACE_ORDER* switchSurface)
{
rdpCache* cache = context->cache;
@ -75,6 +82,7 @@ void update_gdi_switch_surface(rdpContext* context, SWITCH_SURFACE_ORDER* switch
}
cache->offscreen->currentSurface = switchSurface->bitmapId;
return TRUE;
}
rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreenCache, UINT32 index)

View File

@ -30,15 +30,18 @@
#define TAG FREERDP_TAG("cache.palette")
static void update_gdi_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cacheColorTable)
static BOOL update_gdi_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cacheColorTable)
{
UINT32* colorTable;
rdpCache* cache = context->cache;
colorTable = (UINT32*) malloc(sizeof(UINT32) * 256);
if (!colorTable)
return FALSE;
CopyMemory(colorTable, cacheColorTable->colorTable, sizeof(UINT32) * 256);
palette_cache_put(cache->palette, cacheColorTable->cacheIndex, (void*) colorTable);
return TRUE;
}
void* palette_cache_get(rdpPaletteCache* paletteCache, UINT32 index)

View File

@ -33,12 +33,12 @@
#define TAG FREERDP_TAG("cache.pointer")
void update_pointer_position(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position)
BOOL update_pointer_position(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position)
{
Pointer_SetPosition(context, pointer_position->xPos, pointer_position->yPos);
return Pointer_SetPosition(context, pointer_position->xPos, pointer_position->yPos);
}
void update_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
BOOL update_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
{
switch (pointer_system->type)
{
@ -52,11 +52,11 @@ void update_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_s
default:
WLog_ERR(TAG, "Unknown system pointer type (0x%08X)", pointer_system->type);
break;
}
return TRUE;
}
void update_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
BOOL update_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
{
rdpPointer* pointer;
rdpCache* cache = context->cache;
@ -76,21 +76,34 @@ void update_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_col
if (pointer->lengthAndMask && pointer_color->xorMaskData)
{
pointer->andMaskData = (BYTE*) malloc(pointer->lengthAndMask);
if (!pointer->andMaskData)
goto out_fail;
CopyMemory(pointer->andMaskData, pointer_color->andMaskData, pointer->lengthAndMask);
}
if (pointer->lengthXorMask && pointer_color->xorMaskData)
{
pointer->xorMaskData = (BYTE*) malloc(pointer->lengthXorMask);
if (!pointer->xorMaskData)
goto out_fail;
CopyMemory(pointer->xorMaskData, pointer_color->xorMaskData, pointer->lengthXorMask);
}
pointer->New(context, pointer);
pointer_cache_put(cache->pointer, pointer_color->cacheIndex, pointer);
Pointer_Set(context, pointer);
return TRUE;
}
return FALSE;
out_fail:
free(pointer->andMaskData);
free(pointer->xorMaskData);
free(pointer);
return FALSE;
}
void update_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
BOOL update_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
{
rdpPointer* pointer;
rdpCache* cache = context->cache;
@ -112,6 +125,8 @@ void update_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
if (pointer->lengthAndMask)
{
pointer->andMaskData = (BYTE*) malloc(pointer->lengthAndMask);
if (!pointer->andMaskData)
goto out_fail;
CopyMemory(pointer->andMaskData, pointer_new->colorPtrAttr.andMaskData, pointer->lengthAndMask);
}
@ -124,10 +139,18 @@ void update_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
pointer->New(context, pointer);
pointer_cache_put(cache->pointer, pointer_new->colorPtrAttr.cacheIndex, pointer);
Pointer_Set(context, pointer);
return TRUE;
}
return FALSE;
out_fail:
free(pointer->andMaskData);
free(pointer->xorMaskData);
free(pointer);
return FALSE;
}
void update_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
BOOL update_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
{
rdpPointer* pointer;
rdpCache* cache = context->cache;
@ -135,7 +158,11 @@ void update_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_c
pointer = pointer_cache_get(cache->pointer, pointer_cached->cacheIndex);
if (pointer != NULL)
{
Pointer_Set(context, pointer);
return TRUE;
}
return FALSE;
}
rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index)

View File

@ -27,11 +27,9 @@
#include <winpr/crt.h>
#include <freerdp/api.h>
#include <freerdp/log.h>
#include <freerdp/freerdp.h>
#include <freerdp/primitives.h>
#include <freerdp/codec/color.h>
#define TAG FREERDP_TAG("color")

View File

@ -733,6 +733,8 @@ wStream* fastpath_input_pdu_init_header(rdpFastPath* fastpath)
rdp = fastpath->rdp;
s = transport_send_stream_init(rdp->transport, 256);
if (!s)
return NULL;
Stream_Seek(s, 3); /* fpInputHeader, length1 and length2 */
@ -757,6 +759,8 @@ wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE ev
rdp = fastpath->rdp;
s = fastpath_input_pdu_init_header(fastpath);
if (!s)
return NULL;
Stream_Write_UINT8(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */
return s;
@ -869,9 +873,7 @@ BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s)
wStream* fastpath_update_pdu_init(rdpFastPath* fastpath)
{
wStream* s;
s = transport_send_stream_init(fastpath->rdp->transport, FASTPATH_MAX_PACKET_SIZE);
return s;
return transport_send_stream_init(fastpath->rdp->transport, FASTPATH_MAX_PACKET_SIZE);
}
wStream* fastpath_update_pdu_init_new(rdpFastPath* fastpath)

View File

@ -44,9 +44,9 @@ rdpBitmap* Bitmap_Alloc(rdpContext* context)
return bitmap;
}
void Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
BOOL Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
return TRUE;
}
void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
@ -77,9 +77,9 @@ void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width,
}
/* static method */
void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
BOOL Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
context->graphics->Bitmap_Prototype->SetSurface(context, bitmap, primary);
return context->graphics->Bitmap_Prototype->SetSurface(context, bitmap, primary);
}
void graphics_register_bitmap(rdpGraphics* graphics, rdpBitmap* bitmap)
@ -105,9 +105,9 @@ rdpPointer* Pointer_Alloc(rdpContext* context)
return pointer;
}
void Pointer_New(rdpContext* context, rdpPointer* pointer)
BOOL Pointer_New(rdpContext* context, rdpPointer* pointer)
{
return TRUE;
}
void Pointer_Free(rdpContext* context, rdpPointer* pointer)
@ -133,24 +133,24 @@ void Pointer_Free(rdpContext* context, rdpPointer* pointer)
}
/* static method */
void Pointer_Set(rdpContext* context, rdpPointer* pointer)
BOOL Pointer_Set(rdpContext* context, rdpPointer* pointer)
{
context->graphics->Pointer_Prototype->Set(context, pointer);
return context->graphics->Pointer_Prototype->Set(context, pointer);
}
void Pointer_SetNull(rdpContext* context)
BOOL Pointer_SetNull(rdpContext* context)
{
context->graphics->Pointer_Prototype->SetNull(context);
return context->graphics->Pointer_Prototype->SetNull(context);
}
void Pointer_SetDefault(rdpContext* context)
BOOL Pointer_SetDefault(rdpContext* context)
{
context->graphics->Pointer_Prototype->SetDefault(context);
return context->graphics->Pointer_Prototype->SetDefault(context);
}
void Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
BOOL Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
{
IFCALL(context->graphics->Pointer_Prototype->SetPosition, context, x, y);
return IFCALLRESULT(TRUE, context->graphics->Pointer_Prototype->SetPosition, context, x, y);
}
void graphics_register_pointer(rdpGraphics* graphics, rdpPointer* pointer)
@ -176,9 +176,9 @@ rdpGlyph* Glyph_Alloc(rdpContext* context)
return glyph;
}
void Glyph_New(rdpContext* context, rdpGlyph* glyph)
BOOL Glyph_New(rdpContext* context, rdpGlyph* glyph)
{
context->graphics->Glyph_Prototype->New(context, glyph);
return context->graphics->Glyph_Prototype->New(context, glyph);
}
void Glyph_Free(rdpContext* context, rdpGlyph* glyph)
@ -186,19 +186,19 @@ void Glyph_Free(rdpContext* context, rdpGlyph* glyph)
context->graphics->Glyph_Prototype->Free(context, glyph);
}
void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
BOOL Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
{
context->graphics->Glyph_Prototype->Draw(context, glyph, x, y);
return context->graphics->Glyph_Prototype->Draw(context, glyph, x, y);
}
void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
BOOL Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
{
context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width, height, bgcolor, fgcolor, fOpRedundant);
return context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width, height, bgcolor, fgcolor, fOpRedundant);
}
void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
BOOL Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
context->graphics->Glyph_Prototype->EndDraw(context, x, y, width, height, bgcolor, fgcolor);
return context->graphics->Glyph_Prototype->EndDraw(context, x, y, width, height, bgcolor, fgcolor);
}
void graphics_register_glyph(rdpGraphics* graphics, rdpGlyph* glyph)

View File

@ -32,13 +32,13 @@
#define TAG FREERDP_TAG("core")
void rdp_write_client_input_pdu_header(wStream* s, UINT16 number)
static void rdp_write_client_input_pdu_header(wStream* s, UINT16 number)
{
Stream_Write_UINT16(s, 1); /* numberEvents (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
}
void rdp_write_input_event_header(wStream* s, UINT32 time, UINT16 type)
static void rdp_write_input_event_header(wStream* s, UINT32 time, UINT16 type)
{
Stream_Write_UINT32(s, time); /* eventTime (4 bytes) */
Stream_Write_UINT16(s, type); /* messageType (2 bytes) */
@ -48,57 +48,63 @@ wStream* rdp_client_input_pdu_init(rdpRdp* rdp, UINT16 type)
{
wStream* s;
s = rdp_data_pdu_init(rdp);
if (!s)
return NULL;
rdp_write_client_input_pdu_header(s, 1);
rdp_write_input_event_header(s, 0, type);
return s;
}
void rdp_send_client_input_pdu(rdpRdp* rdp, wStream* s)
BOOL rdp_send_client_input_pdu(rdpRdp* rdp, wStream* s)
{
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_INPUT, rdp->mcs->userId);
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_INPUT, rdp->mcs->userId);
}
void input_write_synchronize_event(wStream* s, UINT32 flags)
static void input_write_synchronize_event(wStream* s, UINT32 flags)
{
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
Stream_Write_UINT32(s, flags); /* toggleFlags (4 bytes) */
}
void input_send_synchronize_event(rdpInput* input, UINT32 flags)
BOOL input_send_synchronize_event(rdpInput* input, UINT32 flags)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SYNC);
if (!s)
return FALSE;
input_write_synchronize_event(s, flags);
rdp_send_client_input_pdu(rdp, s);
return rdp_send_client_input_pdu(rdp, s);
}
void input_write_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
static void input_write_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
{
Stream_Write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
Stream_Write_UINT16(s, code); /* keyCode (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
}
void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SCANCODE);
if (!s)
return FALSE;
input_write_keyboard_event(s, flags, code);
rdp_send_client_input_pdu(rdp, s);
return rdp_send_client_input_pdu(rdp, s);
}
void input_write_unicode_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
static void input_write_unicode_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
{
Stream_Write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
Stream_Write_UINT16(s, code); /* unicodeCode (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
}
void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
wStream* s;
UINT16 keyboardFlags = 0;
@ -116,8 +122,10 @@ void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 cod
keyboardFlags |= (flags & KBD_FLAGS_RELEASE) ? KBD_FLAGS_RELEASE : 0;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_UNICODE);
if (!s)
return FALSE;
input_write_unicode_keyboard_event(s, flags, code);
rdp_send_client_input_pdu(rdp, s);
return rdp_send_client_input_pdu(rdp, s);
}
void input_write_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
@ -127,46 +135,52 @@ void input_write_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
Stream_Write_UINT16(s, y); /* yPos (2 bytes) */
}
void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_MOUSE);
if (!s)
return FALSE;
input_write_mouse_event(s, flags, x, y);
rdp_send_client_input_pdu(rdp, s);
return rdp_send_client_input_pdu(rdp, s);
}
void input_write_extended_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
static void input_write_extended_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
{
Stream_Write_UINT16(s, flags); /* pointerFlags (2 bytes) */
Stream_Write_UINT16(s, x); /* xPos (2 bytes) */
Stream_Write_UINT16(s, y); /* yPos (2 bytes) */
}
void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_MOUSEX);
if (!s)
return FALSE;
input_write_extended_mouse_event(s, flags, x, y);
rdp_send_client_input_pdu(rdp, s);
return rdp_send_client_input_pdu(rdp, s);
}
void input_send_focus_in_event(rdpInput* input, UINT16 toggleStates)
BOOL input_send_focus_in_event(rdpInput* input, UINT16 toggleStates)
{
/* send a tab up like mstsc.exe */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f);
if (!input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f))
return FALSE;
/* send the toggle key states */
input_send_synchronize_event(input, (toggleStates & 0x1F));
if (!input_send_synchronize_event(input, (toggleStates & 0x1F)))
return FALSE;
/* send another tab up like mstsc.exe */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f);
return input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f);
}
static void input_send_keyboard_pause_event(rdpInput* input)
BOOL input_send_keyboard_pause_event(rdpInput* input)
{
/* In ancient days, pause-down without control sent E1 1D 45 E1 9D C5,
* and pause-up sent nothing. However, reverse engineering mstsc shows
@ -174,30 +188,38 @@ static void input_send_keyboard_pause_event(rdpInput* input)
*/
/* Control down (0x1D) */
input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
if (!input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL)))
return FALSE;
/* Numlock down (0x45) */
input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
if (!input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK)))
return FALSE;
/* Control up (0x1D) */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
if (!input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL)))
return FALSE;
/* Numlock up (0x45) */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
return input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
}
void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags)
BOOL input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
/* The FastPath Synchronization eventFlags has identical values as SlowPath */
s = fastpath_input_pdu_init(rdp->fastpath, (BYTE) flags, FASTPATH_INPUT_EVENT_SYNC);
fastpath_send_input_pdu(rdp->fastpath, s);
if (!s)
return FALSE;
return fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
wStream* s;
BYTE eventFlags = 0;
@ -206,11 +228,13 @@ void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 co
eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0;
eventFlags |= (flags & KBD_FLAGS_EXTENDED) ? FASTPATH_INPUT_KBDFLAGS_EXTENDED : 0;
s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_SCANCODE);
if (!s)
return FALSE;
Stream_Write_UINT8(s, code); /* keyCode (1 byte) */
fastpath_send_input_pdu(rdp->fastpath, s);
return fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
wStream* s;
BYTE eventFlags = 0;
@ -218,37 +242,45 @@ void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, U
eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0;
s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_UNICODE);
if (!s)
return FALSE;
Stream_Write_UINT16(s, code); /* unicodeCode (2 bytes) */
fastpath_send_input_pdu(rdp->fastpath, s);
return fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = fastpath_input_pdu_init(rdp->fastpath, 0, FASTPATH_INPUT_EVENT_MOUSE);
if (!s)
return FALSE;
input_write_mouse_event(s, flags, x, y);
fastpath_send_input_pdu(rdp->fastpath, s);
return fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
s = fastpath_input_pdu_init(rdp->fastpath, 0, FASTPATH_INPUT_EVENT_MOUSEX);
if (!s)
return FALSE;
input_write_extended_mouse_event(s, flags, x, y);
fastpath_send_input_pdu(rdp->fastpath, s);
return fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates)
BOOL input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
BYTE eventFlags = 0;
s = fastpath_input_pdu_init_header(rdp->fastpath);
if (!s)
return FALSE;
/* send a tab up like mstsc.exe */
eventFlags = FASTPATH_INPUT_KBDFLAGS_RELEASE | FASTPATH_INPUT_EVENT_SCANCODE << 5;
Stream_Write_UINT8(s, eventFlags); /* Key Release event (1 byte) */
@ -263,10 +295,10 @@ void input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates)
Stream_Write_UINT8(s, eventFlags); /* Key Release event (1 byte) */
Stream_Write_UINT8(s, 0x0f); /* keyCode (1 byte) */
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 3);
return fastpath_send_multiple_input_pdu(rdp->fastpath, s, 3);
}
static void input_send_fastpath_keyboard_pause_event(rdpInput* input)
BOOL input_send_fastpath_keyboard_pause_event(rdpInput* input)
{
/* In ancient days, pause-down without control sent E1 1D 45 E1 9D C5,
* and pause-up sent nothing. However, reverse engineering mstsc shows
@ -279,6 +311,8 @@ static void input_send_fastpath_keyboard_pause_event(rdpInput* input)
| FASTPATH_INPUT_KBDFLAGS_RELEASE;
s = fastpath_input_pdu_init_header(rdp->fastpath);
if (!s)
return FALSE;
/* Control down (0x1D) */
Stream_Write_UINT8(s, keyDownEvent | FASTPATH_INPUT_KBDFLAGS_PREFIX_E1);
@ -296,7 +330,7 @@ static void input_send_fastpath_keyboard_pause_event(rdpInput* input)
Stream_Write_UINT8(s, keyUpEvent);
Stream_Write_UINT8(s, RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
return fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
}
static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
@ -309,9 +343,7 @@ static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
Stream_Read_UINT32(s, toggleFlags); /* toggleFlags (4 bytes) */
IFCALL(input->SynchronizeEvent, input, toggleFlags);
return TRUE;
return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, toggleFlags);
}
static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s)
@ -344,9 +376,7 @@ static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s)
else
keyboardFlags |= KBD_FLAGS_DOWN;
IFCALL(input->KeyboardEvent, input, keyboardFlags, keyCode);
return TRUE;
return IFCALLRESULT(TRUE, input->KeyboardEvent, input, keyboardFlags, keyCode);
}
static BOOL input_recv_unicode_keyboard_event(rdpInput* input, wStream* s)
@ -367,9 +397,7 @@ static BOOL input_recv_unicode_keyboard_event(rdpInput* input, wStream* s)
else
keyboardFlags |= KBD_FLAGS_DOWN;
IFCALL(input->UnicodeKeyboardEvent, input, keyboardFlags, unicodeCode);
return TRUE;
return IFCALLRESULT(TRUE, input->UnicodeKeyboardEvent, input, keyboardFlags, unicodeCode);
}
static BOOL input_recv_mouse_event(rdpInput* input, wStream* s)
@ -383,9 +411,7 @@ static BOOL input_recv_mouse_event(rdpInput* input, wStream* s)
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
IFCALL(input->MouseEvent, input, pointerFlags, xPos, yPos);
return TRUE;
return IFCALLRESULT(TRUE, input->MouseEvent, input, pointerFlags, xPos, yPos);
}
static BOOL input_recv_extended_mouse_event(rdpInput* input, wStream* s)
@ -399,9 +425,7 @@ static BOOL input_recv_extended_mouse_event(rdpInput* input, wStream* s)
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
IFCALL(input->ExtendedMouseEvent, input, pointerFlags, xPos, yPos);
return TRUE;
return IFCALLRESULT(TRUE, input->ExtendedMouseEvent, input, pointerFlags, xPos, yPos);
}
static BOOL input_recv_event(rdpInput* input, wStream* s)
@ -507,47 +531,47 @@ void input_register_client_callbacks(rdpInput* input)
}
}
void freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags)
BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags)
{
IFCALL(input->SynchronizeEvent, input, flags);
return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, flags);
}
void freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
IFCALL(input->KeyboardEvent, input, flags, code);
return IFCALLRESULT(TRUE, input->KeyboardEvent, input, flags, code);
}
void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode)
BOOL freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode)
{
freerdp_input_send_keyboard_event(input,
return freerdp_input_send_keyboard_event(input,
(RDP_SCANCODE_EXTENDED(rdp_scancode) ? KBD_FLAGS_EXTENDED : 0) |
((down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE),
RDP_SCANCODE_CODE(rdp_scancode));
}
void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
IFCALL(input->UnicodeKeyboardEvent, input, flags, code);
return IFCALLRESULT(TRUE, input->UnicodeKeyboardEvent, input, flags, code);
}
void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
IFCALL(input->MouseEvent, input, flags, x, y);
return IFCALLRESULT(TRUE, input->MouseEvent, input, flags, x, y);
}
void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
IFCALL(input->ExtendedMouseEvent, input, flags, x, y);
return IFCALLRESULT(TRUE, input->ExtendedMouseEvent, input, flags, x, y);
}
void freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates)
BOOL freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates)
{
IFCALL(input->FocusInEvent, input, toggleStates);
return IFCALLRESULT(TRUE, input->FocusInEvent, input, toggleStates);
}
void freerdp_input_send_keyboard_pause_event(rdpInput* input)
BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input)
{
IFCALL(input->KeyboardPauseEvent, input);
return IFCALLRESULT(TRUE, input->KeyboardPauseEvent, input);
}
int input_process_events(rdpInput* input)

View File

@ -38,17 +38,17 @@
#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4
void input_send_synchronize_event(rdpInput* input, UINT32 flags);
void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL input_send_synchronize_event(rdpInput* input, UINT32 flags);
BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags);
void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
void input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
void input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags);
BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL input_recv(rdpInput* input, wStream* s);

File diff suppressed because it is too large Load Diff

View File

@ -239,6 +239,8 @@ wStream* rdp_data_pdu_init(rdpRdp* rdp)
{
wStream* s;
s = transport_send_stream_init(rdp->transport, 2048);
if (!s)
return NULL;
rdp_init_stream_data_pdu(rdp, s);
return s;
}

View File

@ -136,9 +136,10 @@ int update_recv_surfcmds(rdpUpdate* update, UINT32 size, wStream* s)
return 0;
}
void update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND* cmd)
BOOL update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND* cmd)
{
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH);
if (!Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH))
return FALSE;
Stream_Write_UINT16(s, CMDTYPE_STREAM_SURFACE_BITS);
@ -152,14 +153,18 @@ void update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND*
Stream_Write_UINT16(s, cmd->width);
Stream_Write_UINT16(s, cmd->height);
Stream_Write_UINT32(s, cmd->bitmapDataLength);
return TRUE;
}
void update_write_surfcmd_frame_marker(wStream* s, UINT16 frameAction, UINT32 frameId)
BOOL update_write_surfcmd_frame_marker(wStream* s, UINT16 frameAction, UINT32 frameId)
{
Stream_EnsureRemainingCapacity(s, SURFCMD_FRAME_MARKER_LENGTH);
if (!Stream_EnsureRemainingCapacity(s, SURFCMD_FRAME_MARKER_LENGTH))
return FALSE;
Stream_Write_UINT16(s, CMDTYPE_FRAME_MARKER);
Stream_Write_UINT16(s, frameAction);
Stream_Write_UINT32(s, frameId);
return TRUE;
}

View File

@ -36,8 +36,8 @@ enum SURFCMD_CMDTYPE
int update_recv_surfcmds(rdpUpdate* update, UINT32 size, wStream* s);
void update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND* cmd);
void update_write_surfcmd_frame_marker(wStream* s, UINT16 frameAction, UINT32 frameId);
BOOL update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND* cmd);
BOOL update_write_surfcmd_frame_marker(wStream* s, UINT16 frameAction, UINT32 frameId);
#endif /* __SURFACE */

View File

@ -593,7 +593,7 @@ void update_post_disconnect(rdpUpdate* update)
update_message_proxy_free(update->proxy);
}
static void update_begin_paint(rdpContext* context)
static BOOL update_begin_paint(rdpContext* context)
{
wStream* s;
rdpUpdate* update = context->update;
@ -602,22 +602,25 @@ static void update_begin_paint(rdpContext* context)
update->EndPaint(context);
s = fastpath_update_pdu_init_new(context->rdp->fastpath);
if (!s)
return FALSE;
Stream_SealLength(s);
Stream_Seek(s, 2); /* numberOrders (2 bytes) */
update->combineUpdates = TRUE;
update->numberOrders = 0;
update->us = s;
return TRUE;
}
static void update_end_paint(rdpContext* context)
static BOOL update_end_paint(rdpContext* context)
{
wStream* s;
int headerLength;
rdpUpdate* update = context->update;
if (!update->us)
return;
return FALSE;
s = update->us;
headerLength = Stream_Length(s);
@ -638,6 +641,7 @@ static void update_end_paint(rdpContext* context)
update->us = NULL;
Stream_Free(s, TRUE);
return TRUE;
}
static void update_flush(rdpContext* context)
@ -684,7 +688,7 @@ static BOOL update_check_flush(rdpContext* context, int size)
return FALSE;
}
static void update_set_bounds(rdpContext* context, rdpBounds* bounds)
static BOOL update_set_bounds(rdpContext* context, rdpBounds* bounds)
{
rdpUpdate* update = context->update;
@ -694,6 +698,7 @@ static void update_set_bounds(rdpContext* context, rdpBounds* bounds)
ZeroMemory(&update->currentBounds, sizeof(rdpBounds));
else
CopyMemory(&update->currentBounds, bounds, sizeof(rdpBounds));
return TRUE;
}
BOOL update_bounds_is_null(rdpBounds* bounds)
@ -824,19 +829,24 @@ static void update_write_refresh_rect(wStream* s, BYTE count, RECTANGLE_16* area
}
}
static void update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
static BOOL update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
wStream* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->RefreshRect)
{
BOOL ret;
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
update_write_refresh_rect(s, count, areas);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_REFRESH_RECT, rdp->mcs->userId);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_REFRESH_RECT, rdp->mcs->userId);
Stream_Release(s);
return ret;
}
return TRUE;
}
static void update_write_suppress_output(wStream* s, BYTE allow, RECTANGLE_16* area)
@ -854,160 +864,229 @@ static void update_write_suppress_output(wStream* s, BYTE allow, RECTANGLE_16* a
}
}
static void update_send_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
static BOOL update_send_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
{
wStream* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->SuppressOutput)
{
BOOL ret;
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
update_write_suppress_output(s, allow, area);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SUPPRESS_OUTPUT, rdp->mcs->userId);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SUPPRESS_OUTPUT, rdp->mcs->userId);
Stream_Release(s);
return ret;
}
return TRUE;
}
static void update_send_surface_command(rdpContext* context, wStream* s)
static BOOL update_send_surface_command(rdpContext* context, wStream* s)
{
wStream* update;
rdpRdp* rdp = context->rdp;
BOOL ret;
update = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(update, Stream_GetPosition(s));
if (!update)
return FALSE;
if (!Stream_EnsureRemainingCapacity(update, Stream_GetPosition(s)))
{
ret = FALSE;
goto out;
}
Stream_Write(update, Stream_Buffer(s), Stream_GetPosition(s));
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update, FALSE);
out:
Stream_Release(update);
return ret;
}
static void update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surfaceBitsCommand)
static BOOL update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surfaceBitsCommand)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
update_force_flush(context);
s = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surfaceBitsCommand->bitmapDataLength);
update_write_surfcmd_surface_bits_header(s, surfaceBitsCommand);
if (!s)
return FALSE;
if (!Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surfaceBitsCommand->bitmapDataLength) ||
!update_write_surfcmd_surface_bits_header(s, surfaceBitsCommand))
goto out_fail;
Stream_Write(s, surfaceBitsCommand->bitmapData, surfaceBitsCommand->bitmapDataLength);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, surfaceBitsCommand->skipCompression);
if (!fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, surfaceBitsCommand->skipCompression))
goto out_fail;
update_force_flush(context);
ret = TRUE;
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
static BOOL update_send_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
update_force_flush(context);
s = fastpath_update_pdu_init(rdp->fastpath);
update_write_surfcmd_frame_marker(s, surfaceFrameMarker->frameAction, surfaceFrameMarker->frameId);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, FALSE);
if (!s)
return FALSE;
if (!update_write_surfcmd_frame_marker(s, surfaceFrameMarker->frameAction, surfaceFrameMarker->frameId) ||
!fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, FALSE))
goto out_fail;
update_force_flush(context);
ret = TRUE;
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_surface_frame_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd, BOOL first, BOOL last, UINT32 frameId)
static BOOL update_send_surface_frame_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd, BOOL first, BOOL last, UINT32 frameId)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
update_force_flush(context);
s = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) cmd->bitmapDataLength + 16);
if (!s)
return FALSE;
if (!Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) cmd->bitmapDataLength + 16))
goto out_fail;
if (first)
update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_BEGIN, frameId);
{
if (!update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_BEGIN, frameId))
goto out_fail;
}
update_write_surfcmd_surface_bits_header(s, cmd);
if (!update_write_surfcmd_surface_bits_header(s, cmd))
goto out_fail;
Stream_Write(s, cmd->bitmapData, cmd->bitmapDataLength);
if (last)
update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_END, frameId);
{
if (!update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_END, frameId))
goto out_fail;
}
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, cmd->skipCompression);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, cmd->skipCompression);
update_force_flush(context);
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_frame_acknowledge(rdpContext* context, UINT32 frameId)
static BOOL update_send_frame_acknowledge(rdpContext* context, UINT32 frameId)
{
wStream* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])
{
BOOL ret;
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
Stream_Write_UINT32(s, frameId);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->userId);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->userId);
Stream_Release(s);
return ret;
}
return TRUE;
}
static void update_send_synchronize(rdpContext* context)
static BOOL update_send_synchronize(rdpContext* context)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret;
s = fastpath_update_pdu_init(rdp->fastpath);
if (!s)
return FALSE;
Stream_Zero(s, 2); /* pad2Octets (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s, FALSE);
Stream_Release(s);
return ret;
}
static void update_send_desktop_resize(rdpContext* context)
static BOOL update_send_desktop_resize(rdpContext* context)
{
rdp_server_reactivate(context->rdp);
return rdp_server_reactivate(context->rdp);
}
static void update_send_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
static BOOL update_send_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
{
wStream* s;
rdpRdp* rdp = context->rdp;
rdpUpdate* update = context->update;
BOOL ret = TRUE;
update_force_flush(context);
s = fastpath_update_pdu_init(rdp->fastpath);
update_write_bitmap_update(update, s, bitmapUpdate);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_BITMAP, s, bitmapUpdate->skipCompression);
if (!s)
return FALSE;
if (!update_write_bitmap_update(update, s, bitmapUpdate) ||
!fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_BITMAP, s, bitmapUpdate->skipCompression))
{
ret = FALSE;
goto out_fail;
}
update_force_flush(context);
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_play_sound(rdpContext* context, PLAY_SOUND_UPDATE* play_sound)
static BOOL update_send_play_sound(rdpContext* context, PLAY_SOUND_UPDATE* play_sound)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret;
if (!rdp->settings->ReceivedCapabilities[CAPSET_TYPE_SOUND]) {
return;
return TRUE;
}
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
Stream_Write_UINT32(s, play_sound->duration);
Stream_Write_UINT32(s, play_sound->frequency);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_PLAY_SOUND, rdp->mcs->userId);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_PLAY_SOUND, rdp->mcs->userId);
Stream_Release(s);
return ret;
}
/**
* Primary Drawing Orders
*/
static void update_send_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
static BOOL update_send_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
{
wStream* s;
int offset;
@ -1020,18 +1099,23 @@ static void update_send_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
update_check_flush(context, headerLength + update_approximate_dstblt_order(&orderInfo, dstblt));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_dstblt_order(s, &orderInfo, dstblt);
if (!update_write_dstblt_order(s, &orderInfo, dstblt))
return FALSE;
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
static BOOL update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
wStream* s;
int offset;
@ -1044,18 +1128,22 @@ static void update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
update_check_flush(context, headerLength + update_approximate_patblt_order(&orderInfo, patblt));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_patblt_order(s, &orderInfo, patblt);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
static BOOL update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
{
wStream* s;
int offset;
@ -1068,18 +1156,22 @@ static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
update_check_flush(context, headerLength + update_approximate_scrblt_order(&orderInfo, scrblt));
s = update->us;
if (!s)
return TRUE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_scrblt_order(s, &orderInfo, scrblt);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
static BOOL update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
{
wStream* s;
int offset;
@ -1092,18 +1184,22 @@ static void update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaq
update_check_flush(context, headerLength + update_approximate_opaque_rect_order(&orderInfo, opaque_rect));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_opaque_rect_order(s, &orderInfo, opaque_rect);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
static BOOL update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
{
wStream* s;
int offset;
@ -1116,18 +1212,22 @@ static void update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
update_check_flush(context, headerLength + update_approximate_line_to_order(&orderInfo, line_to));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_line_to_order(s, &orderInfo, line_to);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
static BOOL update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
wStream* s;
int offset;
@ -1140,18 +1240,22 @@ static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
update_check_flush(context, headerLength + update_approximate_memblt_order(&orderInfo, memblt));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_memblt_order(s, &orderInfo, memblt);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
static BOOL update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
{
wStream* s;
int offset;
@ -1164,22 +1268,26 @@ static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyp
update_check_flush(context, headerLength + update_approximate_glyph_index_order(&orderInfo, glyph_index));
s = update->us;
if (!s)
return FALSE;
offset = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_glyph_index_order(s, &orderInfo, glyph_index);
update_write_order_info(context, s, &orderInfo, offset);
update->numberOrders++;
return TRUE;
}
/*
* Secondary Drawing Orders
*/
static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap)
static BOOL update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap)
{
wStream* s;
int bm, em;
@ -1198,12 +1306,19 @@ static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* ca
update_check_flush(context, headerLength + update_approximate_cache_bitmap_order(cache_bitmap, cache_bitmap->compressed, &extraFlags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_bitmap_order(s, cache_bitmap, cache_bitmap->compressed, &extraFlags);
if (!update_write_cache_bitmap_order(s, cache_bitmap, cache_bitmap->compressed, &extraFlags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1216,9 +1331,10 @@ static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* ca
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
static BOOL update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
{
wStream* s;
int bm, em;
@ -1240,12 +1356,19 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
update_check_flush(context, headerLength + update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_bitmap_v2_order(s, cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags);
if (!update_write_cache_bitmap_v2_order(s, cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1258,9 +1381,10 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
static BOOL update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
{
wStream* s;
int bm, em;
@ -1277,12 +1401,19 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
update_check_flush(context, headerLength + update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, &extraFlags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_bitmap_v3_order(s, cache_bitmap_v3, &extraFlags);
if (!update_write_cache_bitmap_v3_order(s, cache_bitmap_v3, &extraFlags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1295,9 +1426,10 @@ static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORD
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table)
static BOOL update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table)
{
wStream* s;
UINT16 flags;
@ -1312,12 +1444,19 @@ static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE
update_check_flush(context, headerLength + update_approximate_cache_color_table_order(cache_color_table, &flags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_color_table_order(s, cache_color_table, &flags);
if (!update_write_cache_color_table_order(s, cache_color_table, &flags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1330,9 +1469,10 @@ static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
static BOOL update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
{
wStream* s;
UINT16 flags;
@ -1347,12 +1487,18 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
update_check_flush(context, headerLength + update_approximate_cache_glyph_order(cache_glyph, &flags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_glyph_order(s, cache_glyph, &flags);
if (!update_write_cache_glyph_order(s, cache_glyph, &flags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1365,9 +1511,10 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
static BOOL update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
{
wStream* s;
UINT16 flags;
@ -1382,12 +1529,18 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
update_check_flush(context, headerLength + update_approximate_cache_glyph_v2_order(cache_glyph_v2, &flags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_glyph_v2_order(s, cache_glyph_v2, &flags);
if (!update_write_cache_glyph_v2_order(s, cache_glyph_v2, &flags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1400,9 +1553,10 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush)
static BOOL update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush)
{
wStream* s;
UINT16 flags;
@ -1417,12 +1571,17 @@ static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cach
update_check_flush(context, headerLength + update_approximate_cache_brush_order(cache_brush, &flags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_cache_brush_order(s, cache_brush, &flags);
if (!update_write_cache_brush_order(s, cache_brush, &flags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
@ -1435,13 +1594,14 @@ static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cach
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
/**
* Alternate Secondary Drawing Orders
*/
static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
static BOOL update_send_create_offscreen_bitmap_order(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
{
wStream* s;
int bm, em;
@ -1457,12 +1617,16 @@ static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREAT
update_check_flush(context, headerLength + update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_create_offscreen_bitmap_order(s, create_offscreen_bitmap);
if (!update_write_create_offscreen_bitmap_order(s, create_offscreen_bitmap))
return FALSE;
em = Stream_GetPosition(s);
Stream_SetPosition(s, bm);
@ -1470,9 +1634,10 @@ static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREAT
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface)
static BOOL update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface)
{
wStream* s;
int bm, em;
@ -1488,12 +1653,16 @@ static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE
update_check_flush(context, headerLength + update_approximate_switch_surface_order(switch_surface));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
Stream_EnsureRemainingCapacity(s, headerLength);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
update_write_switch_surface_order(s, switch_surface);
if (!update_write_switch_surface_order(s, switch_surface))
return FALSE;
em = Stream_GetPosition(s);
Stream_SetPosition(s, bm);
@ -1501,44 +1670,56 @@ static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
static BOOL update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
{
wStream* s;
BYTE updateCode;
rdpRdp* rdp = context->rdp;
BOOL ret;
s = fastpath_update_pdu_init(rdp->fastpath);
if (!s)
return FALSE;
if (pointer_system->type == SYSPTR_NULL)
updateCode = FASTPATH_UPDATETYPE_PTR_NULL;
else
updateCode = FASTPATH_UPDATETYPE_PTR_DEFAULT;
fastpath_send_update_pdu(rdp->fastpath, updateCode, s, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, updateCode, s, FALSE);
Stream_Release(s);
return ret;
}
static void update_send_pointer_position(rdpContext* context, POINTER_POSITION_UPDATE* pointerPosition)
static BOOL update_send_pointer_position(rdpContext* context, POINTER_POSITION_UPDATE* pointerPosition)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
s = fastpath_update_pdu_init(rdp->fastpath);
if (!s)
return FALSE;
Stream_EnsureRemainingCapacity(s, 16);
if (!Stream_EnsureRemainingCapacity(s, 16))
goto out_fail;
Stream_Write_UINT16(s, pointerPosition->xPos); /* xPos (2 bytes) */
Stream_Write_UINT16(s, pointerPosition->yPos); /* yPos (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_PTR_POSITION, s, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_PTR_POSITION, s, FALSE);
out_fail:
Stream_Release(s);
return ret;
}
static void update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
static BOOL update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
{
Stream_EnsureRemainingCapacity(s, 32 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask);
if (!Stream_EnsureRemainingCapacity(s, 32 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask))
return FALSE;
Stream_Write_UINT16(s, pointer_color->cacheIndex);
Stream_Write_UINT16(s, pointer_color->xPos);
@ -1555,45 +1736,65 @@ static void update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer
Stream_Write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
Stream_Write_UINT8(s, 0); /* pad (1 byte) */
return TRUE;
}
static void update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
static BOOL update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
s = fastpath_update_pdu_init(rdp->fastpath);
update_write_pointer_color(s, pointer_color);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_COLOR, s, FALSE);
if (!s)
return FALSE;
if (!update_write_pointer_color(s, pointer_color))
goto out_fail;
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_COLOR, s, FALSE);
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
static BOOL update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret = FALSE;
s = fastpath_update_pdu_init(rdp->fastpath);
if (!s)
return FALSE;
Stream_EnsureRemainingCapacity(s, 16);
if (!Stream_EnsureRemainingCapacity(s, 16))
goto out_fail;
Stream_Write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
update_write_pointer_color(s, &pointer_new->colorPtrAttr);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s, FALSE);
out_fail:
Stream_Release(s);
return ret;
}
static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
static BOOL update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret;
s = fastpath_update_pdu_init(rdp->fastpath);
if (!s)
return FALSE;
Stream_Write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s, FALSE);
ret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s, FALSE);
Stream_Release(s);
return ret;
}
BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
@ -1653,16 +1854,20 @@ BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
return TRUE;
}
static void update_send_set_keyboard_indicators(rdpContext* context, UINT16 led_flags)
static BOOL update_send_set_keyboard_indicators(rdpContext* context, UINT16 led_flags)
{
wStream* s;
rdpRdp* rdp = context->rdp;
BOOL ret;
s = rdp_data_pdu_init(rdp);
if (!s)
return FALSE;
Stream_Write_UINT16(s, 0); /* unitId should be 0 according to MS-RDPBCGR 2.2.8.2.1.1 */
Stream_Write_UINT16(s, led_flags); /* ledFlags (2 bytes) */
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS, rdp->mcs->userId);
ret = rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS, rdp->mcs->userId);
Stream_Release(s);
return ret;
}
void update_register_server_callbacks(rdpUpdate* update)

View File

@ -104,8 +104,9 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
}
}
gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight);
return 0;
if (!gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight))
return 0;
return 1;
}
static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -121,7 +122,7 @@ static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
memset(dstp, 0, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -137,7 +138,7 @@ static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -147,7 +148,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
if ((hdcDest->selectedObject != hdcSrc->selectedObject) ||
gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0)
@ -161,7 +162,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
if (nYSrc < nYDest)
@ -201,7 +202,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -211,7 +212,7 @@ static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -229,7 +230,7 @@ static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -251,7 +252,7 @@ static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -261,7 +262,7 @@ static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -279,7 +280,7 @@ static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -289,7 +290,7 @@ static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -307,7 +308,7 @@ static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -317,7 +318,7 @@ static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -335,7 +336,7 @@ static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -345,7 +346,7 @@ static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -363,7 +364,7 @@ static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
}
}
return 0;
return 1;
}
static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -373,7 +374,7 @@ static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -391,7 +392,7 @@ static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -404,7 +405,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
HGDI_BITMAP hSrcBmp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
/* D = (S & P) | (~S & D) */
/* DSPDxax, used to draw glyphs */
@ -437,7 +438,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -449,7 +450,7 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT16 color16;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
/* D = (S & D) | (~S & P) */
@ -494,7 +495,7 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -505,7 +506,7 @@ static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT16* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -524,7 +525,7 @@ static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -549,7 +550,7 @@ static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -573,7 +574,7 @@ static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -583,7 +584,7 @@ static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -601,7 +602,7 @@ static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
@ -613,7 +614,7 @@ static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT16* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -632,7 +633,7 @@ static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -642,7 +643,7 @@ static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT16* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -660,7 +661,7 @@ static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -719,7 +720,7 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -765,7 +766,7 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -776,7 +777,7 @@ static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT16* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -795,7 +796,7 @@ static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)
@ -814,10 +815,8 @@ int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeigh
return 0;
}
gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight);
if (!hdcDest)
return 1;
if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight))
return 0;
switch (rop)
{
@ -888,7 +887,8 @@ int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i
if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0)
return 0;
gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight);
if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight))
return 0;
switch (rop)
{

View File

@ -90,8 +90,9 @@ int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
}
}
gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight);
return 0;
if (!gdi_InvalidateRegion(hdc, nXDest, nYDest, nWidth, nHeight))
return 0;
return 1;
}
static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -138,7 +139,7 @@ static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -154,7 +155,7 @@ static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -164,7 +165,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
if ((hdcDest->selectedObject != hdcSrc->selectedObject) ||
gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0)
@ -178,7 +179,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
if (nYSrc < nYDest)
@ -218,7 +219,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -228,7 +229,7 @@ static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -246,7 +247,7 @@ static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -268,7 +269,7 @@ static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -278,7 +279,7 @@ static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -296,7 +297,7 @@ static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -306,7 +307,7 @@ static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -324,7 +325,7 @@ static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -334,7 +335,7 @@ static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -352,7 +353,7 @@ static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -362,7 +363,7 @@ static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -380,7 +381,7 @@ static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
}
}
return 0;
return 1;
}
static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -390,7 +391,7 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -408,7 +409,7 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -423,7 +424,7 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
HGDI_BITMAP hSrcBmp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
/* D = (S & P) | (~S & D) */
@ -476,7 +477,7 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -488,7 +489,7 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT32 color32;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
/* D = (S & D) | (~S & P) */
@ -533,7 +534,7 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -545,7 +546,7 @@ static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
UINT32 color32;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
/* D = S ^ (P & (D ^ S)) */
@ -590,7 +591,7 @@ static int BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -601,7 +602,7 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT32* patp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -621,7 +622,7 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -631,7 +632,7 @@ static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -649,7 +650,7 @@ static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -674,7 +675,7 @@ static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -699,7 +700,7 @@ static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth
}
}
return 0;
return 1;
}
static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -710,7 +711,7 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
UINT32* patp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -730,7 +731,7 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -740,7 +741,7 @@ static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
UINT32* dstp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -758,7 +759,7 @@ static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -817,7 +818,7 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -863,7 +864,7 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -874,7 +875,7 @@ static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
UINT32* patp;
if (!hdcDest || !hdcSrc)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -893,7 +894,7 @@ static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)
@ -912,10 +913,8 @@ int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeigh
return 0;
}
gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight);
if (!hdcDest)
return 1;
if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight))
return 0;
switch (rop)
{
@ -989,7 +988,8 @@ int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i
if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0)
return 0;
gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight);
if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight))
return 0;
switch (rop)
{

View File

@ -44,13 +44,13 @@
BYTE gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color)
{
/* TODO: Implement 8bpp gdi_get_color_8bpp() */
return 0;
return 1;
}
int FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
{
/* TODO: Implement 8bpp FillRect() */
return 0;
return 1;
}
static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -66,7 +66,7 @@ static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
memset(dstp, 0, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -82,7 +82,7 @@ static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
memset(dstp, 0xFF, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -92,7 +92,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
if ((hdcDest->selectedObject != hdcSrc->selectedObject) ||
gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0)
@ -106,7 +106,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
}
return 0;
return 1;
}
if (nYSrc < nYDest)
@ -146,7 +146,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -156,7 +156,7 @@ static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -174,7 +174,7 @@ static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -196,7 +196,7 @@ static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -206,7 +206,7 @@ static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -224,7 +224,7 @@ static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -234,7 +234,7 @@ static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -252,7 +252,7 @@ static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int
}
}
return 0;
return 1;
}
static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -262,7 +262,7 @@ static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -280,7 +280,7 @@ static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -290,7 +290,7 @@ static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidt
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -308,7 +308,7 @@ static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidt
}
}
return 0;
return 1;
}
static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -318,7 +318,7 @@ static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -336,16 +336,16 @@ static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
static int BitBlt_DSPDxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
if (!hdcSrc || !hdcDest)
return 1;
return 0;
/* TODO: Implement 8bpp DSPDxax BitBlt */
return 0;
return 1;
}
static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -357,7 +357,7 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
BYTE color8;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
/* D = (S & D) | (~S & P) */
@ -402,7 +402,7 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
}
}
return 0;
return 1;
}
static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -413,7 +413,7 @@ static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
BYTE* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -434,7 +434,7 @@ static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -459,7 +459,7 @@ static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -485,7 +485,7 @@ static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -495,7 +495,7 @@ static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -513,7 +513,7 @@ static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth,
}
}
return 0;
return 1;
}
static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -524,7 +524,7 @@ static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
BYTE* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -545,7 +545,7 @@ static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -555,7 +555,7 @@ static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
BYTE* dstp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -573,7 +573,7 @@ static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
}
}
return 0;
return 1;
}
static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -632,7 +632,7 @@ static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
}
}
return 0;
return 1;
}
static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
@ -678,7 +678,7 @@ static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
}
}
return 0;
return 1;
}
static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
@ -689,7 +689,7 @@ static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
BYTE* patp;
if (!hdcSrc || !hdcDest)
return 1;
return 0;
for (y = 0; y < nHeight; y++)
{
@ -710,11 +710,14 @@ static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
}
}
return 0;
return 1;
}
int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)
{
if (!hdcDest)
return 0;
if (hdcSrc != NULL)
{
if (gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc, &nYSrc) == 0)
@ -726,10 +729,8 @@ int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight
return 0;
}
gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight);
if (!hdcDest)
return 1;
if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight))
return 0;
switch (rop)
{
@ -800,7 +801,8 @@ int PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, in
if (gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL) == 0)
return 0;
gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight);
if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight))
return 0;
switch (rop)
{

View File

@ -105,7 +105,7 @@ INLINE GDI_COLOR gdi_SetPixel(HGDI_DC hdc, int X, int Y, GDI_COLOR crColor)
{
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
*((GDI_COLOR*)&(hBmp->data[(Y * hBmp->width * hdc->bytesPerPixel) + X * hdc->bytesPerPixel])) = crColor;
return 0;
return crColor;
}
INLINE void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, BYTE pixel)
@ -173,6 +173,11 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight)
hBitmap->width = nWidth;
hBitmap->height = nHeight;
hBitmap->data = _aligned_malloc(nWidth * nHeight * hBitmap->bytesPerPixel, 16);
if (!hBitmap->data)
{
free(hBitmap);
return NULL;
}
hBitmap->scanline = nWidth * hBitmap->bytesPerPixel;
return hBitmap;
@ -190,7 +195,7 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight)
* @param nXSrc source x1
* @param nYSrc source y1
* @param rop raster operation code
* @return 1 if successful, 0 otherwise
* @return 0 on failure, non-zero otherwise
*/
int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)

View File

@ -24,7 +24,6 @@
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <freerdp/freerdp.h>
@ -55,6 +54,8 @@ p_PatBlt PatBlt_[5] =
HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor)
{
HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH));
if (!hBrush)
return NULL;
hBrush->objectType = GDIOBJECT_BRUSH;
hBrush->style = GDI_BS_SOLID;
hBrush->color = crColor;
@ -71,6 +72,8 @@ HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor)
HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
{
HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH));
if (!hBrush)
return NULL;
hBrush->objectType = GDIOBJECT_BRUSH;
hBrush->style = GDI_BS_PATTERN;
hBrush->pattern = hbmp;
@ -80,6 +83,8 @@ HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp)
{
HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH));
if (!hBrush)
return NULL;
hBrush->objectType = GDIOBJECT_BRUSH;
hBrush->style = GDI_BS_HATCHED;
hBrush->pattern = hbmp;

View File

@ -42,10 +42,17 @@
HGDI_DC gdi_GetDC()
{
HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
if (!hDC)
return NULL;
hDC->bytesPerPixel = 4;
hDC->bitsPerPixel = 32;
hDC->drawMode = GDI_R2_BLACK;
hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0);
if (!hDC->clip)
{
free(hDC);
return NULL;
}
hDC->clip->null = 1;
hDC->hwnd = NULL;
return hDC;
@ -94,11 +101,18 @@ HGDI_DC gdi_CreateDC(UINT32 flags, int bpp)
HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc)
{
HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
if (!hDC)
return NULL;
if (!(hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0)))
{
free(hDC);
return NULL;
}
hDC->clip->null = 1;
hDC->bytesPerPixel = hdc->bytesPerPixel;
hDC->bitsPerPixel = hdc->bitsPerPixel;
hDC->drawMode = hdc->drawMode;
hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0);
hDC->clip->null = 1;
hDC->hwnd = NULL;
hDC->alpha = hdc->alpha;
hDC->invert = hdc->invert;
@ -146,7 +160,7 @@ HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject)
else
{
/* Unknown GDI Object Type */
return 0;
return NULL;
}
return previousSelectedObject;
@ -182,7 +196,7 @@ int gdi_DeleteObject(HGDIOBJECT hgdiobject)
{
HGDI_BRUSH hBrush = (HGDI_BRUSH) hgdiobject;
if(hBrush->style == GDI_BS_PATTERN)
if (hBrush->style == GDI_BS_PATTERN || hBrush->style == GDI_BS_HATCHED)
{
if (hBrush->pattern != NULL)
gdi_DeleteObject((HGDIOBJECT) hBrush->pattern);

View File

@ -430,7 +430,7 @@ void gdi_bitmap_free_ex(gdiBitmap* bitmap)
}
}
static void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
static BOOL gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
{
int status;
int nXDst;
@ -477,7 +477,7 @@ static void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer, gdi->bitmap_size, 16);
if (!gdi->bitmap_buffer)
return;
return FALSE;
}
if (compressed)
@ -502,7 +502,7 @@ static void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
if (status < 0)
{
WLog_ERR(TAG, "bitmap decompression failure");
return;
return FALSE;
}
pSrcData = gdi->bitmap_buffer;
@ -529,11 +529,13 @@ static void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, gdi->format, nSrcStep, nXSrc, nYSrc, gdi->palette);
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
if (!gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight))
return FALSE;
}
return TRUE;
}
static void gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
static BOOL gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
int index;
PALETTE_ENTRY* pe;
@ -547,9 +549,10 @@ static void gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
pe = &(palette->entries[index]);
palette32[index] = RGB32(pe->red, pe->green, pe->blue);
}
return TRUE;
}
static void gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
static BOOL gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
{
rdpGdi* gdi = context->gdi;
@ -562,17 +565,20 @@ static void gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
{
gdi_SetNullClipRgn(gdi->drawing->hdc);
}
return TRUE;
}
static void gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
static BOOL gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
{
rdpGdi* gdi = context->gdi;
gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect,
dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop));
if (gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect,
dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop)) == 0)
return FALSE;
return TRUE;
}
static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
BYTE* data;
rdpBrush* brush;
@ -581,6 +587,7 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
GDI_COLOR originalColor;
HGDI_BRUSH originalBrush;
rdpGdi* gdi = context->gdi;
BOOL ret = TRUE;
brush = &patblt->brush;
@ -594,9 +601,15 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
originalBrush = gdi->drawing->hdc->brush;
gdi->drawing->hdc->brush = gdi_CreateSolidBrush(foreColor);
if (!gdi->drawing->hdc->brush)
{
ret = FALSE;
goto out_error;
}
gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop));
if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0)
ret = FALSE;
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
gdi->drawing->hdc->brush = originalBrush;
@ -607,6 +620,11 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
HGDI_BITMAP hBmp;
data = (BYTE*) _aligned_malloc(8 * 8 * gdi->bytesPerPixel, 16);
if (!data)
{
ret = FALSE;
goto out_error;
}
hatched = GDI_BS_HATCHED_PATTERNS + (8 * brush->hatch);
@ -614,12 +632,25 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
hatched, backColor, foreColor, gdi->palette);
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data);
if (!hBmp)
{
_aligned_free(data);
ret = FALSE;
goto out_error;
}
originalBrush = gdi->drawing->hdc->brush;
gdi->drawing->hdc->brush = gdi_CreateHatchBrush(hBmp);
if (!gdi->drawing->hdc->brush)
{
_aligned_free(data);
ret = FALSE;
goto out_error;
}
gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop));
if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0)
ret = FALSE;
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
gdi->drawing->hdc->brush = originalBrush;
@ -634,6 +665,11 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
brushFormat = gdi_get_pixel_format(brush->bpp, FALSE);
data = (BYTE*) _aligned_malloc(8 * 8 * gdi->bytesPerPixel, 16);
if (!data)
{
ret = FALSE;
goto out_error;
}
freerdp_image_copy(data, gdi->format, -1, 0, 0,
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
@ -641,18 +677,36 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
else
{
data = (BYTE*) _aligned_malloc(8 * 8 * gdi->bytesPerPixel, 16);
if (!data)
{
ret = FALSE;
goto out_error;
}
freerdp_image_copy_from_monochrome(data, gdi->format, -1, 0, 0, 8, 8,
brush->data, backColor, foreColor, gdi->palette);
}
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data);
if (!hBmp)
{
_aligned_free(data);
ret = FALSE;
goto out_error;
}
originalBrush = gdi->drawing->hdc->brush;
gdi->drawing->hdc->brush = gdi_CreatePatternBrush(hBmp);
if (!gdi->drawing->hdc->brush)
{
_aligned_free(data);
ret = FALSE;
goto out_error;
}
gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop));
if (gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)) == 0)
ret = FALSE;
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
gdi->drawing->hdc->brush = originalBrush;
@ -662,24 +716,29 @@ static void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
WLog_ERR(TAG, "unimplemented brush style:%d", brush->style);
}
out_error:
gdi_SetTextColor(gdi->drawing->hdc, originalColor);
return ret;
}
static void gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
static BOOL gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
{
rdpGdi* gdi = context->gdi;
gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
if (gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc,
scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop));
scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop)) == 0)
return FALSE;
return TRUE;
}
static void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
static BOOL gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
{
GDI_RECT rect;
HGDI_BRUSH hBrush;
UINT32 brush_color;
rdpGdi* gdi = context->gdi;
BOOL ret = FALSE;
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
@ -687,12 +746,16 @@ static void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
brush_color = freerdp_convert_gdi_order_color(opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
hBrush = gdi_CreateSolidBrush(brush_color);
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
gdi_DeleteObject((HGDIOBJECT) hBrush);
if (hBrush)
{
if (gdi_FillRect(gdi->drawing->hdc, &rect, hBrush) == 0)
ret = TRUE;
gdi_DeleteObject((HGDIOBJECT) hBrush);
}
return ret;
}
static void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
static BOOL gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
{
int i;
GDI_RECT rect;
@ -700,6 +763,7 @@ static void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER*
UINT32 brush_color;
DELTA_RECT* rectangle;
rdpGdi* gdi = context->gdi;
BOOL ret = TRUE;
for (i = 1; i < (int) multi_opaque_rect->numRectangles + 1; i++)
{
@ -711,13 +775,19 @@ static void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER*
brush_color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
hBrush = gdi_CreateSolidBrush(brush_color);
if (!hBrush)
{
ret = FALSE;
break;
}
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
gdi_DeleteObject((HGDIOBJECT) hBrush);
}
return ret;
}
static void gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo)
static BOOL gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo)
{
UINT32 color;
HGDI_PEN hPen;
@ -725,16 +795,23 @@ static void gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo)
color = freerdp_convert_gdi_order_color(lineTo->penColor, gdi->srcBpp, gdi->format, gdi->palette);
hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, (GDI_COLOR) color);
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
if (!hPen)
return FALSE;
if (!gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen))
{
gdi_DeleteObject((HGDIOBJECT) hPen);
return FALSE;
}
gdi_SetROP2(gdi->drawing->hdc, lineTo->bRop2);
gdi_MoveToEx(gdi->drawing->hdc, lineTo->nXStart, lineTo->nYStart, NULL);
gdi_LineTo(gdi->drawing->hdc, lineTo->nXEnd, lineTo->nYEnd);
gdi_DeleteObject((HGDIOBJECT) hPen);
return TRUE;
}
static void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
static BOOL gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
{
int i;
INT32 x;
@ -746,6 +823,8 @@ static void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
color = freerdp_convert_gdi_order_color(polyline->penColor, gdi->srcBpp, gdi->format, gdi->palette);
hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color);
if (!hPen)
return FALSE;
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2);
@ -763,21 +842,24 @@ static void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
}
gdi_DeleteObject((HGDIOBJECT) hPen);
return TRUE;
}
static void gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
static BOOL gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
gdiBitmap* bitmap;
rdpGdi* gdi = context->gdi;
bitmap = (gdiBitmap*) memblt->bitmap;
gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
if (gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
memblt->nWidth, memblt->nHeight, bitmap->hdc,
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop)) == 0)
return FALSE;
return TRUE;
}
static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
BYTE* data;
rdpBrush* brush;
@ -787,6 +869,7 @@ static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
GDI_COLOR originalColor;
HGDI_BRUSH originalBrush;
rdpGdi* gdi = context->gdi;
BOOL ret = TRUE;
brush = &mem3blt->brush;
bitmap = (gdiBitmap*) mem3blt->bitmap;
@ -800,6 +883,11 @@ static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
originalBrush = gdi->drawing->hdc->brush;
gdi->drawing->hdc->brush = gdi_CreateSolidBrush(foreColor);
if (!gdi->drawing->hdc->brush)
{
ret = FALSE;
goto out_fail;
}
gdi_BitBlt(gdi->drawing->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
@ -818,6 +906,11 @@ static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
brushFormat = gdi_get_pixel_format(brush->bpp, FALSE);
data = (BYTE*) _aligned_malloc(8 * 8 * gdi->bytesPerPixel, 16);
if (!data)
{
ret = FALSE;
goto out_fail;
}
freerdp_image_copy(data, gdi->format, -1, 0, 0,
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
@ -825,15 +918,31 @@ static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
else
{
data = (BYTE*) _aligned_malloc(8 * 8 * gdi->bytesPerPixel, 16);
if (!data)
{
ret = FALSE;
goto out_fail;
}
freerdp_image_copy_from_monochrome(data, gdi->format, -1, 0, 0, 8, 8,
brush->data, backColor, foreColor, gdi->palette);
}
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data);
if (!hBmp)
{
_aligned_free(data);
ret = FALSE;
goto out_fail;
}
originalBrush = gdi->drawing->hdc->brush;
gdi->drawing->hdc->brush = gdi_CreatePatternBrush(hBmp);
if (!gdi->drawing->hdc->brush)
{
gdi_DeleteObject((HGDIOBJECT) hBmp);
goto out_fail;
}
gdi_BitBlt(gdi->drawing->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
@ -847,36 +956,41 @@ static void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
WLog_ERR(TAG, "Mem3Blt unimplemented brush style:%d", brush->style);
}
out_fail:
gdi_SetTextColor(gdi->drawing->hdc, originalColor);
return ret;
}
static void gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
static BOOL gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
{
WLog_VRB(TAG, "not implemented");
return TRUE;
}
static void gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
static BOOL gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
{
WLog_VRB(TAG, "not implemented");
return TRUE;
}
static void gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc)
static BOOL gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc)
{
WLog_VRB(TAG, "not implemented");
return TRUE;
}
static void gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb)
static BOOL gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb)
{
WLog_VRB(TAG, "not implemented");
return TRUE;
}
static void gdi_frame_marker(rdpContext* context, FRAME_MARKER_ORDER* frameMarker)
static BOOL gdi_frame_marker(rdpContext* context, FRAME_MARKER_ORDER* frameMarker)
{
return TRUE;
}
void gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
BOOL gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
DEBUG_GDI("frameId %d frameAction %d",
surfaceFrameMarker->frameId,
@ -894,9 +1008,10 @@ void gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface
}
break;
}
return TRUE;
}
static void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
static BOOL gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
{
int i, j;
int tx, ty;
@ -963,7 +1078,7 @@ static void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer, gdi->bitmap_size, 16);
if (!gdi->bitmap_buffer)
return;
return FALSE;
}
pDstData = gdi->bitmap_buffer;
@ -988,7 +1103,7 @@ static void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer, gdi->bitmap_size, 16);
if (!gdi->bitmap_buffer)
return;
return FALSE;
}
pDstData = gdi->bitmap_buffer;
@ -1009,6 +1124,7 @@ static void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
{
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
}
return TRUE;
}
/**

View File

@ -29,15 +29,7 @@
#include <freerdp/gdi/shape.h>
#include <freerdp/gdi/region.h>
#include <freerdp/gdi/bitmap.h>
#include <freerdp/codec/jpeg.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/gdi/drawing.h>
#include <freerdp/gdi/clipping.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#include <freerdp/codec/bitmap.h>
#include <freerdp/cache/glyph.h>
#include "graphics.h"
@ -105,21 +97,35 @@ HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int nWidth, int nHeight, int bpp, BYT
return bitmap;
}
void gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
BOOL gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
gdiBitmap* gdi_bitmap;
rdpGdi* gdi = context->gdi;
gdi_bitmap = (gdiBitmap*) bitmap;
gdi_bitmap->hdc = gdi_CreateCompatibleDC(gdi->hdc);
if (!gdi->hdc)
return FALSE;
if (!bitmap->data)
gdi_bitmap->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, bitmap->width, bitmap->height);
else
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width, bitmap->height, bitmap->bpp, bitmap->data);
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap);
if (!gdi_bitmap->bitmap)
{
gdi_DeleteDC(gdi->hdc);
return FALSE;
}
if (!gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap))
{
gdi_DeleteObject((HGDIOBJECT) gdi_bitmap->bitmap);
gdi_DeleteDC(gdi->hdc);
return FALSE;
}
gdi_bitmap->org_bitmap = NULL;
return TRUE;
}
void gdi_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
@ -134,7 +140,7 @@ void gdi_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
}
}
void gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
BOOL gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
int width, height;
gdiBitmap* gdi_bitmap = (gdiBitmap*) bitmap;
@ -142,11 +148,13 @@ void gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
width = bitmap->right - bitmap->left + 1;
height = bitmap->bottom - bitmap->top + 1;
gdi_BitBlt(context->gdi->primary->hdc, bitmap->left, bitmap->top,
width, height, gdi_bitmap->hdc, 0, 0, GDI_SRCCOPY);
if (gdi_BitBlt(context->gdi->primary->hdc, bitmap->left, bitmap->top,
width, height, gdi_bitmap->hdc, 0, 0, GDI_SRCCOPY) == 0)
return FALSE;
return TRUE;
}
void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BYTE* data, int width, int height, int bpp, int length,
BOOL compressed, int codecId)
{
@ -188,7 +196,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
if (status < 0)
{
WLog_ERR(TAG, "Bitmap Decompression Failed");
return;
return FALSE;
}
}
else
@ -202,9 +210,10 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
bitmap->compressed = FALSE;
bitmap->length = size;
bitmap->bpp = gdi->dstBpp;
return TRUE;
}
void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
rdpGdi* gdi = context->gdi;
@ -212,11 +221,13 @@ void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
gdi->drawing = gdi->primary;
else
gdi->drawing = (gdiBitmap*) bitmap;
return TRUE;
}
/* Glyph Class */
void gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
{
BYTE* data;
gdiGlyph* gdi_glyph;
@ -224,16 +235,35 @@ void gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
gdi_glyph = (gdiGlyph*) glyph;
gdi_glyph->hdc = gdi_GetDC();
if (!gdi_glyph->hdc)
return FALSE;
gdi_glyph->hdc->bytesPerPixel = 1;
gdi_glyph->hdc->bitsPerPixel = 1;
data = freerdp_glyph_convert(glyph->cx, glyph->cy, glyph->aj);
if (!data)
{
gdi_DeleteDC(gdi_glyph->hdc);
return FALSE;
}
gdi_glyph->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, 1, data);
if (!gdi_glyph->bitmap)
{
gdi_DeleteDC(gdi_glyph->hdc);
_aligned_free(data);
return FALSE;
}
gdi_glyph->bitmap->bytesPerPixel = 1;
gdi_glyph->bitmap->bitsPerPixel = 1;
gdi_SelectObject(gdi_glyph->hdc, (HGDIOBJECT) gdi_glyph->bitmap);
if (!gdi_SelectObject(gdi_glyph->hdc, (HGDIOBJECT) gdi_glyph->bitmap))
{
gdi_DeleteDC(gdi_glyph->hdc);
_aligned_free(data);
return FALSE;
}
gdi_glyph->org_bitmap = NULL;
return TRUE;
}
void gdi_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
@ -250,48 +280,59 @@ void gdi_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
}
}
void gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
BOOL gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
{
gdiGlyph* gdi_glyph;
rdpGdi* gdi = context->gdi;
gdi_glyph = (gdiGlyph*) glyph;
gdi_BitBlt(gdi->drawing->hdc, x, y, gdi_glyph->bitmap->width,
gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax);
if (gdi_BitBlt(gdi->drawing->hdc, x, y, gdi_glyph->bitmap->width,
gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax) == 0)
return FALSE;
return TRUE;
}
void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
BOOL gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
{
GDI_RECT rect;
HGDI_BRUSH brush;
rdpGdi* gdi = context->gdi;
int ret = 0;
/* TODO: handle fOpRedundant! See xf_Glyph_BeginDraw() */
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format, gdi->palette);
gdi_CRgnToRect(x, y, width, height, &rect);
brush = gdi_CreateSolidBrush(fgcolor);
gdi_FillRect(gdi->drawing->hdc, &rect, brush);
if (!brush)
goto out_fail;
gdi_CRgnToRect(x, y, width, height, &rect);
ret = gdi_FillRect(gdi->drawing->hdc, &rect, brush);
gdi_DeleteObject((HGDIOBJECT) brush);
out_fail:
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
if (ret == 0)
return FALSE;
return TRUE;
}
void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
BOOL gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
rdpGdi* gdi = context->gdi;
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
return TRUE;
}
/* Graphics Module */
void gdi_register_graphics(rdpGraphics* graphics)
BOOL gdi_register_graphics(rdpGraphics* graphics)
{
rdpBitmap* bitmap;
rdpGlyph* glyph;
@ -299,7 +340,7 @@ void gdi_register_graphics(rdpGraphics* graphics)
bitmap = (rdpBitmap*) calloc(1, sizeof(rdpBitmap));
if (!bitmap)
return;
return FALSE;
bitmap->size = sizeof(gdiBitmap);
@ -315,7 +356,7 @@ void gdi_register_graphics(rdpGraphics* graphics)
glyph = (rdpGlyph*) calloc(1, sizeof(rdpGlyph));
if (!glyph)
return;
return FALSE;
glyph->size = sizeof(gdiGlyph);
@ -327,4 +368,5 @@ void gdi_register_graphics(rdpGraphics* graphics)
graphics_register_glyph(graphics, glyph);
free(glyph);
return TRUE;
}

View File

@ -25,11 +25,11 @@
HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, BYTE* data);
void gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap);
BOOL gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap);
void gdi_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap);
void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BYTE* data, int width, int height, int bpp, int length,
BOOL compressed, int codec_id);
void gdi_register_graphics(rdpGraphics* graphics);
BOOL gdi_register_graphics(rdpGraphics* graphics);
#endif /* __GDI_GRAPHICS_H */

View File

@ -71,7 +71,8 @@ int LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd)
bx2 = MIN(bx2, bmp->width - 1);
by2 = MIN(by2, bmp->height - 1);
gdi_InvalidateRegion(hdc, bx1, by1, bx2 - bx1 + 1, by2 - by1 + 1);
if (!gdi_InvalidateRegion(hdc, bx1, by1, bx2 - bx1 + 1, by2 - by1 + 1))
return 0;
pen = GDI_GET_PEN_COLOR(hdc->pen);

View File

@ -24,7 +24,6 @@
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <freerdp/api.h>
@ -45,6 +44,8 @@
HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor)
{
HGDI_PEN hPen = (HGDI_PEN) malloc(sizeof(GDI_PEN));
if (!hPen)
return NULL;
hPen->objectType = GDIOBJECT_PEN;
hPen->style = fnPenStyle;
hPen->color = crColor;

View File

@ -44,6 +44,8 @@
HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
{
HGDI_RGN hRgn = (HGDI_RGN) malloc(sizeof(GDI_RGN));
if (!hRgn)
return NULL;
hRgn->objectType = GDIOBJECT_REGION;
hRgn->x = nLeftRect;
hRgn->y = nTopRect;
@ -65,6 +67,8 @@ HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBot
HGDI_RECT gdi_CreateRect(int xLeft, int yTop, int xRight, int yBottom)
{
HGDI_RECT hRect = (HGDI_RECT) malloc(sizeof(GDI_RECT));
if (!hRect)
return NULL;
hRect->objectType = GDIOBJECT_RECT;
hRect->left = xLeft;
hRect->top = yTop;
@ -361,10 +365,10 @@ INLINE int gdi_PtInRect(HGDI_RECT rc, int x, int y)
* @param y y1
* @param w width
* @param h height
* @return
* @return FALSE on error
*/
INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
{
GDI_RECT inv;
GDI_RECT rgn;
@ -372,13 +376,13 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
HGDI_RGN cinvalid;
if (!hdc->hwnd)
return 0;
return TRUE;
if (!hdc->hwnd->invalid)
return 0;
return TRUE;
if (w == 0 || h == 0)
return 0;
return TRUE;
cinvalid = hdc->hwnd->cinvalid;
@ -390,7 +394,7 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
new_cnt = hdc->hwnd->count * 2;
new_rgn = (HGDI_RGN) realloc(cinvalid, sizeof(GDI_RGN) * new_cnt);
if (!new_rgn)
return -1;
return FALSE;
hdc->hwnd->count = new_cnt;
cinvalid = new_rgn;
}
@ -407,7 +411,7 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
invalid->w = w;
invalid->h = h;
invalid->null = 0;
return 0;
return TRUE;
}
gdi_CRgnToRect(x, y, w, h, &rgn);
@ -433,5 +437,5 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
gdi_RectToRgn(&inv, invalid);
return 0;
return TRUE;
}

View File

@ -221,6 +221,8 @@ int test_gdi_CreateRect(void)
int y2 = 256;
HGDI_RECT hRect = gdi_CreateRect(x1, y1, x2, y2);
if (!hRect)
return -1;
if (hRect->objectType != GDIOBJECT_RECT)
return -1;

View File

@ -555,12 +555,13 @@ BOOL tf_peer_activate(freerdp_peer* client)
return TRUE;
}
void tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
BOOL tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
WLog_DBG(TAG, "Client sent a synchronize event (flags:0x%X)", flags);
return TRUE;
}
void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
freerdp_peer* client = input->context->peer;
rdpUpdate* update = client->update;
@ -613,25 +614,29 @@ void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
}
return TRUE;
}
void tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
WLog_DBG(TAG, "Client sent a unicode keyboard event (flags:0x%X code:0x%X)", flags, code);
return TRUE;
}
void tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//WLog_DBG(TAG, "Client sent a mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
test_peer_draw_icon(input->context->peer, x + 10, y);
return TRUE;
}
void tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//WLog_DBG(TAG, "Client sent an extended mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
return TRUE;
}
static void tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
BYTE i;
WLog_DBG(TAG, "Client requested to refresh:");
@ -640,9 +645,10 @@ static void tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16*
{
WLog_DBG(TAG, " (%d, %d) (%d, %d)", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
}
return TRUE;
}
static void tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
static BOOL tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
{
if (allow > 0)
{
@ -652,6 +658,7 @@ static void tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_1
{
WLog_DBG(TAG, "Client minimized and suppress output.");
}
return TRUE;
}
static void* test_peer_mainloop(void* arg)

View File

@ -42,7 +42,7 @@ void shw_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnec
WLog_INFO(TAG, "OnChannelDisconnected: %s", e->name);
}
void shw_begin_paint(rdpContext* context)
BOOL shw_begin_paint(rdpContext* context)
{
shwContext* shw;
rdpGdi* gdi = context->gdi;
@ -51,9 +51,10 @@ void shw_begin_paint(rdpContext* context)
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
}
void shw_end_paint(rdpContext* context)
BOOL shw_end_paint(rdpContext* context)
{
int index;
int ninvalid;
@ -79,16 +80,18 @@ void shw_end_paint(rdpContext* context)
SetEvent(subsystem->RdpUpdateEnterEvent);
WaitForSingleObject(subsystem->RdpUpdateLeaveEvent, INFINITE);
ResetEvent(subsystem->RdpUpdateLeaveEvent);
return TRUE;
}
void shw_desktop_resize(rdpContext* context)
BOOL shw_desktop_resize(rdpContext* context)
{
return TRUE;
}
void shw_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
BOOL shw_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
shwContext* shw = (shwContext*) context;
return TRUE;
}
BOOL shw_authenticate(freerdp* instance, char** username, char** password, char** domain)
@ -249,9 +252,9 @@ void* shw_client_thread(void* arg)
* Client Interface
*/
void shw_freerdp_client_global_init(void)
BOOL shw_freerdp_client_global_init(void)
{
return TRUE;
}
void shw_freerdp_client_global_uninit(void)

View File

@ -22,49 +22,52 @@
#include "shadow.h"
void shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
{
rdpShadowClient* client = (rdpShadowClient*) input->context;
rdpShadowSubsystem* subsystem = client->server->subsystem;
if (!client->mayInteract)
return;
return TRUE;
if (subsystem->SynchronizeEvent)
{
subsystem->SynchronizeEvent(subsystem, flags);
}
return TRUE;
}
void shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
rdpShadowClient* client = (rdpShadowClient*) input->context;
rdpShadowSubsystem* subsystem = client->server->subsystem;
if (!client->mayInteract)
return;
return TRUE;
if (subsystem->KeyboardEvent)
{
subsystem->KeyboardEvent(subsystem, flags, code);
}
return TRUE;
}
void shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
rdpShadowClient* client = (rdpShadowClient*) input->context;
rdpShadowSubsystem* subsystem = client->server->subsystem;
if (!client->mayInteract)
return;
return TRUE;
if (subsystem->UnicodeKeyboardEvent)
{
subsystem->UnicodeKeyboardEvent(subsystem, flags, code);
}
return TRUE;
}
void shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
rdpShadowClient* client = (rdpShadowClient*) input->context;
rdpShadowSubsystem* subsystem = client->server->subsystem;
@ -80,20 +83,21 @@ void shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
flags &= ~PTR_FLAGS_MOVE;
if (!(flags & (PTR_FLAGS_BUTTON1 | PTR_FLAGS_BUTTON2 | PTR_FLAGS_BUTTON3)))
return;
return TRUE;
}
}
if (!client->mayInteract)
return;
return TRUE;
if (subsystem->MouseEvent)
{
subsystem->MouseEvent(subsystem, flags, x, y);
}
return TRUE;
}
void shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
rdpShadowClient* client = (rdpShadowClient*) input->context;
rdpShadowSubsystem* subsystem = client->server->subsystem;
@ -102,12 +106,13 @@ void shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
client->pointerY = y;
if (!client->mayInteract)
return;
return TRUE;
if (subsystem->ExtendedMouseEvent)
{
subsystem->ExtendedMouseEvent(subsystem, flags, x, y);
}
return TRUE;
}
void shadow_input_register_callbacks(rdpInput* input)

View File

@ -224,7 +224,7 @@ fail:
} while (0)
static BOOL TestStream_Reading()
static BOOL TestStream_Reading(void)
{
BYTE src[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
@ -263,7 +263,7 @@ int TestStream(int argc, char* argv[])
if (!TestStream_Extent(4096))
return 3;
if (!TestStream_Reading(4096))
if (!TestStream_Reading())
return 4;
/**