diff options
Diffstat (limited to '')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/deputil.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/deputil.cpp b/src/libs/dutil/WixToolset.DUtil/deputil.cpp index 1a480263..4de85199 100644 --- a/src/libs/dutil/WixToolset.DUtil/deputil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/deputil.cpp | |||
| @@ -121,9 +121,10 @@ DAPI_(HRESULT) DepCheckDependency( | |||
| 121 | HRESULT hr = S_OK; | 121 | HRESULT hr = S_OK; |
| 122 | LPWSTR sczKey = NULL; | 122 | LPWSTR sczKey = NULL; |
| 123 | HKEY hkKey = NULL; | 123 | HKEY hkKey = NULL; |
| 124 | DWORD64 dw64Version = 0; | 124 | VERUTIL_VERSION* pVersion = NULL; |
| 125 | DWORD64 dw64MinVersion = 0; | 125 | VERUTIL_VERSION* pMinVersion = NULL; |
| 126 | DWORD64 dw64MaxVersion = 0; | 126 | VERUTIL_VERSION* pMaxVersion = NULL; |
| 127 | int nResult = 0; | ||
| 127 | BOOL fAllowEqual = FALSE; | 128 | BOOL fAllowEqual = FALSE; |
| 128 | LPWSTR sczName = NULL; | 129 | LPWSTR sczName = NULL; |
| 129 | 130 | ||
| @@ -138,7 +139,7 @@ DAPI_(HRESULT) DepCheckDependency( | |||
| 138 | DepExitOnFailure(hr, "Failed to open the registry key for dependency \"%ls\".", wzProviderKey); | 139 | DepExitOnFailure(hr, "Failed to open the registry key for dependency \"%ls\".", wzProviderKey); |
| 139 | 140 | ||
| 140 | // If there are no registry values, consider the key orphaned and treat it as missing. | 141 | // If there are no registry values, consider the key orphaned and treat it as missing. |
| 141 | hr = RegReadVersion(hkKey, vcszVersionValue, &dw64Version); | 142 | hr = RegReadWixVersion(hkKey, vcszVersionValue, &pVersion); |
| 142 | if (E_FILENOTFOUND != hr) | 143 | if (E_FILENOTFOUND != hr) |
| 143 | { | 144 | { |
| 144 | DepExitOnFailure(hr, "Failed to read the %ls registry value for dependency \"%ls\".", vcszVersionValue, wzProviderKey); | 145 | DepExitOnFailure(hr, "Failed to read the %ls registry value for dependency \"%ls\".", vcszVersionValue, wzProviderKey); |
| @@ -171,11 +172,15 @@ DAPI_(HRESULT) DepCheckDependency( | |||
| 171 | { | 172 | { |
| 172 | if (*wzMinVersion) | 173 | if (*wzMinVersion) |
| 173 | { | 174 | { |
| 174 | hr = FileVersionFromStringEx(wzMinVersion, 0, &dw64MinVersion); | 175 | hr = VerParseVersion(wzMinVersion, 0, FALSE, &pMinVersion); |
| 175 | DepExitOnFailure(hr, "Failed to get the 64-bit version number from \"%ls\".", wzMinVersion); | 176 | DepExitOnFailure(hr, "Failed to get the min version number from \"%ls\".", wzMinVersion); |
| 177 | |||
| 178 | hr = VerCompareParsedVersions(pVersion, pMinVersion, &nResult); | ||
| 179 | DepExitOnFailure(hr, "Failed to compare dependency with min version \"%ls\".", wzMinVersion); | ||
| 176 | 180 | ||
| 177 | fAllowEqual = iAttributes & RequiresAttributesMinVersionInclusive; | 181 | fAllowEqual = iAttributes & RequiresAttributesMinVersionInclusive; |
| 178 | if (!(fAllowEqual && dw64MinVersion <= dw64Version || dw64MinVersion < dw64Version)) | 182 | // !(fAllowEqual && pMinVersion <= pVersion || pMinVersion < pVersion)) |
| 183 | if (!(fAllowEqual && 0 <= nResult || 0 < nResult)) | ||
| 179 | { | 184 | { |
| 180 | hr = DictKeyExists(sdDependencies, wzProviderKey); | 185 | hr = DictKeyExists(sdDependencies, wzProviderKey); |
| 181 | if (E_NOTFOUND != hr) | 186 | if (E_NOTFOUND != hr) |
| @@ -205,11 +210,15 @@ DAPI_(HRESULT) DepCheckDependency( | |||
| 205 | { | 210 | { |
| 206 | if (*wzMaxVersion) | 211 | if (*wzMaxVersion) |
| 207 | { | 212 | { |
| 208 | hr = FileVersionFromStringEx(wzMaxVersion, 0, &dw64MaxVersion); | 213 | hr = VerParseVersion(wzMaxVersion, 0, FALSE, &pMaxVersion); |
| 209 | DepExitOnFailure(hr, "Failed to get the 64-bit version number from \"%ls\".", wzMaxVersion); | 214 | DepExitOnFailure(hr, "Failed to get the max version number from \"%ls\".", wzMaxVersion); |
| 215 | |||
| 216 | hr = VerCompareParsedVersions(pMaxVersion, pVersion, &nResult); | ||
| 217 | DepExitOnFailure(hr, "Failed to compare dependency with max version \"%ls\".", wzMaxVersion); | ||
| 210 | 218 | ||
| 211 | fAllowEqual = iAttributes & RequiresAttributesMaxVersionInclusive; | 219 | fAllowEqual = iAttributes & RequiresAttributesMaxVersionInclusive; |
| 212 | if (!(fAllowEqual && dw64Version <= dw64MaxVersion || dw64Version < dw64MaxVersion)) | 220 | // !(fAllowEqual && pVersion <= pMaxVersion || pVersion < pMaxVersion) |
| 221 | if (!(fAllowEqual && 0 <= nResult || 0 < nResult)) | ||
| 213 | { | 222 | { |
| 214 | hr = DictKeyExists(sdDependencies, wzProviderKey); | 223 | hr = DictKeyExists(sdDependencies, wzProviderKey); |
| 215 | if (E_NOTFOUND != hr) | 224 | if (E_NOTFOUND != hr) |
| @@ -235,6 +244,9 @@ DAPI_(HRESULT) DepCheckDependency( | |||
| 235 | } | 244 | } |
| 236 | 245 | ||
| 237 | LExit: | 246 | LExit: |
| 247 | ReleaseVerutilVersion(pMaxVersion); | ||
| 248 | ReleaseVerutilVersion(pMinVersion); | ||
| 249 | ReleaseVerutilVersion(pVersion); | ||
| 238 | ReleaseStr(sczName); | 250 | ReleaseStr(sczName); |
| 239 | ReleaseRegKey(hkKey); | 251 | ReleaseRegKey(hkKey); |
| 240 | ReleaseStr(sczKey); | 252 | ReleaseStr(sczKey); |
