#include "SummaryPage.h"
#include "ProcessingPage.h"
#include "ConfigFilePage.h"
+#include "WinSrvPage.h"
+#include "SrvDepsPage.h"
#include "LoggingPage.h"
#include "FinishPage.h"
+#include <winsock2.h>
+#include <afxsock.h> // MFC socket extensions
#include <iphlpapi.h>
#include <iprtrmib.h>
#include <rtinfo.h>
/////////////////////////////////////////////////////////////////////////////
// The one and only CNxconfigApp object
-CNxconfigApp theApp;
+CNxconfigApp appNxConfig;
/////////////////////////////////////////////////////////////////////////////
// CNxconfigApp initialization
RegCloseKey(hKey);
}
+ else
+ {
+ AfxMessageBox(_T("Unable to determine NetXMS installation directory"));
+ m_szInstallDir[0] = 0;
+ }
// Parse command line
if (!_tcsicmp(m_lpCmdLine, _T("--create-agent-config")))
// installation directory
if ((dwData != 0) || (m_szInstallDir[0] == 0))
{
- if (dwData != 0)
+ if ((dwData != 0) && (_tcsicmp(m_lpCmdLine, _T("--configure-if-needed"))))
AfxMessageBox(_T("Server already configured"));
return FALSE;
}
// 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.
- // TODO: You should modify this string to be something appropriate
- // such as the name of your company or organization.
- SetRegistryKey(_T("Local AppWizard-Generated Applications"));
-
+ SetRegistryKey(_T("NetXMS"));
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
-
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create and load the frame with its resources
-
pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
-
-
-
// The one and only window has been initialized, so show and update it.
//pFrame->ShowWindow(SW_SHOW);
//pFrame->UpdateWindow();
CPollCfgPage pgPollConfig;
CSMTPPage pgSMTP;
CLoggingPage pgLogging;
+ CWinSrvPage pgWinSrv;
+ CSrvDepsPage pgSrvDeps;
CSummaryPage pgSummary;
CProcessingPage pgProcessing;
CFinishPage pgFinish;
dlg.AddPage(&pgPollConfig);
dlg.AddPage(&pgSMTP);
dlg.AddPage(&pgLogging);
+ dlg.AddPage(&pgWinSrv);
+ dlg.AddPage(&pgSrvDeps);
dlg.AddPage(&pgSummary);
dlg.AddPage(&pgProcessing);
dlg.AddPage(&pgFinish);
IP_ADDR_STRING *pAddr;
TCHAR szAddrList[4096], szFile[MAX_PATH];
- if (_taccess(_T("nxagentd.conf"), 0) == 0)
+ _sntprintf(szFile, MAX_PATH, _T("%s\\etc\\nxagentd.conf"), m_szInstallDir);
+ if (_taccess(szFile, 0) == 0)
return; // File already exist, we shouldn't overwrite it
// Get local interface list
// 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
}
}
}
free(pBuffer);
}
- _sntprintf(szFile, MAX_PATH, _T("%s\\etc\\nxagentd.conf"), m_szInstallDir);
fp = _tfopen(szFile, _T("w"));
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"));
+ _ftprintf(fp, _T("SubAgent = winperf.nsm\nSubAgent = portcheck.nsm\nSubAgent = ping.nsm\nSubAgent = ssh.nsm\n"));
fclose(fp);
}
}