From 5f46dfd698e09eda8f29fa5d42e7b524f9d7214b Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 18 Jun 2008 00:53:39 -0500 Subject: [PATCH] msi: Fix the RegisterUser action to handle the package context. --- dlls/msi/action.c | 6 +++++- dlls/msi/tests/install.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 30bb7cf3cad..fa5900cd440 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -4348,7 +4348,11 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) if (!productid) return ERROR_SUCCESS; - rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &hkey, TRUE); + if (package->Context == MSIINSTALLCONTEXT_MACHINE) + rc = MSIREG_OpenLocalSystemInstallProps(package->ProductCode, &hkey, TRUE); + else + rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &hkey, TRUE); + if (rc != ERROR_SUCCESS) goto end; diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b066e5b10a7..233080b940b 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -2719,6 +2719,27 @@ static void test_publish_registeruser(void) RegDeleteKeyA(props, ""); RegCloseKey(props); + /* RegisterUser, machine */ + r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + sprintf(keypath, keyfmt, "S-1-5-18"); + + res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + CHECK_REG_STR(props, "ProductID", "none"); + CHECK_REG_STR(props, "RegCompany", company); + CHECK_REG_STR(props, "RegOwner", owner); + + RegDeleteValueA(props, "ProductID"); + RegDeleteValueA(props, "RegCompany"); + RegDeleteValueA(props, "RegOwner"); + RegDeleteKeyA(props, ""); + RegCloseKey(props); + HeapFree(GetProcessHeap(), 0, company); HeapFree(GetProcessHeap(), 0, owner);