#include "LoggingPage.h"
#include "FinishPage.h"
+#include <winsock2.h>
+#include <afxsock.h> // MFC socket extensions
#include <iphlpapi.h>
#include <iprtrmib.h>
#include <rtinfo.h>
{
HKEY hKey;
DWORD dwSize, dwData = 0;
- TCHAR *pszArg, szCmd[1024];
if (!AfxSocketInit())
{
CreateAgentConfig();
return FALSE;
}
- pszArg = ExtractWord(m_lpCmdLine, szCmd);
- if (!_tcsicmp(szCmd, _T("--create-nxhttpd-config")))
- {
- CreateWebConfig(pszArg);
- return FALSE;
- }
// Check if server is already configured or we cannot determine
// installation directory
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
-#ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
-#else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
-#endif
-
// Change the registry key under which our settings are stored.
SetRegistryKey(_T("NetXMS"));
// Read all IP addresses for adapter
for(pAddr = &pInfo->IpAddressList; pAddr != NULL; pAddr = pAddr->Next)
{
- if (_tcscmp(pAddr->IpAddress.String, _T("0.0.0.0")))
+ if (strcmp(pAddr->IpAddress.String, "0.0.0.0"))
{
if (szAddrList[0] != 0)
_tcscat(szAddrList, _T(", "));
- _tcscat(szAddrList, pAddr->IpAddress.String);
+#ifdef UNICODE
+ WCHAR ipaddr[32];
+ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pAddr->IpAddress.String, -1, ipaddr, 32);
+ wcscat(szAddrList, ipaddr);
+#else
+ strcat(szAddrList, pAddr->IpAddress.String);
+#endif
}
}
}
if (fp != NULL)
{
currTime = time(NULL);
- _ftprintf(fp, _T("#\n# NetXMS agent configuration file\n# Created by server installer at %s#\n\n"),
- _tctime(&currTime));
- _ftprintf(fp, _T("LogFile = {syslog}\nServers = 127.0.0.1\n"));
+ _ftprintf(fp, _T("#\n# NetXMS agent configuration file\n# Created by server installer at %s#\n\n"), _tctime(&currTime));
if (szAddrList[0] != 0)
- _ftprintf(fp, _T("InstallationServers = %s\n"), szAddrList);
+ {
+ _ftprintf(fp, _T("LogFile = {syslog}\nMasterServers = 127.0.0.1, %s\n"), szAddrList);
+ }
+ else
+ {
+ _ftprintf(fp, _T("LogFile = {syslog}\nMasterServers = 127.0.0.1\n"));
+ }
_ftprintf(fp, _T("FileStore = %s\\var\n"), m_szInstallDir);
_ftprintf(fp, _T("RequireAuthentication = no\n"));
- _ftprintf(fp, _T("SubAgent = winperf.nsm\nSubAgent = portcheck.nsm\n"));
- fclose(fp);
- }
-}
-
-
-//
-// Create configuration file for nxhttpd
-//
-
-void CNxconfigApp::CreateWebConfig(TCHAR *pszServer)
-{
- FILE *fp;
- time_t currTime;
- TCHAR szFile[MAX_PATH];
-
- _sntprintf(szFile, MAX_PATH, _T("%s\\etc\\nxhttpd.conf"), m_szInstallDir);
- if (_taccess(szFile, 0) == 0)
- return; // File already exist, we shouldn't overwrite it
-
- fp = _tfopen(szFile, _T("w"));
- if (fp != NULL)
- {
- currTime = time(NULL);
- _ftprintf(fp, _T("#\n# NetXMS web server configuration file\n# Created by server installer at %s#\n\n"),
- _tctime(&currTime));
- _ftprintf(fp, _T("LogFile = {syslog}\nMasterServer = %s\n"), pszServer);
- _ftprintf(fp, _T("DocumentRoot = %s\\var\\www\n"), m_szInstallDir);
+ _ftprintf(fp, _T("SubAgent = winperf.nsm\nSubAgent = portcheck.nsm\nSubAgent = ping.nsm\nSubAgent = ssh.nsm\n"));
fclose(fp);
}
}