Author: jgardou
Date: Fri Oct 24 18:45:25 2014
New Revision: 64969
URL:
http://svn.reactos.org/svn/reactos?rev=64969&view=rev
Log:
[WIN32K]
- Properly check for CBM_INIT bit in CreateDIBitmap.
- Take into account the fact that we could be passed a BITMAPCOREHEADER
CORE-8695
Modified:
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Fri Oct 24 18:45:25 2014
@@ -1336,7 +1336,7 @@
// colors, which are black followed by white, nothing else. In all other cases, we
create a color bitmap.
if (BmpFormat != BMF_1BPP) fColor = TRUE;
- else if ((coloruse > DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor =
FALSE;
+ else if ((coloruse > DIB_RGB_COLORS) || ((init & CBM_INIT) == 0) || !data)
fColor = FALSE;
else
{
const RGBQUAD *rgb = (RGBQUAD*)((PBYTE)data + data->bmiHeader.biSize);
@@ -1448,7 +1448,7 @@
PBYTE safeBits = NULL;
HBITMAP hbmResult = NULL;
- if(pjInit && (fInit == CBM_INIT))
+ if(pjInit && (fInit & CBM_INIT))
{
if (cjMaxBits == 0) return NULL;
safeBits = ExAllocatePoolWithTag(PagedPool, cjMaxBits, TAG_DIB);
@@ -1462,7 +1462,7 @@
_SEH2_TRY
{
if(pbmi) ProbeForRead(pbmi, cjMaxInitInfo, 1);
- if(pjInit && (fInit == CBM_INIT))
+ if(pjInit && (fInit & CBM_INIT))
{
ProbeForRead(pjInit, cjMaxBits, 1);
RtlCopyMemory(safeBits, pjInit, cjMaxBits);
@@ -1540,9 +1540,19 @@
* if bpp != 1 and ignore the real value that was passed */
if (pbmi)
{
- bpp = pbmi->bmiHeader.biBitCount;
- planes = pbmi->bmiHeader.biPlanes;
- compression = pbmi->bmiHeader.biCompression;
+ if (pbmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
+ {
+ BITMAPCOREHEADER* CoreHeader = (BITMAPCOREHEADER*)&pbmi->bmiHeader;
+ bpp = CoreHeader->bcBitCount;
+ planes = CoreHeader->bcPlanes;
+ compression = BI_RGB;
+ }
+ else
+ {
+ bpp = pbmi->bmiHeader.biBitCount;
+ planes = pbmi->bmiHeader.biPlanes;
+ compression = pbmi->bmiHeader.biCompression;
+ }
}
else
{