Index: build/win32/project/dummy.h
===================================================================
--- build/win32/project/dummy.h	(revision 0)
+++ build/win32/project/dummy.h	(working copy)
@@ -0,0 +1,6 @@
+#ifndef _DUMMY_H_
+#define _DUMMY_H_
+
+#define VER_FILEDESCRIPTION_STR		"dummy.dll"
+
+#endif
Index: build/win32/project/Makefile_agent.inc
===================================================================
--- build/win32/project/Makefile_agent.inc	(revision 43425)
+++ build/win32/project/Makefile_agent.inc	(working copy)
@@ -29,6 +29,7 @@
 	..\..\..\src\libs\zbxsys\symbols.o \
 	..\..\..\src\libs\zbxsys\threads.o \
 	..\..\..\src\libs\zbxexec\execute.o \
+	..\..\..\src\libs\zbxmodules\modules.o \
 	..\..\..\src\libs\zbxsysinfo\agent\agent.o \
 	..\..\..\src\libs\zbxsysinfo\common\common.o \
 	..\..\..\src\libs\zbxsysinfo\common\file.o \
@@ -65,7 +66,7 @@
 	..\..\..\src\zabbix_agent\zabbix_agentd.o \
 	..\..\..\src\zabbix_agent\zbxconf.o \
 	..\..\..\src\libs\zbxregexp\gnuregex.o \
-	..\..\..\src\libs\zbxregexp\zbxregexp.o
+	..\..\..\src\libs\zbxregexp\zbxregexp.o 
 
 LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib delayimp.lib wevtapi.lib
 
@@ -153,6 +154,9 @@
 ..\..\..\src\libs\zbxexec\execute.o: ..\..\..\src\libs\zbxexec\execute.c
 	$(CC) ..\..\..\src\libs\zbxexec\execute.c /Fo"..\..\..\src\libs\zbxexec\execute.o" $(CFLAGS)
 
+..\..\..\src\libs\zbxmodules\modules.o: ..\..\..\src\libs\zbxmodules\modules.c
+	$(CC) ..\..\..\src\libs\zbxmodules\modules.c /Fo"..\..\..\src\libs\zbxmodules\modules.o" $(CFLAGS)
+	
 ..\..\..\src\libs\zbxsysinfo\agent\agent.o: ..\..\..\src\libs\zbxsysinfo\agent\agent.c
 	$(CC) ..\..\..\src\libs\zbxsysinfo\agent\agent.c /Fo"..\..\..\src\libs\zbxsysinfo\agent\agent.o" $(CFLAGS)
 
@@ -258,4 +262,3 @@
 ..\..\..\src\zabbix_agent\zbxconf.o: ..\..\..\src\zabbix_agent\zbxconf.c
 	$(CC) ..\..\..\src\zabbix_agent\zbxconf.c /Fo"..\..\..\src\zabbix_agent\zbxconf.o" $(CFLAGS)
 
-
Index: build/win32/project/Makefile_dummy
===================================================================
--- build/win32/project/Makefile_dummy	(revision 0)
+++ build/win32/project/Makefile_dummy	(working copy)
@@ -0,0 +1,6 @@
+PROGNAME = ..\..\..\bin\win32\dummy.dll
+INCS = /I .\ /I ..\include /I ..\..\..\include
+CFLAGS = $(INCS) /O2 /Ob1 /GF /FD /EHsc /MT /Gy /W3 /c /TC /D _WINDOWS /D _WIN32_WINNT=0x0500 /D _CONSOLE /D UNICODE /D _UNICODE /D NDEBUG /D WIN32 /D HAVE_WINLDAP_H /D HAVE_ASSERT_H /D ZABBIX_SERVICE /D "_VC80_UPGRADE=0x0600" /D HAVE_IPV6
+LFLAGS = /INCREMENTAL:NO /PDB:"dummy.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO /MACHINE:X86 /DLL
+
+include Makefile_dummy.inc
Index: build/win32/project/Makefile_dummy.inc
===================================================================
--- build/win32/project/Makefile_dummy.inc	(revision 0)
+++ build/win32/project/Makefile_dummy.inc	(working copy)
@@ -0,0 +1,21 @@
+CC = cl.exe /nologo
+LINKER = link.exe /NOLOGO
+RC = rc.exe /d "DUMMY" /d _WINDOWS
+MC = mc.exe
+MT = mt.exe
+DESC_H = dummy.h
+OBJS  = ..\..\..\src\modules\dummyWin\dummy.o
+
+LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib
+
+all: $(PROGNAME)
+
+clean:
+	del $(OBJS) $(RESOURCE_RES) $(MESSAGES_H) $(PROGNAME) messages.rc MSG00001.bin zabbix_get.exe.manifest
+
+$(PROGNAME): $(MESSAGES_H) $(OBJS) $(RESOURCE_RES)
+	$(LINKER) $(OBJS) $(RESOURCE_RES) /OUT:$(PROGNAME) $(LFLAGS) $(LIBS)
+	$(MT) /outputresource:"$(PROGNAME);#1"  /nologo
+
+..\..\..\src\modules\dummyWin\dummy.o: ..\..\..\src\modules\dummyWin\dummy.c
+	$(CC) ..\..\..\src\modules\dummyWin\dummy.c /Fo"..\..\..\src\modules\dummyWin\dummy.o" $(CFLAGS)
Index: src/libs/zbxmodules/modules.c
===================================================================
--- src/libs/zbxmodules/modules.c	(revision 43425)
+++ src/libs/zbxmodules/modules.c	(working copy)
@@ -24,6 +24,31 @@
 #include "log.h"
 #include "sysinfo.h"
 
+#ifdef _WINDOWS
+#include <windows.h>
+#define RTLD_NOW 	2
+
+void *dlopen(const char * filename, int flag)
+{
+	return (void*) LoadLibraryA(filename);
+}
+
+void dlclose(void * handle)
+{
+	FreeLibrary((HINSTANCE)handle);
+}
+
+char * dlerror(void)
+{
+	return (char *)GetLastError();
+}
+
+void * dlsym(void *handle, const char *symbol)
+{
+	return (void*)GetProcAddress((HINSTANCE)handle, symbol);
+}
+#endif
+
 #define ZBX_MODULE_FUNC_INIT		"zbx_module_init"
 #define ZBX_MODULE_FUNC_API_VERSION	"zbx_module_api_version"
 #define ZBX_MODULE_FUNC_ITEM_LIST	"zbx_module_item_list"
Index: src/modules/dummyWin/dummy.c
===================================================================
--- src/modules/dummyWin/dummy.c	(revision 0)
+++ src/modules/dummyWin/dummy.c	(working copy)
@@ -0,0 +1,196 @@
+/*
+** Zabbix
+** Copyright (C) 2001-2014 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.
+**/
+
+#include "sysinc.h"
+#include "module.h"
+#include <windows.h>
+/* the variable keeps timeout setting for item processing */
+static int	item_timeout = 0;
+
+__declspec(dllexport)  int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result);
+__declspec(dllexport)  int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result);
+__declspec(dllexport)  int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result);
+
+static ZBX_METRIC keys[] =
+/*      KEY                     FLAG		FUNCTION        	TEST PARAMETERS */
+{
+	{"dummy.ping",		0,		zbx_module_dummy_ping,	NULL},
+	{"dummy.echo",		CF_HAVEPARAMS,	zbx_module_dummy_echo, 	"a message"},
+	{"dummy.random",	CF_HAVEPARAMS,	zbx_module_dummy_random,"1,1000"},
+	{NULL}
+};
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_api_version                                           *
+ *                                                                            *
+ * Purpose: returns version number of the module interface                    *
+ *                                                                            *
+ * Return value: ZBX_MODULE_API_VERSION_ONE - the only version supported by   *
+ *               Zabbix currently                                             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_api_version()
+{
+	return ZBX_MODULE_API_VERSION_ONE;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_item_timeout                                          *
+ *                                                                            *
+ * Purpose: set timeout value for processing of items                         *
+ *                                                                            *
+ * Parameters: timeout - timeout in seconds, 0 - no timeout set               *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) void	zbx_module_item_timeout(int timeout)
+{
+	item_timeout = timeout;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_item_list                                             *
+ *                                                                            *
+ * Purpose: returns list of item keys supported by the module                 *
+ *                                                                            *
+ * Return value: list of item keys                                            *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) ZBX_METRIC	*zbx_module_item_list()
+{
+	return keys;
+}
+
+__declspec(dllexport) int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	SET_UI64_RESULT(result, 1);
+
+	return SYSINFO_RET_OK;
+}
+
+__declspec(dllexport) int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	char	*param;
+
+	if (1 != request->nparam)
+	{
+		/* set optional error message */
+		SET_MSG_RESULT(result, _strdup("Invalid number of parameters"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	param = get_rparam(request, 0);
+
+	SET_STR_RESULT(result, _strdup(param));
+
+	return SYSINFO_RET_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_dummy_random                                          *
+ *                                                                            *
+ * Purpose: a main entry point for processing of an item                      *
+ *                                                                            *
+ * Parameters: request - structure that contains item key and parameters      *
+ *              request->key - item key without parameters                    *
+ *              request->nparam - number of parameters                        *
+ *              request->timeout - processing should not take longer than     *
+ *                                 this number of seconds                     *
+ *              request->params[N-1] - pointers to item key parameters        *
+ *                                                                            *
+ *             result - structure that will contain result                    *
+ *                                                                            *
+ * Return value: SYSINFO_RET_FAIL - function failed, item will be marked      *
+ *                                 as not supported by zabbix                 *
+ *               SYSINFO_RET_OK - success                                     *
+ *                                                                            *
+ * Comment: get_rparam(request, N-1) can be used to get a pointer to the Nth  *
+ *          parameter starting from 0 (first parameter). Make sure it exists  *
+ *          by checking value of request->nparam.                             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	char	*param1, *param2;
+	int	from, to;
+
+	if (request->nparam != 2)
+	{
+		/* set optional error message */
+		SET_MSG_RESULT(result, _strdup("Invalid number of parameters"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	param1 = get_rparam(request, 0);
+	param2 = get_rparam(request, 1);
+
+	/* there is no strict validation of parameters for simplicity sake */
+	from = atoi(param1);
+	to = atoi(param2);
+
+	if (from > to)
+	{
+		SET_MSG_RESULT(result, _strdup("Incorrect range given"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	SET_UI64_RESULT(result, from + rand() % (to - from + 1));
+
+	return SYSINFO_RET_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_init                                                  *
+ *                                                                            *
+ * Purpose: the function is called on agent startup                           *
+ *          It should be used to call any initialization routines             *
+ *                                                                            *
+ * Return value: ZBX_MODULE_OK - success                                      *
+ *               ZBX_MODULE_FAIL - module initialization failed               *
+ *                                                                            *
+ * Comment: the module won't be loaded in case of ZBX_MODULE_FAIL             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_init()
+{
+	/* initialization for dummy.random */
+	srand(time(NULL));
+
+	return ZBX_MODULE_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_uninit                                                *
+ *                                                                            *
+ * Purpose: the function is called on agent shutdown                          *
+ *          It should be used to cleanup used resources if there are any      *
+ *                                                                            *
+ * Return value: ZBX_MODULE_OK - success                                      *
+ *               ZBX_MODULE_FAIL - function failed                            *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_uninit()
+{
+	return ZBX_MODULE_OK;
+}
Index: src/modules/dummyWin/dummy.c
===================================================================
--- src/modules/dummyWin/dummy.c	(revision 0)
+++ src/modules/dummyWin/dummy.c	(working copy)
@@ -0,0 +1,196 @@
+/*
+** Zabbix
+** Copyright (C) 2001-2014 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.
+**/
+
+#include "sysinc.h"
+#include "module.h"
+#include <windows.h>
+/* the variable keeps timeout setting for item processing */
+static int	item_timeout = 0;
+
+__declspec(dllexport)  int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result);
+__declspec(dllexport)  int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result);
+__declspec(dllexport)  int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result);
+
+static ZBX_METRIC keys[] =
+/*      KEY                     FLAG		FUNCTION        	TEST PARAMETERS */
+{
+	{"dummy.ping",		0,		zbx_module_dummy_ping,	NULL},
+	{"dummy.echo",		CF_HAVEPARAMS,	zbx_module_dummy_echo, 	"a message"},
+	{"dummy.random",	CF_HAVEPARAMS,	zbx_module_dummy_random,"1,1000"},
+	{NULL}
+};
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_api_version                                           *
+ *                                                                            *
+ * Purpose: returns version number of the module interface                    *
+ *                                                                            *
+ * Return value: ZBX_MODULE_API_VERSION_ONE - the only version supported by   *
+ *               Zabbix currently                                             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_api_version()
+{
+	return ZBX_MODULE_API_VERSION_ONE;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_item_timeout                                          *
+ *                                                                            *
+ * Purpose: set timeout value for processing of items                         *
+ *                                                                            *
+ * Parameters: timeout - timeout in seconds, 0 - no timeout set               *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) void	zbx_module_item_timeout(int timeout)
+{
+	item_timeout = timeout;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_item_list                                             *
+ *                                                                            *
+ * Purpose: returns list of item keys supported by the module                 *
+ *                                                                            *
+ * Return value: list of item keys                                            *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) ZBX_METRIC	*zbx_module_item_list()
+{
+	return keys;
+}
+
+__declspec(dllexport) int	zbx_module_dummy_ping(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	SET_UI64_RESULT(result, 1);
+
+	return SYSINFO_RET_OK;
+}
+
+__declspec(dllexport) int	zbx_module_dummy_echo(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	char	*param;
+
+	if (1 != request->nparam)
+	{
+		/* set optional error message */
+		SET_MSG_RESULT(result, _strdup("Invalid number of parameters"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	param = get_rparam(request, 0);
+
+	SET_STR_RESULT(result, _strdup(param));
+
+	return SYSINFO_RET_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_dummy_random                                          *
+ *                                                                            *
+ * Purpose: a main entry point for processing of an item                      *
+ *                                                                            *
+ * Parameters: request - structure that contains item key and parameters      *
+ *              request->key - item key without parameters                    *
+ *              request->nparam - number of parameters                        *
+ *              request->timeout - processing should not take longer than     *
+ *                                 this number of seconds                     *
+ *              request->params[N-1] - pointers to item key parameters        *
+ *                                                                            *
+ *             result - structure that will contain result                    *
+ *                                                                            *
+ * Return value: SYSINFO_RET_FAIL - function failed, item will be marked      *
+ *                                 as not supported by zabbix                 *
+ *               SYSINFO_RET_OK - success                                     *
+ *                                                                            *
+ * Comment: get_rparam(request, N-1) can be used to get a pointer to the Nth  *
+ *          parameter starting from 0 (first parameter). Make sure it exists  *
+ *          by checking value of request->nparam.                             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_dummy_random(AGENT_REQUEST *request, AGENT_RESULT *result)
+{
+	char	*param1, *param2;
+	int	from, to;
+
+	if (request->nparam != 2)
+	{
+		/* set optional error message */
+		SET_MSG_RESULT(result, _strdup("Invalid number of parameters"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	param1 = get_rparam(request, 0);
+	param2 = get_rparam(request, 1);
+
+	/* there is no strict validation of parameters for simplicity sake */
+	from = atoi(param1);
+	to = atoi(param2);
+
+	if (from > to)
+	{
+		SET_MSG_RESULT(result, _strdup("Incorrect range given"));
+		return SYSINFO_RET_FAIL;
+	}
+
+	SET_UI64_RESULT(result, from + rand() % (to - from + 1));
+
+	return SYSINFO_RET_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_init                                                  *
+ *                                                                            *
+ * Purpose: the function is called on agent startup                           *
+ *          It should be used to call any initialization routines             *
+ *                                                                            *
+ * Return value: ZBX_MODULE_OK - success                                      *
+ *               ZBX_MODULE_FAIL - module initialization failed               *
+ *                                                                            *
+ * Comment: the module won't be loaded in case of ZBX_MODULE_FAIL             *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_init()
+{
+	/* initialization for dummy.random */
+	srand(time(NULL));
+
+	return ZBX_MODULE_OK;
+}
+
+/******************************************************************************
+ *                                                                            *
+ * Function: zbx_module_uninit                                                *
+ *                                                                            *
+ * Purpose: the function is called on agent shutdown                          *
+ *          It should be used to cleanup used resources if there are any      *
+ *                                                                            *
+ * Return value: ZBX_MODULE_OK - success                                      *
+ *               ZBX_MODULE_FAIL - function failed                            *
+ *                                                                            *
+ ******************************************************************************/
+__declspec(dllexport) int	zbx_module_uninit()
+{
+	return ZBX_MODULE_OK;
+}
Index: src/zabbix_agent/zabbix_agentd.c
===================================================================
--- src/zabbix_agent/zabbix_agentd.c	(revision 43425)
+++ src/zabbix_agent/zabbix_agentd.c	(working copy)
@@ -24,9 +24,7 @@
 #include "log.h"
 #include "zbxconf.h"
 #include "zbxgetopt.h"
-#ifndef _WINDOWS
-#	include "zbxmodules.h"
-#endif
+#include "zbxmodules.h"
 #include "comms.h"
 #include "alias.h"
 
@@ -264,10 +262,9 @@
 				CONFIG_HOST_METADATA);
 	}
 
+	if (NULL == CONFIG_LOAD_MODULE_PATH)
+		CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, "/modules");
 #ifndef _WINDOWS
-	if (NULL == CONFIG_LOAD_MODULE_PATH)
-		CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, LIBDIR "/modules");
-
 	if (NULL == CONFIG_PID_FILE)
 		CONFIG_PID_FILE = "/tmp/zabbix_agentd.pid";
 #endif
@@ -453,11 +450,11 @@
 			PARM_OPT,	0,			0},
 		{"UserParameter",		&CONFIG_USER_PARAMETERS,		TYPE_MULTISTRING,
 			PARM_OPT,	0,			0},
-#ifndef _WINDOWS
 		{"LoadModulePath",		&CONFIG_LOAD_MODULE_PATH,		TYPE_STRING,
 			PARM_OPT,	0,			0},
 		{"LoadModule",			&CONFIG_LOAD_MODULE,			TYPE_MULTISTRING,
 			PARM_OPT,	0,			0},
+#ifndef _WINDOWS		
 		{"AllowRoot",			&CONFIG_ALLOW_ROOT,			TYPE_INT,
 			PARM_OPT,	0,			1},
 		{"User",			&CONFIG_USER,				TYPE_STRING,
@@ -473,9 +470,7 @@
 	/* initialize multistrings */
 	zbx_strarr_init(&CONFIG_ALIASES);
 	zbx_strarr_init(&CONFIG_USER_PARAMETERS);
-#ifndef _WINDOWS
 	zbx_strarr_init(&CONFIG_LOAD_MODULE);
-#endif
 #ifdef _WINDOWS
 	zbx_strarr_init(&CONFIG_PERF_COUNTERS);
 #endif
@@ -512,9 +507,7 @@
 {
 	zbx_strarr_free(CONFIG_ALIASES);
 	zbx_strarr_free(CONFIG_USER_PARAMETERS);
-#ifndef _WINDOWS
 	zbx_strarr_free(CONFIG_LOAD_MODULE);
-#endif
 #ifdef _WINDOWS
 	zbx_strarr_free(CONFIG_PERF_COUNTERS);
 #endif
@@ -567,13 +560,11 @@
 
 	zabbix_log(LOG_LEVEL_INFORMATION, "using configuration file: %s", CONFIG_FILE);
 
-#ifndef _WINDOWS
 	if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 1))
 	{
 		zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 		exit(EXIT_FAILURE);
 	}
-#endif
 	if (0 != CONFIG_PASSIVE_FORKS)
 	{
 		if (FAIL == zbx_tcp_listen(&listen_sock, CONFIG_LISTEN_IP, (unsigned short)CONFIG_LISTEN_PORT))
@@ -710,9 +701,7 @@
 	zabbix_log(LOG_LEVEL_INFORMATION, "Zabbix Agent stopped. Zabbix %s (revision %s).",
 			ZABBIX_VERSION, ZABBIX_REVISION);
 
-#ifndef _WINDOWS
 	unload_modules();
-#endif
 	zabbix_close_log();
 
 	free_metrics();
@@ -810,13 +799,11 @@
 #else
 			zbx_set_common_signal_handlers();
 #endif
-#ifndef _WINDOWS
 			if (FAIL == load_modules(CONFIG_LOAD_MODULE_PATH, CONFIG_LOAD_MODULE, CONFIG_TIMEOUT, 0))
 			{
 				zabbix_log(LOG_LEVEL_CRIT, "loading modules failed, exiting...");
 				exit(EXIT_FAILURE);
 			}
-#endif
 			load_user_parameters(CONFIG_USER_PARAMETERS);
 			load_aliases(CONFIG_ALIASES);
 			zbx_free_config();
@@ -827,9 +814,7 @@
 #ifdef _WINDOWS
 			free_perf_collector();	/* cpu_collector must be freed before perf_collector is freed */
 #endif
-#ifndef _WINDOWS
 			unload_modules();
-#endif
 			free_metrics();
 			alias_list_free();
 			exit(SUCCEED);
