msi: Always check the return value of MSI_IterateRecords.

This commit is contained in:
Hans Leidekker 2011-07-27 10:53:44 +02:00 committed by Alexandre Julliard
parent e1c2e8828f
commit fe404d1d88
4 changed files with 146 additions and 81 deletions

View File

@ -1109,9 +1109,9 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
ilfs.package = package;
ilfs.feature = feature;
MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs);
rc = MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
return rc;
}
static UINT find_feature_children(MSIRECORD * row, LPVOID param)
@ -1316,7 +1316,7 @@ static UINT load_all_files(MSIPACKAGE *package)
rc = MSI_IterateRecords(view, NULL, load_file, package);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
return rc;
}
static UINT load_media( MSIRECORD *row, LPVOID param )
@ -1344,9 +1344,9 @@ static UINT load_all_media( MSIPACKAGE *package )
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
MSI_IterateRecords( view, NULL, load_media, package );
r = MSI_IterateRecords( view, NULL, load_media, package );
msiobj_release( &view->hdr );
return ERROR_SUCCESS;
return r;
}
static UINT load_patch(MSIRECORD *row, LPVOID param)
@ -1409,7 +1409,7 @@ static UINT load_all_patches(MSIPACKAGE *package)
rc = MSI_IterateRecords(view, NULL, load_patch, package);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
return rc;
}
static UINT load_folder_persistence( MSIPACKAGE *package, MSIFOLDER *folder )
@ -2347,6 +2347,8 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
{
rc = MSI_IterateRecords( view, NULL, ITERATE_CostFinalizeConditions, package );
msiobj_release( &view->hdr );
if (rc != ERROR_SUCCESS)
return rc;
}
}
@ -2910,8 +2912,10 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW( package->db, query, &view );
if (rc == ERROR_SUCCESS)
{
MSI_IterateRecords( view, &count, NULL, package );
rc = MSI_IterateRecords( view, &count, NULL, package );
msiobj_release( &view->hdr );
if (rc != ERROR_SUCCESS)
return rc;
total += count * REG_PROGRESS_VALUE;
}
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
@ -3798,8 +3802,10 @@ static UINT msi_publish_icons(MSIPACKAGE *package)
r = MSI_DatabaseOpenViewW(package->db, query, &view);
if (r == ERROR_SUCCESS)
{
MSI_IterateRecords(view, NULL, ITERATE_PublishIcon, package);
r = MSI_IterateRecords(view, NULL, ITERATE_PublishIcon, package);
msiobj_release(&view->hdr);
if (r != ERROR_SUCCESS)
return r;
}
return ERROR_SUCCESS;
}
@ -4487,9 +4493,9 @@ static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
MSI_IterateRecords(view, NULL, ITERATE_SelfRegModules, package);
rc = MSI_IterateRecords(view, NULL, ITERATE_SelfRegModules, package);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
return rc;
}
static UINT ITERATE_SelfUnregModules( MSIRECORD *row, LPVOID param )
@ -4537,9 +4543,9 @@ static UINT ACTION_SelfUnregModules( MSIPACKAGE *package )
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
MSI_IterateRecords( view, NULL, ITERATE_SelfUnregModules, package );
rc = MSI_IterateRecords( view, NULL, ITERATE_SelfUnregModules, package );
msiobj_release( &view->hdr );
return ERROR_SUCCESS;
return rc;
}
static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
@ -6180,26 +6186,30 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package )
UINT rc;
rc = MSI_DatabaseOpenViewW(package->db, driver_query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDriver, package);
msiobj_release(&view->hdr);
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDriver, package);
msiobj_release(&view->hdr);
if (rc != ERROR_SUCCESS)
return rc;
}
rc = MSI_DatabaseOpenViewW(package->db, translator_query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCTranslator, package);
msiobj_release(&view->hdr);
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCTranslator, package);
msiobj_release(&view->hdr);
if (rc != ERROR_SUCCESS)
return rc;
}
rc = MSI_DatabaseOpenViewW(package->db, source_query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDataSource, package);
msiobj_release(&view->hdr);
return rc;
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDataSource, package);
msiobj_release(&view->hdr);
if (rc != ERROR_SUCCESS)
return rc;
}
return ERROR_SUCCESS;
}
static UINT ITERATE_RemoveODBCDriver( MSIRECORD *rec, LPVOID param )
@ -6354,26 +6364,30 @@ static UINT ACTION_RemoveODBC( MSIPACKAGE *package )
UINT rc;
rc = MSI_DatabaseOpenViewW( package->db, driver_query, &view );
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDriver, package );
msiobj_release( &view->hdr );
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDriver, package );
msiobj_release( &view->hdr );
if (rc != ERROR_SUCCESS)
return rc;
}
rc = MSI_DatabaseOpenViewW( package->db, translator_query, &view );
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCTranslator, package );
msiobj_release( &view->hdr );
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCTranslator, package );
msiobj_release( &view->hdr );
if (rc != ERROR_SUCCESS)
return rc;
}
rc = MSI_DatabaseOpenViewW( package->db, source_query, &view );
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDataSource, package );
msiobj_release( &view->hdr );
return rc;
if (rc == ERROR_SUCCESS)
{
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDataSource, package );
msiobj_release( &view->hdr );
if (rc != ERROR_SUCCESS)
return rc;
}
return ERROR_SUCCESS;
}
#define ENV_ACT_SETALWAYS 0x1
@ -6856,6 +6870,8 @@ static UINT ACTION_SetODBCFolders( MSIPACKAGE *package )
count = 0;
r = MSI_IterateRecords( view, &count, NULL, package );
msiobj_release( &view->hdr );
if (r != ERROR_SUCCESS)
return r;
if (count) FIXME("ignored %u rows in ODBCDriver table\n", count);
}
r = MSI_DatabaseOpenViewW( package->db, translator_query, &view );
@ -6864,6 +6880,8 @@ static UINT ACTION_SetODBCFolders( MSIPACKAGE *package )
count = 0;
r = MSI_IterateRecords( view, &count, NULL, package );
msiobj_release( &view->hdr );
if (r != ERROR_SUCCESS)
return r;
if (count) FIXME("ignored %u rows in ODBCTranslator table\n", count);
}
return ERROR_SUCCESS;
@ -6896,7 +6914,8 @@ static UINT ACTION_RemoveExistingProducts( MSIPACKAGE *package )
{
r = MSI_IterateRecords( view, NULL, ITERATE_RemoveExistingProducts, package );
msiobj_release( &view->hdr );
return r;
if (r != ERROR_SUCCESS)
return r;
}
return ERROR_SUCCESS;
}
@ -6959,6 +6978,8 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
{
r = MSI_IterateRecords( view, NULL, ITERATE_MigrateFeatureStates, package );
msiobj_release( &view->hdr );
if (r != ERROR_SUCCESS)
return r;
}
return ERROR_SUCCESS;
}
@ -7020,6 +7041,8 @@ static UINT ACTION_BindImage( MSIPACKAGE *package )
{
r = MSI_IterateRecords( view, NULL, ITERATE_BindImage, package );
msiobj_release( &view->hdr );
if (r != ERROR_SUCCESS)
return r;
}
return ERROR_SUCCESS;
}
@ -7037,6 +7060,8 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, L
{
r = MSI_IterateRecords(view, &count, NULL, package);
msiobj_release(&view->hdr);
if (r != ERROR_SUCCESS)
return r;
}
if (count) FIXME("%s: ignored %u rows from %s\n", action, count, debugstr_w(table));
return ERROR_SUCCESS;

View File

@ -538,7 +538,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
return ERROR_SUCCESS;
}
static VOID load_all_classes(MSIPACKAGE *package)
static UINT load_all_classes( MSIPACKAGE *package )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','C','l','a','s','s','`',0};
@ -547,10 +547,11 @@ static VOID load_all_classes(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return;
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, iterate_all_classes, package);
msiobj_release(&view->hdr);
return rc;
}
static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
@ -583,7 +584,7 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
return ERROR_SUCCESS;
}
static VOID load_all_extensions(MSIPACKAGE *package)
static UINT load_all_extensions( MSIPACKAGE *package )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','E','x','t','e','n','s','i','o','n','`',0};
@ -592,10 +593,11 @@ static VOID load_all_extensions(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW( package->db, query, &view );
if (rc != ERROR_SUCCESS)
return;
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, iterate_all_extensions, package);
msiobj_release(&view->hdr);
return rc;
}
static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
@ -608,7 +610,7 @@ static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
return ERROR_SUCCESS;
}
static VOID load_all_progids(MSIPACKAGE *package)
static UINT load_all_progids( MSIPACKAGE *package )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ','F','R','O','M',' ',
@ -618,13 +620,14 @@ static VOID load_all_progids(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return;
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, iterate_all_progids, package);
msiobj_release(&view->hdr);
return rc;
}
static VOID load_all_verbs(MSIPACKAGE *package)
static UINT load_all_verbs( MSIPACKAGE *package )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','V','e','r','b','`',0};
@ -633,10 +636,11 @@ static VOID load_all_verbs(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return;
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, iterate_load_verb, package);
msiobj_release(&view->hdr);
return rc;
}
static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
@ -649,7 +653,7 @@ static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
return ERROR_SUCCESS;
}
static VOID load_all_mimes(MSIPACKAGE *package)
static UINT load_all_mimes( MSIPACKAGE *package )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','`','C','o','n','t','e','n','t','T','y','p','e','`',' ',
@ -659,29 +663,39 @@ static VOID load_all_mimes(MSIPACKAGE *package)
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return;
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, iterate_all_mimes, package);
msiobj_release(&view->hdr);
return rc;
}
static void load_classes_and_such(MSIPACKAGE *package)
static UINT load_classes_and_such( MSIPACKAGE *package )
{
UINT r;
TRACE("Loading all the class info and related tables\n");
/* check if already loaded */
if (!list_empty( &package->classes ) ||
!list_empty( &package->mimes ) ||
!list_empty( &package->extensions ) ||
!list_empty( &package->progids ) )
return;
!list_empty( &package->progids )) return ERROR_SUCCESS;
r = load_all_classes( package );
if (r != ERROR_SUCCESS) return r;
r = load_all_extensions( package );
if (r != ERROR_SUCCESS) return r;
r = load_all_progids( package );
if (r != ERROR_SUCCESS) return r;
load_all_classes(package);
load_all_extensions(package);
load_all_progids(package);
/* these loads must come after the other loads */
load_all_verbs(package);
load_all_mimes(package);
r = load_all_verbs( package );
if (r != ERROR_SUCCESS) return r;
return load_all_mimes( package );
}
static void mark_progid_for_install( MSIPACKAGE* package, MSIPROGID *progid )
@ -788,10 +802,13 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0};
const WCHAR *keypath;
MSIRECORD *uirow;
HKEY hkey,hkey2,hkey3;
HKEY hkey, hkey2, hkey3;
MSICLASS *cls;
UINT r;
load_classes_and_such(package);
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
if (is_64bit && package->platform == PLATFORM_INTEL)
keypath = szWow6432NodeCLSID;
@ -953,8 +970,11 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
MSIRECORD *uirow;
MSICLASS *cls;
HKEY hkey, hkey2;
UINT r;
load_classes_and_such( package );
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
if (is_64bit && package->platform == PLATFORM_INTEL)
keypath = szWow6432NodeCLSID;
@ -1087,8 +1107,11 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
{
MSIPROGID *progid;
MSIRECORD *uirow;
UINT r;
load_classes_and_such(package);
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
{
@ -1120,8 +1143,11 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package )
MSIPROGID *progid;
MSIRECORD *uirow;
LONG res;
UINT r;
load_classes_and_such( package );
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
{
@ -1233,8 +1259,11 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
MSIRECORD *uirow;
BOOL install_on_demand = TRUE;
LONG res;
UINT r;
load_classes_and_such(package);
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
/* We need to set install_on_demand based on if the shell handles advertised
* shortcuts and the like. Because Mike McCormack is working on this i am
@ -1346,8 +1375,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
MSIEXTENSION *ext;
MSIRECORD *uirow;
LONG res;
UINT r;
load_classes_and_such( package );
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry )
{
@ -1431,8 +1463,11 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
static const WCHAR szExtension[] = {'E','x','t','e','n','s','i','o','n',0};
MSIRECORD *uirow;
MSIMIME *mt;
UINT r;
load_classes_and_such(package);
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
{
@ -1485,8 +1520,11 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
{
MSIRECORD *uirow;
MSIMIME *mime;
UINT r;
load_classes_and_such( package );
r = load_classes_and_such( package );
if (r != ERROR_SUCCESS)
return r;
LIST_FOR_EACH_ENTRY( mime, &package->mimes, MSIMIME, entry )
{

View File

@ -1235,8 +1235,10 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
r = MSI_DatabaseOpenViewW(package->db, query, &view);
if (r == ERROR_SUCCESS)
{
MSI_IterateRecords(view, NULL, ITERATE_RemoveFiles, package);
r = MSI_IterateRecords(view, NULL, ITERATE_RemoveFiles, package);
msiobj_release(&view->hdr);
if (r != ERROR_SUCCESS)
return r;
}
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )

View File

@ -275,9 +275,9 @@ UINT ACTION_RegisterFonts(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
rc = MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
return rc;
}
static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
@ -355,7 +355,7 @@ UINT ACTION_UnregisterFonts( MSIPACKAGE *package )
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
MSI_IterateRecords( view, NULL, ITERATE_UnregisterFonts, package );
r = MSI_IterateRecords( view, NULL, ITERATE_UnregisterFonts, package );
msiobj_release( &view->hdr );
return ERROR_SUCCESS;
return r;
}