Skip to content

Commit acbadb9

Browse files
authored
[USER32] PrivateExtractIcons must return 0 for empty files (reactos#7767)
This bug breaks the documented S_FALSE return value for SHDefExtractIconW when the icon is not found.
1 parent d1d300b commit acbadb9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

win32ss/user/user32/misc/exticon.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,14 @@ static UINT ICO_ExtractIconExW(
347347
hFile = CreateFileW(szExePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
348348
if (hFile == INVALID_HANDLE_VALUE) return ret;
349349
fsizel = GetFileSize(hFile,&fsizeh);
350+
#ifdef __REACTOS__
351+
if (!(fsizel | fsizeh))
352+
{
353+
/* Cannot map empty file */
354+
CloseHandle(hFile);
355+
return 0; /* No icons */
356+
}
357+
#endif
350358

351359
/* Map the file */
352360
fmapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL);

0 commit comments

Comments
 (0)