[USER32] PrivateExtractIcons must return 0 for empty files (#7767)

This bug breaks the documented S_FALSE return value for SHDefExtractIconW when the icon is not found.
This commit is contained in:
Whindmar Saksit 2025-03-08 13:34:23 +01:00 committed by GitHub
parent d1d300b44b
commit acbadb9fba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -347,6 +347,14 @@ static UINT ICO_ExtractIconExW(
hFile = CreateFileW(szExePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); hFile = CreateFileW(szExePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (hFile == INVALID_HANDLE_VALUE) return ret; if (hFile == INVALID_HANDLE_VALUE) return ret;
fsizel = GetFileSize(hFile,&fsizeh); fsizel = GetFileSize(hFile,&fsizeh);
#ifdef __REACTOS__
if (!(fsizel | fsizeh))
{
/* Cannot map empty file */
CloseHandle(hFile);
return 0; /* No icons */
}
#endif
/* Map the file */ /* Map the file */
fmapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); fmapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL);