Commit 0f1d3474 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Add a length parameter to msi_set_property and use it where appropriate.

parent a7ff2818
......@@ -353,7 +353,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
remove_quotes( val );
TRACE("Found commandline property %s = %s\n", debugstr_w(prop), debugstr_w(val));
r = msi_set_property( package->db, prop, val );
r = msi_set_property( package->db, prop, val, -1 );
if (r == ERROR_SUCCESS && !strcmpW( prop, szSourceDir ))
msi_reset_folders( package, TRUE );
......@@ -462,7 +462,7 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
check = msi_dup_property( package->db, szSourceDir );
if (!check || replace)
{
UINT r = msi_set_property( package->db, szSourceDir, source );
UINT r = msi_set_property( package->db, szSourceDir, source, -1 );
if (r == ERROR_SUCCESS)
msi_reset_folders( package, TRUE );
}
......@@ -470,7 +470,7 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
check = msi_dup_property( package->db, szSOURCEDIR );
if (!check || replace)
msi_set_property( package->db, szSOURCEDIR, source );
msi_set_property( package->db, szSOURCEDIR, source, -1 );
msi_free( check );
msi_free( source );
......@@ -605,7 +605,7 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
{
TRACE("Running the actions\n");
msi_set_property(package->db, szSourceDir, NULL);
msi_set_property( package->db, szSourceDir, NULL, -1 );
rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, package);
msiobj_release(&view->hdr);
}
......@@ -1568,8 +1568,8 @@ static UINT load_all_folders( MSIPACKAGE *package )
static UINT ACTION_CostInitialize(MSIPACKAGE *package)
{
msi_set_property( package->db, szCostingComplete, szZero );
msi_set_property( package->db, szRootDrive, szCRoot );
msi_set_property( package->db, szCostingComplete, szZero, -1 );
msi_set_property( package->db, szRootDrive, szCRoot, -1 );
load_all_folders( package );
msi_load_all_components( package );
......@@ -1785,7 +1785,7 @@ static BOOL process_overrides( MSIPACKAGE *package, int level )
ret |= process_state_property( package, level, szAdvertise, INSTALLSTATE_ADVERTISED );
if (ret)
msi_set_property( package->db, szPreselected, szOne );
msi_set_property( package->db, szPreselected, szOne, -1 );
return ret;
}
......@@ -2361,7 +2361,7 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa
msi_free( normalized_path );
return;
}
msi_set_property( package->db, folder->Directory, normalized_path );
msi_set_property( package->db, folder->Directory, normalized_path, -1 );
msi_free( folder->ResolvedTarget );
folder->ResolvedTarget = normalized_path;
......@@ -2422,15 +2422,15 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
TRACE("Calculating file cost\n");
calculate_file_cost( package );
msi_set_property( package->db, szCostingComplete, szOne );
msi_set_property( package->db, szCostingComplete, szOne, -1 );
/* set default run level if not set */
level = msi_dup_property( package->db, szInstallLevel );
if (!level)
msi_set_property( package->db, szInstallLevel, szOne );
msi_set_property( package->db, szInstallLevel, szOne, -1 );
msi_free(level);
/* FIXME: check volume disk space */
msi_set_property( package->db, szOutOfDiskSpace, szZero );
msi_set_property( package->db, szOutOfDiskSpace, szZero, -1 );
return MSI_SetFeatureStates(package);
}
......@@ -7006,7 +7006,7 @@ UINT msi_validate_product_id( MSIPACKAGE *package )
if (key && template)
{
FIXME( "partial stub: template %s key %s\n", debugstr_w(template), debugstr_w(key) );
r = msi_set_property( package->db, szProductID, key );
r = msi_set_property( package->db, szProductID, key, -1 );
}
msi_free( template );
msi_free( key );
......@@ -7046,7 +7046,7 @@ static UINT ACTION_DisableRollback( MSIPACKAGE *package )
{
TRACE("%p\n", package);
msi_set_property( package->db, szRollbackDisabled, szOne );
msi_set_property( package->db, szRollbackDisabled, szOne, -1 );
return ERROR_SUCCESS;
}
......@@ -7567,7 +7567,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
BOOL ui_exists;
UINT rc;
msi_set_property( package->db, szAction, szInstall );
msi_set_property( package->db, szAction, szInstall, -1 );
package->script->InWhatSequence = SEQUENCE_INSTALL;
......@@ -7617,7 +7617,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
if (!szCommandLine && msi_get_property_int( package->db, szInstalled, 0 ))
{
TRACE("setting reinstall property\n");
msi_set_property( package->db, szReinstall, szAll );
msi_set_property( package->db, szReinstall, szAll, -1 );
}
/* properties may have been added by a transform */
......@@ -7630,7 +7630,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
if (msi_get_property_int( package->db, szDisableRollback, 0 ))
{
TRACE("disabling rollback\n");
msi_set_property( package->db, szRollbackDisabled, szOne );
msi_set_property( package->db, szRollbackDisabled, szOne, -1 );
}
if (needs_ui_sequence( package))
......
......@@ -1093,7 +1093,7 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
r = ACTION_AppSearchSigName(package, sigName, &sig, &value);
if (value)
{
r = msi_set_property( package->db, propName, value );
r = msi_set_property( package->db, propName, value, -1 );
if (r == ERROR_SUCCESS && !strcmpW( propName, szSourceDir ))
msi_reset_folders( package, TRUE );
......@@ -1153,7 +1153,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
if (value)
{
TRACE("Found signature %s\n", debugstr_w(signature));
msi_set_property(package->db, success, szOne);
msi_set_property( package->db, success, szOne, -1 );
msi_free(value);
r = ERROR_NO_MORE_ITEMS;
}
......
......@@ -184,25 +184,21 @@ static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata,
return deferred;
}
static void set_deferred_action_props(MSIPACKAGE *package, LPWSTR deferred_data)
static void set_deferred_action_props( MSIPACKAGE *package, const WCHAR *deferred_data )
{
LPWSTR end, beg = deferred_data + 1;
static const WCHAR sep[] = {'<','=','>',0};
const WCHAR *end, *beg = deferred_data + 1;
end = strstrW(beg, sep);
*end = '\0';
msi_set_property(package->db, szCustomActionData, beg);
msi_set_property( package->db, szCustomActionData, beg, end - beg );
beg = end + 3;
end = strstrW(beg, sep);
*end = '\0';
msi_set_property(package->db, szUserSID, beg);
msi_set_property( package->db, szUserSID, beg, end - beg );
beg = end + 3;
end = strchrW(beg, ']');
*end = '\0';
msi_set_property(package->db, szProductCode, beg);
msi_set_property( package->db, szProductCode, beg, end - beg );
}
static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll )
......@@ -1284,9 +1280,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_set_property(package->db, szCustomActionData, actiondata);
msi_set_property( package->db, szCustomActionData, actiondata, -1 );
else
msi_set_property(package->db, szCustomActionData, szEmpty);
msi_set_property( package->db, szCustomActionData, szEmpty, -1 );
msi_free(actiondata);
}
......@@ -1335,7 +1331,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
break;
deformat_string(package,target,&deformated);
rc = msi_set_property( package->db, source, deformated );
rc = msi_set_property( package->db, source, deformated, -1 );
if (rc == ERROR_SUCCESS && !strcmpW( source, szSourceDir ))
msi_reset_folders( package, TRUE );
msi_free(deformated);
......
......@@ -583,7 +583,7 @@ 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_set_property( package->db, property, value );
UINT r = msi_set_property( package->db, property, value, -1 );
if (r == ERROR_SUCCESS && !strcmpW( property, szSourceDir ))
msi_reset_folders( package, TRUE );
}
......@@ -3939,7 +3939,7 @@ static UINT error_dialog_handler(MSIPACKAGE *package, LPCWSTR event,
if ( !strcmpW( argument, error_abort ) || !strcmpW( argument, error_cancel ) ||
!strcmpW( argument, error_no ) )
{
msi_set_property( package->db, result_prop, error_abort );
msi_set_property( package->db, result_prop, error_abort, -1 );
}
ControlEvent_CleanupSubscriptions(package);
......
......@@ -173,7 +173,7 @@ static UINT ControlEvent_AddLocal( MSIPACKAGE *package, LPCWSTR argument, msi_di
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
{
if (feature->ActionRequest != INSTALLSTATE_LOCAL)
msi_set_property( package->db, szPreselected, szOne );
msi_set_property( package->db, szPreselected, szOne, -1 );
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_LOCAL );
}
}
......@@ -189,7 +189,7 @@ static UINT ControlEvent_Remove( MSIPACKAGE *package, LPCWSTR argument, msi_dial
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
{
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
msi_set_property( package->db, szPreselected, szOne );
msi_set_property( package->db, szPreselected, szOne, -1 );
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_ABSENT );
}
}
......@@ -205,7 +205,7 @@ static UINT ControlEvent_AddSource( MSIPACKAGE *package, LPCWSTR argument, msi_d
if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll ))
{
if (feature->ActionRequest != INSTALLSTATE_SOURCE)
msi_set_property( package->db, szPreselected, szOne );
msi_set_property( package->db, szPreselected, szOne, -1 );
MSI_SetFeatureStateW( package, feature->Feature, INSTALLSTATE_SOURCE );
}
}
......@@ -377,13 +377,13 @@ static UINT ControlEvent_DirectoryListUp(MSIPACKAGE *package, LPCWSTR argument,
static UINT ControlEvent_ReinstallMode(MSIPACKAGE *package, LPCWSTR argument,
msi_dialog *dialog)
{
return msi_set_property( package->db, szReinstallMode, argument );
return msi_set_property( package->db, szReinstallMode, argument, -1 );
}
static UINT ControlEvent_Reinstall( MSIPACKAGE *package, LPCWSTR argument,
msi_dialog *dialog )
{
return msi_set_property( package->db, szReinstall, argument );
return msi_set_property( package->db, szReinstall, argument, -1 );
}
static UINT ControlEvent_ValidateProductID(MSIPACKAGE *package, LPCWSTR argument,
......
......@@ -558,7 +558,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR
{
msi_free( folder->ResolvedTarget );
folder->ResolvedTarget = target_path;
msi_set_property( package->db, folder->Directory, folder->ResolvedTarget );
msi_set_property( package->db, folder->Directory, folder->ResolvedTarget, -1 );
LIST_FOR_EACH_ENTRY( fl, &folder->children, FolderList, entry )
{
......@@ -1650,6 +1650,7 @@ UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel )
{
static const WCHAR fmt[] = { '%','d',0 };
WCHAR level[6];
int len;
UINT r;
TRACE("%p %i\n", package, iInstallLevel);
......@@ -1660,8 +1661,8 @@ UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel )
if (iInstallLevel < 1)
return MSI_SetFeatureStates( package );
sprintfW( level, fmt, iInstallLevel );
r = msi_set_property( package->db, szInstallLevel, level );
len = sprintfW( level, fmt, iInstallLevel );
r = msi_set_property( package->db, szInstallLevel, level, len );
if ( r == ERROR_SUCCESS )
r = MSI_SetFeatureStates( package );
......
......@@ -1003,7 +1003,7 @@ extern UINT ACTION_MsiUnpublishAssemblies(MSIPACKAGE *package) DECLSPEC_HIDDEN;
extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data ) DECLSPEC_HIDDEN;
extern WCHAR *msi_dup_record_field(MSIRECORD *row, INT index) DECLSPEC_HIDDEN;
extern LPWSTR msi_dup_property( MSIDATABASE *db, LPCWSTR prop ) DECLSPEC_HIDDEN;
extern UINT msi_set_property( MSIDATABASE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
extern UINT msi_set_property( MSIDATABASE *, const WCHAR *, const WCHAR *, int ) DECLSPEC_HIDDEN;
extern UINT msi_get_property( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD ) DECLSPEC_HIDDEN;
extern int msi_get_property_int( MSIDATABASE *package, LPCWSTR prop, int def ) DECLSPEC_HIDDEN;
extern WCHAR *msi_resolve_source_folder(MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder) DECLSPEC_HIDDEN;
......
......@@ -225,7 +225,7 @@ static UINT patch_set_media_source_prop( MSIPACKAGE *package )
{
property = MSI_RecordGetString( rec, 1 );
patch = msi_dup_property( package->db, szPatch );
msi_set_property( package->db, property, patch );
msi_set_property( package->db, property, patch, -1 );
msi_free( patch );
msiobj_release( &rec->hdr );
}
......
......@@ -88,7 +88,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
newprop[0] = 0;
strcatW(newprop,productid);
r = msi_set_property( package->db, action_property, newprop );
r = msi_set_property( package->db, action_property, newprop, -1 );
if (r == ERROR_SUCCESS && !strcmpW( action_property, szSourceDir ))
msi_reset_folders( package, TRUE );
......
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