Commit 5343a6f4 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Take the install context into account when deleting the product key.

parent 2b0d2ec5
......@@ -5307,7 +5307,7 @@ static UINT msi_unpublish_product( MSIPACKAGE *package, const WCHAR *remove )
return ERROR_SUCCESS;
MSIREG_DeleteProductKey(package->ProductCode);
MSIREG_DeleteUserDataProductKey(package->ProductCode);
MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
MSIREG_DeleteUninstallKey(package->ProductCode, package->platform);
MSIREG_DeleteLocalClassesProductKey(package->ProductCode);
......@@ -5524,7 +5524,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
if (msi_check_unpublish(package))
{
MSIREG_DeleteUserDataProductKey(package->ProductCode);
MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
goto end;
}
......
......@@ -915,7 +915,7 @@ extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL cr
extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR, MSIINSTALLCONTEXT) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) DECLSPEC_HIDDEN;
extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
......
......@@ -852,7 +852,7 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC
return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
}
UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context)
{
REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
......@@ -862,13 +862,18 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
if (!(usersid = get_user_sid()))
if (context == MSIINSTALLCONTEXT_MACHINE)
sprintfW(keypath, szUserDataProducts_fmt, szLocalSid);
else
{
ERR("Failed to retrieve user SID\n");
return ERROR_FUNCTION_FAILED;
if (!(usersid = get_user_sid()))
{
ERR("Failed to retrieve user SID\n");
return ERROR_FUNCTION_FAILED;
}
sprintfW(keypath, szUserDataProducts_fmt, usersid);
LocalFree(usersid);
}
sprintfW(keypath, szUserDataProducts_fmt, usersid);
LocalFree(usersid);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
r = RegDeleteTreeW( hkey, squashed_pc );
......
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