Commit 186f4efa authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

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.
parent 031d2c63
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -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));
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 );
......
......@@ -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;
......
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