win: Reuse existing WinSalInstance::getWindowsBuildNumber

Change-Id: I59b4da71a25a3532e044451b7e89637a53d53a0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178136
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-12-09 10:40:48 +00:00
parent 5f00b748cb
commit 0bf5756b6a

View file

@ -311,30 +311,7 @@ SalData::~SalData()
bool OSSupportsDarkMode()
{
bool bRet = false;
if (HMODULE h_ntdll = GetModuleHandleW(L"ntdll.dll"))
{
typedef LONG(WINAPI* RtlGetVersion_t)(PRTL_OSVERSIONINFOW);
if (auto RtlGetVersion
= reinterpret_cast<RtlGetVersion_t>(GetProcAddress(h_ntdll, "RtlGetVersion")))
{
RTL_OSVERSIONINFOW vi2{};
vi2.dwOSVersionInfoSize = sizeof(vi2);
if (RtlGetVersion(&vi2) == 0)
{
if (vi2.dwMajorVersion > 10)
bRet = true;
else if (vi2.dwMajorVersion == 10)
{
if (vi2.dwMinorVersion > 0)
bRet = true;
else if (vi2.dwBuildNumber >= 18362)
bRet = true;
}
}
}
}
return bRet;
return WinSalInstance::getWindowsBuildNumber() >= 18362;
}
namespace {