James Hawkins : msi: Rewrite the PublishFeatures test to only check the registry changes.
Alexandre Julliard
julliard at winehq.org
Wed Jun 18 12:58:42 CDT 2008
Module: wine
Branch: master
Commit: d8e4258d08d32c28a010d3aee21fc43d9a793a02
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8e4258d08d32c28a010d3aee21fc43d9a793a02
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Wed Jun 18 00:54:24 2008 -0500
msi: Rewrite the PublishFeatures test to only check the registry changes.
---
dlls/msi/tests/install.c | 131 ++++++++++++++--------------------------------
1 files changed, 40 insertions(+), 91 deletions(-)
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 233080b..84ffdb6 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2489,21 +2489,25 @@ static void test_publish_publishfeatures(void)
{
UINT r;
LONG res;
- HKEY uninstall, prodkey;
- INSTALLSTATE state;
- CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
+ HKEY hkey;
+ LPSTR usersid;
+ CHAR keypath[MAX_PATH];
- static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
+ static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
+ "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
+ static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
+ "\\Installer\\UserData\\%s\\Products"
+ "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
+ static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
+ "\\Installer\\Features";
- if (!pMsiQueryComponentStateA)
+ get_user_sid(&usersid);
+ if (!usersid)
{
- skip("MsiQueryComponentStateA is not available\n");
+ skip("ConvertSidToStringSidA is not available\n");
return;
}
- res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
- ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-
CreateDirectoryA("msitest", NULL);
create_file("msitest\\maximus", 500);
@@ -2511,103 +2515,48 @@ static void test_publish_publishfeatures(void)
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
- state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
-
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
-
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
-
- r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
- "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
- ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
-
- res = RegOpenKeyA(uninstall, prodcode, &prodkey);
- ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
-
- /* PublishFeatures */
+ /* PublishFeatures, current user */
r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(pf_exists("msitest\\maximus"), "File not installed\n");
- ok(pf_exists("msitest"), "File not installed\n");
-
- state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
-
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
-
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
-
- r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
- "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
- ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
+ ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
+ ok(delete_pf("msitest", FALSE), "File not installed\n");
- /* try to uninstall after PublishFeatures */
- r = MsiInstallProductA(msifile, "REMOVE=ALL");
+ res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
todo_wine
{
- ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
+ ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
}
- ok(pf_exists("msitest\\maximus"), "File deleted\n");
- ok(pf_exists("msitest"), "File deleted\n");
-
- /* PublishFeatures and PublishProduct */
- r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 PUBLISH_FEATURES=1");
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(pf_exists("msitest\\maximus"), "File not installed\n");
- ok(pf_exists("msitest"), "File not installed\n");
-
- state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
-
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
-
- r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
- "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
- ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ if (res == ERROR_SUCCESS)
+ RegCloseKey(hkey);
- /* PublishFeatures and RegisterProduct */
- r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_FEATURES=1");
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(pf_exists("msitest\\maximus"), "File not installed\n");
- ok(pf_exists("msitest"), "File not installed\n");
+ res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
- state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
- ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
+ CHECK_REG_STR(hkey, "feature", "");
+ CHECK_REG_STR(hkey, "montecristo", "");
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
+ RegDeleteValueA(hkey, "feature");
+ RegDeleteValueA(hkey, "montecristo");
+ RegDeleteKeyA(hkey, "");
+ RegCloseKey(hkey);
- state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
+ sprintf(keypath, udpath, usersid);
+ res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
+ ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
- r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
- "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
- ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
- ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
+ CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82 at JU1j_KE");
+ CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82 at JU1j_KE");
- /* full install to remove */
- r = MsiInstallProductA(msifile, "FULL=1");
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ RegDeleteValueA(hkey, "feature");
+ RegDeleteValueA(hkey, "montecristo");
+ RegDeleteKeyA(hkey, "");
+ RegCloseKey(hkey);
- RegCloseKey(uninstall);
DeleteFile(msifile);
DeleteFile("msitest\\maximus");
RemoveDirectory("msitest");
- delete_pfmsitest_files();
+ HeapFree(GetProcessHeap(), 0, usersid);
}
static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
More information about the wine-cvs
mailing list