| 36 | } |
| 37 | |
| 38 | std::wstring GetSdkBuild() |
| 39 | { |
| 40 | auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>(); |
| 41 | wil::unique_cotaskmem_string targetVersion; |
| 42 | CHECK_FAILURE(options->get_TargetCompatibleBrowserVersion(&targetVersion)); |
| 43 | |
| 44 | // The full version string A.B.C.D |
| 45 | const wchar_t* targetVersionMajorAndRest = targetVersion.get(); |
| 46 | // Should now be .B.C.D |
| 47 | const wchar_t* targetVersionMinorAndRest = wcschr(targetVersionMajorAndRest, L'.'); |
| 48 | CHECK_FAILURE((targetVersionMinorAndRest != nullptr && *targetVersionMinorAndRest == L'.') ? S_OK : E_UNEXPECTED); |
| 49 | |
| 50 | // Should now be .C.D |
| 51 | const wchar_t* targetVersionBuildAndRest = wcschr(targetVersionMinorAndRest + 1, L'.'); |
| 52 | CHECK_FAILURE((targetVersionBuildAndRest != nullptr && *targetVersionBuildAndRest == L'.') ? S_OK : E_UNEXPECTED); |
| 53 | |
| 54 | // Return + 1 to skip the first . so just C.D |
| 55 | return targetVersionBuildAndRest + 1; |
| 56 | } |
| 57 | |
| 58 | std::wstring GetRuntimeVersion(AppWindow* appWindow) |
| 59 | { |