changes in windows SEH code; other minor fixes
authorVictor Kirhenshtein <victor@netxms.org>
Sun, 24 Jan 2010 12:35:04 +0000 (12:35 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Sun, 24 Jan 2010 12:35:04 +0000 (12:35 +0000)
include/nms_threads.h
src/agent/core/nxagentd.cpp
src/agent/core/nxagentd.h
src/client/windows/nxcon/nxcon.cpp
src/libnetxms/seh.cpp
src/libnxmb/dispatcher.cpp
src/server/core/config.cpp
src/server/core/main.cpp
src/server/include/nxsrvapi.h
src/server/netxmsd/netxmsd.cpp
src/server/tools/nxget/nxget.cpp

index e1ecfc4..9864017 100644 (file)
@@ -76,8 +76,8 @@ int LIBNETXMS_EXPORTABLE ___ExceptionHandler(EXCEPTION_POINTERS *pInfo);
 
 void LIBNETXMS_EXPORTABLE SetExceptionHandler(BOOL (*pfHandler)(EXCEPTION_POINTERS *),
                                                                                                                         void (*pfWriter)(const TCHAR *), const TCHAR *pszDumpDir,
-                                                                                                                        const TCHAR *pszBaseProcessName,
-                                                                                                                        DWORD dwLogMsgCode, BOOL bPrintToScreen);
+                                                                                                                        const TCHAR *pszBaseProcessName, DWORD dwLogMsgCode,
+                                                                                                                        BOOL writeFullDump, BOOL printToScreen);
 BOOL LIBNETXMS_EXPORTABLE SEHDefaultConsoleHandler(EXCEPTION_POINTERS *pInfo);
 TCHAR LIBNETXMS_EXPORTABLE *SEHExceptionName(DWORD code);
 void LIBNETXMS_EXPORTABLE SEHShowCallStack(CONTEXT *pCtx);
index b0f0a8e..f738a05 100644 (file)
@@ -206,6 +206,7 @@ static NX_CFG_TEMPLATE m_cfgTemplate[] =
    { "ExternalParameter", CT_STRING_LIST, '\n', 0, 0, 0, &m_pszExtParamList },
    { "ExternalParameterShellExec", CT_STRING_LIST, '\n', 0, 0, 0, &m_pszShExtParamList },
    { "FileStore", CT_STRING, 0, 0, MAX_PATH, 0, g_szFileStore },
+   { "FullCrashDumps", CT_BOOLEAN, 0, 0, AF_WRITE_FULL_DUMP, 0, &g_dwFlags },
    { "InstallationServers", CT_STRING_LIST, ',', 0, 0, 0, &m_pszMasterServerList }, // Old name for MasterServers, deprecated
    { "ListenAddress", CT_STRING, 0, 0, MAX_PATH, 0, g_szListenAddress },
    { "ListenPort", CT_WORD, 0, 0, 0, 0, &g_wListenPort },
@@ -1366,7 +1367,7 @@ int main(int argc, char *argv[])
 #ifdef _WIN32
                                        if (g_dwFlags & AF_CATCH_EXCEPTIONS)
                                                SetExceptionHandler(SEHServiceExceptionHandler, SEHServiceExceptionDataWriter, m_szDumpDir,
-                                                                                                 "nxagentd", MSG_EXCEPTION, !(g_dwFlags & AF_DAEMON));
+                                                                                                 "nxagentd", MSG_EXCEPTION, g_dwFlags & AF_WRITE_FULL_DUMP, !(g_dwFlags & AF_DAEMON));
                                        __try {
 #endif
                                        if ((!stricmp(g_szLogFile, "{syslog}")) || 
index b7ee9f4..61dd7f5 100644 (file)
 #define AF_REGISTER                 0x00004000
 #define AF_ENABLE_WATCHDOG          0x00008000
 #define AF_CATCH_EXCEPTIONS         0x00010000
+#define AF_WRITE_FULL_DUMP          0x00020000
 
 
 #ifdef _WIN32
index 0588b61..888a516 100644 (file)
@@ -4170,7 +4170,7 @@ int CConsoleApp::Run()
        int nRet;
 
 #ifndef _DEBUG
-       SetExceptionHandler(ExceptionHandler, ExceptionDataWriter, NULL, _T("nxcon.exe"), NULL, FALSE);
+       SetExceptionHandler(ExceptionHandler, ExceptionDataWriter, NULL, _T("nxcon.exe"), NULL, FALSE, FALSE);
        __try
        {
 #endif
index 3bde3d5..e8831bb 100644 (file)
@@ -54,7 +54,8 @@ static HANDLE m_hExceptionLock = INVALID_HANDLE_VALUE;
 static TCHAR m_szBaseProcessName[64] = _T("netxms");
 static TCHAR m_szDumpDir[MAX_PATH] = _T("C:\\");
 static DWORD m_dwLogMessageCode = 0;
-static BOOL m_bPrintToScreen = FALSE;
+static BOOL m_printToScreen = FALSE;
+static BOOL m_writeFullDump = FALSE;
 
 
 //
@@ -98,8 +99,8 @@ void SEHInit(void)
 
 void LIBNETXMS_EXPORTABLE SetExceptionHandler(BOOL (*pfHandler)(EXCEPTION_POINTERS *),
                                                                                                                         void (*pfWriter)(const TCHAR *), const TCHAR *pszDumpDir,
-                                                                                                                        const TCHAR *pszBaseProcessName,
-                                                                                                                        DWORD dwLogMsgCode, BOOL bPrintToScreen)
+                                                                                                                        const TCHAR *pszBaseProcessName, DWORD dwLogMsgCode,
+                                                                                                                        BOOL writeFullDump, BOOL printToScreen)
 {
        m_pfExceptionHandler = pfHandler;
        m_pfWriter = pfWriter;
@@ -108,7 +109,8 @@ void LIBNETXMS_EXPORTABLE SetExceptionHandler(BOOL (*pfHandler)(EXCEPTION_POINTE
        if (pszDumpDir != NULL)
                nx_strncpy(m_szDumpDir, pszDumpDir, MAX_PATH);
        m_dwLogMessageCode = dwLogMsgCode;
-       m_bPrintToScreen = bPrintToScreen;
+       m_writeFullDump = writeFullDump;
+       m_printToScreen = printToScreen;
 }
 
 
@@ -364,7 +366,7 @@ BOOL LIBNETXMS_EXPORTABLE SEHServiceExceptionHandler(EXCEPTION_POINTERS *pInfo)
                mei.ExceptionPointers = pInfo;
                mei.ClientPointers = FALSE;
       MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile,
-                        MiniDumpNormal, &mei, NULL, NULL);
+                                 m_writeFullDump ? MiniDumpWithDataSegs : MiniDumpNormal, &mei, NULL, NULL);
       CloseHandle(hFile);
    }
 
@@ -375,7 +377,7 @@ BOOL LIBNETXMS_EXPORTABLE SEHServiceExceptionHandler(EXCEPTION_POINTERS *pInfo)
                    pInfo->ExceptionRecord->ExceptionAddress,
                    szInfoFile, szDumpFile);
 
-       if (m_bPrintToScreen)
+       if (m_printToScreen)
        {
                _tprintf(_T("\n\n*************************************************************\n")
 #ifdef _M_IX86
index 5c587dc..5ff8a66 100644 (file)
@@ -99,7 +99,9 @@ void NXMBDispatcher::workerThread()
                for(i = 0; i < m_numSubscribers; i++)
                {
                        if (m_filters[i]->isAllowed(*msg))
+                       {
                                m_subscribers[i]->messageHandler(*msg);
+                       }
                }
                MutexUnlock(m_subscriberListAccess);
                delete msg;
index 78c5ad7..1fddf61 100644 (file)
@@ -64,6 +64,7 @@ static NX_CFG_TEMPLATE m_cfgTemplate[] =
    { "DBPassword", CT_STRING, 0, 0, MAX_DB_PASSWORD, 0, g_szDbPassword },
    { "DBServer", CT_STRING, 0, 0, MAX_PATH, 0, g_szDbServer },
    { "DumpDirectory", CT_STRING, 0, 0, MAX_PATH, 0, g_szDumpDir },
+   { "FullCrashDumps", CT_BOOLEAN, 0, 0, AF_WRITE_FULL_DUMP, 0, &g_dwFlags },
    { "ListenAddress", CT_STRING, 0, 0, MAX_PATH, 0, g_szListenAddress },
    { "LogFailedSQLQueries", CT_BOOLEAN, 0, 0, AF_LOG_SQL_ERRORS, 0, &g_dwFlags },
    { "LogFile", CT_STRING, 0, 0, MAX_PATH, 0, g_szLogFile },
index d544388..a8cd376 100644 (file)
@@ -947,13 +947,16 @@ int ProcessConsoleCommand(char *pszCmdLine, CONSOLE_CTX pCtx)
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_DELETE_EMPTY_SUBNETS));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_ENABLE_SNMP_TRAPD));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_ENABLE_ZONING));
-                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_RESOLVE_NODE_NAMES));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_SYNC_NODE_NAMES_WITH_DNS));
+                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_CHECK_TRUSTED_NODES));
+                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_WRITE_FULL_DUMP));
+                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_RESOLVE_NODE_NAMES));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_CATCH_EXCEPTIONS));
-                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_ENABLE_MULTIPLE_DB_CONN));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_INTERNAL_CA));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_DB_LOCKED));
+                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_ENABLE_MULTIPLE_DB_CONN));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_DB_CONNECTION_LOST));
+                       ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_NO_NETWORK_CONNECTIVITY));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_EVENT_STORM_DETECTED));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_SERVER_INITIALIZED));
                        ConsolePrintf(pCtx, SHOW_FLAG_VALUE(AF_SHUTDOWN));
index 7607d4f..75a307f 100644 (file)
 #define AF_ENABLE_ZONING                  0x00000080
 #define AF_SYNC_NODE_NAMES_WITH_DNS       0x00000100
 #define AF_CHECK_TRUSTED_NODES            0x00000200
+#define AF_WRITE_FULL_DUMP                0x00080000
 #define AF_RESOLVE_NODE_NAMES             0x00100000
 #define AF_CATCH_EXCEPTIONS               0x00200000
 #define AF_INTERNAL_CA                    0x00400000
index 1b3c613..2076221 100644 (file)
@@ -329,7 +329,7 @@ int main(int argc, char *argv[])
 #ifdef _WIN32
        if (g_dwFlags & AF_CATCH_EXCEPTIONS)
                SetExceptionHandler(SEHServiceExceptionHandler, SEHServiceExceptionDataWriter,
-                                   g_szDumpDir, "netxmsd", MSG_EXCEPTION, IsStandalone());
+                                   g_szDumpDir, "netxmsd", MSG_EXCEPTION, g_dwFlags & AF_WRITE_FULL_DUMP, IsStandalone());
        __try {
 #endif
 
index c784f74..f9e00d3 100644 (file)
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
 
    InitThreadLibrary();
 #ifdef _WIN32
-       SetExceptionHandler(SEHDefaultConsoleHandler, NULL, NULL, "nxget", 0, FALSE);
+       SetExceptionHandler(SEHDefaultConsoleHandler, NULL, NULL, "nxget", 0, FALSE, FALSE);
 #endif
 
    // Parse command line