msi: Handle a NULL and empty szPackagePath in MsiInstallProduct (Coverity 181).
This commit is contained in:
parent
fb8db0ac13
commit
5e62686a0f
|
@ -231,6 +231,12 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
|
|||
|
||||
TRACE("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
|
||||
|
||||
if (!szPackagePath)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (!*szPackagePath)
|
||||
return ERROR_PATH_NOT_FOUND;
|
||||
|
||||
r = MSI_OpenPackageW( szPackagePath, &package );
|
||||
if (r == ERROR_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -1721,6 +1721,21 @@ static void test_MsiInstallProduct(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* szPackagePath is NULL */
|
||||
r = MsiInstallProductA(NULL, "INSTALL=ALL");
|
||||
ok(r == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* both szPackagePath and szCommandLine are NULL */
|
||||
r = MsiInstallProductA(NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* szPackagePath is empty */
|
||||
r = MsiInstallProductA("", "INSTALL=ALL");
|
||||
ok(r == ERROR_PATH_NOT_FOUND,
|
||||
"Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
|
||||
|
||||
|
|
Loading…
Reference in New Issue