mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Move OS detection to common and PowerToysInterop (#5120)
* Remove os-detection project * Removed os-detection project from sln * Added os-detection to PowerToysInterop * Removed references to os-detection and added PowerToysInterop.dll to the ImageResizer folder
This commit is contained in:
32
src/common/os-detect.cpp
Normal file
32
src/common/os-detect.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "pch.h"
|
||||
#include "os-detect.h"
|
||||
|
||||
#include <winrt/Windows.Foundation.Metadata.h>
|
||||
|
||||
// The following three helper functions determine if the user has a build version higher than or equal to 19h1, as that is a requirement for xaml islands
|
||||
// Source : Microsoft-ui-xaml github
|
||||
// Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp
|
||||
template<uint16_t APIVersion>
|
||||
bool IsAPIContractVxAvailable()
|
||||
{
|
||||
static bool isAPIContractVxAvailable = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", APIVersion);
|
||||
|
||||
return isAPIContractVxAvailable;
|
||||
}
|
||||
|
||||
bool IsAPIContractV8Available()
|
||||
{
|
||||
return IsAPIContractVxAvailable<8>();
|
||||
}
|
||||
|
||||
bool Is19H1OrHigher()
|
||||
{
|
||||
return IsAPIContractV8Available();
|
||||
}
|
||||
|
||||
// This function returns true if the build is 19h1 or higher, so that we deploy the new settings.
|
||||
// It returns false otherwise.
|
||||
bool UseNewSettings()
|
||||
{
|
||||
return Is19H1OrHigher();
|
||||
}
|
||||
Reference in New Issue
Block a user