Skip to content

Commit

Permalink
Fixed WIXBUG5334 where the provider key was beig returned instead of …
Browse files Browse the repository at this point in the history
…the bundle id.
  • Loading branch information
jchoover committed Jul 11, 2016
1 parent 404c300 commit 5633d66
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/libs/dutil/butil.cpp
Expand Up @@ -130,6 +130,7 @@ HRESULT DAPI BundleEnumRelatedBundle(
HKEY hkUninstall = NULL;
HKEY hkBundle = NULL;
LPWSTR sczUninstallSubKey = NULL;
DWORD cchUninstallSubKey = 0;
LPWSTR sczUninstallSubKeyPath = NULL;
LPWSTR sczValue = NULL;
DWORD dwType = 0;
Expand All @@ -138,9 +139,6 @@ HRESULT DAPI BundleEnumRelatedBundle(
DWORD cBundleUpgradeCodes = 0;
BOOL fUpgradeCodeFound = FALSE;

LPWSTR szProviderKey = NULL;
DWORD cchProviderKey = 0;

if (!wzUpgradeCode || !lpBundleIdBuf || !pdwStartIndex)
{
ExitOnFailure(hr = E_INVALIDARG, "An invalid parameter was passed to the function.");
Expand Down Expand Up @@ -214,15 +212,12 @@ HRESULT DAPI BundleEnumRelatedBundle(

if (fUpgradeCodeFound)
{
hr = RegReadString(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, &szProviderKey );
ExitOnFailure(hr, "Failed to read the bundle provider key.");

hr = ::StringCchLengthW(szProviderKey, STRSAFE_MAX_CCH, reinterpret_cast<UINT_PTR*>(&cchProviderKey));
ExitOnFailure(hr, "Failed to calculate length of string");

if (lpBundleIdBuf)
{
hr = ::StringCchCatNExW(lpBundleIdBuf, MAX_GUID_CHARS + 1, szProviderKey, cchProviderKey, NULL, NULL, STRSAFE_FILL_BEHIND_NULL);
hr = ::StringCchLengthW(sczUninstallSubKey, STRSAFE_MAX_CCH, reinterpret_cast<UINT_PTR*>(&cchUninstallSubKey));
ExitOnFailure(hr, "Failed to calculate length of string");

hr = ::StringCchCatNExW(lpBundleIdBuf, MAX_GUID_CHARS + 1, sczUninstallSubKey, cchUninstallSubKey, NULL, NULL, STRSAFE_FILL_BEHIND_NULL);
ExitOnFailure(hr, "Failed to copy the property value to the output buffer.");
}

Expand All @@ -236,7 +231,6 @@ HRESULT DAPI BundleEnumRelatedBundle(
}

LExit:
ReleaseStr(szProviderKey);
ReleaseStr(sczValue);
ReleaseStr(sczUninstallSubKey);
ReleaseStr(sczUninstallSubKeyPath);
Expand Down

0 comments on commit 5633d66

Please sign in to comment.