msi 1: Implement the UnpublishFeatures standard action
James Hawkins
truiken at gmail.com
Thu Aug 9 13:38:48 CDT 2007
Hi,
Changelog:
* Implement the UnpublishFeatures standard action.
dlls/msi/action.c | 51 ++++++++++++++++++++---
dlls/msi/msipriv.h | 1
dlls/msi/registry.c | 14 ++++++
dlls/msi/tests/install.c | 101 +++++++++-------------------------------------
4 files changed, 78 insertions(+), 89 deletions(-)
--
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 953c65b..0b3374d 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -3610,7 +3610,10 @@ static UINT ACTION_PublishFeatures(MSIPA
UINT rc;
HKEY hkey=0;
HKEY hukey=0;
-
+
+ if (!msi_check_publish(package))
+ return ERROR_SUCCESS;
+
rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
@@ -3705,6 +3708,45 @@ end:
return rc;
}
+static UINT msi_unpublish_feature(MSIPACKAGE *package, MSIFEATURE *feature)
+{
+ UINT r;
+ HKEY hkey;
+
+ TRACE("unpublishing feature %s\n", debugstr_w(feature->Feature));
+
+ r = MSIREG_OpenUserFeaturesKey(package->ProductCode, &hkey, FALSE);
+ if (r == ERROR_SUCCESS)
+ {
+ RegDeleteValueW(hkey, feature->Feature);
+ RegCloseKey(hkey);
+ }
+
+ r = MSIREG_OpenUserDataFeaturesKey(package->ProductCode, &hkey, FALSE);
+ if (r == ERROR_SUCCESS)
+ {
+ RegDeleteValueW(hkey, feature->Feature);
+ RegCloseKey(hkey);
+ }
+
+ return ERROR_SUCCESS;
+}
+
+static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
+{
+ MSIFEATURE *feature;
+
+ if (msi_check_publish(package))
+ return ERROR_SUCCESS;
+
+ LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
+ {
+ msi_unpublish_feature(package, feature);
+ }
+
+ return ERROR_SUCCESS;
+}
+
static UINT msi_get_local_package_name( LPWSTR path )
{
static const WCHAR szInstaller[] = {
@@ -3957,6 +3999,7 @@ static UINT msi_unpublish_product(MSIPAC
MSIREG_DeleteProductKey(package->ProductCode);
MSIREG_DeleteUserProductKey(package->ProductCode);
MSIREG_DeleteUserDataProductKey(package->ProductCode);
+ MSIREG_DeleteUserFeaturesKey(package->ProductCode);
done:
msi_free(remove);
@@ -5111,12 +5154,6 @@ static UINT ACTION_UnpublishComponents(
return msi_unimplemented_action_stub( package, "UnpublishComponents", table );
}
-static UINT ACTION_UnpublishFeatures( MSIPACKAGE *package )
-{
- static const WCHAR table[] = { 'F','e','a','t','u','r','e','C','o','m','p','o','n','e','n','t','s',0 };
- return msi_unimplemented_action_stub( package, "UnpublishFeatures", table );
-}
-
static UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
{
static const WCHAR table[] = { 'A','p','p','I','d',0 };
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 471d9ad..d85ac55 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -751,6 +751,7 @@ extern UINT MSIREG_OpenLocalSystemProduc
extern UINT MSIREG_OpenLocalSystemComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
extern UINT MSIREG_OpenLocalClassesProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
extern UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
+extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct);
extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 62562c3..1163111 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -582,6 +582,20 @@ UINT MSIREG_OpenUserFeaturesKey(LPCWSTR
return rc;
}
+UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n",debugstr_w(szProduct));
+ if (!squash_guid(szProduct,squished_pc))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath,szUserFeatures_fmt,squished_pc);
+ return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
+}
+
UINT MSIREG_OpenFeatures(HKEY* key)
{
return RegCreateKeyW(HKEY_LOCAL_MACHINE,szInstaller_Features,key);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 0e99d34..c6adeed 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -1690,12 +1690,6 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- if (state != INSTALLSTATE_UNKNOWN)
- {
- skip("Install database not in a clean state\n");
- return;
- }
-
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
@@ -1865,18 +1859,12 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* PublishProduct and RegisterProduct and ProcessComponents */
r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1");
@@ -1888,16 +1876,10 @@ static void test_publish(void)
ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
@@ -1917,24 +1899,15 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* PublishProduct, RegisterProduct, ProcessComponents, PublishFeatures */
r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1 PUBLISH_FEATURES=1");
@@ -1978,24 +1951,15 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");\
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* complete install */
r = MsiInstallProductA(msifile, "FULL=1");
@@ -2039,24 +2003,15 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* complete install */
r = MsiInstallProductA(msifile, "FULL=1");
@@ -2158,24 +2113,15 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* complete install */
r = MsiInstallProductA(msifile, "FULL=1");
@@ -2219,24 +2165,15 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- todo_wine
- {
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
/* make sure 'Program Files\msitest' is removed */
delete_pfmsitest_files();
--
1.4.1
More information about the wine-patches
mailing list