Commit 44b79839 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Make MSI_SetPropertyW take a pointer to a database instead of a package.

parent 186f4efa
......@@ -277,9 +277,13 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
if (lstrlenW(prop) > 0)
{
UINT r = MSI_SetPropertyW( package->db, prop, val );
TRACE("Found commandline property (%s) = (%s)\n",
debugstr_w(prop), debugstr_w(val));
MSI_SetPropertyW(package,prop,val);
if (r == ERROR_SUCCESS && !strcmpW( prop, cszSourceDir ))
msi_reset_folders( package, TRUE );
}
msi_free(val);
msi_free(prop);
......@@ -477,7 +481,7 @@ static UINT msi_set_media_source_prop(MSIPACKAGE *package)
{
prop = MSI_RecordGetString(rec, 1);
patch = msi_dup_property(package->db, szPatch);
MSI_SetPropertyW(package, prop, patch);
MSI_SetPropertyW(package->db, prop, patch);
msi_free(patch);
}
......@@ -668,13 +672,16 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
check = msi_dup_property( package->db, cszSourceDir );
if (!check || replace)
MSI_SetPropertyW( package, cszSourceDir, source );
{
UINT r = MSI_SetPropertyW( package->db, cszSourceDir, source );
if (r == ERROR_SUCCESS)
msi_reset_folders( package, TRUE );
}
msi_free( check );
check = msi_dup_property( package->db, cszSOURCEDIR );
if (!check || replace)
MSI_SetPropertyW( package, cszSOURCEDIR, source );
MSI_SetPropertyW( package->db, cszSOURCEDIR, source );
msi_free( check );
msi_free( source );
......@@ -1513,8 +1520,8 @@ static UINT ACTION_CostInitialize(MSIPACKAGE *package)
static const WCHAR szCosting[] =
{'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
MSI_SetPropertyW(package, szCosting, szZero);
MSI_SetPropertyW(package, cszRootDrive, c_colon);
MSI_SetPropertyW( package->db, szCosting, szZero );
MSI_SetPropertyW( package->db, cszRootDrive, c_colon );
load_all_folders( package );
load_all_components( package );
......@@ -1684,7 +1691,7 @@ static BOOL process_overrides( MSIPACKAGE *package, int level )
ret |= process_state_property( package, level, szAdvertise, INSTALLSTATE_ADVERTISED );
if (ret)
MSI_SetPropertyW( package, szPreselected, szOne );
MSI_SetPropertyW( package->db, szPreselected, szOne );
return ret;
}
......@@ -2077,15 +2084,15 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
}
}
MSI_SetPropertyW(package,szCosting,szOne);
MSI_SetPropertyW( package->db, szCosting, szOne );
/* set default run level if not set */
level = msi_dup_property( package->db, szlevel );
if (!level)
MSI_SetPropertyW(package,szlevel, szOne);
MSI_SetPropertyW( package->db, szlevel, szOne );
msi_free(level);
/* FIXME: check volume disk space */
MSI_SetPropertyW(package, szOutOfDiskSpace, szZero);
MSI_SetPropertyW( package->db, szOutOfDiskSpace, szZero );
return MSI_SetFeatureStates(package);
}
......@@ -6795,7 +6802,7 @@ static UINT ACTION_ValidateProductID( MSIPACKAGE *package )
if (key && template)
{
FIXME( "partial stub: template %s key %s\n", debugstr_w(template), debugstr_w(key) );
r = MSI_SetPropertyW( package, szProductID, key );
r = MSI_SetPropertyW( package->db, szProductID, key );
}
msi_free( template );
msi_free( key );
......@@ -7209,7 +7216,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
static const WCHAR szAction[] = {'A','C','T','I','O','N',0};
static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0};
MSI_SetPropertyW(package, szAction, szInstall);
MSI_SetPropertyW( package->db, szAction, szInstall );
package->script->InWhatSequence = SEQUENCE_INSTALL;
......@@ -7257,7 +7264,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
if (!szCommandLine && msi_get_property_int( package->db, szInstalled, 0 ))
{
TRACE("setting reinstall property\n");
MSI_SetPropertyW( package, szReinstall, szAll );
MSI_SetPropertyW( package->db, szReinstall, szAll );
}
/* properties may have been added by a transform */
......
......@@ -1041,7 +1041,10 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
r = ACTION_AppSearchSigName(package, sigName, &sig, &value);
if (value)
{
MSI_SetPropertyW(package, propName, value);
r = MSI_SetPropertyW( package->db, propName, value );
if (r == ERROR_SUCCESS && !strcmpW( propName, cszSourceDir ))
msi_reset_folders( package, TRUE );
msi_free(value);
}
ACTION_FreeSignature(&sig);
......@@ -1100,7 +1103,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
if (value)
{
TRACE("Found signature %s\n", debugstr_w(signature));
MSI_SetPropertyW(package, success, szOne);
MSI_SetPropertyW(package->db, success, szOne);
msi_free(value);
r = ERROR_NO_MORE_ITEMS;
}
......
......@@ -163,17 +163,17 @@ static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
end = strstrW(beg, sep);
*end = '\0';
MSI_SetPropertyW(package, szCustomActionData, beg);
MSI_SetPropertyW(package->db, szCustomActionData, beg);
beg = end + 3;
end = strstrW(beg, sep);
*end = '\0';
MSI_SetPropertyW(package, szUserSID, beg);
MSI_SetPropertyW(package->db, szUserSID, beg);
beg = end + 3;
end = strchrW(beg, ']');
*end = '\0';
MSI_SetPropertyW(package, szProductCode, beg);
MSI_SetPropertyW(package->db, szProductCode, beg);
}
UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
......@@ -276,9 +276,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
if (deferred_data)
set_deferred_action_props(package, deferred_data);
else if (actiondata)
MSI_SetPropertyW(package, szCustomActionData, actiondata);
MSI_SetPropertyW(package->db, szCustomActionData, actiondata);
else
MSI_SetPropertyW(package, szCustomActionData, szEmpty);
MSI_SetPropertyW(package->db, szCustomActionData, szEmpty);
msi_free(actiondata);
}
......@@ -327,7 +327,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
break;
deformat_string(package,target,&deformated);
rc = MSI_SetPropertyW(package,source,deformated);
rc = MSI_SetPropertyW( package->db, source, deformated );
if (rc == ERROR_SUCCESS && !strcmpW( source, cszSourceDir ))
msi_reset_folders( package, TRUE );
msi_free(deformated);
break;
case 37: /* JScript/VBScript text stored in target column. */
......
......@@ -583,6 +583,13 @@ static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property )
}
}
static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value )
{
UINT r = MSI_SetPropertyW( package->db, property, value );
if (r == ERROR_SUCCESS && !strcmpW( property, cszSourceDir ))
msi_reset_folders( package, TRUE );
}
/* called from the Control Event subscription code */
void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
LPCWSTR attribute, MSIRECORD *rec )
......@@ -636,7 +643,7 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
else if ( !lstrcmpW(attribute, szProperty) )
{
MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl );
MSI_SetPropertyW( dialog->package, ctrl->property, feature->Directory );
msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory );
}
else if ( !lstrcmpW(attribute, szSelectionPath) )
{
......@@ -1330,8 +1337,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog,
else
value = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, index, 0 );
MSI_SetPropertyW( info->dialog->package,
control->property, value );
msi_dialog_set_property( info->dialog->package, control->property, value );
msi_dialog_evaluate_control_conditions( info->dialog );
if (index == CB_ERR)
......@@ -1538,10 +1544,9 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
if( i == info->num_groups )
{
TRACE("Set property %s to %s\n",
debugstr_w(info->prop), debugstr_w(val) );
TRACE("Set property %s to %s\n", debugstr_w(info->prop), debugstr_w(val));
CharUpperBuffW( val, info->num_chars );
MSI_SetPropertyW( info->dialog->package, info->prop, val );
msi_dialog_set_property( info->dialog->package, info->prop, val );
msi_dialog_evaluate_control_conditions( info->dialog );
}
msi_free( val );
......@@ -1891,7 +1896,7 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control )
else
{
valid = TRUE;
MSI_SetPropertyW( dialog->package, prop, buf );
msi_dialog_set_property( dialog->package, prop, buf );
}
msi_dialog_update_pathedit( dialog, control );
......@@ -2543,8 +2548,7 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog,
index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 );
value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 );
MSI_SetPropertyW( info->dialog->package,
control->property, value );
msi_dialog_set_property( info->dialog->package, control->property, value );
msi_dialog_evaluate_control_conditions( info->dialog );
return ERROR_SUCCESS;
......@@ -2707,7 +2711,7 @@ UINT msi_dialog_directorylist_up( msi_dialog *dialog )
if (ptr != path) *(ptr - 1) = '\0';
PathAddBackslashW( path );
MSI_SetPropertyW( dialog->package, prop, path );
msi_dialog_set_property( dialog->package, prop, path );
msi_dialog_update_directory_list( dialog, NULL );
msi_dialog_update_directory_combo( dialog, NULL );
......@@ -2753,7 +2757,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog,
lstrcatW( new_path, text );
lstrcatW( new_path, szBackSlash );
MSI_SetPropertyW( dialog->package, prop, new_path );
msi_dialog_set_property( dialog->package, prop, new_path );
msi_dialog_update_directory_list( dialog, NULL );
msi_dialog_update_directory_combo( dialog, NULL );
......@@ -2996,7 +3000,7 @@ static UINT msi_dialog_volsel_handler( msi_dialog *dialog,
indirect = control->attributes & msidbControlAttributesIndirect;
prop = msi_dialog_dup_property( dialog, control->property, indirect );
MSI_SetPropertyW( dialog->package, prop, text );
msi_dialog_set_property( dialog->package, prop, text );
msi_free( prop );
return ERROR_SUCCESS;
......@@ -3399,7 +3403,7 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar
return ERROR_SUCCESS;
}
static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg )
static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg )
{
static const WCHAR szNullArg[] = { '{','}',0 };
LPWSTR p, prop, arg_fmt = NULL;
......@@ -3414,7 +3418,7 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
*p = 0;
if( strcmpW( szNullArg, arg ) )
deformat_string( dialog->package, arg, &arg_fmt );
MSI_SetPropertyW( dialog->package, prop, arg_fmt );
msi_dialog_set_property( dialog->package, prop, arg_fmt );
msi_dialog_update_controls( dialog, prop );
msi_free( arg_fmt );
}
......@@ -3437,7 +3441,7 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param )
event = MSI_RecordGetString( rec, 3 );
arg = MSI_RecordGetString( rec, 4 );
if( event[0] == '[' )
msi_dialog_set_property( dialog, event, arg );
msi_dialog_set_property_event( dialog, event, arg );
else
msi_dialog_send_event( dialog, event, arg );
}
......@@ -3565,7 +3569,7 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog,
/* if uncheck then the property is set to NULL */
if (!state)
{
MSI_SetPropertyW( dialog->package, control->property, NULL );
msi_dialog_set_property( dialog->package, control->property, NULL );
return;
}
......@@ -3575,7 +3579,7 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog,
else
val = szState;
MSI_SetPropertyW( dialog->package, control->property, val );
msi_dialog_set_property( dialog->package, control->property, val );
}
static void msi_dialog_checkbox_sync_state( msi_dialog *dialog,
......@@ -3619,8 +3623,7 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog,
debugstr_w(control->property));
buf = msi_get_window_text( control->hwnd );
MSI_SetPropertyW( dialog->package, control->property, buf );
msi_dialog_set_property( dialog->package, control->property, buf );
msi_free( buf );
return ERROR_SUCCESS;
......@@ -3635,7 +3638,7 @@ static UINT msi_dialog_radiogroup_handler( msi_dialog *dialog,
TRACE("clicked radio button %s, set %s\n", debugstr_w(control->name),
debugstr_w(control->property));
MSI_SetPropertyW( dialog->package, control->property, control->name );
msi_dialog_set_property( dialog->package, control->property, control->name );
return msi_dialog_button_handler( dialog, control, param );
}
......@@ -4021,7 +4024,7 @@ static UINT error_dialog_handler(MSIPACKAGE *package, LPCWSTR event,
if ( !lstrcmpW( argument, error_abort ) || !lstrcmpW( argument, error_cancel ) ||
!lstrcmpW( argument, error_no ) )
{
MSI_SetPropertyW( package, result_prop, error_abort );
MSI_SetPropertyW( package->db, result_prop, error_abort );
}
ControlEvent_CleanupSubscriptions(package);
......
......@@ -380,7 +380,7 @@ static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
msi_dialog *dialog)
{
return MSI_SetPropertyW( package, szReinstallMode, argument );
return MSI_SetPropertyW( package->db, szReinstallMode, argument );
}
static UINT ControlEvent_Reinstall( MSIPACKAGE *package, LPCWSTR argument,
......@@ -413,7 +413,7 @@ static UINT ControlEvent_ValidateProductID(MSIPACKAGE *package, LPCWSTR argument
if (key && template)
{
FIXME( "partial stub: template %s key %s\n", debugstr_w(template), debugstr_w(key) );
ret = MSI_SetPropertyW( package, szProductID, key );
ret = MSI_SetPropertyW( package->db, szProductID, key );
}
msi_free( template );
msi_free( key );
......
......@@ -270,14 +270,14 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
{
check_path = msi_dup_property( package->db, cszRootDrive );
if (set_prop)
MSI_SetPropertyW(package,cszTargetDir,check_path);
MSI_SetPropertyW( package->db, cszTargetDir, check_path );
}
/* correct misbuilt target dir */
path = build_directory_name(2, check_path, NULL);
clean_spaces_from_path( path );
if (strcmpiW(path,check_path)!=0)
MSI_SetPropertyW(package,cszTargetDir,path);
MSI_SetPropertyW( package->db, cszTargetDir, path );
msi_free(check_path);
f->ResolvedTarget = path;
......@@ -310,7 +310,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
TRACE(" internally set to %s\n",debugstr_w(path));
if (set_prop)
MSI_SetPropertyW( package, name, path );
MSI_SetPropertyW( package->db, name, path );
return path;
}
......@@ -338,7 +338,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
f->ResolvedTarget = strdupW( path );
TRACE("target -> %s\n", debugstr_w(path));
if (set_prop)
MSI_SetPropertyW(package,name,path);
MSI_SetPropertyW( package->db, name, path );
}
else
{
......
......@@ -1284,7 +1284,7 @@ UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel )
return MSI_SetFeatureStates( package );
sprintfW( level, fmt, iInstallLevel );
r = MSI_SetPropertyW( package, szInstallLevel, level );
r = MSI_SetPropertyW( package->db, szInstallLevel, level );
if ( r == ERROR_SUCCESS )
r = MSI_SetFeatureStates( package );
......
......@@ -3535,10 +3535,10 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
if (r != ERROR_SUCCESS)
return r;
MSI_SetPropertyW( package, szReinstallMode, reinstallmode );
MSI_SetPropertyW( package, szInstalled, szOne );
MSI_SetPropertyW( package, szLogVerbose, szOne );
MSI_SetPropertyW( package, szReinstall, szFeature );
MSI_SetPropertyW( package->db, szReinstallMode, reinstallmode );
MSI_SetPropertyW( package->db, szInstalled, szOne );
MSI_SetPropertyW( package->db, szLogVerbose, szOne );
MSI_SetPropertyW( package->db, szReinstall, szFeature );
r = MSI_InstallPackage( package, sourcepath, NULL );
......
......@@ -746,7 +746,7 @@ extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPCWSTR );
extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE **pPackage );
extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern UINT MSI_SetPropertyW( MSIDATABASE *, LPCWSTR, LPCWSTR );
extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * );
extern UINT MSI_GetPropertyW( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD );
extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR );
......@@ -974,6 +974,7 @@ extern int msi_get_property_int( MSIDATABASE *package, LPCWSTR prop, int def );
extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
BOOL set_prop, BOOL load_prop, MSIFOLDER **folder);
extern LPWSTR resolve_file_source(MSIPACKAGE *package, MSIFILE *file);
extern void msi_reset_folders( MSIPACKAGE *package, BOOL source );
extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
......
......@@ -61,6 +61,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
LPWSTR prop;
LPWSTR newprop;
DWORD len;
UINT r;
prop = msi_dup_property(package->db, action_property );
if (prop)
......@@ -87,9 +88,13 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
newprop[0] = 0;
strcatW(newprop,productid);
MSI_SetPropertyW(package, action_property, newprop);
TRACE("Found Related Product... %s now %s\n",debugstr_w(action_property),
debugstr_w(newprop));
r = MSI_SetPropertyW( package->db, action_property, newprop );
if (r == ERROR_SUCCESS && !strcmpW( action_property, cszSourceDir ))
msi_reset_folders( package, TRUE );
TRACE("Found Related Product... %s now %s\n",
debugstr_w(action_property), debugstr_w(newprop));
msi_free( prop );
msi_free( newprop );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment