diff options
Diffstat (limited to 'src/dutil')
-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; |