From 301f2a5eae6fce37e0c9fffd742bfc84466db8d3 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Mon, 23 Jun 2008 23:04:04 -0500 Subject: [PATCH] msi: Open the local user data product key for the machine context. --- dlls/msi/action.c | 16 +++++++++------- dlls/msi/msipriv.h | 1 + dlls/msi/registry.c | 18 ++++++++++++++++++ dlls/msi/tests/install.c | 10 ++-------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 6761b39cf84..955b7966bd0 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -3547,17 +3547,23 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) if (!msi_check_publish(package)) return ERROR_SUCCESS; - /* ok there is a lot more done here but i need to figure out what */ - if (package->Context == MSIINSTALLCONTEXT_MACHINE) { rc = MSIREG_OpenLocalClassesProductKey(package->ProductCode, &hukey, TRUE); if (rc != ERROR_SUCCESS) goto end; + + rc = MSIREG_OpenLocalUserDataProductKey(package->ProductCode, &hudkey, TRUE); + if (rc != ERROR_SUCCESS) + goto end; } else { - rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE); + rc = MSIREG_OpenUserProductsKey(package->ProductCode, &hukey, TRUE); + if (rc != ERROR_SUCCESS) + goto end; + + rc = MSIREG_OpenUserDataProductKey(package->ProductCode, &hudkey, TRUE); if (rc != ERROR_SUCCESS) goto end; } @@ -3568,10 +3574,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) RegCloseKey(source); - rc = MSIREG_OpenUserDataProductKey(package->ProductCode,&hudkey,TRUE); - if (rc != ERROR_SUCCESS) - goto end; - rc = msi_publish_upgrade_code(package); if (rc != ERROR_SUCCESS) goto end; diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index e2c18e4da8a..096bb886ffc 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -773,6 +773,7 @@ extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create); +extern UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenLocalSystemInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create); diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index c3d425d7d20..1d308d4dabf 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -809,6 +809,24 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create) return rc; } +UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create) +{ + WCHAR squished_pc[GUID_SIZE]; + WCHAR keypath[0x200]; + + TRACE("%s\n", debugstr_w(szProduct)); + if (!squash_guid(szProduct, squished_pc)) + return ERROR_FUNCTION_FAILED; + TRACE("squished (%s)\n", debugstr_w(squished_pc)); + + sprintfW(keypath, szUserDataProd_fmt, localsid, squished_pc); + + if (create) + return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); + + return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); +} + static UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, HKEY *key, BOOL create) { diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 23e0c76e885..7598023a23d 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -2589,16 +2589,10 @@ static void test_publish_publishproduct(void) sprintf(keypath, prodpath, "S-1-5-18"); res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &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); res = RegOpenKeyA(hkey, "InstallProperties", &props); - todo_wine - { - ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); - } + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); res = RegOpenKeyA(hkey, "Patches", &patches); todo_wine