msi: Fix the RegisterUser action to handle the package context.

This commit is contained in:
James Hawkins 2008-06-18 00:53:39 -05:00 committed by Alexandre Julliard
parent 79d0c3719f
commit 5f46dfd698
2 changed files with 26 additions and 1 deletions

View File

@ -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;

View File

@ -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);