diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2023-01-23 15:53:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-23 15:53:41 +0100 |
| commit | 8d477c65c9a72020a5839299c0dcf130304cb2e6 (patch) | |
| tree | 6854f323ff2e6e3c97fb017bde3387ae0d9ccd52 /Source/Core/WinUpdater/Platform.cpp | |
| parent | a8a4b9c6d0a845fe87ff24a1d75150c75b9eca90 (diff) | |
| parent | dff7f20f9db6210c4b9fe1f0bdd6332abde9f7d9 (diff) | |
Merge pull request #11458 from shuffle2/winuver
windows: prefer os version from registry
Diffstat (limited to 'Source/Core/WinUpdater/Platform.cpp')
| -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}; } |
