diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-10-17 19:36:11 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-10-24 20:03:38 -0500 |
| commit | c6a94a7f3556c8dc998630aa65b4e812c7898ad1 (patch) | |
| tree | c72bcfa80749131f6050c78d55690ed037f55035 /src/dutil/verutil.cpp | |
| parent | d3bd9187857fb42218925c4b9192b25f82e81db6 (diff) | |
| download | wix-c6a94a7f3556c8dc998630aa65b4e812c7898ad1.tar.gz wix-c6a94a7f3556c8dc998630aa65b4e812c7898ad1.tar.bz2 wix-c6a94a7f3556c8dc998630aa65b4e812c7898ad1.zip | |
Update verutil precedence rules to check for invalid after release labels.
Diffstat (limited to 'src/dutil/verutil.cpp')
| -rw-r--r-- | src/dutil/verutil.cpp | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/dutil/verutil.cpp b/src/dutil/verutil.cpp index f362f413..835dde81 100644 --- a/src/dutil/verutil.cpp +++ b/src/dutil/verutil.cpp | |||
| @@ -85,22 +85,6 @@ DAPI_(HRESULT) VerCompareParsedVersions( | |||
| 85 | ExitFunction(); | 85 | ExitFunction(); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | if (pVersion1->fInvalid) | ||
| 89 | { | ||
| 90 | if (!pVersion2->fInvalid) | ||
| 91 | { | ||
| 92 | ExitFunction1(nResult = -1); | ||
| 93 | } | ||
| 94 | else | ||
| 95 | { | ||
| 96 | fCompareMetadata = TRUE; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | else if (pVersion2->fInvalid) | ||
| 100 | { | ||
| 101 | ExitFunction1(nResult = 1); | ||
| 102 | } | ||
| 103 | |||
| 104 | if (pVersion1->cReleaseLabels) | 88 | if (pVersion1->cReleaseLabels) |
| 105 | { | 89 | { |
| 106 | if (pVersion2->cReleaseLabels) | 90 | if (pVersion2->cReleaseLabels) |
| @@ -132,6 +116,22 @@ DAPI_(HRESULT) VerCompareParsedVersions( | |||
| 132 | } | 116 | } |
| 133 | } | 117 | } |
| 134 | 118 | ||
| 119 | if (pVersion1->fInvalid) | ||
| 120 | { | ||
| 121 | if (!pVersion2->fInvalid) | ||
| 122 | { | ||
| 123 | ExitFunction1(nResult = -1); | ||
| 124 | } | ||
| 125 | else | ||
| 126 | { | ||
| 127 | fCompareMetadata = TRUE; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | else if (pVersion2->fInvalid) | ||
| 131 | { | ||
| 132 | ExitFunction1(nResult = 1); | ||
| 133 | } | ||
| 134 | |||
| 135 | if (fCompareMetadata) | 135 | if (fCompareMetadata) |
| 136 | { | 136 | { |
| 137 | hr = CompareVersionSubstring(pVersion1->sczVersion + pVersion1->cchMetadataOffset, -1, pVersion2->sczVersion + pVersion2->cchMetadataOffset, -1, &nResult); | 137 | hr = CompareVersionSubstring(pVersion1->sczVersion + pVersion1->cchMetadataOffset, -1, pVersion2->sczVersion + pVersion2->cchMetadataOffset, -1, &nResult); |
| @@ -191,20 +191,23 @@ DAPI_(HRESULT) VerCopyVersion( | |||
| 191 | pCopy->dwPatch = pSource->dwPatch; | 191 | pCopy->dwPatch = pSource->dwPatch; |
| 192 | pCopy->dwRevision = pSource->dwRevision; | 192 | pCopy->dwRevision = pSource->dwRevision; |
| 193 | 193 | ||
| 194 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pCopy->rgReleaseLabels), 0, sizeof(VERUTIL_VERSION_RELEASE_LABEL), pSource->cReleaseLabels); | 194 | if (pSource->cReleaseLabels) |
| 195 | VerExitOnFailure(hr, "Failed to allocate memory for Verutil version release labels copies."); | 195 | { |
| 196 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pCopy->rgReleaseLabels), 0, sizeof(VERUTIL_VERSION_RELEASE_LABEL), pSource->cReleaseLabels); | ||
| 197 | VerExitOnFailure(hr, "Failed to allocate memory for Verutil version release labels copies."); | ||
| 196 | 198 | ||
| 197 | pCopy->cReleaseLabels = pSource->cReleaseLabels; | 199 | pCopy->cReleaseLabels = pSource->cReleaseLabels; |
| 198 | 200 | ||
| 199 | for (DWORD i = 0; i < pCopy->cReleaseLabels; ++i) | 201 | for (DWORD i = 0; i < pCopy->cReleaseLabels; ++i) |
| 200 | { | 202 | { |
| 201 | VERUTIL_VERSION_RELEASE_LABEL* pSourceLabel = pSource->rgReleaseLabels + i; | 203 | VERUTIL_VERSION_RELEASE_LABEL* pSourceLabel = pSource->rgReleaseLabels + i; |
| 202 | VERUTIL_VERSION_RELEASE_LABEL* pCopyLabel = pCopy->rgReleaseLabels + i; | 204 | VERUTIL_VERSION_RELEASE_LABEL* pCopyLabel = pCopy->rgReleaseLabels + i; |
| 203 | 205 | ||
| 204 | pCopyLabel->cchLabelOffset = pSourceLabel->cchLabelOffset; | 206 | pCopyLabel->cchLabelOffset = pSourceLabel->cchLabelOffset; |
| 205 | pCopyLabel->cchLabel = pSourceLabel->cchLabel; | 207 | pCopyLabel->cchLabel = pSourceLabel->cchLabel; |
| 206 | pCopyLabel->fNumeric = pSourceLabel->fNumeric; | 208 | pCopyLabel->fNumeric = pSourceLabel->fNumeric; |
| 207 | pCopyLabel->dwValue = pSourceLabel->dwValue; | 209 | pCopyLabel->dwValue = pSourceLabel->dwValue; |
| 210 | } | ||
| 208 | } | 211 | } |
| 209 | 212 | ||
| 210 | pCopy->cchMetadataOffset = pSource->cchMetadataOffset; | 213 | pCopy->cchMetadataOffset = pSource->cchMetadataOffset; |
