[USER32] Show Debug Log Message when unhandled PNG found in ICO file. (#5566)

Detect the PNG data in ICO files and print an appropriate message to the debug log.
JIRA issue: CORE-19107
This commit is contained in:
Doug Lyons 2024-03-12 02:45:22 -05:00 committed by GitHub
parent 88e1675ace
commit afd39cbc06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,6 +179,12 @@ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
LONG *height, WORD *bpp, DWORD *compr )
{
#define CR 13
#define LF 10
#define EOFM 26 // DOS End Of File Marker
#define HighBitDetect 0x89 // Byte with high bit set to test if not 7-bit
/* wine's definition */
static const BYTE png_sig_pattern[] = { HighBitDetect, 'P', 'N', 'G', CR, LF, EOFM, LF };
if (header->biSize == sizeof(BITMAPCOREHEADER))
{
const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)header;
@ -198,7 +204,15 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
*compr = header->biCompression;
return 1;
}
ERR("(%d): unknown/wrong size for header\n", header->biSize );
if (memcmp(&header->biSize, png_sig_pattern, sizeof(png_sig_pattern)) == 0)
{
ERR("Cannot yet display PNG icons\n");
/* for PNG format details see https://en.wikipedia.org/wiki/PNG */
}
else
{
ERR("Unknown/wrong size for header of 0x%x\n", header->biSize );
}
return -1;
}
@ -1377,7 +1391,10 @@ CURSORICON_LoadFromFileW(
/* Do the dance */
if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)(&bits[entry->dwDIBOffset])))
{
ERR("Failing File is \n '%S'.\n", lpszName);
goto end;
}
hCurIcon = NtUserxCreateEmptyCurObject(FALSE);
if(!hCurIcon)