James Hawkins : msi:
Delay publishing of the SourceList until the PublishProduct action.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 3 08:01:33 CDT 2007
Module: wine
Branch: master
Commit: 5e46fc9019dce5befe72b50695b8d309aba4f65f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e46fc9019dce5befe72b50695b8d309aba4f65f
Author: James Hawkins <truiken at gmail.com>
Date: Mon Jul 2 20:20:20 2007 -0700
msi: Delay publishing of the SourceList until the PublishProduct action.
---
dlls/msi/action.c | 17 +++++++++++++++++
dlls/msi/files.c | 18 +++++++-----------
dlls/msi/helpers.c | 21 ++++++++++++++++++++-
dlls/msi/msipriv.h | 24 ++++++++++++++++++++++++
dlls/msi/package.c | 39 +++++++++++++++++++++++++++++++++++++++
dlls/msi/tests/install.c | 5 ++++-
6 files changed, 111 insertions(+), 13 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index f09a1b9..c9d4fa8 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -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);
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 14fb83b..f2561d4 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -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);
diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c
index 36cbda4..d314699 100644
--- a/dlls/msi/helpers.c
+++ b/dlls/msi/helpers.c
@@ -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++)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 7e563a4..e5b5ea3 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -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 * );
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 8cb2771..e7482e0 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -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;
+}
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 421fd85..f7df7eb 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -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);
More information about the wine-cvs
mailing list