Added option to disable graphics decoding in client code path

This commit is contained in:
akallabeth
2021-09-17 08:59:10 +02:00
committed by akallabeth
parent ab0f3bb4ff
commit 1ca7e1f7a0
19 changed files with 352 additions and 178 deletions

View File

@@ -228,12 +228,11 @@ out_free:
static DWORD WINAPI rdpsnd_server_thread(LPVOID arg)
{
DWORD nCount, status;
HANDLE events[8];
RdpsndServerContext* context;
DWORD nCount = 0, status;
HANDLE events[4] = { 0 };
RdpsndServerContext* context = (RdpsndServerContext*)arg;
UINT error = CHANNEL_RC_OK;
context = (RdpsndServerContext*)arg;
nCount = 0;
WINPR_ASSERT(context);
events[nCount++] = context->priv->channelEvent;
events[nCount++] = context->priv->StopEvent;
@@ -762,6 +761,8 @@ out_close:
static UINT rdpsnd_server_stop(RdpsndServerContext* context)
{
UINT error = CHANNEL_RC_OK;
if (!context->priv->StopEvent)
return error;
if (context->priv->ownThread)
{
@@ -778,13 +779,24 @@ static UINT rdpsnd_server_stop(RdpsndServerContext* context)
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
context->priv->Thread = NULL;
context->priv->StopEvent = NULL;
}
}
DeleteCriticalSection(&context->priv->lock);
if (context->priv->rdpsnd_pdu)
{
Stream_Free(context->priv->rdpsnd_pdu, TRUE);
context->priv->rdpsnd_pdu = NULL;
}
if (context->priv->ChannelHandle)
{
WTSVirtualChannelClose(context->priv->ChannelHandle);
context->priv->ChannelHandle = NULL;
}
return error;
}
@@ -859,8 +871,7 @@ void rdpsnd_server_context_free(RdpsndServerContext* context)
if (!context)
return;
if (context->priv->ChannelHandle)
WTSVirtualChannelClose(context->priv->ChannelHandle);
rdpsnd_server_stop(context);
free(context->priv->out_buffer);

View File

@@ -22,6 +22,7 @@
#include "config.h"
#endif
#include <winpr/assert.h>
#include <freerdp/gdi/gfx.h>
#include <freerdp/client/rdpei.h>
@@ -66,23 +67,35 @@ static void tf_encomsp_uninit(tfContext* tf, EncomspClientContext* encomsp)
tf->encomsp = NULL;
}
static UINT tf_update_surfaces(RdpgfxClientContext* context)
{
WINPR_UNUSED(context);
return CHANNEL_RC_OK;
}
void tf_OnChannelConnectedEventHandler(void* context, ChannelConnectedEventArgs* e)
{
tfContext* tf = (tfContext*)context;
WINPR_ASSERT(tf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
tf->rdpei = (RdpeiClientContext*)e->pInterface;
}
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_init(tf->context.gdi, (RdpgfxClientContext*)e->pInterface);
RdpgfxClientContext* gfx = (RdpgfxClientContext*)e->pInterface;
gdi_graphics_pipeline_init(tf->context.gdi, gfx);
}
else if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
CliprdrClientContext* clip = (CliprdrClientContext*)e->pInterface;
WINPR_ASSERT(clip);
clip->custom = context;
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
@@ -94,6 +107,8 @@ void tf_OnChannelDisconnectedEventHandler(void* context, ChannelDisconnectedEven
{
tfContext* tf = (tfContext*)context;
WINPR_ASSERT(tf);
WINPR_ASSERT(e);
if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
tf->rdpei = NULL;
@@ -107,6 +122,9 @@ void tf_OnChannelDisconnectedEventHandler(void* context, ChannelDisconnectedEven
}
else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
CliprdrClientContext* clip = (CliprdrClientContext*)e->pInterface;
WINPR_ASSERT(clip);
clip->custom = NULL;
}
else if (strcmp(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{

View File

@@ -180,6 +180,11 @@ static BOOL tf_post_connect(freerdp* instance)
if (!gdi_init(instance, PIXEL_FORMAT_XRGB32))
return FALSE;
/* With this setting we disable all graphics processing in the library.
*
* This allows low resource (client) protocol parsing.
*/
freerdp_settings_set_bool(instance->settings, FreeRDP_DeactivateClientDecoding, TRUE);
instance->update->BeginPaint = tf_begin_paint;
instance->update->EndPaint = tf_end_paint;
instance->update->PlaySound = tf_play_sound;

View File

@@ -292,12 +292,12 @@ extern "C"
ALIGN64 rdpCache* cache; /* 35 */
ALIGN64 rdpChannels* channels; /* 36 */
ALIGN64 rdpGraphics* graphics; /* 37 */
ALIGN64 rdpInput* input; /* 38 */
ALIGN64 rdpUpdate* update; /* 39 */
ALIGN64 rdpSettings* settings; /* 40 */
ALIGN64 rdpInput* input; /* 38 owned by rdpRdp */
ALIGN64 rdpUpdate* update; /* 39 owned by rdpRdp */
ALIGN64 rdpSettings* settings; /* 40 owned by rdpRdp */
ALIGN64 rdpMetrics* metrics; /* 41 */
ALIGN64 rdpCodecs* codecs; /* 42 */
ALIGN64 rdpAutoDetect* autodetect; /* 43 */
ALIGN64 rdpAutoDetect* autodetect; /* 43 owned by rdpRdp */
ALIGN64 HANDLE abortEvent; /* 44 */
ALIGN64 int disconnectUltimatum; /* 45 */
UINT64 paddingC[64 - 46]; /* 46 */
@@ -346,22 +346,24 @@ extern "C"
UINT64 paddingA[16 - 2]; /* 2 */
ALIGN64 rdpInput* input; /* (offset 16)
Input handle for the connection.
Will be initialized by a call to freerdp_context_new() */
ALIGN64 rdpUpdate*
update; /* (offset 17)
Update display parameters. Used to register display events callbacks and settings.
Will be initialized by a call to freerdp_context_new() */
ALIGN64 rdpInput* input; /* (offset 16)
Input handle for the connection.
Will be initialized by a call to freerdp_context_new()
owned by rdpRdp */
ALIGN64 rdpUpdate* update; /* (offset 17)
Update display parameters. Used to register display events callbacks
and settings. Will be initialized by a call to freerdp_context_new() owned by rdpRdp */
ALIGN64 rdpSettings* settings; /**< (offset 18)
Pointer to a rdpSettings structure. Will be used to maintain the
required RDP settings. Will be
initialized by a call to freerdp_context_new()
owned by rdpRdp
*/
ALIGN64 rdpAutoDetect* autodetect; /* (offset 19)
Auto-Detect handle for the connection.
Will be initialized by a call to freerdp_context_new() */
ALIGN64 rdpHeartbeat* heartbeat; /* (offset 21) */
Will be initialized by a call to freerdp_context_new()
owned by rdpRdp */
ALIGN64 rdpHeartbeat* heartbeat; /* (offset 21) owned by rdpRdp*/
UINT64 paddingB[32 - 21]; /* 21 */

View File

@@ -94,7 +94,7 @@ struct p_client_context
BOOL connected; /* Set after client post_connect. */
pReceiveChannelData client_receive_channel_data_original;
wArrayList* cached_server_channel_data;
wQueue* cached_server_channel_data;
BOOL (*sendChannelData)(pClientContext* pc, const proxyChannelDataEventInfo* ev);
/* X509 specific */

View File

@@ -741,6 +741,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_PlayRemoteFx (1857)
#define FreeRDP_DumpRemoteFxFile (1858)
#define FreeRDP_PlayRemoteFxFile (1859)
#define FreeRDP_DeactivateClientDecoding (1863)
#define FreeRDP_GatewayUsageMethod (1984)
#define FreeRDP_GatewayPort (1985)
#define FreeRDP_GatewayHostname (1986)
@@ -1246,7 +1247,9 @@ struct rdp_settings
ALIGN64 BOOL PlayRemoteFx; /* 1857 */
ALIGN64 char* DumpRemoteFxFile; /* 1858 */
ALIGN64 char* PlayRemoteFxFile; /* 1859 */
UINT64 padding1920[1920 - 1860]; /* 1860 */
UINT64 padding1860[1863 - 1860]; /* 1860 */
ALIGN64 BOOL DeactivateClientDecoding; /* 1863 */
UINT64 padding1920[1920 - 1864]; /* 1864 */
UINT64 padding1984[1984 - 1920]; /* 1920 */
/**

View File

@@ -270,14 +270,17 @@ void bitmap_cache_register_callbacks(rdpUpdate* update)
cache = update->context->cache;
WINPR_ASSERT(cache);
cache->bitmap->MemBlt = update->primary->MemBlt;
cache->bitmap->Mem3Blt = update->primary->Mem3Blt;
update->primary->MemBlt = update_gdi_memblt;
update->primary->Mem3Blt = update_gdi_mem3blt;
update->secondary->CacheBitmap = update_gdi_cache_bitmap;
update->secondary->CacheBitmapV2 = update_gdi_cache_bitmap_v2;
update->secondary->CacheBitmapV3 = update_gdi_cache_bitmap_v3;
update->BitmapUpdate = gdi_bitmap_update;
if (!freerdp_settings_get_bool(update->context->settings, FreeRDP_DeactivateClientDecoding))
{
cache->bitmap->MemBlt = update->primary->MemBlt;
cache->bitmap->Mem3Blt = update->primary->Mem3Blt;
update->primary->MemBlt = update_gdi_memblt;
update->primary->Mem3Blt = update_gdi_mem3blt;
update->secondary->CacheBitmap = update_gdi_cache_bitmap;
update->secondary->CacheBitmapV2 = update_gdi_cache_bitmap_v2;
update->secondary->CacheBitmapV3 = update_gdi_cache_bitmap_v3;
update->BitmapUpdate = gdi_bitmap_update;
}
}
rdpBitmapCache* bitmap_cache_new(rdpContext* context)

View File

@@ -229,24 +229,25 @@ void brush_cache_put(rdpBrushCache* brushCache, UINT32 index, void* entry, UINT3
void brush_cache_register_callbacks(rdpUpdate* update)
{
rdpCache* cache;
WINPR_ASSERT(update);
WINPR_ASSERT(update->context);
WINPR_ASSERT(update->primary);
WINPR_ASSERT(update->secondary);
cache = update->context->cache;
WINPR_ASSERT(cache);
WINPR_ASSERT(cache->brush);
if (!freerdp_settings_get_bool(update->context->settings, FreeRDP_DeactivateClientDecoding))
{
rdpCache* cache = update->context->cache;
WINPR_ASSERT(cache);
WINPR_ASSERT(cache->brush);
cache->brush->PatBlt = update->primary->PatBlt;
cache->brush->PolygonSC = update->primary->PolygonSC;
cache->brush->PolygonCB = update->primary->PolygonCB;
update->primary->PatBlt = update_gdi_patblt;
update->primary->PolygonSC = update_gdi_polygon_sc;
update->primary->PolygonCB = update_gdi_polygon_cb;
update->secondary->CacheBrush = update_gdi_cache_brush;
cache->brush->PatBlt = update->primary->PatBlt;
cache->brush->PolygonSC = update->primary->PolygonSC;
cache->brush->PolygonCB = update->primary->PolygonCB;
update->primary->PatBlt = update_gdi_patblt;
update->primary->PolygonSC = update_gdi_polygon_sc;
update->primary->PolygonCB = update_gdi_polygon_cb;
update->secondary->CacheBrush = update_gdi_cache_brush;
}
}
rdpBrushCache* brush_cache_new(rdpContext* context)

View File

@@ -668,11 +668,14 @@ void glyph_cache_register_callbacks(rdpUpdate* update)
WINPR_ASSERT(update->primary);
WINPR_ASSERT(update->secondary);
update->primary->GlyphIndex = update_gdi_glyph_index;
update->primary->FastIndex = update_gdi_fast_index;
update->primary->FastGlyph = update_gdi_fast_glyph;
update->secondary->CacheGlyph = update_gdi_cache_glyph;
update->secondary->CacheGlyphV2 = update_gdi_cache_glyph_v2;
if (!freerdp_settings_get_bool(update->context->settings, FreeRDP_DeactivateClientDecoding))
{
update->primary->GlyphIndex = update_gdi_glyph_index;
update->primary->FastIndex = update_gdi_fast_index;
update->primary->FastGlyph = update_gdi_fast_glyph;
update->secondary->CacheGlyph = update_gdi_cache_glyph;
update->secondary->CacheGlyphV2 = update_gdi_cache_glyph_v2;
}
}
rdpGlyphCache* glyph_cache_new(rdpContext* context)

View File

@@ -109,22 +109,24 @@ static BOOL upate_pointer_copy_andxor(rdpPointer* pointer, const BYTE* andMaskDa
WINPR_ASSERT(pointer);
if (lengthAndMask && andMaskData)
{
BYTE* tmp;
pointer->lengthAndMask = lengthAndMask;
pointer->andMaskData = (BYTE*)malloc(lengthAndMask);
if (!pointer->andMaskData)
tmp = (BYTE*)realloc(pointer->andMaskData, lengthAndMask);
if (!tmp)
return FALSE;
pointer->andMaskData = tmp;
CopyMemory(pointer->andMaskData, andMaskData, lengthAndMask);
}
if (lengthXorMask && xorMaskData)
{
BYTE* tmp;
pointer->lengthXorMask = lengthXorMask;
pointer->xorMaskData = (BYTE*)malloc(lengthXorMask);
if (!pointer->xorMaskData)
tmp = (BYTE*)realloc(pointer->xorMaskData, lengthXorMask);
if (!tmp)
return FALSE;
pointer->xorMaskData = tmp;
CopyMemory(pointer->xorMaskData, xorMaskData, lengthXorMask);
}
@@ -145,29 +147,29 @@ static BOOL update_pointer_color(rdpContext* context, const POINTER_COLOR_UPDATE
pointer = Pointer_Alloc(context);
if (pointer != NULL)
{
pointer->xorBpp = 24;
pointer->xPos = pointer_color->xPos;
pointer->yPos = pointer_color->yPos;
pointer->width = pointer_color->width;
pointer->height = pointer_color->height;
if (pointer == NULL)
return FALSE;
pointer->xorBpp = 24;
pointer->xPos = pointer_color->xPos;
pointer->yPos = pointer_color->yPos;
pointer->width = pointer_color->width;
pointer->height = pointer_color->height;
if (!upate_pointer_copy_andxor(pointer, pointer_color->andMaskData,
pointer_color->lengthAndMask, pointer_color->xorMaskData,
pointer_color->lengthXorMask))
goto out_fail;
if (!upate_pointer_copy_andxor(pointer, pointer_color->andMaskData,
pointer_color->lengthAndMask, pointer_color->xorMaskData,
pointer_color->lengthXorMask))
goto out_fail;
if (!IFCALLRESULT(TRUE, pointer->New, context, pointer))
goto out_fail;
if (!IFCALLRESULT(TRUE, pointer->New, context, pointer))
goto out_fail;
if (!pointer_cache_put(cache->pointer, pointer_color->cacheIndex, pointer))
goto out_fail;
if (!pointer_cache_put(cache->pointer, pointer_color->cacheIndex, pointer))
goto out_fail;
return IFCALLRESULT(TRUE, pointer->Set, context, pointer);
}
if (!IFCALLRESULT(TRUE, pointer->Set, context, pointer))
goto out_fail;
return FALSE;
return TRUE;
out_fail:
pointer_free(context, pointer);
return FALSE;
@@ -185,29 +187,29 @@ static BOOL update_pointer_large(rdpContext* context, const POINTER_LARGE_UPDATE
WINPR_ASSERT(cache);
pointer = Pointer_Alloc(context);
if (pointer != NULL)
{
pointer->xorBpp = pointer_large->xorBpp;
pointer->xPos = pointer_large->hotSpotX;
pointer->yPos = pointer_large->hotSpotY;
pointer->width = pointer_large->width;
pointer->height = pointer_large->height;
if (pointer == NULL)
return FALSE;
pointer->xorBpp = pointer_large->xorBpp;
pointer->xPos = pointer_large->hotSpotX;
pointer->yPos = pointer_large->hotSpotY;
pointer->width = pointer_large->width;
pointer->height = pointer_large->height;
if (!upate_pointer_copy_andxor(pointer, pointer_large->andMaskData,
pointer_large->lengthAndMask, pointer_large->xorMaskData,
pointer_large->lengthXorMask))
goto out_fail;
if (!upate_pointer_copy_andxor(pointer, pointer_large->andMaskData,
pointer_large->lengthAndMask, pointer_large->xorMaskData,
pointer_large->lengthXorMask))
goto out_fail;
if (!IFCALLRESULT(TRUE, pointer->New, context, pointer))
goto out_fail;
if (!IFCALLRESULT(TRUE, pointer->New, context, pointer))
goto out_fail;
if (!pointer_cache_put(cache->pointer, pointer_large->cacheIndex, pointer))
goto out_fail;
if (!pointer_cache_put(cache->pointer, pointer_large->cacheIndex, pointer))
goto out_fail;
return IFCALLRESULT(TRUE, pointer->Set, context, pointer);
}
if (!IFCALLRESULT(TRUE, pointer->Set, context, pointer))
goto out_fail;
return FALSE;
return TRUE;
out_fail:
pointer_free(context, pointer);
return FALSE;
@@ -243,7 +245,9 @@ static BOOL update_pointer_new(rdpContext* context, const POINTER_NEW_UPDATE* po
if (!pointer_cache_put(cache->pointer, pointer_new->colorPtrAttr.cacheIndex, pointer))
goto out_fail;
return IFCALLRESULT(TRUE, pointer->Set, context, pointer);
if (!IFCALLRESULT(TRUE, pointer->Set, context, pointer))
goto out_fail;
return TRUE;
out_fail:
pointer_free(context, pointer);
return FALSE;
@@ -314,12 +318,15 @@ void pointer_cache_register_callbacks(rdpUpdate* update)
pointer = update->pointer;
WINPR_ASSERT(pointer);
pointer->PointerPosition = update_pointer_position;
pointer->PointerSystem = update_pointer_system;
pointer->PointerColor = update_pointer_color;
pointer->PointerLarge = update_pointer_large;
pointer->PointerNew = update_pointer_new;
pointer->PointerCached = update_pointer_cached;
if (!freerdp_settings_get_bool(update->context->settings, FreeRDP_DeactivateClientDecoding))
{
pointer->PointerPosition = update_pointer_position;
pointer->PointerSystem = update_pointer_system;
pointer->PointerColor = update_pointer_color;
pointer->PointerLarge = update_pointer_large;
pointer->PointerNew = update_pointer_new;
pointer->PointerCached = update_pointer_cached;
}
}
rdpPointerCache* pointer_cache_new(rdpContext* context)

View File

@@ -105,6 +105,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_CredentialsFromStdin:
return settings->CredentialsFromStdin;
case FreeRDP_DeactivateClientDecoding:
return settings->DeactivateClientDecoding;
case FreeRDP_Decorations:
return settings->Decorations;
@@ -650,6 +653,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->CredentialsFromStdin = val;
break;
case FreeRDP_DeactivateClientDecoding:
settings->DeactivateClientDecoding = val;
break;
case FreeRDP_Decorations:
settings->Decorations = val;
break;

View File

@@ -40,6 +40,7 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_CompressionEnabled, 0, "FreeRDP_CompressionEnabled" },
{ FreeRDP_ConsoleSession, 0, "FreeRDP_ConsoleSession" },
{ FreeRDP_CredentialsFromStdin, 0, "FreeRDP_CredentialsFromStdin" },
{ FreeRDP_DeactivateClientDecoding, 0, "FreeRDP_DeactivateClientDecoding" },
{ FreeRDP_Decorations, 0, "FreeRDP_Decorations" },
{ FreeRDP_DesktopResize, 0, "FreeRDP_DesktopResize" },
{ FreeRDP_DeviceRedirection, 0, "FreeRDP_DeviceRedirection" },

View File

@@ -195,14 +195,19 @@ static BOOL rdp_client_reset_codecs(rdpContext* context)
return FALSE;
settings = context->settings;
context->codecs = codecs_new(context);
if (!context->codecs)
return FALSE;
if (!freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
{
codecs_free(context->codecs);
context->codecs = codecs_new(context);
if (!freerdp_client_codecs_prepare(context->codecs, freerdp_settings_get_codecs_flags(settings),
settings->DesktopWidth, settings->DesktopHeight))
return FALSE;
if (!context->codecs)
return FALSE;
if (!freerdp_client_codecs_prepare(context->codecs,
freerdp_settings_get_codecs_flags(settings),
settings->DesktopWidth, settings->DesktopHeight))
return FALSE;
/* Runtime H264 detection. (only available if dynamic backend loading is defined)
* If no backend is available disable it before the channel is loaded.
@@ -215,6 +220,8 @@ static BOOL rdp_client_reset_codecs(rdpContext* context)
settings->GfxAVC444v2 = FALSE;
}
#endif
}
return TRUE;
}
@@ -229,12 +236,17 @@ BOOL rdp_client_connect(rdpRdp* rdp)
{
UINT32 SelectedProtocol;
BOOL status;
rdpSettings* settings = rdp->settings;
rdpSettings* settings;
/* make sure SSL is initialize for earlier enough for crypto, by taking advantage of winpr SSL
* FIPS flag for openssl initialization */
DWORD flags = WINPR_SSL_INIT_DEFAULT;
UINT32 timeout;
WINPR_ASSERT(rdp);
settings = rdp->settings;
WINPR_ASSERT(settings);
if (!rdp_client_reset_codecs(rdp->context))
return FALSE;
@@ -388,8 +400,11 @@ BOOL rdp_client_disconnect(rdpRdp* rdp)
context = rdp->context;
if (!nego_disconnect(rdp->nego))
return FALSE;
if (rdp->nego)
{
if (!nego_disconnect(rdp->nego))
return FALSE;
}
if (!rdp_reset(rdp))
return FALSE;
@@ -411,7 +426,11 @@ BOOL rdp_client_disconnect_and_clear(rdpRdp* rdp)
if (!rdp_client_disconnect(rdp))
return FALSE;
WINPR_ASSERT(rdp);
context = rdp->context;
WINPR_ASSERT(context);
context->LastError = FREERDP_ERROR_SUCCESS;
clearChannelError(context);
ResetEvent(context->abortEvent);
@@ -523,17 +542,17 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
BOOL status;
rdpSettings* settings;
if (!rdp || !rdp->settings)
return FALSE;
settings = rdp->settings;
if (!rdp_client_disconnect_and_clear(rdp))
return FALSE;
if (rdp_redirection_apply_settings(rdp) != 0)
return FALSE;
WINPR_ASSERT(rdp);
settings = rdp->settings;
WINPR_ASSERT(settings);
if (settings->RedirectionFlags & LB_LOAD_BALANCE_INFO)
{
if (settings->LoadBalanceInfo && (settings->LoadBalanceInfoLength > 0))
@@ -597,9 +616,6 @@ BOOL rdp_client_reconnect(rdpRdp* rdp)
{
BOOL status;
if (!rdp || !rdp->context || !rdp->context->channels)
return FALSE;
if (!rdp_client_disconnect_and_clear(rdp))
return FALSE;
@@ -1179,8 +1195,18 @@ BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s)
UINT32 SelectedProtocol = 0;
UINT32 RequestedProtocols;
BOOL status;
rdpSettings* settings = rdp->settings;
rdpNego* nego = rdp->nego;
rdpSettings* settings;
rdpNego* nego;
WINPR_ASSERT(rdp);
WINPR_ASSERT(s);
settings = rdp->settings;
WINPR_ASSERT(settings);
nego = rdp->nego;
WINPR_ASSERT(nego);
transport_set_blocking_mode(rdp->transport, TRUE);
if (!nego_read_request(nego, s))

View File

@@ -267,6 +267,7 @@ static BOOL fastpath_recv_update_common(rdpFastPath* fastpath, wStream* s)
UINT16 updateType;
rdpUpdate* update;
rdpContext* context;
BOOL defaultReturn;
if (!fastpath || !s || !fastpath->rdp)
return FALSE;
@@ -278,6 +279,8 @@ static BOOL fastpath_recv_update_common(rdpFastPath* fastpath, wStream* s)
context = update->context;
defaultReturn = freerdp_settings_get_bool(context->settings, FreeRDP_DeactivateClientDecoding);
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
@@ -291,7 +294,7 @@ static BOOL fastpath_recv_update_common(rdpFastPath* fastpath, wStream* s)
if (!bitmap_update)
return FALSE;
rc = IFCALLRESULT(FALSE, update->BitmapUpdate, context, bitmap_update);
rc = IFCALLRESULT(defaultReturn, update->BitmapUpdate, context, bitmap_update);
free_bitmap_update(context, bitmap_update);
}
break;
@@ -303,7 +306,7 @@ static BOOL fastpath_recv_update_common(rdpFastPath* fastpath, wStream* s)
if (!palette_update)
return FALSE;
rc = IFCALLRESULT(FALSE, update->Palette, context, palette_update);
rc = IFCALLRESULT(defaultReturn, update->Palette, context, palette_update);
free_palette_update(context, palette_update);
}
break;
@@ -333,6 +336,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
rdpUpdate* update;
rdpContext* context;
rdpPointerUpdate* pointer;
BOOL defaultReturn;
if (!fastpath || !fastpath->rdp || !s)
return -1;
@@ -353,6 +357,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
fastpath_update_to_string(updateCode), updateCode, Stream_GetRemainingLength(s));
#endif
defaultReturn = freerdp_settings_get_bool(context->settings, FreeRDP_DeactivateClientDecoding);
switch (updateCode)
{
case FASTPATH_UPDATETYPE_ORDERS:
@@ -381,7 +386,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
{
POINTER_SYSTEM_UPDATE pointer_system;
pointer_system.type = SYSPTR_NULL;
rc = IFCALLRESULT(FALSE, pointer->PointerSystem, context, &pointer_system);
rc = IFCALLRESULT(defaultReturn, pointer->PointerSystem, context, &pointer_system);
}
break;
@@ -389,7 +394,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
{
POINTER_SYSTEM_UPDATE pointer_system;
pointer_system.type = SYSPTR_DEFAULT;
rc = IFCALLRESULT(FALSE, pointer->PointerSystem, context, &pointer_system);
rc = IFCALLRESULT(defaultReturn, pointer->PointerSystem, context, &pointer_system);
}
break;
@@ -399,7 +404,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
if (pointer_position)
{
rc = IFCALLRESULT(FALSE, pointer->PointerPosition, context, pointer_position);
rc = IFCALLRESULT(defaultReturn, pointer->PointerPosition, context,
pointer_position);
free_pointer_position_update(context, pointer_position);
}
}
@@ -411,7 +417,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
if (pointer_color)
{
rc = IFCALLRESULT(FALSE, pointer->PointerColor, context, pointer_color);
rc = IFCALLRESULT(defaultReturn, pointer->PointerColor, context, pointer_color);
free_pointer_color_update(context, pointer_color);
}
}
@@ -423,7 +429,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
if (pointer_cached)
{
rc = IFCALLRESULT(FALSE, pointer->PointerCached, context, pointer_cached);
rc = IFCALLRESULT(defaultReturn, pointer->PointerCached, context, pointer_cached);
free_pointer_cached_update(context, pointer_cached);
}
}
@@ -435,7 +441,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
if (pointer_new)
{
rc = IFCALLRESULT(FALSE, pointer->PointerNew, context, pointer_new);
rc = IFCALLRESULT(defaultReturn, pointer->PointerNew, context, pointer_new);
free_pointer_new_update(context, pointer_new);
}
}
@@ -447,7 +453,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
if (pointer_large)
{
rc = IFCALLRESULT(FALSE, pointer->PointerLarge, context, pointer_large);
rc = IFCALLRESULT(defaultReturn, pointer->PointerLarge, context, pointer_large);
free_pointer_large_update(context, pointer_large);
}
}

View File

@@ -3415,6 +3415,9 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
ORDER_INFO* orderInfo = &(primary->order_info);
rdpSettings* settings = context->settings;
const char* orderName;
BOOL defaultReturn;
defaultReturn = freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding);
if (flags & ORDER_TYPE_CHANGE)
{
@@ -3454,7 +3457,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
}
}
rc = IFCALLRESULT(FALSE, update->SetBounds, context, &orderInfo->bounds);
rc = IFCALLRESULT(defaultReturn, update->SetBounds, context, &orderInfo->bounds);
if (!rc)
return FALSE;
@@ -3476,7 +3479,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->dstblt.bRop),
gdi_rop3_code(primary->dstblt.bRop));
rc = IFCALLRESULT(FALSE, primary->DstBlt, context, &primary->dstblt);
rc = IFCALLRESULT(defaultReturn, primary->DstBlt, context, &primary->dstblt);
}
break;
@@ -3485,7 +3488,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->patblt.bRop),
gdi_rop3_code(primary->patblt.bRop));
rc = IFCALLRESULT(FALSE, primary->PatBlt, context, &primary->patblt);
rc = IFCALLRESULT(defaultReturn, primary->PatBlt, context, &primary->patblt);
}
break;
@@ -3494,21 +3497,22 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->scrblt.bRop),
gdi_rop3_code(primary->scrblt.bRop));
rc = IFCALLRESULT(FALSE, primary->ScrBlt, context, &primary->scrblt);
rc = IFCALLRESULT(defaultReturn, primary->ScrBlt, context, &primary->scrblt);
}
break;
case ORDER_TYPE_OPAQUE_RECT:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->OpaqueRect, context, &primary->opaque_rect);
rc = IFCALLRESULT(defaultReturn, primary->OpaqueRect, context, &primary->opaque_rect);
}
break;
case ORDER_TYPE_DRAW_NINE_GRID:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->DrawNineGrid, context, &primary->draw_nine_grid);
rc = IFCALLRESULT(defaultReturn, primary->DrawNineGrid, context,
&primary->draw_nine_grid);
}
break;
@@ -3517,7 +3521,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->multi_dstblt.bRop),
gdi_rop3_code(primary->multi_dstblt.bRop));
rc = IFCALLRESULT(FALSE, primary->MultiDstBlt, context, &primary->multi_dstblt);
rc = IFCALLRESULT(defaultReturn, primary->MultiDstBlt, context, &primary->multi_dstblt);
}
break;
@@ -3526,7 +3530,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->multi_patblt.bRop),
gdi_rop3_code(primary->multi_patblt.bRop));
rc = IFCALLRESULT(FALSE, primary->MultiPatBlt, context, &primary->multi_patblt);
rc = IFCALLRESULT(defaultReturn, primary->MultiPatBlt, context, &primary->multi_patblt);
}
break;
@@ -3535,22 +3539,22 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->multi_scrblt.bRop),
gdi_rop3_code(primary->multi_scrblt.bRop));
rc = IFCALLRESULT(FALSE, primary->MultiScrBlt, context, &primary->multi_scrblt);
rc = IFCALLRESULT(defaultReturn, primary->MultiScrBlt, context, &primary->multi_scrblt);
}
break;
case ORDER_TYPE_MULTI_OPAQUE_RECT:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc =
IFCALLRESULT(FALSE, primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
rc = IFCALLRESULT(defaultReturn, primary->MultiOpaqueRect, context,
&primary->multi_opaque_rect);
}
break;
case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->MultiDrawNineGrid, context,
rc = IFCALLRESULT(defaultReturn, primary->MultiDrawNineGrid, context,
&primary->multi_draw_nine_grid);
}
break;
@@ -3558,14 +3562,14 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_LINE_TO:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->LineTo, context, &primary->line_to);
rc = IFCALLRESULT(defaultReturn, primary->LineTo, context, &primary->line_to);
}
break;
case ORDER_TYPE_POLYLINE:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->Polyline, context, &primary->polyline);
rc = IFCALLRESULT(defaultReturn, primary->Polyline, context, &primary->polyline);
}
break;
@@ -3574,7 +3578,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->memblt.bRop),
gdi_rop3_code(primary->memblt.bRop));
rc = IFCALLRESULT(FALSE, primary->MemBlt, context, &primary->memblt);
rc = IFCALLRESULT(defaultReturn, primary->MemBlt, context, &primary->memblt);
}
break;
@@ -3583,63 +3587,63 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
orderName, gdi_rop3_code_string(primary->mem3blt.bRop),
gdi_rop3_code(primary->mem3blt.bRop));
rc = IFCALLRESULT(FALSE, primary->Mem3Blt, context, &primary->mem3blt);
rc = IFCALLRESULT(defaultReturn, primary->Mem3Blt, context, &primary->mem3blt);
}
break;
case ORDER_TYPE_SAVE_BITMAP:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->SaveBitmap, context, &primary->save_bitmap);
rc = IFCALLRESULT(defaultReturn, primary->SaveBitmap, context, &primary->save_bitmap);
}
break;
case ORDER_TYPE_GLYPH_INDEX:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->GlyphIndex, context, &primary->glyph_index);
rc = IFCALLRESULT(defaultReturn, primary->GlyphIndex, context, &primary->glyph_index);
}
break;
case ORDER_TYPE_FAST_INDEX:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->FastIndex, context, &primary->fast_index);
rc = IFCALLRESULT(defaultReturn, primary->FastIndex, context, &primary->fast_index);
}
break;
case ORDER_TYPE_FAST_GLYPH:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->FastGlyph, context, &primary->fast_glyph);
rc = IFCALLRESULT(defaultReturn, primary->FastGlyph, context, &primary->fast_glyph);
}
break;
case ORDER_TYPE_POLYGON_SC:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->PolygonSC, context, &primary->polygon_sc);
rc = IFCALLRESULT(defaultReturn, primary->PolygonSC, context, &primary->polygon_sc);
}
break;
case ORDER_TYPE_POLYGON_CB:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->PolygonCB, context, &primary->polygon_cb);
rc = IFCALLRESULT(defaultReturn, primary->PolygonCB, context, &primary->polygon_cb);
}
break;
case ORDER_TYPE_ELLIPSE_SC:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->EllipseSC, context, &primary->ellipse_sc);
rc = IFCALLRESULT(defaultReturn, primary->EllipseSC, context, &primary->ellipse_sc);
}
break;
case ORDER_TYPE_ELLIPSE_CB:
{
WLog_Print(update->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
rc = IFCALLRESULT(FALSE, primary->EllipseCB, context, &primary->ellipse_cb);
rc = IFCALLRESULT(defaultReturn, primary->EllipseCB, context, &primary->ellipse_cb);
}
break;
@@ -3656,7 +3660,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
if (flags & ORDER_BOUNDS)
{
rc = IFCALLRESULT(FALSE, update->SetBounds, context, NULL);
rc = IFCALLRESULT(defaultReturn, update->SetBounds, context, NULL);
}
return rc;
@@ -3674,6 +3678,9 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
rdpSettings* settings = context->settings;
rdpSecondaryUpdate* secondary = update->secondary;
const char* name;
BOOL defaultReturn;
defaultReturn = freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding);
rem = Stream_GetRemainingLength(s);
if (rem < 5)
@@ -3725,7 +3732,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheBitmap, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmap, context, order);
free_cache_bitmap_order(context, order);
}
}
@@ -3740,7 +3747,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheBitmapV2, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmapV2, context, order);
free_cache_bitmap_v2_order(context, order);
}
}
@@ -3752,7 +3759,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheBitmapV3, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmapV3, context, order);
free_cache_bitmap_v3_order(context, order);
}
}
@@ -3765,7 +3772,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheColorTable, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheColorTable, context, order);
free_cache_color_table_order(context, order);
}
}
@@ -3782,7 +3789,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheGlyph, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheGlyph, context, order);
free_cache_glyph_order(context, order);
}
}
@@ -3795,7 +3802,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheGlyphV2, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheGlyphV2, context, order);
free_cache_glyph_v2_order(context, order);
}
}
@@ -3815,7 +3822,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
if (order)
{
rc = IFCALLRESULT(FALSE, secondary->CacheBrush, context, order);
rc = IFCALLRESULT(defaultReturn, secondary->CacheBrush, context, order);
free_cache_brush_order(context, order);
}
}

View File

@@ -29,6 +29,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_CompressionEnabled,
FreeRDP_ConsoleSession,
FreeRDP_CredentialsFromStdin,
FreeRDP_DeactivateClientDecoding,
FreeRDP_Decorations,
FreeRDP_DesktopResize,
FreeRDP_DeviceRedirection,

View File

@@ -1124,6 +1124,8 @@ static void gdi_register_update_callbacks(rdpUpdate* update)
primary = update->primary;
WINPR_ASSERT(primary);
if (freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
return;
update->Palette = gdi_palette_update;
update->SetBounds = gdi_set_bounds;
primary->DstBlt = gdi_dstblt;

View File

@@ -91,9 +91,21 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
UINT32 DesktopHeight;
gdiGfxSurface* surface;
UINT16* pSurfaceIds = NULL;
rdpGdi* gdi = (rdpGdi*)context->custom;
rdpUpdate* update = gdi->context->update;
rdpSettings* settings = gdi->context->settings;
rdpGdi* gdi;
rdpUpdate* update;
rdpSettings* settings;
WINPR_ASSERT(context);
WINPR_ASSERT(resetGraphics);
gdi = (rdpGdi*)context->custom;
WINPR_ASSERT(gdi);
update = gdi->context->update;
WINPR_ASSERT(update);
settings = gdi->context->settings;
WINPR_ASSERT(settings);
EnterCriticalSection(&context->mux);
DesktopWidth = resetGraphics->width;
DesktopHeight = resetGraphics->height;
@@ -146,7 +158,14 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
const RECTANGLE_16* rects;
UINT32 i, nbRects;
double sx, sy;
rdpUpdate* update = gdi->context->update;
rdpUpdate* update;
WINPR_ASSERT(gdi);
WINPR_ASSERT(gdi->context);
WINPR_ASSERT(surface);
update = gdi->context->update;
WINPR_ASSERT(update);
if (gdi->suppressOutput)
return CHANNEL_RC_OK;
@@ -207,7 +226,12 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)
UINT status = ERROR_INTERNAL_ERROR;
gdiGfxSurface* surface;
UINT16* pSurfaceIds = NULL;
rdpGdi* gdi = (rdpGdi*)context->custom;
rdpGdi* gdi;
WINPR_ASSERT(context);
gdi = (rdpGdi*)context->custom;
WINPR_ASSERT(gdi);
EnterCriticalSection(&context->mux);
context->GetSurfaceIds(context, &pSurfaceIds, &count);
@@ -248,7 +272,13 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)
*/
static UINT gdi_StartFrame(RdpgfxClientContext* context, const RDPGFX_START_FRAME_PDU* startFrame)
{
rdpGdi* gdi = (rdpGdi*)context->custom;
rdpGdi* gdi;
WINPR_ASSERT(context);
WINPR_ASSERT(startFrame);
gdi = (rdpGdi*)context->custom;
WINPR_ASSERT(gdi);
gdi->inGfxFrame = TRUE;
gdi->frameId = startFrame->frameId;
return CHANNEL_RC_OK;
@@ -287,6 +317,9 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi, RdpgfxClientContext* co
RECTANGLE_16 invalidRect;
DWORD bpp;
size_t size;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -347,6 +380,9 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi, RdpgfxClientContext* contex
REGION16 invalidRegion;
const RECTANGLE_16* rects;
UINT32 nrRects, x;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -356,6 +392,7 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi, RdpgfxClientContext* contex
return ERROR_NOT_FOUND;
}
WINPR_ASSERT(surface->codecs);
rfx_context_set_pixel_format(surface->codecs->rfx, cmd->format);
region16_init(&invalidRegion);
@@ -400,6 +437,9 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi, RdpgfxClientContext* cont
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -409,6 +449,7 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi, RdpgfxClientContext* cont
return ERROR_NOT_FOUND;
}
WINPR_ASSERT(surface->codecs);
rc = clear_decompress(surface->codecs->clear, cmd->data, cmd->length, cmd->width, cmd->height,
surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
surface->width, surface->height, &gdi->palette);
@@ -452,6 +493,9 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
BYTE* DstData = NULL;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -507,6 +551,9 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi, RdpgfxClientContext* context,
gdiGfxSurface* surface;
RDPGFX_H264_METABLOCK* meta;
RDPGFX_AVC420_BITMAP_STREAM* bs;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
@@ -593,6 +640,9 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
RDPGFX_H264_METABLOCK* meta1;
RDPGFX_AVC420_BITMAP_STREAM* avc2;
RDPGFX_H264_METABLOCK* meta2;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -683,6 +733,7 @@ static BOOL gdi_apply_alpha(BYTE* data, UINT32 format, UINT32 stride, RECTANGLE_
UINT32 written = 0;
BOOL first = TRUE;
const UINT32 bpp = GetBytesPerPixel(format);
WINPR_ASSERT(rect);
for (y = rect->top; y < rect->bottom; y++)
{
@@ -724,6 +775,9 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
wStream s;
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
Stream_StaticInit(&s, cmd->data, cmd->length);
if (Stream_GetRemainingLength(&s) < 4)
@@ -861,6 +915,9 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi, RdpgfxClientContext* con
* cmd's top/left/right/bottom/width/height members are always zero!
* The update region is determined during decompression.
*/
WINPR_ASSERT(gdi);
WINPR_ASSERT(context);
WINPR_ASSERT(cmd);
surface = (gdiGfxSurface*)context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@@ -873,6 +930,7 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi, RdpgfxClientContext* con
if (!is_within_surface(surface, cmd))
return ERROR_INVALID_DATA;
WINPR_ASSERT(surface->codecs);
rc = progressive_create_surface_context(surface->codecs->progressive, cmd->surfaceId,
surface->width, surface->height);
@@ -1012,12 +1070,15 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
{
UINT rc = ERROR_INTERNAL_ERROR;
gdiGfxSurface* surface;
WINPR_ASSERT(context);
WINPR_ASSERT(createSurface);
EnterCriticalSection(&context->mux);
surface = (gdiGfxSurface*)calloc(1, sizeof(gdiGfxSurface));
if (!surface)
goto fail;
WINPR_ASSERT(context->codecs);
surface->codecs = context->codecs;
if (!surface->codecs)
@@ -1555,11 +1616,15 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
gfx->UnmapWindowForSurface = unmap;
gfx->UpdateSurfaceArea = update;
gfx->codecs = codecs_new(context);
if (!gfx->codecs)
return FALSE;
freerdp_client_codecs_prepare(gfx->codecs, FREERDP_CODEC_ALL, settings->DesktopWidth,
settings->DesktopHeight);
if (!freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
{
gfx->codecs = codecs_new(context);
if (!gfx->codecs)
return FALSE;
if (!freerdp_client_codecs_prepare(gfx->codecs, FREERDP_CODEC_ALL, settings->DesktopWidth,
settings->DesktopHeight))
return FALSE;
}
InitializeCriticalSection(&gfx->mux);
PROFILER_CREATE(gfx->SurfaceProfiler, "GFX-PROFILER")
@@ -1570,6 +1635,12 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
* we simply initialize it with TRUE here for now.
*/
gdi->graphicsReset = TRUE;
if (freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
{
gfx->UpdateSurfaceArea = NULL;
gfx->UpdateSurfaces = NULL;
gfx->SurfaceCommand = NULL;
}
return TRUE;
}

View File

@@ -230,7 +230,7 @@ out:
static BOOL WLog_Write(wLog* log, wLogMessage* message)
{
BOOL status;
BOOL status = FALSE;
wLogAppender* appender;
appender = WLog_GetLogAppender(log);
@@ -239,20 +239,20 @@ static BOOL WLog_Write(wLog* log, wLogMessage* message)
if (!appender->active)
if (!WLog_OpenAppender(log))
return FALSE;
if (!appender->WriteMessage)
return FALSE;
EnterCriticalSection(&appender->lock);
if (appender->recursive)
status = log_recursion(message->FileName, message->FunctionName, message->LineNumber);
else
if (appender->WriteMessage)
{
appender->recursive = TRUE;
status = appender->WriteMessage(log, appender, message);
appender->recursive = FALSE;
if (appender->recursive)
status = log_recursion(message->FileName, message->FunctionName, message->LineNumber);
else
{
appender->recursive = TRUE;
status = appender->WriteMessage(log, appender, message);
appender->recursive = FALSE;
}
}
LeaveCriticalSection(&appender->lock);