James Hawkins : msi: Add the ability to query a specific context for a patch.
Alexandre Julliard
julliard at winehq.org
Mon Dec 15 08:27:20 CST 2008
Module: wine
Branch: master
Commit: 880b9199a9c54e578d6186b46e6019e1ac970665
URL: http://source.winehq.org/git/wine.git/?a=commit;h=880b9199a9c54e578d6186b46e6019e1ac970665
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Sun Dec 14 21:07:09 2008 -0600
msi: Add the ability to query a specific context for a patch.
---
dlls/msi/msipriv.h | 2 ++
dlls/msi/registry.c | 37 +++++++++++++++++++++++--------------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 0eaa9f3..a7dada7 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -778,6 +778,8 @@ extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserS
extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
LPCWSTR szUserSid, HKEY *key, BOOL create);
+extern UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext,
+ HKEY *key, BOOL create);
extern UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
HKEY *key, BOOL create);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index a1c3a48..d8411ee 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -837,30 +837,38 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex
return rc;
}
-UINT MSIREG_OpenUserDataPatchKey(LPWSTR patch, HKEY *key, BOOL create)
+UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext,
+ HKEY *key, BOOL create)
{
UINT rc;
+ WCHAR squished_patch[GUID_SIZE];
WCHAR keypath[0x200];
LPWSTR usersid;
- TRACE("\n");
+ TRACE("%s\n", debugstr_w(szPatch));
+ if (!squash_guid(szPatch, squished_patch))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_patch));
- rc = get_user_sid(&usersid);
- if (rc != ERROR_SUCCESS || !usersid)
+ if (dwContext == MSIINSTALLCONTEXT_MACHINE)
+ sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch);
+ else
{
- 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, szUserDataPatch_fmt, usersid, patch);
+ sprintfW(keypath, szUserDataPatch_fmt, usersid, squished_patch);
+ LocalFree(usersid);
+ }
if (create)
- rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
- else
- rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
- LocalFree(usersid);
- return rc;
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
@@ -1819,7 +1827,8 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
}
else
{
- temp = MSIREG_OpenUserDataPatchKey(ptr, &patchkey, FALSE);
+ temp = MSIREG_OpenUserDataPatchKey(patch, context,
+ &patchkey, FALSE);
RegCloseKey(patchkey);
if (temp != ERROR_SUCCESS)
continue;
More information about the wine-cvs
mailing list