From 4aa3a997f87d377730431c43cf2ffd3fed504b4b Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 18 Jun 2008 00:49:42 -0500 Subject: [PATCH] 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 f319427e01..f6c82ac6e6 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 19d0b0d3fd..6dcd267ba6 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 b95d5bb48c..37558e7f00 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 d20a4fe46b..410121dc3a 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, "");