James Hawkins : msi: Add the ability to delete multiple users' component keys.
Alexandre Julliard
julliard at winehq.org
Tue Dec 9 06:24:41 CST 2008
Module: wine
Branch: master
Commit: a9e029093431f57d329ac0257279ff92e7fba5b0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a9e029093431f57d329ac0257279ff92e7fba5b0
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Tue Dec 9 00:21:19 2008 -0600
msi: Add the ability to delete multiple users' component keys.
---
dlls/msi/action.c | 4 ++--
dlls/msi/msipriv.h | 3 +--
dlls/msi/registry.c | 35 +++++++++++++----------------------
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index fd60505..654a7d0 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -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 */
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 861cae8..99eff8f 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -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);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 2808d7f..3d91626 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -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,16 +781,21 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent)
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);
- LocalFree(usersid);
return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
}
More information about the wine-cvs
mailing list