Hans Leidekker : msi: Publish patches regardless of any features being installed locally.

Alexandre Julliard julliard at winehq.org
Wed Jul 21 10:54:57 CDT 2010


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jul 21 09:46:30 2010 +0200

msi: Publish patches regardless of any features being installed locally.

---

 dlls/msi/action.c  |   36 +++++++++++++++++++-----------------
 dlls/msi/msipriv.h |    1 +
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index b101533..1e2af4b 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -3770,9 +3770,6 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
     LPWSTR upgrade;
     WCHAR squashed_pc[SQUISH_GUID_SIZE];
 
-    static const WCHAR szUpgradeCode[] =
-        {'U','p','g','r','a','d','e','C','o','d','e',0};
-
     upgrade = msi_dup_property(package->db, szUpgradeCode);
     if (!upgrade)
         return ERROR_SUCCESS;
@@ -3826,21 +3823,28 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package)
     return TRUE;
 }
 
-static UINT msi_publish_patches( MSIPACKAGE *package, HKEY prodkey )
+static UINT msi_publish_patches( MSIPACKAGE *package )
 {
     static const WCHAR szAllPatches[] = {'A','l','l','P','a','t','c','h','e','s',0};
     WCHAR patch_squashed[GUID_SIZE];
-    HKEY patches_key = NULL, product_patches_key;
+    HKEY patches_key = NULL, product_patches_key = NULL, product_key;
     LONG res;
     MSIPATCHINFO *patch;
     UINT r;
     WCHAR *p, *all_patches = NULL;
     DWORD len = 0;
 
-    res = RegCreateKeyExW( prodkey, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &patches_key, NULL );
-    if (res != ERROR_SUCCESS)
+    r = MSIREG_OpenProductKey( package->ProductCode, NULL, package->Context, &product_key, FALSE );
+    if (r != ERROR_SUCCESS)
         return ERROR_FUNCTION_FAILED;
 
+    res = RegCreateKeyExW( product_key, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &patches_key, NULL );
+    if (res != ERROR_SUCCESS)
+    {
+        r = ERROR_FUNCTION_FAILED;
+        goto done;
+    }
+
     r = MSIREG_OpenUserDataProductPatchesKey( package->ProductCode, package->Context, &product_patches_key, TRUE );
     if (r != ERROR_SUCCESS)
         goto done;
@@ -3903,6 +3907,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package, HKEY prodkey )
 done:
     RegCloseKey( product_patches_key );
     RegCloseKey( patches_key );
+    RegCloseKey( product_key );
     msi_free( all_patches );
     return r;
 }
@@ -3919,6 +3924,13 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
     HKEY hukey = NULL, hudkey = NULL;
     MSIRECORD *uirow;
 
+    if (!list_empty(&package->patches))
+    {
+        rc = msi_publish_patches(package);
+        if (rc != ERROR_SUCCESS)
+            goto end;
+    }
+
     /* FIXME: also need to publish if the product is in advertise mode */
     if (!msi_check_publish(package))
         return ERROR_SUCCESS;
@@ -3937,13 +3949,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
     if (rc != ERROR_SUCCESS)
         goto end;
 
-    if (!list_empty(&package->patches))
-    {
-        rc = msi_publish_patches(package, hukey);
-        if (rc != ERROR_SUCCESS)
-            goto end;
-    }
-
     rc = msi_publish_product_properties(package, hukey);
     if (rc != ERROR_SUCCESS)
         goto end;
@@ -4699,9 +4704,6 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
     HKEY upgrade;
     UINT rc;
 
-    static const WCHAR szUpgradeCode[] = {
-        'U','p','g','r','a','d','e','C','o','d','e',0};
-
     /* FIXME: also need to publish if the product is in advertise mode */
     if (!msi_check_publish(package))
         return ERROR_SUCCESS;
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 8e978cc..df9f045 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -1119,6 +1119,7 @@ static const WCHAR szInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d
 static const WCHAR szMIMEDatabase[] = {'M','I','M','E','\\','D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',' ','T','y','p','e','\\',0};
 static const WCHAR szLocalPackage[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
 static const WCHAR szOriginalDatabase[] = {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
+static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0};
 
 /* memory allocation macro functions */
 static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);




More information about the wine-cvs mailing list