diff --git "a/win32ss/user/user32/windows/cursoricon.c" "b/win32ss/user/user32/windows/cursoricon.c" index f021016ed3f..c845e805a46 100644 --- "a/win32ss/user/user32/windows/cursoricon.c" +++ "b/win32ss/user/user32/windows/cursoricon.c" @@ -401,6 +401,50 @@ static BOOL is_dib_monochrome( const BITMAPINFO* info ) } } +#ifdef __REACTOS__ +static BOOL is_bmp_monochrome( const BITMAPINFO* info ) +{ + if (is_dib_monochrome(info)) + return TRUE; + + if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + const RGBTRIPLE *rgb = ((const BITMAPCOREINFO*)info)->bmciColors; + if (((const BITMAPCOREINFO*)info)->bmciHeader.bcBitCount != 1) return FALSE; + + /* Check if the first color is white */ + if (RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue) == RGB(0xff, 0xff, 0xff)) + { + /* Check if the second color is black */ + if (RGB(rgb[1].rgbtRed, rgb[1].rgbtGreen, rgb[1].rgbtBlue) == RGB(0, 0, 0)) + { + return TRUE; + } + } + return FALSE; + } + else /* assume BITMAPINFOHEADER */ + { + const RGBQUAD *rgb = info->bmiColors; + if (info->bmiHeader.biBitCount != 1) return FALSE; + + /* Check if the first color is white */ + if (RGBA(rgb[0].rgbRed, rgb[0].rgbGreen, rgb[0].rgbBlue, + rgb[0].rgbReserved) == RGBA(0xff, 0xff, 0xff, 0)) + { + /* Check if the second color is black */ + if (RGBA(rgb[1].rgbRed, rgb[1].rgbGreen, rgb[1].rgbBlue, + rgb[1].rgbReserved) == RGBA(0, 0, 0, 0)) + { + return TRUE; + } + } + return FALSE; + } +} +#endif + + /* Return the size of the bitmap info structure including color table and * the bytes required for 3 DWORDS if this is a BI_BITFIELDS bmp. */ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) @@ -1564,7 +1608,11 @@ create_bitmap: hbmpRet = CreateDIBSection(hdc, pbmiScaled, DIB_RGB_COLORS, NULL, 0, 0); else { +#ifdef __REACTOS__ + if(is_bmp_monochrome(pbmiCopy) || (fuLoad & LR_MONOCHROME)) +#else if(is_dib_monochrome(pbmiCopy) || (fuLoad & LR_MONOCHROME)) +#endif hbmpRet = CreateBitmap(cxDesired, cyDesired, 1, 1, NULL); else hbmpRet = CreateCompatibleBitmap(hdcScreen, cxDesired, cyDesired);