diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2023-01-17 01:23:44 -0800 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2023-01-17 01:38:00 -0800 |
| commit | dff7f20f9db6210c4b9fe1f0bdd6332abde9f7d9 (patch) | |
| tree | 990e7794ee72d6163c0860a4f90828f7bc494a68 /Source/Core/WinUpdater | |
| parent | 10fd76889854e2367c39d902d70abf70e1d920f6 (diff) | |
windows: prefer os version from registry
this value is not modified by compatibility mode
drop reporting service pack numbers. no longer used
Diffstat (limited to 'Source/Core/WinUpdater')
| -rw-r--r-- | Source/Core/WinUpdater/Platform.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Source/Core/WinUpdater/Platform.cpp b/Source/Core/WinUpdater/Platform.cpp index 565d53c413..f60a6621c0 100644 --- a/Source/Core/WinUpdater/Platform.cpp +++ b/Source/Core/WinUpdater/Platform.cpp @@ -10,6 +10,7 @@ #include "Common/IOFile.h" #include "Common/ScopeGuard.h" #include "Common/StringUtil.h" +#include "Common/WindowsRegistry.h" #include "UpdaterCommon/Platform.h" #include "UpdaterCommon/UI.h" @@ -133,9 +134,7 @@ static const char* VCRuntimeRegistrySubkey() static bool ReadVCRuntimeVersionField(u32* value, const char* name) { - DWORD value_len = sizeof(*value); - return RegGetValueA(HKEY_LOCAL_MACHINE, VCRuntimeRegistrySubkey(), name, RRF_RT_REG_DWORD, - nullptr, value, &value_len) == ERROR_SUCCESS; + return WindowsRegistry::ReadValue(value, VCRuntimeRegistrySubkey(), name); } static std::optional<BuildVersion> GetInstalledVCRuntimeVersion() @@ -219,11 +218,7 @@ static bool VCRuntimeUpdate(const BuildInfo& build_info) static BuildVersion CurrentOSVersion() { - typedef DWORD(WINAPI * RtlGetVersion_t)(PRTL_OSVERSIONINFOW); - auto RtlGetVersion = - (RtlGetVersion_t)GetProcAddress(GetModuleHandle(TEXT("ntdll")), "RtlGetVersion"); - RTL_OSVERSIONINFOW info{.dwOSVersionInfoSize = sizeof(info)}; - RtlGetVersion(&info); + OSVERSIONINFOW info = WindowsRegistry::GetOSVersion(); return {.major = info.dwMajorVersion, .minor = info.dwMinorVersion, .build = info.dwBuildNumber}; } |
