msi: Translate ERROR_BAD_PATHNAME into ERROR_FILE_NOT_FOUND.

This commit is contained in:
James Hawkins 2008-02-04 11:34:10 -06:00 committed by Alexandre Julliard
parent 5d46eeac75
commit 856800c84b
2 changed files with 10 additions and 7 deletions

View File

@ -1569,7 +1569,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
'%','d','.','%','d','.','%','d','.','%','d',0}; '%','d','.','%','d','.','%','d','.','%','d',0};
static const WCHAR szLangFormat[] = {'%','d',0}; static const WCHAR szLangFormat[] = {'%','d',0};
UINT ret = 0; UINT ret = 0;
DWORD dwVerLen; DWORD dwVerLen, gle;
LPVOID lpVer = NULL; LPVOID lpVer = NULL;
VS_FIXEDFILEINFO *ffi; VS_FIXEDFILEINFO *ffi;
UINT puLen; UINT puLen;
@ -1581,7 +1581,13 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL); dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
if( !dwVerLen ) if( !dwVerLen )
return GetLastError(); {
gle = GetLastError();
if (gle == ERROR_BAD_PATHNAME)
return ERROR_FILE_NOT_FOUND;
return gle;
}
lpVer = msi_alloc(dwVerLen); lpVer = msi_alloc(dwVerLen);
if( !lpVer ) if( !lpVer )

View File

@ -1847,17 +1847,14 @@ static void test_MsiGetFileVersion(void)
lstrcpyA(version, "version"); lstrcpyA(version, "version");
lstrcpyA(lang, "lang"); lstrcpyA(lang, "lang");
r = MsiGetFileVersionA("", version, &versz, lang, &langsz); 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"), ok(!lstrcmpA(version, "version"),
"Expected version to be unchanged, got %s\n", version); "Expected version to be unchanged, got %s\n", version);
ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz); ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
ok(!lstrcmpA(lang, "lang"), ok(!lstrcmpA(lang, "lang"),
"Expected lang to be unchanged, got %s\n", lang); "Expected lang to be unchanged, got %s\n", lang);
ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz); 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 */ /* nonexistent szFilePath */
versz = MAX_PATH; versz = MAX_PATH;