提交 47aa56b3 编写于 作者: R Ryan Foster 提交者: jp9000

libobs/util: Fix Windows 10 revision detection

Sometimes the revision number isn't put in to the kernel32.dll version
information.  It's best to use the registry in this case.
上级 95f364dd
......@@ -754,6 +754,8 @@ bool get_dll_ver(const wchar_t *lib, struct win_version_info *ver_info)
return true;
}
#define WINVER_REG_KEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
void get_win_ver(struct win_version_info *info)
{
static struct win_version_info ver = {0};
......@@ -765,6 +767,26 @@ void get_win_ver(struct win_version_info *info)
if (!got_version) {
get_dll_ver(L"kernel32", &ver);
got_version = true;
if (ver.major == 10 && ver.revis == 0) {
HKEY key;
DWORD size, win10_revision;
LSTATUS status;
status = RegOpenKeyW(HKEY_LOCAL_MACHINE,
WINVER_REG_KEY, &key);
if (status != ERROR_SUCCESS)
return;
size = sizeof(win10_revision);
status = RegQueryValueExW(key, L"UBR", NULL, NULL,
(LPBYTE)&win10_revision, &size);
if (status == ERROR_SUCCESS)
ver.revis = (int)win10_revision;
RegCloseKey(key);
}
}
*info = ver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册