Module: wine Branch: master Commit: b198f4f23f0d36016076645b1634dafda3757628 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b198f4f23f0d36016076645b16...
Author: James Hawkins jhawkins@codeweavers.com Date: Tue Dec 9 00:21:00 2008 -0600
msi: Add the ability to open multiple users' component keys.
---
dlls/msi/action.c | 6 ++++-- dlls/msi/msi.c | 12 ++++++------ dlls/msi/msipriv.h | 4 ++-- dlls/msi/registry.c | 42 +++++++++++++++--------------------------- 4 files changed, 27 insertions(+), 37 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index e11421b..8dd2476 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -2859,9 +2859,11 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) 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; diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 7de78f9..b2664e6 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -618,7 +618,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer) 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; @@ -1326,7 +1326,7 @@ static BOOL msi_comp_find_prodcode(LPWSTR squished_pc, 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; @@ -1777,7 +1777,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent, 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); @@ -1803,7 +1803,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent, 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); @@ -1991,9 +1991,9 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature) 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) { diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index ed2e349..6f5299c 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -773,8 +773,8 @@ extern UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL c 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); diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index c624ffd..c8ea83f 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -753,24 +753,6 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, 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]; @@ -785,7 +767,8 @@ UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent) 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]; @@ -797,21 +780,26 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create 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; }
@@ -1433,7 +1421,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct) 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;