MCPcopy Create free account
hub / github.com/WallBreaker2/op / QueryWindowsVersion

Function QueryWindowsVersion

libop/base/WindowsVersion.cpp:10–25  ·  view source on GitHub ↗

直接调用 ntdll!RtlGetVersion,避免普通 Win32 版本接口受 manifest 影响。

Source from the content-addressed store, hash-verified

8
9// 直接调用 ntdll!RtlGetVersion,避免普通 Win32 版本接口受 manifest 影响。
10bool QueryWindowsVersion(RTL_OSVERSIONINFOW &info) {
11 const HMODULE ntdll = ::GetModuleHandleW(L"ntdll.dll");
12 if (!ntdll) {
13 return false;
14 }
15
16 const auto rtl_get_version =
17 reinterpret_cast<RtlGetVersionFn>(::GetProcAddress(ntdll, "RtlGetVersion"));
18 if (!rtl_get_version) {
19 return false;
20 }
21
22 ::ZeroMemory(&info, sizeof(info));
23 info.dwOSVersionInfoSize = sizeof(info);
24 return rtl_get_version(&info) == 0;
25}
26
27} // namespace
28

Callers 1

GetWindowsVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected