diff --git "a/win32ss/user/user32/misc/exticon.c" "b/win32ss/user/user32/misc/exticon.c" index fec6103b2bb..d1e93a3897a 100644 --- "a/win32ss/user/user32/misc/exticon.c" +++ "b/win32ss/user/user32/misc/exticon.c" @@ -310,6 +310,8 @@ static UINT ICO_ExtractIconExW( DWORD fsizeh,fsizel; #ifdef __REACTOS__ WCHAR szExpandedExePath[MAX_PATH]; + DWORD SizeOfMZHdr = 0; + DWORD OffsetNameInfo = 0; #endif WCHAR szExePath[MAX_PATH]; DWORD dwSearchReturn; @@ -430,6 +432,14 @@ static UINT ICO_ExtractIconExW( NE_NAMEINFO *pIconDir = NULL; LPicoICONDIR lpiID = NULL; ULONG uSize = 0; +#ifdef __REACTOS__ + if (peimage[24] >= 64) + { + SizeOfMZHdr = MAKEWORD(peimage[60], peimage[61]); + OffsetNameInfo = SizeOfMZHdr + + MAKEWORD(peimage[SizeOfMZHdr + 38], peimage[SizeOfMZHdr + 39]); + } +#endif TRACE("-- OS2/icon Signature (0x%08x)\n", sig); @@ -442,6 +452,35 @@ static UINT ICO_ExtractIconExW( TRACE("-- icon found %p 0x%08x 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount); } } +#ifdef __REACTOS__ + else + { + while (pTInfo->type_id && !(pIconStorage && pIconDir)) + { + if (pTInfo->type_id == NE_RSCTYPE_GROUP_ICON) /* find icon directory and icon repository */ + { + iconDirCount = pTInfo->count; + pIconDir = ((NE_NAMEINFO*)(pTInfo + 1)); + TRACE("\tfound directory - %i icon families\n", iconDirCount); + } + if (pTInfo->type_id == NE_RSCTYPE_ICON) + { + iconCount = pTInfo->count; + pIconStorage = ((NE_NAMEINFO*)(pTInfo + 1)); + TRACE("\ttotal icons - %i\n", iconCount); + } + + pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO)); + + /* If we point into the Name Table, we did not find an Icon + * directory in the Type Table and we are finished. */ + if ((LPBYTE)pTInfo >= peimage + (INT_PTR)OffsetNameInfo) + { + break; + } + } + } +#else else while (pTInfo->type_id && !(pIconStorage && pIconDir)) { if (pTInfo->type_id == NE_RSCTYPE_GROUP_ICON) /* find icon directory and icon repository */ @@ -458,6 +497,7 @@ static UINT ICO_ExtractIconExW( } pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO)); } +#endif if ((pIconStorage && pIconDir) || lpiID) /* load resources and create icons */ {