msi: Fix the published location of the upgrade code for the machine context.

This commit is contained in:
James Hawkins 2008-06-23 23:04:46 -05:00 committed by Alexandre Julliard
parent 301f2a5eae
commit 58e1543960
4 changed files with 38 additions and 8 deletions

View File

@ -3487,9 +3487,18 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
if (!upgrade)
return ERROR_SUCCESS;
r = MSIREG_OpenUserUpgradeCodesKey(upgrade, &hkey, TRUE);
if (r != ERROR_SUCCESS)
goto done;
if (package->Context == MSIINSTALLCONTEXT_MACHINE)
{
r = MSIREG_OpenClassesUpgradeCodesKey(upgrade, &hkey, TRUE);
if (r != ERROR_SUCCESS)
goto done;
}
else
{
r = MSIREG_OpenUserUpgradeCodesKey(upgrade, &hkey, TRUE);
if (r != ERROR_SUCCESS)
goto done;
}
squash_guid(package->ProductCode, squashed_pc);
msi_reg_set_val_str(hkey, squashed_pc, NULL);

View File

@ -793,6 +793,7 @@ extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode);
extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create);
extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);

View File

@ -220,6 +220,11 @@ static const WCHAR szInstaller_LocalManagedProd_fmt[] = {
'I','n','s','t','a','l','l','e','r','\\',
'P','r','o','d','u','c','t','s','\\','%','s',0};
static const WCHAR szInstaller_ClassesUpgrade_fmt[] = {
'I','n','s','t','a','l','l','e','r','\\',
'U','p','g','r','a','d','e','C','o','d','e','s','\\',
'%','s',0};
static const WCHAR localsid[] = {'S','-','1','-','5','-','1','8',0};
BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
@ -1123,6 +1128,24 @@ UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL cr
return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
{
WCHAR squished_pc[GUID_SIZE];
WCHAR keypath[0x200];
TRACE("%s\n", debugstr_w(szUpgradeCode));
if (!squash_guid(szUpgradeCode, squished_pc))
return ERROR_FUNCTION_FAILED;
TRACE("squished (%s)\n", debugstr_w(squished_pc));
sprintfW(keypath, szInstaller_ClassesUpgrade_fmt, squished_pc);
if (create)
return RegCreateKeyW(HKEY_CLASSES_ROOT, keypath, key);
return RegOpenKeyW(HKEY_CLASSES_ROOT, keypath, key);
}
/*************************************************************************
* MsiDecomposeDescriptorW [MSI.@]
*

View File

@ -2649,12 +2649,9 @@ static void test_publish_publishproduct(void)
RegCloseKey(hkey);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
todo_wine
{
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
}
CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
RegDeleteKeyA(hkey, "");
RegCloseKey(hkey);