msi: Add the ability to delete multiple users' component keys.

This commit is contained in:
James Hawkins 2008-12-09 00:21:19 -06:00 committed by Alexandre Julliard
parent bdf7da9bdc
commit a9e0290934
3 changed files with 16 additions and 26 deletions

View File

@ -2922,9 +2922,9 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
else if (ACTION_VerifyComponentForAction(comp, INSTALLSTATE_ABSENT))
{
if (package->Context == MSIINSTALLCONTEXT_MACHINE)
MSIREG_DeleteLocalUserDataComponentKey(comp->ComponentId);
MSIREG_DeleteUserDataComponentKey(comp->ComponentId, szLocalSid);
else
MSIREG_DeleteUserDataComponentKey(comp->ComponentId);
MSIREG_DeleteUserDataComponentKey(comp->ComponentId, NULL);
}
/* UI stuff */

View File

@ -787,8 +787,7 @@ extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct);
extern UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent);
extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid);
extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode);
extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create);
extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode);

View File

@ -733,20 +733,6 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
return rc;
}
UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent)
{
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);
return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
}
UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
HKEY *key, BOOL create)
{
@ -783,7 +769,7 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
return rc;
}
UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent)
UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
{
UINT rc;
WCHAR comp[GUID_SIZE];
@ -795,6 +781,8 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent)
return ERROR_FUNCTION_FAILED;
TRACE("squished (%s)\n", debugstr_w(comp));
if (!szUserSid)
{
rc = get_user_sid(&usersid);
if (rc != ERROR_SUCCESS || !usersid)
{
@ -803,8 +791,11 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent)
}
sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
LocalFree(usersid);
}
else
sprintfW(keypath, szUserDataComp_fmt, szUserSid, comp);
return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
}