Commit 880b9199 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Add the ability to query a specific context for a patch.

parent 4a9f6995
...@@ -778,6 +778,8 @@ extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserS ...@@ -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_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
LPCWSTR szUserSid, HKEY *key, BOOL create); 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_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
HKEY *key, BOOL create); HKEY *key, BOOL create);
......
...@@ -837,14 +837,23 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex ...@@ -837,14 +837,23 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex
return rc; return rc;
} }
UINT MSIREG_OpenUserDataPatchKey(LPWSTR patch, HKEY *key, BOOL create) UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext,
HKEY *key, BOOL create)
{ {
UINT rc; UINT rc;
WCHAR squished_patch[GUID_SIZE];
WCHAR keypath[0x200]; WCHAR keypath[0x200];
LPWSTR usersid; 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));
if (dwContext == MSIINSTALLCONTEXT_MACHINE)
sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch);
else
{
rc = get_user_sid(&usersid); rc = get_user_sid(&usersid);
if (rc != ERROR_SUCCESS || !usersid) if (rc != ERROR_SUCCESS || !usersid)
{ {
...@@ -852,15 +861,14 @@ UINT MSIREG_OpenUserDataPatchKey(LPWSTR patch, HKEY *key, BOOL create) ...@@ -852,15 +861,14 @@ UINT MSIREG_OpenUserDataPatchKey(LPWSTR patch, HKEY *key, BOOL create)
return rc; return rc;
} }
sprintfW(keypath, szUserDataPatch_fmt, usersid, patch); sprintfW(keypath, szUserDataPatch_fmt, usersid, squished_patch);
LocalFree(usersid);
}
if (create) if (create)
rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
else
rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
LocalFree(usersid); return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
return rc;
} }
UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
...@@ -1819,7 +1827,8 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, ...@@ -1819,7 +1827,8 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
} }
else else
{ {
temp = MSIREG_OpenUserDataPatchKey(ptr, &patchkey, FALSE); temp = MSIREG_OpenUserDataPatchKey(patch, context,
&patchkey, FALSE);
RegCloseKey(patchkey); RegCloseKey(patchkey);
if (temp != ERROR_SUCCESS) if (temp != ERROR_SUCCESS)
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment