msi: Return ERROR_INVALID_PARAMETER if szProduct is invalid.

This commit is contained in:
James Hawkins 2008-02-11 01:16:49 -06:00 committed by Alexandre Julliard
parent 33c1e6ef56
commit ff0dc44f2d
2 changed files with 11 additions and 16 deletions

View File

@ -567,6 +567,7 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
UINT r;
HKEY hkey;
LPWSTR val = NULL;
WCHAR squished_pc[GUID_SIZE];
TRACE("%s %s %p %p\n", debugstr_w(szProduct),
debugstr_w(szAttribute), szValue, pcchValueBuf);
@ -575,7 +576,10 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
* FIXME: Values seem scattered/duplicated in the registry. Is there a system?
*/
if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szProduct[0] || !szAttribute)
if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute)
return ERROR_INVALID_PARAMETER;
if (!squash_guid(szProduct, squished_pc))
return ERROR_INVALID_PARAMETER;
/* check for special properties */

View File

@ -2080,11 +2080,8 @@ static void test_MsiGetProductInfo(void)
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK, buf, &sz);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
@ -2093,11 +2090,8 @@ static void test_MsiGetProductInfo(void)
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
INSTALLPROPERTY_HELPLINK, buf, &sz);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
@ -2116,11 +2110,8 @@ static void test_MsiGetProductInfo(void)
lstrcpyA(buf, "apple");
r = MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
INSTALLPROPERTY_HELPLINK, buf, &sz);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);