diff --git "a/win32ss/user/user32/misc/exticon.c" "b/win32ss/user/user32/misc/exticon.c" index 04d129ea0b0..9037d1bce47 100644 --- "a/win32ss/user/user32/misc/exticon.c" +++ "b/win32ss/user/user32/misc/exticon.c" @@ -711,8 +711,13 @@ static UINT ICO_ExtractIconExW( } /* assure we don't get too much */ +#ifdef __REACTOS__ + if( nIcons > iconDirCount - nIconIndex + 1 ) // + 1 (starts at zero index) + nIcons = iconDirCount - nIconIndex + 1; +#else if( nIcons > iconDirCount - nIconIndex ) nIcons = iconDirCount - nIconIndex; +#endif /* starting from specified index */ xresent = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(icongroupresdir+1) + nIconIndex; @@ -736,7 +741,16 @@ static UINT ICO_ExtractIconExW( goto end; /* failure */ } pIconId[i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx1, cy1, flags); +#ifdef __REACTOS__ + TRACE("pIconId[%d] is %d\n", i, pIconId[i]); + if (cx2 && cy2) + { + pIconId[++i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx2, cy2, flags); + TRACE("pIconId[%d] is %d\n", i, pIconId[i]); + } +#else if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx2, cy2, flags); +#endif } if (!(iconresdir=find_entry_by_id(rootresdir,LOWORD(RT_ICON),rootresdir))) @@ -745,6 +759,12 @@ static UINT ICO_ExtractIconExW( goto end; /* failure */ } +#ifdef __REACTOS__ + /* If doing pairs and nIcons is an odd number */ + if (cx2 && cy2 && nIcons % 2 == 1) + nIcons++; + +#endif for (i=0; iSize, TRUE, 0x00030000, cx2, cy2, flags); + } + else + { + /* Handling individual icons */ + RetPtr[i] = CreateIconFromResourceEx(idata, idataent->Size, TRUE, 0x00030000, cx1, cy1, flags); + } +#else RetPtr[i] = CreateIconFromResourceEx(idata, idataent->Size, TRUE, 0x00030000, cx1, cy1, flags); if (cx2 && cy2) RetPtr[++i] = CreateIconFromResourceEx(idata, idataent->Size, TRUE, 0x00030000, cx2, cy2, flags); +#endif } ret = i; /* return number of retrieved icons */ } /* if(sig == IMAGE_NT_SIGNATURE) */