From ab8d368fe8e7a41e503ec295b196035922293ef4 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 27 Apr 2023 21:06:35 -0400 Subject: Fix XmlConfig lookup logic. Fixes https://github.com/wixtoolset/issues/issues/7377. Requires fix for https://github.com/wixtoolset/issues/issues/7444. --- src/ext/Util/ca/XmlConfig.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/ext/Util/ca') diff --git a/src/ext/Util/ca/XmlConfig.cpp b/src/ext/Util/ca/XmlConfig.cpp index 2014e15f..3f059435 100644 --- a/src/ext/Util/ca/XmlConfig.cpp +++ b/src/ext/Util/ca/XmlConfig.cpp @@ -266,11 +266,11 @@ static HRESULT ProcessChanges( // Keep track of where our next spot will be since our current node may be moved pxfcNext = pxfc->pxfcNext; - // With each node, check to see if it's element path matches the Id of some other node in the list + // With each node, check to see if its element path matches the Id of some other node in the list pxfcCheck = *ppxfcHead; while (pxfcCheck) { - if (pxfc->pwzElementId) + if (pxfc->pwzElementId && *pxfc->pwzElementId) { if (0 == lstrcmpW(pxfc->pwzElementId, pxfcCheck->wzId) && 0 == pxfc->iXmlFlags @@ -315,11 +315,6 @@ static HRESULT ProcessChanges( pxfcCheck->cAdditionalChanges = ++cAdditionalChanges; } } - else - { - hr = E_NOTFOUND; - ExitOnRootFailure(hr, "failed to find matching ElementId: %ls", pxfc->pwzElementId); - } } pxfcCheck = pxfcCheck->pxfcNext; @@ -402,10 +397,10 @@ static HRESULT WriteChangeData( HRESULT hr = S_OK; XML_CONFIG_CHANGE* pxfcAdditionalChanges = NULL; - LPCWSTR wzElementPath = pxfc->pwzElementId ? pxfc->pwzElementId : pxfc->pwzElementPath; + LPCWSTR wzElementPath = pxfc->pwzElementId && *pxfc->pwzElementId ? pxfc->pwzElementId : pxfc->pwzElementPath; hr = WcaWriteStringToCaData(wzElementPath, ppwzCustomActionData); - ExitOnFailure(hr, "failed to write ElementPath to custom action data: %ls", wzElementPath); + ExitOnFailure(hr, "failed to write ElementId/ElementPath to custom action data: %ls", wzElementPath); hr = WcaWriteStringToCaData(pxfc->pwzVerifyPath, ppwzCustomActionData); ExitOnFailure(hr, "failed to write VerifyPath to custom action data: %ls", pxfc->pwzVerifyPath); -- cgit v1.2.3-55-g6feb