fixed Windows build errors
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 8 Mar 2017 14:37:56 +0000 (16:37 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 8 Mar 2017 14:37:56 +0000 (16:37 +0200)
19 files changed:
include/nxcpapi.h
src/agent/core/config.cpp
src/agent/core/nxagentd.vcproj
src/agent/core/register.cpp
src/agent/core/sa.cpp
src/agent/nxsagent/main.cpp
src/flow_analyzer/nxflowd/nxflowd.cpp
src/libnetxms/libnetxms.vcproj
src/libnetxms/nxcp.cpp
src/nxcproxy/nxcproxy.cpp
src/nxinstall/nxinstall.cpp
src/nxlptest/nxlptest.cpp
src/server/core/admin.cpp
src/server/core/isc.cpp
src/server/core/nxcore.vcproj
src/server/core/tunnel.cpp
src/server/libnxsrv/agent.cpp
src/server/libnxsrv/isc.cpp
src/server/tools/nxconfig/WizardWorker.cpp

index 170b0d0..b094872 100644 (file)
@@ -545,6 +545,7 @@ typedef bool (*NXCPMessageNameResolver)(UINT16 code, TCHAR *buffer);
 
 #ifdef __cplusplus
 
+void LIBNETXMS_EXPORTABLE NXCPInitBuffer(NXCP_BUFFER *nxcpBuffer);
 int LIBNETXMS_EXPORTABLE RecvNXCPMessage(SOCKET hSocket, NXCP_MESSAGE *pMsg,
                                          NXCP_BUFFER *pBuffer, UINT32 dwMaxMsgSize,
                                          NXCPEncryptionContext **ppCtx,
index c1ed745..8552a4d 100644 (file)
@@ -104,7 +104,7 @@ BOOL DownloadConfig(TCHAR *pszServer)
          {
             pRawMsg = (NXCP_MESSAGE *)realloc(pRawMsg, MAX_MSG_SIZE);
             pBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-            RecvNXCPMessage(0, NULL, pBuffer, 0, NULL, NULL, 0);
+            NXCPInitBuffer(pBuffer);
 
             nLen = RecvNXCPMessage(hSocket, pRawMsg, pBuffer, MAX_MSG_SIZE,
                                    &pDummyCtx, NULL, 30000);
index 4e8c5a5..3d91147 100644 (file)
@@ -70,7 +70,7 @@
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ssleay32.lib"
+                               AdditionalDependencies="ws2_32.lib ssleay32.lib libeay32.lib"
                                LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ssleay32.lib"
+                               AdditionalDependencies="ws2_32.lib ssleay32.lib libeay32.lib"
                                LinkIncremental="2"
                                AdditionalManifestDependencies=""
                                GenerateDebugInformation="true"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ssleay32.lib"
+                               AdditionalDependencies="ws2_32.lib ssleay32.lib libeay32.lib"
                                LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ssleay32.lib"
+                               AdditionalDependencies="ws2_32.lib ssleay32.lib libeay32.lib"
                                LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="1"
index ab13b56..631de72 100644 (file)
@@ -77,7 +77,7 @@ BOOL RegisterOnServer(const TCHAR *pszServer)
          {
             pRawMsg = (NXCP_MESSAGE *)realloc(pRawMsg, MAX_MSG_SIZE);
             pBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-            RecvNXCPMessage(0, NULL, pBuffer, 0, NULL, NULL, 0);
+            NXCPInitBuffer(pBuffer);
 
             nLen = RecvNXCPMessage(hSocket, pRawMsg, pBuffer, MAX_MSG_SIZE,
                                    &pDummyCtx, NULL, 30000);
index ec368c0..38722f4 100644 (file)
@@ -129,7 +129,7 @@ bool SessionAgentConnector::sendMessage(NXCPMessage *msg)
 void SessionAgentConnector::readThread()
 {
    NXCPEncryptionContext *dummyCtx = NULL;
-   RecvNXCPMessage(0, NULL, &m_msgBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(&m_msgBuffer);
    UINT32 rawMsgSize = 65536;
    NXCP_MESSAGE *rawMsg = (NXCP_MESSAGE *)malloc(rawMsgSize);
    while(1)
index cee6bad..048cfa6 100644 (file)
@@ -198,7 +198,7 @@ static void ProcessRequest(NXCPMessage *request)
 static void ProcessMessages()
 {
    NXCPEncryptionContext *dummyCtx = NULL;
-   RecvNXCPMessage(0, NULL, &s_msgBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(&s_msgBuffer);
    UINT32 rawMsgSize = 65536;
    NXCP_MESSAGE *rawMsg = (NXCP_MESSAGE *)malloc(rawMsgSize);
    while(true)
@@ -333,7 +333,7 @@ static HWND GetConsoleHWND()
  */
 int main(int argc, char *argv[])
 {
-   InitNetXMSProcess();
+   InitNetXMSProcess(true);
 
    bool hideConsole = false;
 
index 3996f44..25a3ef5 100644 (file)
@@ -275,7 +275,7 @@ int main(int argc, char *argv[])
        TCHAR moduleName[MAX_PATH];
 #endif
 
-   InitNetXMSProcess();
+   InitNetXMSProcess(false);
 
        // Parse command line
        opterr = 1;
index 083c9ec..ca4e1bc 100644 (file)
@@ -68,7 +68,7 @@
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib libeay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
+                               AdditionalDependencies="ws2_32.lib libeay32.lib ssleay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
                                LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib libeay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
+                               AdditionalDependencies="ws2_32.lib libeay32.lib ssleay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
                                LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib libeay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
+                               AdditionalDependencies="ws2_32.lib libeay32.lib ssleay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
                                LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib libeay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
+                               AdditionalDependencies="ws2_32.lib libeay32.lib ssleay32.lib crypt32.lib dbghelp.lib psapi.lib rpcrt4.lib iphlpapi.lib"
                                LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                                >
                        </File>
                        <File
+                               RelativePath=".\cch.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\config.cpp"
                                >
                        </File>
index f38ed3d..a318977 100644 (file)
@@ -435,6 +435,15 @@ void LIBNETXMS_EXPORTABLE NXCPUnregisterMessageNameResolver(NXCPMessageNameResol
 }
 
 /**
+ * Init NXCP receiver buffer
+ */
+void LIBNETXMS_EXPORTABLE NXCPInitBuffer(NXCP_BUFFER *nxcpBuffer)
+{
+   nxcpBuffer->bufferSize = 0;
+   nxcpBuffer->bufferPos = 0;
+}
+
+/**
  * Receive raw CSCP message from network
  * If pMsg is NULL, temporary buffer will be re-initialized
  * Returns message size on success or:
@@ -858,7 +867,7 @@ bool LIBNETXMS_EXPORTABLE NXCPGetPeerProtocolVersion(AbstractCommChannel *channe
    if (channel->send(&msg, NXCP_HEADER_SIZE, mutex) == NXCP_HEADER_SIZE)
    {
       pBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-      RecvNXCPMessage(0, NULL, pBuffer, 0, NULL, NULL, 0);
+      NXCPInitBuffer(pBuffer);
       nSize = RecvNXCPMessage(channel, &msg, pBuffer, NXCP_HEADER_SIZE, &pDummyCtx, NULL, 30000);
       if ((nSize == NXCP_HEADER_SIZE) &&
           (ntohs(msg.code) == CMD_NXCP_CAPS) &&
index 9176f2e..0614e1f 100644 (file)
@@ -315,7 +315,7 @@ int main(int argc, char *argv[])
    TCHAR *pszEnv;
 #endif
 
-   InitNetXMSProcess();
+   InitNetXMSProcess(false);
 
 #if defined(__sun) || defined(_AIX) || defined(__hpux)
    signal(SIGPIPE, SIG_IGN);
index e986e30..d6a8976 100644 (file)
@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
    int i, ch;
    bool dump = false, printResult = false, quiet = false;
 
-   InitNetXMSProcess();
+   InitNetXMSProcess(true);
 
    // Parse command line
    opterr = 1;
index fbc19b9..5875f63 100644 (file)
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
        UINT32 size;
        TCHAR *inputFile = NULL;
 
-   InitNetXMSProcess();
+   InitNetXMSProcess(true);
 
    // Parse command line
    opterr = 1;
index 787ebcb..bafe703 100644 (file)
@@ -44,7 +44,7 @@ static THREAD_RESULT THREAD_CALL ProcessingThread(void *pArg)
 
    pRawMsg = (NXCP_MESSAGE *)malloc(MAX_MSG_SIZE);
    pRecvBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-   RecvNXCPMessage(0, NULL, pRecvBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(pRecvBuffer);
    ctx.hSocket = sock;
        ctx.socketMutex = MutexCreate();
    ctx.pMsg = &response;
index 898106e..3066808 100644 (file)
@@ -69,7 +69,7 @@ static THREAD_RESULT THREAD_CALL ProcessingThread(void *arg)
 
    pRawMsg = (NXCP_MESSAGE *)malloc(MAX_MSG_SIZE);
    pRecvBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-   RecvNXCPMessage(0, NULL, pRecvBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(pRecvBuffer);
 
    while(1)
    {
index 5ccbfc3..322e373 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\tunnel.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\uniroot.cpp"
                                >
                        </File>
index 70b9d67..f7d6626 100644 (file)
@@ -432,7 +432,7 @@ void AgentTunnel::processCertificateRequest(NXCPMessage *request)
       const BYTE *certRequestData = request->getBinaryFieldPtr(VID_CERTIFICATE, &certRequestLen);
       if (certRequestData != NULL)
       {
-         X509_REQ *certRequest = d2i_X509_REQ(NULL, &certRequestData, certRequestLen);
+         X509_REQ *certRequest = d2i_X509_REQ(NULL, &certRequestData, (long)certRequestLen);
          if (certRequest != NULL)
          {
             char *cn = m_bindGuid.toString().getUTF8String();
@@ -718,7 +718,7 @@ static void SetupTunnel(void *arg)
    }
 
    SSL_set_accept_state(ssl);
-   SSL_set_fd(ssl, request->sock);
+   SSL_set_fd(ssl, (int)request->sock);
 
 retry:
    rc = SSL_do_handshake(ssl);
index e1b69ae..b12821a 100644 (file)
@@ -183,7 +183,7 @@ void AgentConnection::receiverThread()
 
    // Initialize raw message receiving function
    NXCP_BUFFER *msgBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-   RecvNXCPMessage(0, NULL, msgBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(msgBuffer);
 
    // Allocate space for raw message
    NXCP_MESSAGE *rawMsg = (NXCP_MESSAGE *)malloc(msgBufferSize);
index 8bf2e25..519430f 100644 (file)
@@ -166,7 +166,7 @@ void ISC::receiverThread()
 
    // Initialize raw message receiving function
    pMsgBuffer = (NXCP_BUFFER *)malloc(sizeof(NXCP_BUFFER));
-   RecvNXCPMessage(0, NULL, pMsgBuffer, 0, NULL, NULL, 0);
+   NXCPInitBuffer(pMsgBuffer);
 
    // Allocate space for raw message
    pRawMsg = (NXCP_MESSAGE *)malloc(RECEIVER_BUFFER_SIZE);
index 439673e..2b3584d 100644 (file)
 
 #include "stdafx.h"
 #include "nxconfig.h"
-#include <nxsrvapi.h>
+#include <nms_common.h>
+#include <nxcldefs.h>
 
+#define CORE_SERVICE_NAME     _T("NetXMSCore")
+#define CORE_EVENT_SOURCE     _T("NetXMSCore")
 
-//
-// Global data
-//
-
+/**
+ * Error message
+ */
 TCHAR g_szWizardErrorText[MAX_ERROR_TEXT] = _T("Completed successfully");
 
-
-//
-// Static data
-//
-
+/**
+ * Status window handle
+ */
 static HWND m_hStatusWnd = NULL;
 
-
-//
-// Install event source
-//
-
+/**
+ * Install event source
+ */
 static BOOL InstallEventSource(TCHAR *pszPath)
 {
    HKEY hKey;