Source
get_wmi_check_timeout(wmi_namespace, "select CSDVersion from Win32_OperatingSystem", &os_csdversion, start_time,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: reads value from Windows registry *
* *
******************************************************************************/
static wchar_t *read_registry_value(HKEY hKey, LPCTSTR name)
{
DWORD szData = 0;
wchar_t *value = NULL;
if (ERROR_SUCCESS == RegQueryValueEx(hKey, name, NULL, NULL, NULL, &szData))
{
value = zbx_malloc(NULL, szData);
if (ERROR_SUCCESS != RegQueryValueEx(hKey, name, NULL, NULL, (LPBYTE)value, &szData))
zbx_free(value);
}
return value;
}
/******************************************************************************
* *
* Purpose: gets Windows version information *
* *
******************************************************************************/
const OSVERSIONINFOEX *zbx_win_getversion(void)
{
static OSVERSIONINFOEX vi = {sizeof(OSVERSIONINFOEX)};
OSVERSIONINFOEX *pvi = NULL;
HKEY h_key_registry = NULL;
wchar_t *key_value = NULL, *ptr;