Merge pull request #3773 from hardening/gfx_and_sample_fixes

Gfx and sample fixes
This commit is contained in:
Martin Fleisz 2017-02-16 15:43:02 +01:00 committed by GitHub
commit af4034b68b
3 changed files with 50 additions and 16 deletions

View File

@ -271,6 +271,12 @@ static UINT rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
Stream_Seek(s, pad); /* pad (total size is 340 bytes) */
WLog_DBG(TAG, "RecvResetGraphicsPdu: width: %"PRIu32" height: %"PRIu32" count: %"PRIu32"",
pdu.width, pdu.height, pdu.monitorCount);
for (index = 0; index < pdu.monitorCount; index++)
{
monitor = &(pdu.monitorDefArray[index]);
WLog_DBG(TAG, "RecvResetGraphicsPdu: monitor left:%"PRIi32" top:%"PRIi32" right:%"PRIi32" left:%"PRIi32" flags:0x%"PRIx32"",
monitor->left, monitor->top, monitor->right, monitor->bottom, monitor->flags);
}
if (context)
{

View File

@ -33,6 +33,7 @@
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h>
#include <winpr/crt.h>
@ -174,6 +175,8 @@ int main(int argc, char* argv[])
instance->ContextNew = tf_context_new;
instance->ContextFree = tf_context_free;
freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0);
if (!freerdp_context_new(instance))
{
WLog_ERR(TAG, "Couldn't create context");
@ -188,6 +191,7 @@ int main(int argc, char* argv[])
exit(0);
}
if (!freerdp_client_load_addins(instance->context->channels,
instance->settings))
exit(-1);

View File

@ -208,10 +208,13 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
if (!freerdp_image_copy(surface->data, surface->format, surface->scanline,
cmd->left, cmd->top, cmd->width, cmd->height,
@ -245,10 +248,13 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
{
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
rfx_context_set_pixel_format(surface->codecs->rfx, cmd->format);
@ -283,10 +289,13 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
rc = clear_decompress(surface->codecs->clear, cmd->data, cmd->length,
cmd->width, cmd->height,
@ -328,10 +337,13 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
BYTE* DstData = NULL;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
DstData = surface->data;
@ -373,10 +385,13 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
gdiGfxSurface* surface;
RDPGFX_H264_METABLOCK* meta;
RDPGFX_AVC420_BITMAP_STREAM* bs;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
bs = (RDPGFX_AVC420_BITMAP_STREAM*) cmd->extra;
@ -429,10 +444,13 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
RDPGFX_AVC420_BITMAP_STREAM* avc2;
RDPGFX_H264_METABLOCK* meta2;
RECTANGLE_16* regionRects = NULL;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
bs = (RDPGFX_AVC444_BITMAP_STREAM*) cmd->extra;
@ -494,10 +512,13 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
UINT32 color;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
WLog_WARN(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %"PRIu32"", status);
/* fill with green for now to distinguish from the rest */
@ -536,10 +557,13 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
RECTANGLE_16 invalidRect;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
return ERROR_INTERNAL_ERROR;
{
WLog_ERR(TAG, "%s: unable to retrieve surfaceData for surfaceId=%"PRIu32"", __FUNCTION__, cmd->surfaceId);
return ERROR_NOT_FOUND;
}
rc = progressive_create_surface_context(surface->codecs->progressive,
cmd->surfaceId,