msi: Don't crash if an empty record is given to MsiProcessMessage.
This commit is contained in:
parent
7edea0cc68
commit
f10365bb5d
|
@ -668,6 +668,10 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
|
|||
|
||||
action = MSI_RecordGetString(record, 1);
|
||||
action_text = MSI_RecordGetString(record, 2);
|
||||
|
||||
if (!action || !action_text)
|
||||
return IDOK;
|
||||
|
||||
deformat_string(package, action_text, &deformatted);
|
||||
|
||||
len = strlenW(timet) + strlenW(action) + strlenW(template_s);
|
||||
|
|
|
@ -1360,9 +1360,35 @@ static void test_formatrecord_package(void)
|
|||
DeleteFile( filename );
|
||||
}
|
||||
|
||||
static void test_processmessage(void)
|
||||
{
|
||||
static const CHAR filename[] = "winetest.msi";
|
||||
MSIHANDLE hrec;
|
||||
MSIHANDLE package;
|
||||
int r;
|
||||
|
||||
package = helper_createpackage( filename );
|
||||
ok(package!=0, "Unable to create package\n");
|
||||
|
||||
hrec = MsiCreateRecord(3);
|
||||
ok( hrec, "failed to create record\n");
|
||||
|
||||
r = MsiRecordSetString(hrec, 1, "");
|
||||
ok( r == ERROR_SUCCESS, "set string failed\n");
|
||||
|
||||
r = MsiProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, hrec);
|
||||
ok( r == IDOK, "expected IDOK, got %i\n", r);
|
||||
|
||||
MsiCloseHandle(hrec);
|
||||
MsiCloseHandle(package);
|
||||
|
||||
DeleteFile(filename);
|
||||
}
|
||||
|
||||
START_TEST(format)
|
||||
{
|
||||
test_createpackage();
|
||||
test_formatrecord();
|
||||
test_formatrecord_package();
|
||||
test_processmessage();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue