msi: Delay publishing of the SourceList until the PublishProduct action.

oldstable
James Hawkins 2007-07-02 20:20:20 -07:00 committed by Alexandre Julliard
parent 08443b3bf7
commit 5e46fc9019
6 changed files with 111 additions and 13 deletions

View File

@ -3251,6 +3251,8 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
{
UINT rc;
MSIQUERY * view;
MSISOURCELISTINFO *info;
MSIMEDIADISK *disk;
static const WCHAR Query[]=
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','I','c','o','n','`',0};
@ -3363,6 +3365,21 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
rc = ERROR_SUCCESS;
}
/* publish the SourceList info */
LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
{
MsiSourceListSetInfoW(package->ProductCode, NULL,
info->context, info->options,
info->property, info->value);
}
LIST_FOR_EACH_ENTRY(disk, &package->sourcelist_media, MSIMEDIADISK, entry)
{
MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
disk->context, disk->options,
disk->disk_id, disk->volume_label, disk->disk_prompt);
}
end:
RegCloseKey(hkey);
RegCloseKey(hukey);

View File

@ -580,14 +580,12 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
lstrcatW(mi->source, mi->cabinet);
}
MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT,
mi->disk_id, mi->volume_label, mi->disk_prompt);
msi_package_add_media_disk(package, MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT,
mi->disk_id, mi->volume_label, mi->disk_prompt);
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_MEDIA,
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->source);
msi_package_add_info(package, MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_MEDIA,
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->source);
msi_free(source_dir);
return ERROR_SUCCESS;
@ -754,10 +752,8 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
if (ptr)
{
ptr++;
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT,
INSTALLPROPERTY_PACKAGENAMEW, ptr);
msi_package_add_info(package, MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, ptr);
}
schedule_install_files(package);

View File

@ -489,7 +489,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
{
INT i;
struct list *item, *cursor;
TRACE("Freeing package action data\n");
remove_tracked_tempfiles(package);
@ -607,6 +607,25 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
msi_free( appid );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->sourcelist_info )
{
MSISOURCELISTINFO *info = LIST_ENTRY( item, MSISOURCELISTINFO, entry );
list_remove( &info->entry );
msi_free( info->value );
msi_free( info );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->sourcelist_media )
{
MSIMEDIADISK *info = LIST_ENTRY( item, MSIMEDIADISK, entry );
list_remove( &info->entry );
msi_free( info->volume_label );
msi_free( info->disk_prompt );
msi_free( info );
}
if (package->script)
{
for (i = 0; i < TOTAL_SCRIPTS; i++)

View File

@ -113,6 +113,25 @@ typedef struct tagMSIRECORD
MSIFIELD fields[1]; /* nb. array size is count+1 */
} MSIRECORD;
typedef struct tagMSISOURCELISTINFO
{
struct list entry;
DWORD context;
DWORD options;
LPCWSTR property;
LPWSTR value;
} MSISOURCELISTINFO;
typedef struct tagMSIMEDIADISK
{
struct list entry;
DWORD context;
DWORD options;
DWORD disk_id;
LPWSTR volume_label;
LPWSTR disk_prompt;
} MSIMEDIADISK;
typedef const struct tagMSICOLUMNHASHENTRY *MSIITERHANDLE;
typedef struct tagMSIVIEWOPS
@ -249,6 +268,9 @@ typedef struct tagMSIPACKAGE
struct list subscriptions;
struct list sourcelist_info;
struct list sourcelist_media;
unsigned char scheduled_action_running : 1;
unsigned char commit_action_running : 1;
unsigned char rollback_action_running : 1;
@ -664,6 +686,8 @@ extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTA
extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * );
extern UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE );
extern LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename );
extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR);
extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR);
/* for deformating */
extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, DWORD * );

View File

@ -699,6 +699,8 @@ static MSIPACKAGE *msi_alloc_package( void )
list_init( &package->extensions );
list_init( &package->progids );
list_init( &package->RunningActions );
list_init( &package->sourcelist_info );
list_init( &package->sourcelist_media );
package->ActionFormat = NULL;
package->LastAction = NULL;
@ -1573,3 +1575,40 @@ HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
return S_OK;
}
UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options,
LPCWSTR property, LPWSTR value)
{
MSISOURCELISTINFO *info;
info = msi_alloc(sizeof(MSISOURCELISTINFO));
if (!info)
return ERROR_OUTOFMEMORY;
info->context = context;
info->options = options;
info->property = property;
info->value = strdupW(value);
list_add_head(&package->sourcelist_info, &info->entry);
return ERROR_SUCCESS;
}
UINT msi_package_add_media_disk(MSIPACKAGE *package, DWORD context, DWORD options,
DWORD disk_id, LPWSTR volume_label, LPWSTR disk_prompt)
{
MSIMEDIADISK *disk;
disk = msi_alloc(sizeof(MSIMEDIADISK));
if (!disk)
return ERROR_OUTOFMEMORY;
disk->context = context;
disk->options = options;
disk->disk_id = disk_id;
disk->volume_label = strdupW(volume_label);
disk->disk_prompt = strdupW(disk_prompt);
list_add_head(&package->sourcelist_media, &disk->entry);
return ERROR_SUCCESS;
}

View File

@ -1706,7 +1706,10 @@ static void test_publish(void)
ok(pf_exists("msitest"), "File deleted\n");
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);