From 186f4efa3f6fedb199984f310145a78d276a7882 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 21 Apr 2010 11:37:54 +0200 Subject: [PATCH] msi: Make msi_get_property_int and friends take a pointer to a database instead of a package. They only operate on a database and this way we can use them before a package is created. --- dlls/msi/action.c | 82 +++++++++++++++++++++++----------------------- dlls/msi/cond.y | 2 +- dlls/msi/custom.c | 16 ++++----- dlls/msi/dialog.c | 28 ++++++++-------- dlls/msi/events.c | 6 ++-- dlls/msi/files.c | 8 ++--- dlls/msi/format.c | 2 +- dlls/msi/helpers.c | 12 +++---- dlls/msi/install.c | 4 +-- dlls/msi/media.c | 10 +++--- dlls/msi/msipriv.h | 7 ++-- dlls/msi/package.c | 30 ++++++++--------- dlls/msi/upgrade.c | 4 +-- 13 files changed, 105 insertions(+), 106 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index fb1346b26f0..86924a35ad3 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -333,7 +333,7 @@ static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch LPWSTR prod_code, patch_product, langid = NULL, template = NULL; UINT ret = ERROR_FUNCTION_FAILED; - prod_code = msi_dup_property( package, szProductCode ); + prod_code = msi_dup_property( package->db, szProductCode ); patch_product = msi_get_suminfo_product( patch ); TRACE("db = %s patch = %s\n", debugstr_w(prod_code), debugstr_w(patch_product)); @@ -365,7 +365,7 @@ static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch goto end; } - langid = msi_dup_property( package, szSystemLanguageID ); + langid = msi_dup_property( package->db, szSystemLanguageID ); if (!langid) { msiobj_release( &si->hdr ); @@ -429,7 +429,7 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) LPWSTR guid_list, *guids, product_code; UINT i, ret = ERROR_FUNCTION_FAILED; - product_code = msi_dup_property( package, szProductCode ); + product_code = msi_dup_property( package->db, szProductCode ); if (!product_code) { /* FIXME: the property ProductCode should be written into the DB somewhere */ @@ -476,7 +476,7 @@ static UINT msi_set_media_source_prop(MSIPACKAGE *package) if (MSI_ViewFetch(view, &rec) == ERROR_SUCCESS) { prop = MSI_RecordGetString(rec, 1); - patch = msi_dup_property(package, szPatch); + patch = msi_dup_property(package->db, szPatch); MSI_SetPropertyW(package, prop, patch); msi_free(patch); } @@ -576,7 +576,7 @@ static UINT msi_apply_patches( MSIPACKAGE *package ) LPWSTR patch_list, *patches; UINT i, r = ERROR_SUCCESS; - patch_list = msi_dup_property( package, szPatch ); + patch_list = msi_dup_property( package->db, szPatch ); TRACE("patches to be applied: %s\n", debugstr_w( patch_list ) ); @@ -597,7 +597,7 @@ static UINT msi_apply_transforms( MSIPACKAGE *package ) LPWSTR xform_list, *xforms; UINT i, r = ERROR_SUCCESS; - xform_list = msi_dup_property( package, szTransforms ); + xform_list = msi_dup_property( package->db, szTransforms ); xforms = msi_split_string( xform_list, ';' ); for( i=0; xforms && xforms[i] && r == ERROR_SUCCESS; i++ ) @@ -647,7 +647,7 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) static const WCHAR szOriginalDatabase[] = {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0}; - db = msi_dup_property( package, szOriginalDatabase ); + db = msi_dup_property( package->db, szOriginalDatabase ); if (!db) return ERROR_OUTOFMEMORY; @@ -666,13 +666,13 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) source = msi_alloc( len * sizeof(WCHAR) ); lstrcpynW( source, db, len ); - check = msi_dup_property( package, cszSourceDir ); + check = msi_dup_property( package->db, cszSourceDir ); if (!check || replace) MSI_SetPropertyW( package, cszSourceDir, source ); msi_free( check ); - check = msi_dup_property( package, cszSOURCEDIR ); + check = msi_dup_property( package->db, cszSOURCEDIR ); if (!check || replace) MSI_SetPropertyW( package, cszSOURCEDIR, source ); @@ -685,7 +685,7 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) static BOOL needs_ui_sequence(MSIPACKAGE *package) { - INT level = msi_get_property_int(package, szUILevel, 0); + INT level = msi_get_property_int(package->db, szUILevel, 0); return (level & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED; } @@ -698,7 +698,7 @@ static UINT msi_set_context(MSIPACKAGE *package) package->Context = MSIINSTALLCONTEXT_USERUNMANAGED; - r = MSI_GetPropertyW(package, szAllUsers, val, &sz); + r = MSI_GetPropertyW(package->db, szAllUsers, val, &sz); if (r == ERROR_SUCCESS) { num = atolW(val); @@ -1466,7 +1466,7 @@ static UINT load_folder( MSIRECORD *row, LPVOID param ) folder->Parent = msi_dup_record_field( row, 2 ); - folder->Property = msi_dup_property( package, folder->Directory ); + folder->Property = msi_dup_property( package->db, folder->Directory ); list_add_tail( &package->folders, &folder->entry ); @@ -1607,7 +1607,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, LPWSTR override; MSIFEATURE *feature; - override = msi_dup_property( package, property ); + override = msi_dup_property( package->db, property ); if (!override) return FALSE; @@ -1699,9 +1699,9 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) TRACE("Checking Install Level\n"); - level = msi_get_property_int(package, szlevel, 1); + level = msi_get_property_int(package->db, szlevel, 1); - if (!msi_get_property_int( package, szPreselected, 0 )) + if (!msi_get_property_int( package->db, szPreselected, 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -2053,7 +2053,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) TRACE("File calculations\n"); msi_check_file_install_states( package ); - if (!process_overrides( package, msi_get_property_int( package, szlevel, 1 ) )) + if (!process_overrides( package, msi_get_property_int( package->db, szlevel, 1 ) )) { TRACE("Evaluating Condition Table\n"); @@ -2079,7 +2079,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) MSI_SetPropertyW(package,szCosting,szOne); /* set default run level if not set */ - level = msi_dup_property( package, szlevel ); + level = msi_dup_property( package->db, szlevel ); if (!level) MSI_SetPropertyW(package,szlevel, szOne); msi_free(level); @@ -2219,7 +2219,7 @@ static const WCHAR *get_root_key( MSIPACKAGE *package, INT root, HKEY *root_key switch (root) { case -1: - if (msi_get_property_int( package, szAllUsers, 0 )) + if (msi_get_property_int( package->db, szAllUsers, 0 )) { *root_key = HKEY_LOCAL_MACHINE; ret = szHLM; @@ -3606,17 +3606,17 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) {'C','l','i','e','n','t','s',0}; static const WCHAR szColon[] = {':',0}; - buffer = msi_dup_property(package, INSTALLPROPERTY_PRODUCTNAMEW); + buffer = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer); msi_free(buffer); - langid = msi_get_property_int(package, szProductLanguage, 0); + langid = msi_get_property_int(package->db, szProductLanguage, 0); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid); /* FIXME */ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_AUTHORIZED_LUA_APPW, 0); - buffer = msi_dup_property(package, szARPProductIcon); + buffer = msi_dup_property(package->db, szARPProductIcon); if (buffer) { LPWSTR path = build_icon_path(package,buffer); @@ -3625,7 +3625,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) msi_free(buffer); } - buffer = msi_dup_property(package, szProductVersion); + buffer = msi_dup_property(package->db, szProductVersion); if (buffer) { DWORD verdword = msi_version_str_to_dword(buffer); @@ -3673,7 +3673,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package) static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0}; - upgrade = msi_dup_property(package, szUpgradeCode); + upgrade = msi_dup_property(package->db, szUpgradeCode); if (!upgrade) return ERROR_SUCCESS; @@ -3832,10 +3832,10 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row ) { folder = resolve_folder( package, dirprop, FALSE, FALSE, TRUE, NULL ); if (!folder) - folder = msi_dup_property( package, dirprop ); + folder = msi_dup_property( package->db, dirprop ); } else - folder = msi_dup_property( package, szWindowsFolder ); + folder = msi_dup_property( package->db, szWindowsFolder ); if (!folder) { @@ -4469,7 +4469,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) { prop = strdupAtoW(*p++); key = strdupAtoW(*p++); - val = msi_dup_property(package, prop); + val = msi_dup_property(package->db, prop); msi_reg_set_val_str(hkey, key, val); msi_free(val); msi_free(key); @@ -4486,15 +4486,15 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) /* FIXME: Write real Estimated Size when we have it */ msi_reg_set_val_dword(hkey, szEstimatedSize, 0); - buffer = msi_dup_property(package, szProductName); + buffer = msi_dup_property(package->db, szProductName); msi_reg_set_val_str(hkey, szDisplayName, buffer); msi_free(buffer); - buffer = msi_dup_property(package, cszSourceDir); + buffer = msi_dup_property(package->db, cszSourceDir); msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLSOURCEW, buffer); msi_free(buffer); - buffer = msi_dup_property(package, szManufacturer); + buffer = msi_dup_property(package->db, szManufacturer); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PUBLISHERW, buffer); msi_free(buffer); @@ -4502,10 +4502,10 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) sprintfW(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay); msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLDATEW, date); - langid = msi_get_property_int(package, szProductLanguage, 0); + langid = msi_get_property_int(package->db, szProductLanguage, 0); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid); - buffer = msi_dup_property(package, szProductVersion); + buffer = msi_dup_property(package->db, szProductVersion); msi_reg_set_val_str(hkey, szDisplayVersion, buffer); if (buffer) { @@ -4557,7 +4557,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto done; - upgrade_code = msi_dup_property(package, szUpgradeCode); + upgrade_code = msi_dup_property(package->db, szUpgradeCode); if (upgrade_code) { MSIREG_OpenUpgradeCodesKey(upgrade_code, &upgrade, TRUE); @@ -4593,7 +4593,7 @@ static UINT msi_unpublish_product(MSIPACKAGE *package) static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0}; - remove = msi_dup_property(package, szRemove); + remove = msi_dup_property(package->db, szRemove); if (!remove) return ERROR_SUCCESS; @@ -4634,7 +4634,7 @@ static UINT msi_unpublish_product(MSIPACKAGE *package) MSIREG_DeleteUserFeaturesKey(package->ProductCode); } - upgrade = msi_dup_property(package, szUpgradeCode); + upgrade = msi_dup_property(package->db, szUpgradeCode); if (upgrade) { MSIREG_DeleteUserUpgradeCodesKey(upgrade); @@ -4801,7 +4801,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) goto end; } - productid = msi_dup_property( package, INSTALLPROPERTY_PRODUCTIDW ); + productid = msi_dup_property( package->db, INSTALLPROPERTY_PRODUCTIDW ); if (!productid) goto end; @@ -4812,7 +4812,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) for( i = 0; szPropKeys[i][0]; i++ ) { - buffer = msi_dup_property( package, szPropKeys[i] ); + buffer = msi_dup_property( package->db, szPropKeys[i] ); msi_reg_set_val_str( hkey, szRegKeys[i], buffer ); msi_free( buffer ); } @@ -6783,14 +6783,14 @@ static UINT ACTION_ValidateProductID( MSIPACKAGE *package ) LPWSTR key, template, id; UINT r = ERROR_SUCCESS; - id = msi_dup_property( package, szProductID ); + id = msi_dup_property( package->db, szProductID ); if (id) { msi_free( id ); return ERROR_SUCCESS; } - template = msi_dup_property( package, szPIDTemplate ); - key = msi_dup_property( package, szPIDKEY ); + template = msi_dup_property( package->db, szPIDTemplate ); + key = msi_dup_property( package->db, szPIDKEY ); if (key && template) { @@ -6814,7 +6814,7 @@ static UINT ACTION_AllocateRegistrySpace( MSIPACKAGE *package ) static const WCHAR szAvailableFreeReg[] = {'A','V','A','I','L','A','B','L','E','F','R','E','E','R','E','G',0}; MSIRECORD *uirow; - int space = msi_get_property_int( package, szAvailableFreeReg, 0 ); + int space = msi_get_property_int( package->db, szAvailableFreeReg, 0 ); TRACE("%p %d kilobytes\n", package, space); @@ -7254,7 +7254,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_apply_transforms( package ); msi_apply_patches( package ); - if (!szCommandLine && msi_get_property_int( package, szInstalled, 0 )) + if (!szCommandLine && msi_get_property_int( package->db, szInstalled, 0 )) { TRACE("setting reinstall property\n"); MSI_SetPropertyW( package, szReinstall, szAll ); diff --git a/dlls/msi/cond.y b/dlls/msi/cond.y index f3db635a10a..9a7a16d67df 100644 --- a/dlls/msi/cond.y +++ b/dlls/msi/cond.y @@ -347,7 +347,7 @@ symbol_s: COND_input* cond = (COND_input*) info; UINT len; - $$ = msi_dup_property( cond->package, $1 ); + $$ = msi_dup_property( cond->package->db, $1 ); if ($$) { len = (lstrlenW($$) + 1) * sizeof (WCHAR); diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 584c0507c53..4c75578fbd9 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -231,9 +231,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL } if (!execute) { - LPWSTR actiondata = msi_dup_property(package, action); - LPWSTR usersid = msi_dup_property(package, szUserSID); - LPWSTR prodcode = msi_dup_property(package, szProductCode); + LPWSTR actiondata = msi_dup_property(package->db, action); + LPWSTR usersid = msi_dup_property(package->db, szUserSID); + LPWSTR prodcode = msi_dup_property(package->db, szProductCode); LPWSTR deferred = msi_get_deferred_action(action, actiondata, usersid, prodcode); if (type & msidbCustomActionTypeCommit) @@ -256,7 +256,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL } else { - LPWSTR actiondata = msi_dup_property( package, action ); + LPWSTR actiondata = msi_dup_property( package->db, action ); switch (script) { @@ -376,7 +376,7 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source, DWORD sz = MAX_PATH; UINT r; - if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS) + if (MSI_GetPropertyW(package->db, cszTempFolder, fmt, &sz) != ERROR_SUCCESS) GetTempPathW(MAX_PATH, fmt); if (GetTempFileNameW(fmt, szMsi, 0, tmp_file) == 0) @@ -864,7 +864,7 @@ static UINT HANDLE_CustomType23(MSIPACKAGE *package, LPCWSTR source, UINT r; size = MAX_PATH; - MSI_GetPropertyW(package, cszSourceDir, package_path, &size); + MSI_GetPropertyW(package->db, cszSourceDir, package_path, &size); lstrcatW(package_path, szBackSlash); lstrcatW(package_path, source); @@ -1078,7 +1078,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, memset(&si,0,sizeof(STARTUPINFOW)); memset(&info,0,sizeof(PROCESS_INFORMATION)); - prop = msi_dup_property( package, source ); + prop = msi_dup_property( package->db, source ); if (!prop) return ERROR_SUCCESS; @@ -1380,7 +1380,7 @@ static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, LPCWSTR source, TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); - prop = msi_dup_property(package,source); + prop = msi_dup_property( package->db, source ); if (!prop) return ERROR_SUCCESS; diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 002ea831ca4..b436910f994 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -236,7 +236,7 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO return NULL; if (indirect) - prop = msi_dup_property( dialog->package, property ); + prop = msi_dup_property( dialog->package->db, property ); if (!prop) prop = strdupW( property ); @@ -643,7 +643,7 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control, LPWSTR prop = msi_dialog_dup_property( dialog, ctrl->property, TRUE ); LPWSTR path; if (!prop) return; - path = msi_dup_property( dialog->package, prop ); + path = msi_dup_property( dialog->package->db, prop ); SetWindowTextW( ctrl->hwnd, path ); msi_free(prop); msi_free(path); @@ -886,7 +886,7 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) if (ret) return ret; - ret = msi_dup_property( dialog->package, prop ); + ret = msi_dup_property( dialog->package->db, prop ); if( ret && !ret[0] ) { msi_free( ret ); @@ -1349,7 +1349,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, info = GetPropW( control->hwnd, szButtonData ); - value = msi_dup_property( dialog->package, control->property ); + value = msi_dup_property( dialog->package->db, control->property ); if (!value) { SendMessageW( control->hwnd, CB_SETCURSEL, -1, 0 ); @@ -1462,7 +1462,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) if( prop ) control->property = strdupW( prop ); - val = msi_dup_property( dialog->package, control->property ); + val = msi_dup_property( dialog->package->db, control->property ); SetWindowTextW( control->hwnd, val ); msi_free( val ); return ERROR_SUCCESS; @@ -1773,7 +1773,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) if( prop ) { - val = msi_dup_property( dialog->package, prop ); + val = msi_dup_property( dialog->package->db, prop ); if( val ) { msi_maskedit_set_text( info, val ); @@ -2041,7 +2041,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) group.dialog = dialog; group.parent = control; group.attributes = MSI_RecordGetInteger( rec, 8 ); - group.propval = msi_dup_property( dialog->package, control->property ); + group.propval = msi_dup_property( dialog->package->db, control->property ); r = MSI_IterateRecords( view, 0, msi_dialog_create_radiobutton, &group ); msiobj_release( &view->hdr ); @@ -3264,8 +3264,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP sz.cx = msi_dialog_scale_unit( dialog, sz.cx ); sz.cy = msi_dialog_scale_unit( dialog, sz.cy ); - xres = msi_get_property_int( dialog->package, szScreenX, 0 ); - yres = msi_get_property_int( dialog->package, szScreenY, 0 ); + xres = msi_get_property_int( dialog->package->db, szScreenX, 0 ); + yres = msi_get_property_int( dialog->package->db, szScreenY, 0 ); center.x = MulDiv( center.x, xres, 100 ); center.y = MulDiv( center.y, yres, 100 ); @@ -3358,7 +3358,7 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) dialog->attributes = MSI_RecordGetInteger( rec, 6 ); - dialog->default_font = msi_dup_property( dialog->package, df ); + dialog->default_font = msi_dup_property( dialog->package->db, df ); if (!dialog->default_font) { dialog->default_font = strdupW(dfv); @@ -3552,7 +3552,7 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, WCHAR state[2] = { 0 }; DWORD sz = 2; - MSI_GetPropertyW( dialog->package, control->property, state, &sz ); + MSI_GetPropertyW( dialog->package->db, control->property, state, &sz ); return state[0] ? 1 : 0; } @@ -4064,12 +4064,12 @@ UINT msi_spawn_error_dialog( MSIPACKAGE *package, LPWSTR error_dialog, LPWSTR er 'M','S','I','E','r','r','o','r','D','i','a','l','o','g','R','e','s','u','l','t',0 }; - if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE ) + if ( (msi_get_property_int( package->db, szUILevel, 0 ) & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE ) return ERROR_SUCCESS; if ( !error_dialog ) { - LPWSTR product_name = msi_dup_property( package, pn_prop ); + LPWSTR product_name = msi_dup_property( package->db, pn_prop ); WCHAR title[MAX_PATH]; sprintfW( title, title_fmt, product_name ); @@ -4097,7 +4097,7 @@ UINT msi_spawn_error_dialog( MSIPACKAGE *package, LPWSTR error_dialog, LPWSTR er if ( r != ERROR_SUCCESS ) goto done; - r = MSI_GetPropertyW( package, result_prop, result, &size ); + r = MSI_GetPropertyW( package->db, result_prop, result, &size ); if ( r != ERROR_SUCCESS) r = ERROR_SUCCESS; diff --git a/dlls/msi/events.c b/dlls/msi/events.c index 1f63c72dfde..331c05a58df 100644 --- a/dlls/msi/events.c +++ b/dlls/msi/events.c @@ -226,7 +226,7 @@ static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument, static UINT ControlEvent_SetTargetPath(MSIPACKAGE* package, LPCWSTR argument, msi_dialog* dialog) { - LPWSTR path = msi_dup_property( package, argument ); + LPWSTR path = msi_dup_property( package->db, argument ); MSIRECORD *rec = MSI_CreateRecord( 1 ); UINT r; @@ -407,8 +407,8 @@ static UINT ControlEvent_ValidateProductID(MSIPACKAGE *package, LPCWSTR argument LPWSTR key, template; UINT ret = ERROR_SUCCESS; - template = msi_dup_property( package, szPIDTemplate ); - key = msi_dup_property( package, szPIDKEY ); + template = msi_dup_property( package->db, szPIDTemplate ); + key = msi_dup_property( package->db, szPIDKEY ); if (key && template) { diff --git a/dlls/msi/files.c b/dlls/msi/files.c index e2f399da88e..14366f42709 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -557,11 +557,11 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) sourcename = MSI_RecordGetString(rec, 3); options = MSI_RecordGetInteger(rec, 7); - sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5)); + sourcedir = msi_dup_property(package->db, MSI_RecordGetString(rec, 5)); if (!sourcedir) goto done; - destdir = msi_dup_property(package, MSI_RecordGetString(rec, 6)); + destdir = msi_dup_property(package->db, MSI_RecordGetString(rec, 6)); if (!destdir) goto done; @@ -706,7 +706,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const if (!dst_path) { /* try a property */ - dst_path = msi_dup_property( package, dst_key ); + dst_path = msi_dup_property( package->db, dst_key ); if (!dst_path) { FIXME("Unable to get destination folder, try AppSearch properties\n"); @@ -940,7 +940,7 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; } - dir = msi_dup_property(package, dirprop); + dir = msi_dup_property(package->db, dirprop); if (!dir) return ERROR_OUTOFMEMORY; diff --git a/dlls/msi/format.c b/dlls/msi/format.c index f59024abf86..278a08f1cd5 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -175,7 +175,7 @@ static LPWSTR deformat_property(FORMAT *format, FORMSTR *str) val = msi_alloc((str->len + 1) * sizeof(WCHAR)); lstrcpynW(val, get_formstr_data(format, str), str->len + 1); - ret = msi_dup_property(format->package, val); + ret = msi_dup_property(format->package->db, val); msi_free(val); return ret; diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c index c45ba236d50..09ce2cafcdc 100644 --- a/dlls/msi/helpers.c +++ b/dlls/msi/helpers.c @@ -47,7 +47,7 @@ LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name ) static const WCHAR szFolder[] = {'A','p','p','D','a','t','a','F','o','l','d','e','r',0}; - SystemFolder = msi_dup_property( package, szFolder ); + SystemFolder = msi_dup_property( package->db, szFolder ); dest = build_directory_name(3, SystemFolder, szInstaller, package->ProductCode); @@ -160,11 +160,11 @@ static LPWSTR get_source_root( MSIPACKAGE *package ) { LPWSTR path, p; - path = msi_dup_property( package, cszSourceDir ); + path = msi_dup_property( package->db, cszSourceDir ); if (path) return path; - path = msi_dup_property( package, cszDatabase ); + path = msi_dup_property( package->db, cszDatabase ); if (path) { p = strrchrW(path,'\\'); @@ -265,10 +265,10 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, if (!f->ResolvedTarget && !f->Property) { LPWSTR check_path; - check_path = msi_dup_property( package, cszTargetDir ); + check_path = msi_dup_property( package->db, cszTargetDir ); if (!check_path) { - check_path = msi_dup_property( package, cszRootDrive ); + check_path = msi_dup_property( package->db, cszRootDrive ); if (set_prop) MSI_SetPropertyW(package,cszTargetDir,check_path); } @@ -314,7 +314,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, return path; } - if (!source && load_prop && (path = msi_dup_property( package, name ))) + if (!source && load_prop && (path = msi_dup_property( package->db, name ))) { f->ResolvedTarget = strdupW( path ); TRACE(" property set to %s\n", debugstr_w(path)); diff --git a/dlls/msi/install.c b/dlls/msi/install.c index c23075d61d3..74742945b49 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -709,7 +709,7 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode) break; case MSIRUNMODE_MAINTENANCE: - r = msi_get_property_int( package, szInstalled, 0 ) != 0; + r = msi_get_property_int( package->db, szInstalled, 0 ) != 0; break; case MSIRUNMODE_REBOOTATEND: @@ -1262,7 +1262,7 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) return 0; } - langid = msi_get_property_int( package, szProductLanguage, 0 ); + langid = msi_get_property_int( package->db, szProductLanguage, 0 ); msiobj_release( &package->hdr ); return langid; } diff --git a/dlls/msi/media.c b/dlls/msi/media.c index c8a14879a81..7cf9836a666 100644 --- a/dlls/msi/media.c +++ b/dlls/msi/media.c @@ -79,13 +79,13 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0}; - if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) == + if ((msi_get_property_int(package->db, szUILevel, 0) & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE && !gUIHandlerA && !gUIHandlerW && !gUIHandlerRecord) return ERROR_SUCCESS; error = generate_error_string(package, 1302, 1, mi->disk_prompt); - error_dialog = msi_dup_property(package, error_prop); - source_dir = msi_dup_property(package, cszSourceDir); + error_dialog = msi_dup_property(package->db, error_prop); + source_dir = msi_dup_property(package->db, cszSourceDir); while (r == ERROR_SUCCESS && !source_matches_volume(mi, source_dir)) { @@ -659,7 +659,7 @@ static UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO if (!mi->first_volume) mi->first_volume = strdupW(mi->volume_label); - source_dir = msi_dup_property(package, cszSourceDir); + source_dir = msi_dup_property(package->db, cszSourceDir); lstrcpyW(mi->sourcedir, source_dir); mi->type = get_drive_type(source_dir); @@ -807,7 +807,7 @@ UINT ready_media(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO *mi) if (mi->volume_label && mi->disk_id > 1 && lstrcmpW(mi->first_volume, mi->volume_label)) { - LPWSTR source = msi_dup_property(package, cszSourceDir); + LPWSTR source = msi_dup_property(package->db, cszSourceDir); BOOL matches; matches = source_matches_volume(mi, source); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index fada8c67745..562a014cec6 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -748,8 +748,7 @@ extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE **pPackage ); extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR ); extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR ); extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ); -extern UINT MSI_GetPropertyW( MSIPACKAGE *, LPCWSTR, LPWSTR, LPDWORD ); -extern UINT MSI_GetPropertyA(MSIPACKAGE *, LPCSTR, LPSTR, LPDWORD ); +extern UINT MSI_GetPropertyW( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD ); extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR ); extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); @@ -970,8 +969,8 @@ extern UINT ACTION_UnregisterProgIdInfo(MSIPACKAGE *package); /* Helpers */ extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data ); extern LPWSTR msi_dup_record_field(MSIRECORD *row, INT index); -extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop); -extern int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def ); +extern LPWSTR msi_dup_property( MSIDATABASE *db, LPCWSTR prop ); +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); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 71346f452a8..c859a423f41 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -824,8 +824,8 @@ static VOID set_installer_properties(MSIPACKAGE *package) ReleaseDC(0, dc); /* USERNAME and COMPANYNAME */ - username = msi_dup_property( package, szUSERNAME ); - companyname = msi_dup_property( package, szCOMPANYNAME ); + username = msi_dup_property( package->db, szUSERNAME ); + companyname = msi_dup_property( package->db, szCOMPANYNAME ); if ((!username || !companyname) && RegOpenKeyW( HKEY_CURRENT_USER, szUserInfo, &hkey ) == ERROR_SUCCESS) @@ -1013,7 +1013,7 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package) static void adjust_allusers_property( MSIPACKAGE *package ) { /* FIXME: this should depend on the user's privileges */ - if (msi_get_property_int( package, szAllUsers, 0 ) == 2) + if (msi_get_property_int( package->db, szAllUsers, 0 ) == 2) { TRACE("resetting ALLUSERS property from 2 to 1\n"); MSI_SetPropertyW( package, szAllUsers, szOne ); @@ -1043,7 +1043,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url ) create_temp_property_table( package ); msi_clone_properties( package ); - package->ProductCode = msi_dup_property( package, szProductCode ); + package->ProductCode = msi_dup_property( package->db, szProductCode ); set_installed_prop( package ); set_installer_properties( package ); @@ -1683,7 +1683,7 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue) if (!szName[0]) return szValue ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS; - rc = MSI_GetPropertyW(package, szName, 0, &sz); + rc = MSI_GetPropertyW(package->db, szName, 0, &sz); if (!szValue || !*szValue) { sprintfW(Query, Delete, szName); @@ -1769,7 +1769,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue return ret; } -static MSIRECORD *MSI_GetPropertyRow( MSIPACKAGE *package, LPCWSTR name ) +static MSIRECORD *MSI_GetPropertyRow( MSIDATABASE *db, LPCWSTR name ) { MSIQUERY *view; MSIRECORD *rec, *row = NULL; @@ -1790,7 +1790,7 @@ static MSIRECORD *MSI_GetPropertyRow( MSIPACKAGE *package, LPCWSTR name ) MSI_RecordSetStringW(rec, 1, name); - r = MSI_DatabaseOpenViewW(package->db, query, &view); + r = MSI_DatabaseOpenViewW(db, query, &view); if (r == ERROR_SUCCESS) { MSI_ViewExecute(view, rec); @@ -1804,13 +1804,13 @@ static MSIRECORD *MSI_GetPropertyRow( MSIPACKAGE *package, LPCWSTR name ) } /* internal function, not compatible with MsiGetPropertyW */ -UINT MSI_GetPropertyW( MSIPACKAGE *package, LPCWSTR szName, +UINT MSI_GetPropertyW( MSIDATABASE *db, LPCWSTR szName, LPWSTR szValueBuf, LPDWORD pchValueBuf ) { MSIRECORD *row; UINT rc = ERROR_FUNCTION_FAILED; - row = MSI_GetPropertyRow( package, szName ); + row = MSI_GetPropertyRow( db, szName ); if (*pchValueBuf > 0) szValueBuf[0] = 0; @@ -1836,19 +1836,19 @@ UINT MSI_GetPropertyW( MSIPACKAGE *package, LPCWSTR szName, return rc; } -LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop) +LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) { DWORD sz = 0; LPWSTR str; UINT r; - r = MSI_GetPropertyW(package, prop, NULL, &sz); + r = MSI_GetPropertyW(db, prop, NULL, &sz); if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA) return NULL; sz++; str = msi_alloc(sz * sizeof(WCHAR)); - r = MSI_GetPropertyW(package, prop, str, &sz); + r = MSI_GetPropertyW(db, prop, str, &sz); if (r != ERROR_SUCCESS) { msi_free(str); @@ -1858,9 +1858,9 @@ LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop) return str; } -int msi_get_property_int(MSIPACKAGE *package, LPCWSTR prop, int def) +int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def ) { - LPWSTR str = msi_dup_property(package, prop); + LPWSTR str = msi_dup_property( db, prop ); int val = str ? atoiW(str) : def; msi_free(str); return val; @@ -1939,7 +1939,7 @@ done: return r; } - row = MSI_GetPropertyRow( package, name ); + row = MSI_GetPropertyRow( package->db, name ); if (row) val = MSI_RecordGetString( row, 1 ); diff --git a/dlls/msi/upgrade.c b/dlls/msi/upgrade.c index 3f40f55bb66..5fb39bbe200 100644 --- a/dlls/msi/upgrade.c +++ b/dlls/msi/upgrade.c @@ -62,7 +62,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property, LPWSTR newprop; DWORD len; - prop = msi_dup_property(package, action_property ); + prop = msi_dup_property(package->db, action_property ); if (prop) len = strlenW(prop); else @@ -203,7 +203,7 @@ UINT ACTION_FindRelatedProducts(MSIPACKAGE *package) UINT rc = ERROR_SUCCESS; MSIQUERY *view; - if (msi_get_property_int(package, szInstalled, 0)) + if (msi_get_property_int(package->db, szInstalled, 0)) { TRACE("Skipping FindRelatedProducts action: product already installed\n"); return ERROR_SUCCESS;