msi: Fix some possible NULL pointer dereferences (Coverity).
This commit is contained in:
parent
13dccd7541
commit
a92fe55cce
|
@ -667,6 +667,9 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
|||
|
||||
TRACE("%s\n", debugstr_w(szProduct));
|
||||
|
||||
if (!szProduct)
|
||||
return INSTALLSTATE_INVALIDARG;
|
||||
|
||||
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
goto end;
|
||||
|
|
|
@ -514,6 +514,9 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP
|
|||
|
||||
TRACE("%s %08lx %p\n", debugstr_w(szPackage), dwOptions, phPackage );
|
||||
|
||||
if( szPackage == NULL )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if( dwOptions )
|
||||
FIXME("dwOptions %08lx not supported\n", dwOptions);
|
||||
|
||||
|
|
|
@ -675,6 +675,9 @@ UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index,
|
|||
|
||||
TRACE("%s %ld %p %p\n",debugstr_w(szProduct),index,szFeature,szParent);
|
||||
|
||||
if( !szProduct )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
r = MSIREG_OpenFeaturesKey(szProduct,&hkeyProduct,FALSE);
|
||||
if( r != ERROR_SUCCESS )
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
|
|
|
@ -66,6 +66,21 @@ static void test_usefeature(void)
|
|||
|
||||
}
|
||||
|
||||
static void test_null(void)
|
||||
{
|
||||
MSIHANDLE hpkg;
|
||||
UINT r;
|
||||
|
||||
r = MsiOpenPackageExW(NULL, 0, &hpkg);
|
||||
ok( r == ERROR_INVALID_PARAMETER,"wrong error");
|
||||
|
||||
r = MsiQueryProductStateW(NULL);
|
||||
ok( r == INSTALLSTATE_INVALIDARG, "wrong return\n");
|
||||
|
||||
r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
|
||||
ok( r == ERROR_INVALID_PARAMETER,"wrong error");
|
||||
}
|
||||
|
||||
START_TEST(msi)
|
||||
{
|
||||
HMODULE hmod = GetModuleHandle("msi.dll");
|
||||
|
@ -73,4 +88,5 @@ START_TEST(msi)
|
|||
GetProcAddress(hmod, "MsiUseFeatureExA");
|
||||
|
||||
test_usefeature();
|
||||
test_null();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue