msi: Reject NULL or empty patch package parameter in MsiApplyPatch.

This commit is contained in:
Hans Leidekker 2009-05-06 15:57:22 +02:00 committed by Alexandre Julliard
parent 2b03dd373d
commit 0d8a826ef5
2 changed files with 15 additions and 0 deletions

View File

@ -315,6 +315,9 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
static const WCHAR patcheq[] = {'P','A','T','C','H','=',0}; static const WCHAR patcheq[] = {'P','A','T','C','H','=',0};
static WCHAR empty[] = {0}; static WCHAR empty[] = {0};
if (!szPatchPackage || !szPatchPackage[0])
return ERROR_INVALID_PARAMETER;
if (!szProductCode) if (!szProductCode)
{ {
r = MsiOpenDatabaseW(szPatchPackage, MSIDBOPEN_READONLY, &patch); r = MsiOpenDatabaseW(szPatchPackage, MSIDBOPEN_READONLY, &patch);

View File

@ -11604,6 +11604,17 @@ static void test_MsiApplyMultiplePatches(void)
todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r); todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
} }
static void test_MsiApplyPatch(void)
{
UINT r;
r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
}
START_TEST(package) START_TEST(package)
{ {
HMODULE hmsi = GetModuleHandleA("msi.dll"); HMODULE hmsi = GetModuleHandleA("msi.dll");
@ -11642,4 +11653,5 @@ START_TEST(package)
test_MsiGetProductProperty(); test_MsiGetProductProperty();
test_MsiSetProperty(); test_MsiSetProperty();
test_MsiApplyMultiplePatches(); test_MsiApplyMultiplePatches();
test_MsiApplyPatch();
} }