Source
static int seek_eventlog(HANDLE *eventlog_handle, zbx_uint64_t FirstID, DWORD ReadDirection, zbx_uint64_t LastID,
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/* StringCchPrintf */
/******************************************************************************
* *
* Purpose: gets event message and parameter translation files from registry *
* *
* Parameters: szLogName - [IN] *
* szSourceName - [IN] log source name *
* pEventMessageFile - [OUT] *
* pParamMessageFile - [OUT] *
* *
******************************************************************************/
static void zbx_get_message_files(const wchar_t *szLogName, const wchar_t *szSourceName,
wchar_t **pEventMessageFile, wchar_t **pParamMessageFile)
{
wchar_t buf[MAX_PATH];
HKEY hKey = NULL;
DWORD szData = 0;
/* Get path to message dll */
StringCchPrintf(buf, MAX_PATH, EVENTLOG_REG_PATH TEXT("%s\\%s"), szLogName, szSourceName);
if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, buf, 0, KEY_READ, &hKey))
return;
if (ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("EventMessageFile"), NULL, NULL, NULL, &szData))
{
*pEventMessageFile = zbx_malloc(*pEventMessageFile, szData);