MCPcopy Create free account
hub / github.com/crownengine/crown / windowsVersionIs

Function windowsVersionIs

3rdparty/bgfx/src/bgfx.cpp:2733–2773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2731 }
2732
2733 bool windowsVersionIs(Condition::Enum _op, uint32_t _version, uint32_t _build)
2734 {
2735#if BX_PLATFORM_WINDOWS
2736 RTL_OSVERSIONINFOW ovi;
2737 bx::memSet(&ovi, 0 , sizeof(ovi));
2738 ovi.dwOSVersionInfoSize = sizeof(ovi);
2739 const HMODULE hMod = GetModuleHandleW(L"ntdll.dll");
2740 if (NULL != hMod)
2741 {
2742 FARPROC (WINAPI* rtlGetVersionPtr) (PRTL_OSVERSIONINFOW) = reinterpret_cast<FARPROC (WINAPI*)(PRTL_OSVERSIONINFOW)>(bx::dlsym(hMod, "RtlGetVersion"));
2743 if (NULL != rtlGetVersionPtr)
2744 {
2745 rtlGetVersionPtr(&ovi);
2746 if (ovi.dwMajorVersion == 0)
2747 {
2748 return false;
2749 }
2750 ovi.dwBuildNumber = UINT32_MAX == _build ? UINT32_MAX : ovi.dwBuildNumber;
2751 }
2752 }
2753 // _WIN32_WINNT_WIN10 0x0A00
2754 // _WIN32_WINNT_WINBLUE 0x0603
2755 // _WIN32_WINNT_WIN8 0x0602
2756 // _WIN32_WINNT_WIN7 0x0601
2757 // _WIN32_WINNT_VISTA 0x0600
2758 const DWORD cMajorVersion = HIBYTE(_version);
2759 const DWORD cMinorVersion = LOBYTE(_version);
2760 switch (_op)
2761 {
2762 case Condition::LessEqual:
2763 return (ovi.dwMajorVersion < cMajorVersion || (ovi.dwMajorVersion == cMajorVersion && ovi.dwMinorVersion <= cMinorVersion)) && ovi.dwBuildNumber <= _build;
2764 case Condition::GreaterEqual:
2765 return (ovi.dwMajorVersion > cMajorVersion || (ovi.dwMajorVersion == cMajorVersion && ovi.dwMinorVersion >= cMinorVersion)) && ovi.dwBuildNumber >= _build;
2766 default:
2767 return false;
2768 }
2769#else
2770 BX_UNUSED(_op, _version, _build);
2771 return false;
2772#endif // BX_PLATFORM_WINDOWS
2773 }
2774
2775 RendererContextI* rendererCreate(const Init& _init)
2776 {

Callers 4

rendererCreateFunction · 0.85
getSupportedRenderersFunction · 0.85
initMethod · 0.85
getIntelExtensionsFunction · 0.85

Calls 2

memSetFunction · 0.85
dlsymFunction · 0.85

Tested by

no test coverage detected