Commit 03335de8 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Return ERROR_INVALID_PARAMETER if a string pointer is non-NULL and the size pointer is NULL.

parent 856800c8
......@@ -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 )
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment