@joebigelow / wix-1 / commits / 15e332b8

Fix verutil string comparisons

Invariant string comparisons were finding strings like "abc" to be less than "-abc". Switching to ordinal comparison correctly reports the order.

Rob Mensching committed Oct 2, 2022 at 19:26 UTC 15e332b88cb473d911cb268580400728014dd01b
2 files changed +2 -2
src/libs/dutil/WixToolset.DUtil/verutil.cpp
+1 -1
@@ -660,7 +660,7 @@ static HRESULT CompareVersionSubstring(
660 HRESULT hr = S_OK;
661 int nResult = 0;
662
663 - nResult = ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, wzString1, cchCount1, wzString2, cchCount2);
663 + nResult = ::CompareStringOrdinal(wzString1, cchCount1, wzString2, cchCount2, TRUE);
664 if (!nResult)
665 {
666 VerExitOnLastError(hr, "Failed to compare version substrings");
src/libs/dutil/test/DUtilUnitTest/VerUtilTests.cpp
+1 -1
@@ -606,7 +606,7 @@ namespace DutilTests
606
607 TestVerutilCompareParsedVersions(pVersion1, pVersion2, 1);
608 TestVerutilCompareParsedVersions(pVersion1, pVersion3, 1);
609 - TestVerutilCompareParsedVersions(pVersion2, pVersion3, -1);
609 + TestVerutilCompareParsedVersions(pVersion2, pVersion3, 1);
610 }
611 finally
612 {