diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index f4ee66c58e7..774c53fcf00 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -1519,6 +1519,10 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL; UINT ret = ERROR_OUTOFMEMORY; + if ((lpVersionBuf && !pcchVersionBuf) || + (lpLangBuf && !pcchLangBuf)) + return ERROR_INVALID_PARAMETER; + if( szFilePath ) { szwFilePath = strdupAtoW( szFilePath ); @@ -1579,6 +1583,10 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0, lpLangBuf, pcchLangBuf?*pcchLangBuf:0); + if ((lpVersionBuf && !pcchVersionBuf) || + (lpLangBuf && !pcchLangBuf)) + return ERROR_INVALID_PARAMETER; + dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL); if( !dwVerLen ) { diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 79652a1d3a3..3bd618100dd 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -1877,17 +1877,14 @@ static void test_MsiGetFileVersion(void) lstrcpyA(version, "version"); lstrcpyA(lang, "lang"); r = MsiGetFileVersionA("nonexistent", version, NULL, lang, &langsz); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, 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_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */ versz = MAX_PATH; @@ -1895,17 +1892,14 @@ static void test_MsiGetFileVersion(void) lstrcpyA(version, "version"); lstrcpyA(lang, "lang"); r = MsiGetFileVersionA("nonexistent", version, &versz, lang, NULL); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, 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_INVALID_PARAMETER, - "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */ versz = 0;