[PATCH] version: Return ERROR_FILE_NOT_FOUND for Win 9X when a file was not found in GetFileVersionInfoSize.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed May 16 23:20:52 CDT 2018


From: Michael Müller <michael at fds-team.de>

Windows 9x doesnt have function GetFileVersionInfoSizeExA/W however is does
have function GetFileVersionInfoSizeA/W. Since all the GetFileVersionInfoSize*
functions go though GetFileVersionInfoSizeExW, this seems the best position for
the code.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/version/version.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/version/version.c b/dlls/version/version.c
index 13436ca..f33361b 100644
--- a/dlls/version/version.c
+++ b/dlls/version/version.c
@@ -705,7 +705,12 @@ DWORD WINAPI GetFileVersionInfoSizeExW( DWORD flags, LPCWSTR filename, LPDWORD h
         return (len * 2) + 4;
 
     default:
-        SetLastError( lzfd == HFILE_ERROR ? ofs.nErrCode : ERROR_RESOURCE_DATA_NOT_FOUND );
+        if (lzfd == HFILE_ERROR)
+            SetLastError(ofs.nErrCode);
+        else if (GetVersion() & 0x80000000) /* Windows 95/98 */
+            SetLastError(ERROR_FILE_NOT_FOUND);
+        else
+            SetLastError(ERROR_RESOURCE_DATA_NOT_FOUND);
         return 0;
     }
 }
-- 
1.9.1



More information about the wine-devel mailing list