Merge pull request #4926 from akallabeth/primary_order_checks
Order data validation and correction
This commit is contained in:
commit
e46d1d95ff
@ -1197,7 +1197,7 @@ static void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd)
|
||||
{
|
||||
if (rdpsnd)
|
||||
{
|
||||
audio_format_free(rdpsnd->fixed_format);
|
||||
audio_formats_free(rdpsnd->fixed_format, 1);
|
||||
free(rdpsnd->subsystem);
|
||||
free(rdpsnd->device_name);
|
||||
CloseHandle(rdpsnd->stopEvent);
|
||||
|
@ -1108,9 +1108,9 @@ static BOOL xf_pre_connect(freerdp* instance)
|
||||
settings->OrderSupport[NEG_MEMBLT_V2_INDEX] = settings->BitmapCacheEnabled;
|
||||
settings->OrderSupport[NEG_MEM3BLT_V2_INDEX] = settings->BitmapCacheEnabled;
|
||||
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = settings->GlyphSupportLevel != GLYPH_SUPPORT_NONE;
|
||||
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = settings->GlyphSupportLevel != GLYPH_SUPPORT_NONE;
|
||||
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = settings->GlyphSupportLevel != GLYPH_SUPPORT_NONE;
|
||||
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
|
@ -1756,6 +1756,10 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
{
|
||||
settings->ConsoleSession = enable;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "relax-order-checks")
|
||||
{
|
||||
settings->AllowUnanouncedOrdersFromServer = arg->Value;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "restricted-admin")
|
||||
{
|
||||
settings->ConsoleSession = enable;
|
||||
|
@ -142,6 +142,7 @@ static COMMAND_LINE_ARGUMENT_A args[] =
|
||||
{ "pwidth", COMMAND_LINE_VALUE_REQUIRED, "<width>", NULL, NULL, -1, NULL, "Physical width of display (in millimeters)" },
|
||||
{ "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "<base64-cookie>", NULL, NULL, -1, NULL, "Pass base64 reconnect cookie to the connection" },
|
||||
{ "redirect-prefer", COMMAND_LINE_VALUE_REQUIRED, "<FQDN|IP|NETBIOS>[,<FQDN|IP|NETBIOS>[,<FQDN|IP|NETBIOS>]]", NULL, NULL, -1, NULL, "Override the preferred redirection order" },
|
||||
{ "relax-order-checks", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "relax-order-checks", "Do not check if a RDP order was announced during capability exchange, only use when connecting to a buggy server" },
|
||||
{ "restricted-admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "restrictedAdmin", "Restricted admin mode" },
|
||||
{ "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" },
|
||||
{ "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "image|video", NULL, NULL, -1, NULL, "RemoteFX mode" },
|
||||
|
@ -212,7 +212,7 @@ struct _MULTI_DRAW_NINE_GRID_ORDER
|
||||
UINT32 bitmapId;
|
||||
UINT32 nDeltaEntries;
|
||||
UINT32 cbData;
|
||||
BYTE* codeDeltaList;
|
||||
DELTA_RECT rectangles[45];
|
||||
};
|
||||
typedef struct _MULTI_DRAW_NINE_GRID_ORDER MULTI_DRAW_NINE_GRID_ORDER;
|
||||
|
||||
|
@ -165,15 +165,15 @@
|
||||
#define NEG_MEMBLT_INDEX 0x03
|
||||
#define NEG_MEM3BLT_INDEX 0x04
|
||||
#define NEG_ATEXTOUT_INDEX 0x05
|
||||
#define NEG_AEXTTEXTOUT_INDEX 0x06
|
||||
#define NEG_DRAWNINEGRID_INDEX 0x07
|
||||
#define NEG_AEXTTEXTOUT_INDEX 0x06 /* Must be ignored */
|
||||
#define NEG_DRAWNINEGRID_INDEX 0x07 /* Must be ignored */
|
||||
#define NEG_LINETO_INDEX 0x08
|
||||
#define NEG_MULTI_DRAWNINEGRID_INDEX 0x09
|
||||
#define NEG_OPAQUE_RECT_INDEX 0x0A
|
||||
#define NEG_OPAQUE_RECT_INDEX 0x0A /* Must be ignored */
|
||||
#define NEG_SAVEBITMAP_INDEX 0x0B
|
||||
#define NEG_WTEXTOUT_INDEX 0x0C
|
||||
#define NEG_MEMBLT_V2_INDEX 0x0D
|
||||
#define NEG_MEM3BLT_V2_INDEX 0x0E
|
||||
#define NEG_WTEXTOUT_INDEX 0x0C /* Must be ignored */
|
||||
#define NEG_MEMBLT_V2_INDEX 0x0D /* Must be ignored */
|
||||
#define NEG_MEM3BLT_V2_INDEX 0x0E /* Must be ignored */
|
||||
#define NEG_MULTIDSTBLT_INDEX 0x0F
|
||||
#define NEG_MULTIPATBLT_INDEX 0x10
|
||||
#define NEG_MULTISCRBLT_INDEX 0x11
|
||||
@ -182,15 +182,15 @@
|
||||
#define NEG_POLYGON_SC_INDEX 0x14
|
||||
#define NEG_POLYGON_CB_INDEX 0x15
|
||||
#define NEG_POLYLINE_INDEX 0x16
|
||||
#define NEG_UNUSED23_INDEX 0x17
|
||||
#define NEG_UNUSED23_INDEX 0x17 /* Must be ignored */
|
||||
#define NEG_FAST_GLYPH_INDEX 0x18
|
||||
#define NEG_ELLIPSE_SC_INDEX 0x19
|
||||
#define NEG_ELLIPSE_CB_INDEX 0x1A
|
||||
#define NEG_GLYPH_INDEX_INDEX 0x1B
|
||||
#define NEG_GLYPH_WEXTTEXTOUT_INDEX 0x1C
|
||||
#define NEG_GLYPH_WLONGTEXTOUT_INDEX 0x1D
|
||||
#define NEG_GLYPH_WLONGEXTTEXTOUT_INDEX 0x1E
|
||||
#define NEG_UNUSED31_INDEX 0x1F
|
||||
#define NEG_GLYPH_WEXTTEXTOUT_INDEX 0x1C /* Must be ignored */
|
||||
#define NEG_GLYPH_WLONGTEXTOUT_INDEX 0x1D /* Must be ignored */
|
||||
#define NEG_GLYPH_WLONGEXTTEXTOUT_INDEX 0x1E /* Must be ignored */
|
||||
#define NEG_UNUSED31_INDEX 0x1F /* Must be ignored */
|
||||
|
||||
/* Glyph Support Level */
|
||||
#define GLYPH_SUPPORT_NONE 0x0000
|
||||
@ -1265,7 +1265,8 @@ struct rdp_settings
|
||||
ALIGN64 BYTE* OrderSupport; /* 2432 */
|
||||
ALIGN64 BOOL BitmapCacheV3Enabled; /* 2433 */
|
||||
ALIGN64 BOOL AltSecFrameMarkerSupport; /* 2434 */
|
||||
UINT64 padding2497[2497 - 2435]; /* 2435 */
|
||||
ALIGN64 BOOL AllowUnanouncedOrdersFromServer; /* 2435 */
|
||||
UINT64 padding2497[2497 - 2436]; /* 2436 */
|
||||
|
||||
/* Bitmap Cache Capabilities */
|
||||
ALIGN64 BOOL BitmapCacheEnabled; /* 2497 */
|
||||
|
@ -87,6 +87,9 @@ BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 monoStep;
|
||||
const UINT32 dstBytesPerPixel = GetBytesPerPixel(DstFormat);
|
||||
|
||||
if (!pDstData || !pSrcData || !palette)
|
||||
return FALSE;
|
||||
|
||||
if (nDstStep == 0)
|
||||
nDstStep = dstBytesPerPixel * nWidth;
|
||||
|
||||
@ -203,7 +206,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
const BYTE* andBits;
|
||||
const BYTE* xorBits;
|
||||
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
xorBit = andBit = 0x80;
|
||||
|
||||
if (!vFlip)
|
||||
@ -281,7 +284,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
const BYTE* xorBits;
|
||||
const BYTE* andBits = NULL;
|
||||
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
andBit = 0x80;
|
||||
|
||||
if (!vFlip)
|
||||
@ -326,9 +329,9 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
}
|
||||
|
||||
xorPixel = FreeRDPConvertColor(xorPixel,
|
||||
pixelFormat,
|
||||
PIXEL_FORMAT_ARGB32,
|
||||
palette);
|
||||
pixelFormat,
|
||||
PIXEL_FORMAT_ARGB32,
|
||||
palette);
|
||||
xorBits += xorBytesPerPixel;
|
||||
andPixel = 0;
|
||||
|
||||
@ -352,7 +355,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
}
|
||||
|
||||
color = FreeRDPConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
|
||||
DstFormat, palette);
|
||||
DstFormat, palette);
|
||||
WriteColor(pDstPixel, DstFormat, color);
|
||||
pDstPixel += GetBytesPerPixel(DstFormat);
|
||||
}
|
||||
@ -435,11 +438,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
memcpy(&dstLine[xDstOffset],
|
||||
&srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@ -450,11 +453,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = nHeight - 1; y >= 0; y--)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
memcpy(&dstLine[xDstOffset],
|
||||
&srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@ -465,11 +468,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
memmove(&dstLine[xDstOffset],
|
||||
&srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@ -480,11 +483,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = nHeight - 1; y >= 0; y--)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
memmove(&dstLine[xDstOffset],
|
||||
&srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@ -499,11 +502,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
nDstStep * dstVMultiplier +
|
||||
dstVOffset];
|
||||
memcpy(&dstLine[xDstOffset],
|
||||
&srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@ -516,10 +519,10 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) *
|
||||
nDstStep * dstVMultiplier + dstVOffset];
|
||||
nDstStep * dstVMultiplier + dstVOffset];
|
||||
|
||||
for (x = 0; x < nWidth; x++)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ static INLINE BYTE* WRITEFIRSTLINEFGBGIMAGE(BYTE* pbDest, BYTE bitmask,
|
||||
/**
|
||||
* Decompress an RLE compressed bitmap.
|
||||
*/
|
||||
static INLINE void RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
|
||||
static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
|
||||
BYTE* pbDestBuffer,
|
||||
UINT32 rowDelta, UINT32 width, UINT32 height)
|
||||
{
|
||||
@ -310,6 +310,9 @@ static INLINE void RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
|
||||
UINT32 advance;
|
||||
RLEEXTRA
|
||||
|
||||
if (!pbSrcBuffer || !pbDestBuffer)
|
||||
return FALSE;
|
||||
|
||||
while (pbSrc < pbEnd)
|
||||
{
|
||||
/* Watch out for the end of the first scanline. */
|
||||
@ -628,6 +631,11 @@ static INLINE void RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer,
|
||||
DESTWRITEPIXEL(pbDest, BLACK_PIXEL);
|
||||
DESTNEXTPIXEL(pbDest);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
UINT32 SrcFormat;
|
||||
UINT32 BufferSize;
|
||||
|
||||
if (!interleaved)
|
||||
if (!interleaved || !pSrcData || !pDstData)
|
||||
return FALSE;
|
||||
|
||||
switch (bpp)
|
||||
@ -322,19 +322,25 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
switch (bpp)
|
||||
{
|
||||
case 24:
|
||||
RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
if (!RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight))
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
if (!RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight))
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
if (!RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nSrcWidth, nSrcHeight))
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1453,7 +1453,7 @@ static BOOL rdp_write_brush_capability_set(wStream* s, rdpSettings* settings)
|
||||
return FALSE;
|
||||
|
||||
header = rdp_capability_set_start(s);
|
||||
Stream_Write_UINT32(s, BRUSH_COLOR_FULL); /* brushSupportLevel (4 bytes) */
|
||||
Stream_Write_UINT32(s, settings->BrushSupportLevel); /* brushSupportLevel (4 bytes) */
|
||||
rdp_capability_set_finish(s, header, CAPSET_TYPE_BRUSH);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -265,15 +265,24 @@ static BOOL fastpath_recv_orders(rdpFastPath* fastpath, wStream* s)
|
||||
UINT16 numberOrders;
|
||||
|
||||
if (!fastpath || !fastpath->rdp || !s)
|
||||
{
|
||||
WLog_ERR(TAG, "Invalid arguments");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
update = fastpath->rdp->update;
|
||||
|
||||
if (!update)
|
||||
{
|
||||
WLog_ERR(TAG, "Invalid configuration");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
{
|
||||
WLog_ERR(TAG, "Stream short");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -337,6 +337,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
settings->FIPSMode = FALSE;
|
||||
settings->CompressionEnabled = TRUE;
|
||||
settings->LogonNotify = TRUE;
|
||||
settings->BrushSupportLevel = BRUSH_COLOR_FULL;
|
||||
|
||||
if (settings->ServerMode)
|
||||
settings->CompressionLevel = PACKET_COMPR_TYPE_RDP61;
|
||||
@ -390,23 +391,23 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MEMBLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_MEM3BLT_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = TRUE;
|
||||
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
settings->ClientProductId = calloc(1, 32);
|
||||
|
||||
if (!settings->ClientProductId)
|
||||
|
@ -33,7 +33,7 @@
|
||||
BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
UINT16 new_len;
|
||||
BYTE *new_str;
|
||||
BYTE* new_str;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
@ -52,9 +52,10 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
}
|
||||
|
||||
new_str = (BYTE*) realloc(unicode_string->string, new_len);
|
||||
|
||||
if (!new_str)
|
||||
{
|
||||
free (unicode_string->string);
|
||||
free(unicode_string->string);
|
||||
unicode_string->string = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
@ -62,7 +63,6 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
unicode_string->string = new_str;
|
||||
unicode_string->length = new_len;
|
||||
Stream_Read(s, unicode_string->string, unicode_string->length);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -110,14 +110,15 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
|
||||
/* bitsMask */
|
||||
newBitMask = (BYTE*) realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||
|
||||
if (!newBitMask)
|
||||
{
|
||||
free (iconInfo->bitsMask);
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
iconInfo->bitsMask = newBitMask;
|
||||
|
||||
iconInfo->bitsMask = newBitMask;
|
||||
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||
|
||||
/* colorTable */
|
||||
@ -126,21 +127,23 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
if (iconInfo->cbColorTable)
|
||||
{
|
||||
iconInfo->colorTable = (BYTE*) malloc(iconInfo->cbColorTable);
|
||||
|
||||
if (!iconInfo->colorTable)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (iconInfo->cbColorTable)
|
||||
{
|
||||
BYTE *new_tab;
|
||||
|
||||
BYTE* new_tab;
|
||||
new_tab = (BYTE*) realloc(iconInfo->colorTable, iconInfo->cbColorTable);
|
||||
|
||||
if (!new_tab)
|
||||
{
|
||||
free (iconInfo->colorTable);
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iconInfo->colorTable = new_tab;
|
||||
}
|
||||
else
|
||||
@ -153,17 +156,17 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
Stream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);
|
||||
|
||||
/* bitsColor */
|
||||
newBitMask = (BYTE *)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
|
||||
if (!newBitMask)
|
||||
{
|
||||
free (iconInfo->bitsColor);
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iconInfo->bitsColor = newBitMask;
|
||||
|
||||
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -174,7 +177,6 @@ BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cachedIconInfo)
|
||||
|
||||
Stream_Read_UINT16(s, cachedIconInfo->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
Stream_Read_UINT8(s, cachedIconInfo->cacheId); /* cacheId (1 byte) */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -185,12 +187,12 @@ BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notifyIcon
|
||||
|
||||
Stream_Read_UINT32(s, notifyIconInfoTip->timeout); /* timeout (4 bytes) */
|
||||
Stream_Read_UINT32(s, notifyIconInfoTip->flags); /* infoFlags (4 bytes) */
|
||||
|
||||
return rail_read_unicode_string(s, ¬ifyIconInfoTip->text) && /* infoTipText */
|
||||
rail_read_unicode_string(s, ¬ifyIconInfoTip->title); /* title */
|
||||
rail_read_unicode_string(s, ¬ifyIconInfoTip->title); /* title */
|
||||
}
|
||||
|
||||
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
|
||||
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_STATE_ORDER* windowState)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
@ -295,18 +297,21 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
|
||||
Stream_Read_UINT16(s, windowState->numWindowRects); /* numWindowRects (2 bytes) */
|
||||
|
||||
if (windowState->numWindowRects == 0) {
|
||||
if (windowState->numWindowRects == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size = sizeof(RECTANGLE_16) * windowState->numWindowRects;
|
||||
newRect = (RECTANGLE_16*)realloc(windowState->windowRects, size);
|
||||
|
||||
if (!newRect)
|
||||
{
|
||||
free(windowState->windowRects);
|
||||
windowState->windowRects = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
windowState->windowRects = newRect;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 8 * windowState->numWindowRects)
|
||||
@ -338,17 +343,21 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
|
||||
Stream_Read_UINT16(s, windowState->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
||||
|
||||
if (windowState->numVisibilityRects == 0) {
|
||||
if (windowState->numVisibilityRects == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size = sizeof(RECTANGLE_16) * windowState->numVisibilityRects;
|
||||
newRect = (RECTANGLE_16*)realloc(windowState->visibilityRects, size);
|
||||
|
||||
if (!newRect)
|
||||
{
|
||||
free(windowState->visibilityRects);
|
||||
windowState->visibilityRects = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
windowState->visibilityRects = newRect;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < windowState->numVisibilityRects * 8)
|
||||
@ -363,22 +372,27 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
Stream_Read_UINT16(s, windowState->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL update_read_window_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon)
|
||||
BOOL update_read_window_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_ICON_ORDER* window_icon)
|
||||
{
|
||||
update_free_window_icon_info(window_icon->iconInfo);
|
||||
window_icon->iconInfo = (ICON_INFO*) calloc(1, sizeof(ICON_INFO));
|
||||
|
||||
if (!window_icon->iconInfo)
|
||||
return FALSE;
|
||||
|
||||
return update_read_icon_info(s, window_icon->iconInfo); /* iconInfo (ICON_INFO) */
|
||||
}
|
||||
|
||||
BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
||||
BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
||||
{
|
||||
return update_read_cached_icon_info(s, &window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
||||
return update_read_cached_icon_info(s,
|
||||
&window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
||||
}
|
||||
|
||||
void update_read_window_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
||||
@ -401,6 +415,7 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
{
|
||||
if (!update_read_window_icon_order(s, orderInfo, &window->window_icon))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "WindowIcon");
|
||||
IFCALLRET(window->WindowIcon, result, context, orderInfo, &window->window_icon);
|
||||
}
|
||||
@ -408,6 +423,7 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
{
|
||||
if (!update_read_window_cached_icon_order(s, orderInfo, &window->window_cached_icon))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "WindowCachedIcon");
|
||||
IFCALLRET(window->WindowCachedIcon, result, context, orderInfo, &window->window_cached_icon);
|
||||
}
|
||||
@ -437,12 +453,14 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
||||
BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
||||
{
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
Stream_Read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */
|
||||
}
|
||||
|
||||
@ -454,7 +472,8 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
||||
{
|
||||
if (!update_read_notify_icon_infotip(s, ¬ify_icon_state->infoTip)) /* infoTip (NOTIFY_ICON_INFOTIP) */
|
||||
if (!update_read_notify_icon_infotip(s,
|
||||
¬ify_icon_state->infoTip)) /* infoTip (NOTIFY_ICON_INFOTIP) */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -474,7 +493,8 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
|
||||
{
|
||||
if (!update_read_cached_icon_info(s, ¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
||||
if (!update_read_cached_icon_info(s,
|
||||
¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -486,7 +506,8 @@ void update_read_notification_icon_delete_order(wStream* s, WINDOW_ORDER_INFO* o
|
||||
/* notification icon deletion event */
|
||||
}
|
||||
|
||||
BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
||||
BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s,
|
||||
WINDOW_ORDER_INFO* orderInfo)
|
||||
{
|
||||
rdpContext* context = update->context;
|
||||
rdpWindowUpdate* window = update->window;
|
||||
@ -524,7 +545,8 @@ BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s, WIN
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop)
|
||||
BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
MONITORED_DESKTOP_ORDER* monitored_desktop)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
@ -539,7 +561,7 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
||||
{
|
||||
UINT32 *newid;
|
||||
UINT32* newid;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
@ -549,16 +571,18 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
if (Stream_GetRemainingLength(s) < 4 * monitored_desktop->numWindowIds)
|
||||
return FALSE;
|
||||
|
||||
if (monitored_desktop->numWindowIds > 0) {
|
||||
if (monitored_desktop->numWindowIds > 0)
|
||||
{
|
||||
size = sizeof(UINT32) * monitored_desktop->numWindowIds;
|
||||
|
||||
newid = (UINT32*)realloc(monitored_desktop->windowIds, size);
|
||||
|
||||
if (!newid)
|
||||
{
|
||||
free(monitored_desktop->windowIds);
|
||||
monitored_desktop->windowIds = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
monitored_desktop->windowIds = newid;
|
||||
|
||||
/* windowIds */
|
||||
@ -593,6 +617,7 @@ BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_
|
||||
{
|
||||
if (!update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "ActivelyMonitoredDesktop");
|
||||
IFCALLRET(window->MonitoredDesktop, result, context, orderInfo, &window->monitored_desktop);
|
||||
}
|
||||
@ -602,39 +627,44 @@ BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_
|
||||
|
||||
void update_free_window_icon_info(ICON_INFO* iconInfo)
|
||||
{
|
||||
if (!iconInfo)
|
||||
return;
|
||||
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
if (!iconInfo)
|
||||
return;
|
||||
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
free(iconInfo);
|
||||
}
|
||||
|
||||
BOOL update_recv_altsec_window_order(rdpUpdate* update, wStream* s)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
UINT16 orderSize;
|
||||
rdpWindowUpdate* window = update->window;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "Stream short");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
||||
Stream_Read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
||||
|
||||
if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
|
||||
return update_recv_window_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_window_info_order(update, s, &window->orderInfo);
|
||||
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY)
|
||||
return update_recv_notification_icon_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_notification_icon_info_order(update, s, &window->orderInfo);
|
||||
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP)
|
||||
return update_recv_desktop_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_desktop_info_order(update, s, &window->orderInfo);
|
||||
|
||||
return TRUE;
|
||||
if (!rc)
|
||||
WLog_Print(update->log, WLOG_ERROR, "windoworder flags %08"PRIx32" failed",
|
||||
window->orderInfo.fieldFlags);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ INLINE UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos)
|
||||
{
|
||||
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||
BYTE* data = &(hBmp->data[(nYPos * hBmp->scanline) + nXPos * GetBytesPerPixel(
|
||||
hBmp->format)]);
|
||||
hBmp->format)]);
|
||||
return ReadColor(data, hBmp->format);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ static INLINE UINT32 gdi_SetPixelBmp(HGDI_BITMAP hBmp, UINT32 X, UINT32 Y,
|
||||
UINT32 crColor)
|
||||
{
|
||||
BYTE* p = &hBmp->data[(Y * hBmp->scanline) + X * GetBytesPerPixel(
|
||||
hBmp->format)];
|
||||
hBmp->format)];
|
||||
WriteColor(p, hBmp->format, crColor);
|
||||
return crColor;
|
||||
}
|
||||
@ -480,9 +480,15 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
switch (rop)
|
||||
{
|
||||
case GDI_SRCCOPY:
|
||||
if (!hdcSrc)
|
||||
return FALSE;
|
||||
|
||||
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
|
||||
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||
|
||||
if (!hSrcBmp || !hDstBmp)
|
||||
return FALSE;
|
||||
|
||||
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
||||
nXDest, nYDest, nWidth, nHeight,
|
||||
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
||||
@ -494,6 +500,9 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
hSrcBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
|
||||
|
||||
if (!hSrcBmp || !hDstBmp)
|
||||
return FALSE;
|
||||
|
||||
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
|
||||
nXDest, nYDest, nWidth, nHeight,
|
||||
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
||||
|
@ -574,7 +574,7 @@ static BOOL gdi_dstblt(rdpContext* context, const DSTBLT_ORDER* dstblt)
|
||||
gdi_rop3_code(dstblt->bRop), &gdi->palette);
|
||||
}
|
||||
|
||||
static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
static BOOL gdi_patblt(rdpContext* context, const PATBLT_ORDER* patblt)
|
||||
{
|
||||
const rdpBrush* brush = &patblt->brush;
|
||||
UINT32 foreColor;
|
||||
@ -663,9 +663,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!hbrush)
|
||||
gdi_DeleteObject((HGDIOBJECT) hBmp);
|
||||
else
|
||||
if (hbrush)
|
||||
{
|
||||
hbrush->nXOrg = brush->x;
|
||||
hbrush->nYOrg = brush->y;
|
||||
@ -676,6 +674,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
|
||||
out_error:
|
||||
gdi_DeleteObject((HGDIOBJECT) hBmp);
|
||||
gdi_DeleteObject((HGDIOBJECT) hbrush);
|
||||
gdi->drawing->hdc->brush = originalBrush;
|
||||
gdi_SetTextColor(gdi->drawing->hdc, originalColor);
|
||||
@ -933,6 +932,7 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, gdi_rop3_code(mem3blt->bRop),
|
||||
&gdi->palette);
|
||||
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
|
||||
gdi_DeleteObject((HGDIOBJECT) hBmp);
|
||||
gdi->drawing->hdc->brush = originalBrush;
|
||||
}
|
||||
break;
|
||||
|
@ -112,10 +112,11 @@ static void gdi_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
|
||||
|
||||
if (gdi_bitmap)
|
||||
{
|
||||
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->org_bitmap);
|
||||
if (gdi_bitmap->hdc)
|
||||
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->org_bitmap);
|
||||
|
||||
gdi_DeleteObject((HGDIOBJECT) gdi_bitmap->bitmap);
|
||||
gdi_DeleteDC(gdi_bitmap->hdc);
|
||||
|
||||
_aligned_free(bitmap->data);
|
||||
}
|
||||
|
||||
@ -139,7 +140,6 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
UINT32 codecId)
|
||||
{
|
||||
UINT32 SrcSize = length;
|
||||
UINT32 SrcFormat;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->format = gdi->dstFormat;
|
||||
@ -173,7 +173,19 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
}
|
||||
else
|
||||
{
|
||||
SrcFormat = gdi_get_pixel_format(bpp);
|
||||
const UINT32 SrcFormat = gdi_get_pixel_format(bpp);
|
||||
const size_t sbpp = GetBytesPerPixel(SrcFormat);
|
||||
const size_t dbpp = GetBytesPerPixel(bitmap->format);
|
||||
|
||||
if ((sbpp == 0) || (dbpp == 0))
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
const size_t dstSize = SrcSize * dbpp / sbpp;
|
||||
|
||||
if (dstSize < bitmap->length)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,
|
||||
DstWidth, DstHeight, pSrcData, SrcFormat,
|
||||
@ -193,6 +205,7 @@ static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
|
||||
return FALSE;
|
||||
|
||||
gdi = context->gdi;
|
||||
|
||||
if (!gdi)
|
||||
return FALSE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user