diff options
Diffstat (limited to 'src/dutil/wiutil.cpp')
| -rw-r--r-- | src/dutil/wiutil.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/dutil/wiutil.cpp b/src/dutil/wiutil.cpp index ffbfe85a..f1984266 100644 --- a/src/dutil/wiutil.cpp +++ b/src/dutil/wiutil.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | // Exit macros | 6 | // Exit macros |
| 7 | #define WiuExitTrace(x, s, ...) ExitTraceSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) | ||
| 7 | #define WiuExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) | 8 | #define WiuExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) |
| 8 | #define WiuExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) | 9 | #define WiuExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) |
| 9 | #define WiuExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) | 10 | #define WiuExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_WIUTIL, x, s, __VA_ARGS__) |
| @@ -692,12 +693,23 @@ extern "C" HRESULT DAPI WiuEnumRelatedProductCodes( | |||
| 692 | 693 | ||
| 693 | if (fReturnHighestVersionOnly) | 694 | if (fReturnHighestVersionOnly) |
| 694 | { | 695 | { |
| 695 | // get the version | 696 | // try to get the version but if the product registration is broken |
| 697 | // (for whatever reason), skip this product | ||
| 696 | hr = WiuGetProductInfo(wzCurrentProductCode, L"VersionString", &sczInstalledVersion); | 698 | hr = WiuGetProductInfo(wzCurrentProductCode, L"VersionString", &sczInstalledVersion); |
| 697 | WiuExitOnFailure(hr, "Failed to get version for product code: %ls", wzCurrentProductCode); | 699 | if (FAILED(hr)) |
| 700 | { | ||
| 701 | WiuExitTrace(hr, "Could not get product version for product code: %ls, skipping...", wzCurrentProductCode); | ||
| 702 | continue; | ||
| 703 | } | ||
| 698 | 704 | ||
| 705 | // try to parse the product version but if it is corrupt (for whatever | ||
| 706 | // reason), skip it | ||
| 699 | hr = FileVersionFromStringEx(sczInstalledVersion, 0, &qwCurrentVersion); | 707 | hr = FileVersionFromStringEx(sczInstalledVersion, 0, &qwCurrentVersion); |
| 700 | WiuExitOnFailure(hr, "Failed to convert version: %ls to DWORD64 for product code: %ls", sczInstalledVersion, wzCurrentProductCode); | 708 | if (FAILED(hr)) |
| 709 | { | ||
| 710 | WiuExitTrace(hr, "Could not convert version: %ls to DWORD64 for product code: %ls, skipping...", sczInstalledVersion, wzCurrentProductCode); | ||
| 711 | continue; | ||
| 712 | } | ||
| 701 | 713 | ||
| 702 | // if this is the first product found then it is the highest version (for now) | 714 | // if this is the first product found then it is the highest version (for now) |
| 703 | if (0 == *pcRelatedProducts) | 715 | if (0 == *pcRelatedProducts) |
