msi: Open the local user data product key for the machine context.

This commit is contained in:
James Hawkins 2008-06-23 23:04:04 -05:00 committed by Alexandre Julliard
parent e6d126cd49
commit 301f2a5eae
4 changed files with 30 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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