msi: Don't crash if an empty record is given to MsiProcessMessage.

oldstable
James Hawkins 2006-08-01 13:15:34 -07:00 committed by Alexandre Julliard
parent 7edea0cc68
commit f10365bb5d
2 changed files with 30 additions and 0 deletions

View File

@ -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);

View File

@ -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();
}