James Hawkins : msi: Don't publish components to the Installer key.

Alexandre Julliard julliard at winehq.org
Wed Jun 18 12:58:07 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Wed Jun 18 00:49:42 2008 -0500

msi: Don't publish components to the Installer key.

---

 dlls/msi/action.c        |   50 ++++++++++-----------------------------------
 dlls/msi/msipriv.h       |    1 -
 dlls/msi/registry.c      |    7 +-----
 dlls/msi/tests/install.c |    8 +------
 4 files changed, 13 insertions(+), 53 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index f319427..f6c82ac 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -2822,15 +2822,11 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
     WCHAR squished_cc[GUID_SIZE];
     UINT rc;
     MSICOMPONENT *comp;
-    HKEY hkey=0,hkey2=0;
+    HKEY hkey;
 
     TRACE("\n");
 
-    /* writes the Component and Features values to the registry */
-
-    rc = MSIREG_OpenComponents(&hkey);
-    if (rc != ERROR_SUCCESS)
-        return rc;
+    /* writes the Component values to the registry */
 
     squash_guid(package->ProductCode,squished_pc);
     ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0);
@@ -2862,14 +2858,12 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
          */
         if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
         {
-            rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
-            if (rc != ERROR_SUCCESS)
-                continue;
-
             if (!comp->FullKeypath)
                 continue;
 
-            msi_reg_set_val_str( hkey2, squished_pc, comp->FullKeypath );
+            rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, &hkey, TRUE);
+            if (rc != ERROR_SUCCESS)
+                continue;
 
             if (comp->Attributes & msidbComponentAttributesPermanent)
             {
@@ -2878,36 +2872,14 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                       '0','0','0','0','0','0','0','0','0','0','0','0',
                       '0','0','0','0','0','0','0','0',0 };
 
-                msi_reg_set_val_str( hkey2, szPermKey, comp->FullKeypath );
+                msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath);
             }
 
-            RegCloseKey(hkey2);
-
-            rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, &hkey2, TRUE);
-            if (rc != ERROR_SUCCESS)
-                continue;
-
-            msi_reg_set_val_str(hkey2, squished_pc, comp->FullKeypath);
-            RegCloseKey(hkey2);
+            msi_reg_set_val_str(hkey, squished_pc, comp->FullKeypath);
+            RegCloseKey(hkey);
         }
-        else if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT))
-        {
-            DWORD res;
-
-            rc = RegOpenKeyW(hkey,squished_cc,&hkey2);
-            if (rc != ERROR_SUCCESS)
-                continue;
-
-            RegDeleteValueW(hkey2,squished_pc);
-
-            /* if the key is empty delete it */
-            res = RegEnumKeyExW(hkey2,0,NULL,0,0,NULL,0,NULL);
-            RegCloseKey(hkey2);
-            if (res == ERROR_NO_MORE_ITEMS)
-                RegDeleteKeyW(hkey,squished_cc);
-
+        else if (ACTION_VerifyComponentForAction(comp, INSTALLSTATE_ABSENT))
             MSIREG_DeleteUserDataComponentKey(comp->ComponentId);
-        }
 
         /* UI stuff */
         uirow = MSI_CreateRecord(3);
@@ -2917,8 +2889,8 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         ui_actiondata(package,szProcessComponents,uirow);
         msiobj_release( &uirow->hdr );
     }
-    RegCloseKey(hkey);
-    return rc;
+
+    return ERROR_SUCCESS;
 }
 
 typedef struct {
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 19d0b0d..6dcd267 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -767,7 +767,6 @@ extern UINT MSIREG_OpenUserProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create
 extern UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create);
-extern UINT MSIREG_OpenComponents(HKEY* key);
 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
 extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index b95d5bb..37558e7 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -645,11 +645,6 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create)
     return rc;
 }
 
-UINT MSIREG_OpenComponents(HKEY* key)
-{
-    return RegCreateKeyW(HKEY_LOCAL_MACHINE,szInstaller_Components,key);
-}
-
 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
 {
     UINT rc;
@@ -1240,7 +1235,7 @@ UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid)
 
     TRACE("%d %p\n", index, lpguid);
 
-    r = MSIREG_OpenComponents(&hkeyComponents);
+    r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_Components, &hkeyComponents);
     if( r != ERROR_SUCCESS )
         return ERROR_NO_MORE_ITEMS;
 
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index d20a4fe..410121d 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2767,13 +2767,7 @@ static void test_publish_processcomponents(void)
        "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
-    todo_wine
-    {
-        ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
-    }
-
-    if (res == ERROR_SUCCESS)
-        RegCloseKey(hkey);
+    ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
     RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
     RegDeleteKeyA(comp, "");




More information about the wine-cvs mailing list