LookupIconIdFromDirectoryEx16() fixed: if GetSystemPaletteEntries()
returns 0, it is interpreted as if it were 256.
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 39d461d..33ed6cf 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -1375,10 +1375,15 @@
UINT16 retVal = 0;
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;
+ 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);