Commit 58e15439 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

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

parent 301f2a5e
...@@ -3487,9 +3487,18 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package) ...@@ -3487,9 +3487,18 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
if (!upgrade) if (!upgrade)
return ERROR_SUCCESS; return ERROR_SUCCESS;
r = MSIREG_OpenUserUpgradeCodesKey(upgrade, &hkey, TRUE); if (package->Context == MSIINSTALLCONTEXT_MACHINE)
if (r != ERROR_SUCCESS) {
goto done; 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); squash_guid(package->ProductCode, squashed_pc);
msi_reg_set_val_str(hkey, squashed_pc, NULL); msi_reg_set_val_str(hkey, squashed_pc, NULL);
......
...@@ -793,6 +793,7 @@ extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct); ...@@ -793,6 +793,7 @@ extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent); extern UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent); extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode); 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 LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val); extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);
......
...@@ -220,6 +220,11 @@ static const WCHAR szInstaller_LocalManagedProd_fmt[] = { ...@@ -220,6 +220,11 @@ static const WCHAR szInstaller_LocalManagedProd_fmt[] = {
'I','n','s','t','a','l','l','e','r','\\', 'I','n','s','t','a','l','l','e','r','\\',
'P','r','o','d','u','c','t','s','\\','%','s',0}; '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}; static const WCHAR localsid[] = {'S','-','1','-','5','-','1','8',0};
BOOL unsquash_guid(LPCWSTR in, LPWSTR out) BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
...@@ -1123,6 +1128,24 @@ UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL cr ...@@ -1123,6 +1128,24 @@ UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL cr
return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); 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.@] * MsiDecomposeDescriptorW [MSI.@]
* *
......
...@@ -2649,12 +2649,9 @@ static void test_publish_publishproduct(void) ...@@ -2649,12 +2649,9 @@ static void test_publish_publishproduct(void)
RegCloseKey(hkey); RegCloseKey(hkey);
res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &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, ""); RegDeleteKeyA(hkey, "");
RegCloseKey(hkey); RegCloseKey(hkey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment