Source
if (NULL == (service = CreateService(mgr, wservice_name, wservice_name, GENERIC_READ, SERVICE_WIN32_OWN_PROCESS,
/*
** 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/>.
**/
/* StringCchPrintf */
static SERVICE_STATUS serviceStatus;
static SERVICE_STATUS_HANDLE serviceHandle;
/* required for closing application from service */
static int application_status = ZBX_APP_RUNNING;
static zbx_on_exit_t zbx_on_exit_cb;
static zbx_get_config_str_f get_zbx_service_name_cb = NULL;
static zbx_get_config_str_f get_zbx_event_source_cb = NULL;
int ZBX_IS_RUNNING(void)
{
return application_status;
}
void ZBX_DO_EXIT(void)
{
application_status = ZBX_APP_STOPPED;
}
/* free resources allocated by MAIN_ZABBIX_ENTRY() */
void zbx_free_service_resources(int ret);
static void parent_signal_handler(int sig)
{
switch (sig)
{
case SIGINT:
case SIGTERM:
ZBX_DO_EXIT();
zabbix_log(LOG_LEVEL_INFORMATION, "Got signal. Exiting ...");
zbx_on_exit_cb(SUCCEED);
break;
}