LookupIconIdFromDirectoryEx16() fixed: if GetSystemPaletteEntries()

returns 0, it is interpreted as if it were 256.
This commit is contained in:
Pavel Roskin 1999-04-18 09:34:51 +00:00 committed by Alexandre Julliard
parent a8f8bef098
commit 5b14b535c8
1 changed files with 8 additions and 3 deletions

View File

@ -1375,10 +1375,15 @@ INT16 WINAPI LookupIconIdFromDirectoryEx16( LPBYTE xdir, BOOL16 bIcon,
UINT16 retVal = 0; UINT16 retVal = 0;
if( dir && !dir->idReserved && (dir->idType & 3) ) if( dir && !dir->idReserved && (dir->idType & 3) )
{ {
HDC hdc = GetDC(0);
UINT palEnts = GetSystemPaletteEntries(hdc, 0, 0, NULL);
int colors = (cFlag & LR_MONOCHROME) ? 2 : palEnts;
CURSORICONDIRENTRY* entry; CURSORICONDIRENTRY* entry;
HDC hdc;
UINT palEnts;
int colors;
hdc = GetDC(0);
palEnts = GetSystemPaletteEntries(hdc, 0, 0, NULL);
if (palEnts == 0)
palEnts = 256;
colors = (cFlag & LR_MONOCHROME) ? 2 : palEnts;
ReleaseDC(0, hdc); ReleaseDC(0, hdc);