diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index b80fe914c3d..b2038a125a9 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -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; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 24a23d6ac93..aaf93e981ff 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -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); diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index 528070e0ffd..3ff8d3fb418 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -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; diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index c9afdca29d3..e6fd855446d 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -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(); }