James Hawkins : msi: Factor out publishing the product source list.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:45:37 CDT 2008


Module: wine
Branch: master
Commit: 68e6071d3c91f0a5ab2aa0b924e4905c462c98d0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68e6071d3c91f0a5ab2aa0b924e4905c462c98d0

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Mon Jun 23 22:57:36 2008 -0500

msi: Factor out publishing the product source list.

---

 dlls/msi/action.c |   94 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 53 insertions(+), 41 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 9d6fe7b..8e30102 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -3339,6 +3339,55 @@ static UINT msi_publish_icons(MSIPACKAGE *package)
     return ERROR_SUCCESS;
 }
 
+static UINT msi_publish_sourcelist(MSIPACKAGE *package)
+{
+    UINT r;
+    LPWSTR buffer;
+    MSIMEDIADISK *disk;
+    MSISOURCELISTINFO *info;
+
+    static const WCHAR szEmpty[] = {0};
+
+    buffer = strrchrW(package->PackagePath, '\\') + 1;
+    r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+                              package->Context, MSICODE_PRODUCT,
+                              INSTALLPROPERTY_PACKAGENAMEW, buffer);
+    if (r != ERROR_SUCCESS)
+        return r;
+
+    r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+                              package->Context, MSICODE_PRODUCT,
+                              INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty);
+    if (r != ERROR_SUCCESS)
+        return r;
+
+    r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+                              package->Context, MSICODE_PRODUCT,
+                              INSTALLPROPERTY_DISKPROMPTW, szEmpty);
+    if (r != ERROR_SUCCESS)
+        return r;
+
+    LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
+    {
+        if (!lstrcmpW(info->property, INSTALLPROPERTY_LASTUSEDSOURCEW))
+            msi_set_last_used_source(package->ProductCode, NULL, info->context,
+                                     info->options, info->value);
+        else
+            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);
+    }
+
+    return ERROR_SUCCESS;
+}
+
 static BOOL msi_check_publish(MSIPACKAGE *package)
 {
     MSIFEATURE *feature;
@@ -3362,8 +3411,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
 {
     UINT rc;
     LPWSTR packname;
-    MSISOURCELISTINFO *info;
-    MSIMEDIADISK *disk;
     HKEY hkey=0;
     HKEY hukey=0;
     HKEY hudkey=0, props=0;
@@ -3376,7 +3423,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
         {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
     static const WCHAR szSourceList[] =
         {'S','o','u','r','c','e','L','i','s','t',0};
-    static const WCHAR szEmpty[] = {0};
     DWORD langid;
     LPWSTR buffer;
     DWORD size;
@@ -3454,25 +3500,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
     }
     msi_free(buffer);
 
-    buffer = strrchrW( package->PackagePath, '\\') + 1;
-    rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
-                                package->Context, MSICODE_PRODUCT,
-                                INSTALLPROPERTY_PACKAGENAMEW, buffer );
-    if (rc != ERROR_SUCCESS)
-        goto end;
-
-    rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
-                                package->Context, MSICODE_PRODUCT,
-                                INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty );
-    if (rc != ERROR_SUCCESS)
-        goto end;
-
-    rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
-                                package->Context, MSICODE_PRODUCT,
-                                INSTALLPROPERTY_DISKPROMPTW, szEmpty );
-    if (rc != ERROR_SUCCESS)
-        goto end;
-
     /* FIXME: Need to write more keys to the user registry */
   
     hDb= alloc_msihandle( &package->db->hdr );
@@ -3508,26 +3535,11 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
         rc = ERROR_SUCCESS;
     }
 
-    /* publish the SourceList info */
-    LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
-    {
-        if (!lstrcmpW(info->property, INSTALLPROPERTY_LASTUSEDSOURCEW))
-            msi_set_last_used_source(package->ProductCode, NULL, info->context,
-                                     info->options, info->value);
-        else
-            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);
-    }
+    rc = msi_publish_sourcelist(package);
+    if (rc != ERROR_SUCCESS)
+        goto end;
 
-    msi_publish_icons(package);
+    rc = msi_publish_icons(package);
 
 end:
     RegCloseKey(hkey);




More information about the wine-cvs mailing list