// static OSInfo** OSInfo::GetInstanceStorage(){ // Note: we don't use the Singleton class because it depends on AtExitManager, // and it's convenient for other modules to use this class without it. static OSInfo* info = []() { _OSVERSIONINFOEXW version_info = {sizeof(version_info)};
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" // GetVersionEx() is deprecated, and the suggested replacement are // the IsWindows*OrGreater() functions in VersionHelpers.h. We can't // use that because: // - For Windows 10, there's IsWindows10OrGreater(), but nothing more // granular. We need to be able to detect different Windows 10 releases // since they sometimes change behavior in ways that matter. // - There is no IsWindows11OrGreater() function yet. ::GetVersionEx(reinterpret_cast<_OSVERSIONINFOW*>(&version_info)); #pragma clang diagnostic pop
<!-- GetVersion.exe.manifest --> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assemblymanifestVersion="1.0"xmlns="urn:schemas-microsoft-com:asm.v1"xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <assemblyIdentity type="win32" name="Contoso.ExampleApplication.ExampleBinary" version="1.0.0.0" processorArchitecture="x86" /> <description>Contoso Example Application</description> <compatibilityxmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows 10 and Windows 11 --> <supportedOSId="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> <!-- Windows 8.1 --> <supportedOSId="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> <!-- Windows 8 --> <supportedOSId="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 7 --> <supportedOSId="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- Windows Vista --> <supportedOSId="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> </application> </compatibility> <trustInfoxmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <!-- UAC settings: - app should run at same integrity level as calling process - app does not need to manipulate windows belonging to higher-integrity-level processes --> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> </assembly>