[PATCH 2/4] msi: Re-publish product if previous installation with different package is detected
Hans Leidekker
hans at codeweavers.com
Tue Jun 19 04:44:35 CDT 2018
> diff --git a/dlls/msi/action.c b/dlls/msi/action.c
> index 74917afdd1..ba351b45bc 100644
> --- a/dlls/msi/action.c
> +++ b/dlls/msi/action.c
> @@ -4473,6 +4473,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
> UINT rc;
> HKEY hukey = NULL, hudkey = NULL;
> MSIRECORD *uirow;
> + BOOL republish = FALSE;
>
> if (!list_empty(&package->patches))
> {
> @@ -4481,14 +4482,65 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
> goto end;
> }
>
> - /* FIXME: also need to publish if the product is in advertise mode */
> - if (!msi_check_publish(package))
> - return ERROR_SUCCESS;
> -
> rc = MSIREG_OpenProductKey(package->ProductCode, NULL, package->Context,
> - &hukey, TRUE);
> - if (rc != ERROR_SUCCESS)
> - goto end;
> + &hukey, FALSE);
> + if (rc == ERROR_SUCCESS)
> + {
> + WCHAR *package_code;
> +
> + package_code = msi_reg_get_val_str(hukey, INSTALLPROPERTY_PACKAGECODEW);
> + if (package_code)
> + {
> + WCHAR guid[MAX_PATH], packed[SQUASHED_GUID_SIZE], *p;
> + MSIHANDLE hdb, suminfo;
> + DWORD size;
> +
> + hdb = alloc_msihandle(&package->db->hdr);
> + if (!hdb)
> + {
> + RegCloseKey(hukey);
> + return ERROR_NOT_ENOUGH_MEMORY;
> + }
> +
> + rc = MsiGetSummaryInformationW(hdb, NULL, 0, &suminfo);
> + MsiCloseHandle(hdb);
> + if (rc == ERROR_SUCCESS)
> + {
> + size = sizeof(guid);
> + rc = MsiSummaryInfoGetPropertyW(suminfo, PID_REVNUMBER, NULL, NULL, NULL, guid, &size);
> + MsiCloseHandle(suminfo);
> + }
> + if (rc == ERROR_SUCCESS)
> + {
> + p = strchrW(guid, ';');
> + if (p) *p = 0;
> + squash_guid(guid, packed);
This duplicates code to retrieve the package code in msi_publish_product_properties.
You could use get_package_code from package.c, which avoids creating a handle.
More information about the wine-devel
mailing list