https://git.reactos.org/?p=reactos.git;a=commitdiff;h=acbadb9fbad343cca189b…
commit acbadb9fbad343cca189b550e198f77ec7da0dc7
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Sat Mar 8 13:34:23 2025 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Mar 8 13:34:23 2025 +0100
[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.
---
win32ss/user/user32/misc/exticon.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/win32ss/user/user32/misc/exticon.c b/win32ss/user/user32/misc/exticon.c
index fec6103b2bb..04d129ea0b0 100644
--- a/win32ss/user/user32/misc/exticon.c
+++ b/win32ss/user/user32/misc/exticon.c
@@ -347,6 +347,14 @@ static UINT ICO_ExtractIconExW(
hFile = CreateFileW(szExePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
0, 0);
if (hFile == INVALID_HANDLE_VALUE) return ret;
fsizel = GetFileSize(hFile,&fsizeh);
+#ifdef __REACTOS__
+ if (!(fsizel | fsizeh))
+ {
+ /* Cannot map empty file */
+ CloseHandle(hFile);
+ return 0; /* No icons */
+ }
+#endif
/* Map the file */
fmapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0,
NULL);