diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index c1478b3119a..f4ee66c58e7 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -1569,7 +1569,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, '%','d','.','%','d','.','%','d','.','%','d',0}; static const WCHAR szLangFormat[] = {'%','d',0}; UINT ret = 0; - DWORD dwVerLen; + DWORD dwVerLen, gle; LPVOID lpVer = NULL; VS_FIXEDFILEINFO *ffi; UINT puLen; @@ -1581,7 +1581,13 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL); if( !dwVerLen ) - return GetLastError(); + { + gle = GetLastError(); + if (gle == ERROR_BAD_PATHNAME) + return ERROR_FILE_NOT_FOUND; + + return gle; + } lpVer = msi_alloc(dwVerLen); if( !lpVer ) diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 57fe40511da..79652a1d3a3 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -1847,17 +1847,14 @@ static void test_MsiGetFileVersion(void) lstrcpyA(version, "version"); lstrcpyA(lang, "lang"); r = MsiGetFileVersionA("", version, &versz, lang, &langsz); + ok(r == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", r); ok(!lstrcmpA(version, "version"), "Expected version to be unchanged, got %s\n", version); ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz); ok(!lstrcmpA(lang, "lang"), "Expected lang to be unchanged, got %s\n", lang); ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz); - todo_wine - { - ok(r == ERROR_FILE_NOT_FOUND, - "Expected ERROR_FILE_NOT_FOUND, got %d\n", r); - } /* nonexistent szFilePath */ versz = MAX_PATH;