James Hawkins : msi: Fix the published location of the upgrade code for the machine context.
Alexandre Julliard
julliard at winehq.org
Tue Jun 24 06:45:54 CDT 2008
Module: wine
Branch: master
Commit: 58e15439609415cee972591903074d1cb1978ed6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=58e15439609415cee972591903074d1cb1978ed6
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Mon Jun 23 23:04:46 2008 -0500
msi: Fix the published location of the upgrade code for the machine context.
---
dlls/msi/action.c | 15 ++++++++++++---
dlls/msi/msipriv.h | 1 +
dlls/msi/registry.c | 23 +++++++++++++++++++++++
dlls/msi/tests/install.c | 7 ++-----
4 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 955b796..0573a22 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -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);
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 096bb88..18a029f 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -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);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 1d308d4..beb98a8 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -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.@]
*
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 7598023..8fa729a 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -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);
More information about the wine-cvs
mailing list