@@ -519,7 +519,7 @@ static unsigned write_property_to_data( const LibmsiOLEVariant *prop, uint8_t *d
519
519
return sz ;
520
520
}
521
521
522
- static unsigned suminfo_persist ( LibmsiSummaryInfo * si )
522
+ static unsigned suminfo_persist ( LibmsiSummaryInfo * si , LibmsiDatabase * database )
523
523
{
524
524
int cProperties , cbSection , dwOffset ;
525
525
GsfInput * stm ;
@@ -574,7 +574,7 @@ static unsigned suminfo_persist( LibmsiSummaryInfo *si )
574
574
575
575
assert (sz == 28 + 20 + cbSection );
576
576
577
- r = write_raw_stream_data ( si -> database , szSumInfo , data , sz , & stm );
577
+ r = write_raw_stream_data ( database , szSumInfo , data , sz , & stm );
578
578
if (r == 0 ) {
579
579
g_object_unref (G_OBJECT (stm ));
580
580
}
@@ -1017,7 +1017,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, char ***records, int num_records,
1017
1017
1018
1018
end :
1019
1019
if (r == LIBMSI_RESULT_SUCCESS )
1020
- r = suminfo_persist ( si );
1020
+ r = suminfo_persist ( si , db );
1021
1021
1022
1022
g_object_unref (si );
1023
1023
return r ;
@@ -1049,7 +1049,7 @@ libmsi_summary_info_persist (LibmsiSummaryInfo *si, GError **error)
1049
1049
}
1050
1050
1051
1051
g_object_ref (si );
1052
- ret = suminfo_persist (si );
1052
+ ret = suminfo_persist (si , si -> database );
1053
1053
g_object_unref (si );
1054
1054
1055
1055
if (ret != LIBMSI_RESULT_SUCCESS )
@@ -1058,12 +1058,44 @@ libmsi_summary_info_persist (LibmsiSummaryInfo *si, GError **error)
1058
1058
return ret == LIBMSI_RESULT_SUCCESS ;
1059
1059
}
1060
1060
1061
+ /**
1062
+ * libmsi_summary_info_save:
1063
+ * @si: a #LibmsiSummaryInfo
1064
+ * @database: a #LibmsiDatabase to save to
1065
+ * @error: (allow-none): #GError to set on error, or %NULL
1066
+ *
1067
+ * Save summary informations to the associated database.
1068
+ *
1069
+ * Returns: %TRUE on success
1070
+ **/
1071
+ gboolean
1072
+ libmsi_summary_info_save (LibmsiSummaryInfo * si , LibmsiDatabase * db , GError * * error )
1073
+ {
1074
+ unsigned ret ;
1075
+
1076
+ g_return_val_if_fail (LIBMSI_IS_SUMMARY_INFO (si ), FALSE);
1077
+ g_return_val_if_fail (LIBMSI_IS_DATABASE (db ), FALSE);
1078
+ g_return_val_if_fail (!error || * error == NULL , FALSE);
1079
+
1080
+ ret = suminfo_persist (si , db );
1081
+ if (ret != LIBMSI_RESULT_SUCCESS )
1082
+ g_set_error_literal (error , LIBMSI_RESULT_ERROR , ret , G_STRFUNC );
1083
+
1084
+ return ret == LIBMSI_RESULT_SUCCESS ;
1085
+ }
1086
+
1061
1087
/**
1062
1088
* libmsi_summary_info_new:
1063
- * @database: (allow-none): a #LibmsiDatabase
1089
+ * @database: (allow-none): an optionnal associated #LibmsiDatabase
1064
1090
* @update_count: number of changes allowed
1065
1091
* @error: (allow-none): #GError to set on error, or %NULL
1066
1092
*
1093
+ * If @database is provided, the summary informations will be
1094
+ * populated during creation, and the libmsi_summary_info_persist()
1095
+ * function will save the properties to it. If @database is %NULL, you
1096
+ * may still populate properties and then save them to a particular
1097
+ * database with the libmsi_summary_info_save() function.
1098
+ *
1067
1099
* Returns: a #LibmsiSummaryInfo or %NULL on failure
1068
1100
**/
1069
1101
LibmsiSummaryInfo *
0 commit comments