continue;
if (package->Context == MSIINSTALLCONTEXT_MACHINE)
- rc = MSIREG_OpenLocalUserDataComponentKey(comp->ComponentId, &hkey, TRUE);
+ rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, szLocalSid,
+ &hkey, TRUE);
else
- rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, &hkey, TRUE);
+ rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, NULL,
+ &hkey, TRUE);
if (rc != ERROR_SUCCESS)
continue;
if (!squash_guid(szComponent, squished_comp))
return ERROR_INVALID_PARAMETER;
- if (MSIREG_OpenUserDataComponentKey(szComponent, &compkey, FALSE) != ERROR_SUCCESS &&
+ if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
MSIREG_OpenLocalSystemComponentKey(szComponent, &compkey, FALSE) != ERROR_SUCCESS)
{
return ERROR_UNKNOWN_COMPONENT;
if (context == MSIINSTALLCONTEXT_MACHINE)
r = MSIREG_OpenLocalSystemComponentKey(comp, &hkey, FALSE);
else
- r = MSIREG_OpenUserDataComponentKey(comp, &hkey, FALSE);
+ r = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE);
if (r != ERROR_SUCCESS)
return FALSE;
state = INSTALLSTATE_UNKNOWN;
if (MSIREG_OpenLocalSystemComponentKey(szComponent, &hkey, FALSE) == ERROR_SUCCESS ||
- MSIREG_OpenUserDataComponentKey(szComponent, &hkey, FALSE) == ERROR_SUCCESS)
+ MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
{
path = msi_reg_get_val_str(hkey, squished_pc);
RegCloseKey(hkey);
RegCloseKey(hkey);
if (MSIREG_OpenLocalSystemComponentKey(szComponent, &hkey, FALSE) == ERROR_SUCCESS ||
- MSIREG_OpenUserDataComponentKey(szComponent, &hkey, FALSE) == ERROR_SUCCESS)
+ MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
{
msi_free(path);
path = msi_reg_get_val_str(hkey, squished_pc);
StringFromGUID2(&guid, comp, GUID_SIZE);
if (machine)
- rc = MSIREG_OpenLocalUserDataComponentKey(comp, &hkey, FALSE);
+ rc = MSIREG_OpenUserDataComponentKey(comp, szLocalSid, &hkey, FALSE);
else
- rc = MSIREG_OpenUserDataComponentKey(comp, &hkey, FALSE);
+ rc = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE);
if (rc != ERROR_SUCCESS)
{
UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context,
HKEY *key, BOOL create);
extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
-extern UINT MSIREG_OpenLocalUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
-extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
+extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
+ HKEY *key, BOOL create);
extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid,
HKEY* key, BOOL create);
return rc;
}
-UINT MSIREG_OpenLocalUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create)
-{
- WCHAR comp[GUID_SIZE];
- WCHAR keypath[0x200];
-
- TRACE("%s\n", debugstr_w(szComponent));
- if (!squash_guid(szComponent, comp))
- return ERROR_FUNCTION_FAILED;
- TRACE("squished (%s)\n", debugstr_w(comp));
-
- sprintfW(keypath, szUserDataComp_fmt, szLocalSid, comp);
-
- if (create)
- return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
-
- return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
-}
-
UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent)
{
WCHAR comp[GUID_SIZE];
return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
}
-UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create)
+UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
+ HKEY *key, BOOL create)
{
UINT rc;
WCHAR comp[GUID_SIZE];
return ERROR_FUNCTION_FAILED;
TRACE("squished (%s)\n", debugstr_w(comp));
- rc = get_user_sid(&usersid);
- if (rc != ERROR_SUCCESS || !usersid)
+ if (!szUserSid)
{
- ERR("Failed to retrieve user SID: %d\n", rc);
- return rc;
- }
+ rc = get_user_sid(&usersid);
+ if (rc != ERROR_SUCCESS || !usersid)
+ {
+ ERR("Failed to retrieve user SID: %d\n", rc);
+ return rc;
+ }
- sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
+ sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
+ LocalFree(usersid);
+ }
+ else
+ sprintfW(keypath, szUserDataComp_fmt, szUserSid, comp);
if (create)
rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
else
rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
- LocalFree(usersid);
return rc;
}
if (!szComponent || !*szComponent || !szProduct)
return ERROR_INVALID_PARAMETER;
- if (MSIREG_OpenUserDataComponentKey(szComponent, &hkeyComp, FALSE) != ERROR_SUCCESS &&
+ if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkeyComp, FALSE) != ERROR_SUCCESS &&
MSIREG_OpenLocalSystemComponentKey(szComponent, &hkeyComp, FALSE) != ERROR_SUCCESS)
return ERROR_UNKNOWN_COMPONENT;