- Exception handlers added to all threads in console
authorVictor Kirhenshtein <victor@netxms.org>
Sat, 10 Feb 2007 16:53:40 +0000 (16:53 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Sat, 10 Feb 2007 16:53:40 +0000 (16:53 +0000)
- Fixed incorrect fatal error dialog box behaviour when called for non-gui thread
- Predefined graphs start working (can be defined and opened)

26 files changed:
.gitattributes
src/console/nxuilib/speaker.cpp
src/console/win32/DefineGraphDlg.cpp [new file with mode: 0644]
src/console/win32/DefineGraphDlg.h [new file with mode: 0644]
src/console/win32/DeploymentView.cpp
src/console/win32/EventBrowser.cpp
src/console/win32/GraphFrame.cpp
src/console/win32/MainFrm.cpp
src/console/win32/MainFrm.h
src/console/win32/Makefile.am
src/console/win32/SNMPWalkDlg.cpp
src/console/win32/SyslogBrowser.cpp
src/console/win32/TableView.cpp
src/console/win32/TrapLogBrowser.cpp
src/console/win32/UserSelectDlg.cpp
src/console/win32/UserSelectDlg.h
src/console/win32/comm.cpp
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/nxcon.dsp
src/console/win32/nxcon.h
src/console/win32/nxcon.rc
src/console/win32/resource.h
src/console/win32/tools.cpp
src/libnetxms/seh.cpp

index d11e8d2..01d2ca5 100644 (file)
@@ -709,6 +709,8 @@ src/console/win32/DataQueryDlg.cpp -text
 src/console/win32/DataQueryDlg.h -text
 src/console/win32/DebugFrame.cpp -text
 src/console/win32/DebugFrame.h -text
+src/console/win32/DefineGraphDlg.cpp -text
+src/console/win32/DefineGraphDlg.h -text
 src/console/win32/DeploymentView.cpp -text
 src/console/win32/DeploymentView.h -text
 src/console/win32/DesktopManager.cpp -text
index dd2bcfe..1aef271 100644 (file)
@@ -39,7 +39,7 @@ static Queue *m_pSpeakerQueue = NULL;
 // Speaker thread
 //
 
-static void SpeakerThread(void *pArg)
+static THREAD_RESULT THREAD_CALL SpeakerThread(void *pArg)
 {
    TCHAR *pszText;
    ISpVoice *pVoice = NULL;
@@ -75,6 +75,7 @@ static void SpeakerThread(void *pArg)
       }
       CoUninitialize();
    }
+       return THREAD_OK;
 }
 
 
@@ -84,7 +85,7 @@ static void SpeakerThread(void *pArg)
 
 void NXUILIB_EXPORTABLE SpeakerInit(void)
 {
-   _beginthread(SpeakerThread, 0, NULL);
+       ThreadCreate(SpeakerThread, 0, NULL);
 }
 
 
diff --git a/src/console/win32/DefineGraphDlg.cpp b/src/console/win32/DefineGraphDlg.cpp
new file mode 100644 (file)
index 0000000..637b734
--- /dev/null
@@ -0,0 +1,104 @@
+// DefineGraphDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "nxcon.h"
+#include "DefineGraphDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefineGraphDlg dialog
+
+
+CDefineGraphDlg::CDefineGraphDlg(CWnd* pParent /*=NULL*/)
+       : CDialog(CDefineGraphDlg::IDD, pParent)
+{
+       //{{AFX_DATA_INIT(CDefineGraphDlg)
+       m_strName = _T("");
+       //}}AFX_DATA_INIT
+       m_dwACLSize = 0;
+       m_pACL = NULL;
+}
+
+CDefineGraphDlg::~CDefineGraphDlg()
+{
+       safe_free(m_pACL);
+}
+
+void CDefineGraphDlg::DoDataExchange(CDataExchange* pDX)
+{
+       CDialog::DoDataExchange(pDX);
+       //{{AFX_DATA_MAP(CDefineGraphDlg)
+       DDX_Control(pDX, IDC_LIST_USERS, m_wndListCtrl);
+       DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
+       DDV_MaxChars(pDX, m_strName, 255);
+       //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CDefineGraphDlg, CDialog)
+       //{{AFX_MSG_MAP(CDefineGraphDlg)
+       //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefineGraphDlg message handlers
+
+//
+// WM_INITDIALOG message handler
+//
+
+BOOL CDefineGraphDlg::OnInitDialog() 
+{
+       RECT rect;
+       DWORD i;
+       NXC_USER *pUser;
+       int nItem;
+       TCHAR szBuffer[16];
+
+       CDialog::OnInitDialog();
+
+       // Setup list control
+       m_wndListCtrl.GetClientRect(&rect);
+       m_wndListCtrl.InsertColumn(0, _T("User"), LVCFMT_LEFT, rect.right - 60 - GetSystemMetrics(SM_CXVSCROLL));
+       m_wndListCtrl.InsertColumn(1, _T("Access"), LVCFMT_LEFT, 60);
+       m_wndListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
+
+   // Create image list
+   m_imageList.Create(16, 16, ILC_COLOR8 | ILC_MASK, 4, 1);
+   m_imageList.Add(theApp.LoadIcon(IDI_USER));
+   m_imageList.Add(theApp.LoadIcon(IDI_USER_GROUP));
+   m_imageList.Add(theApp.LoadIcon(IDI_EVERYONE));
+   m_wndListCtrl.SetImageList(&m_imageList, LVSIL_SMALL);
+
+       // Fill ACL
+       for(i = 0; i < m_dwACLSize; i++)
+       {
+               pUser = NXCFindUserById(g_hSession, m_pACL[i].dwUserId);
+               if (pUser != NULL)
+               {
+                       nItem = m_wndListCtrl.InsertItem(0x7FFFFFFF, pUser->szName,
+                                                        (m_pACL[i].dwUserId == GROUP_EVERYONE) ? 2 :
+                                                                     ((m_pACL[i].dwUserId & GROUP_FLAG) ? 1 : 0));
+                       if (nItem != -1)
+                       {
+                               m_wndListCtrl.SetItemData(nItem, m_pACL[i].dwUserId);
+                               szBuffer[0] = (m_pACL[i].dwAccess & NXGRAPH_ACCESS_READ) ? _T('R') : _T('-');
+                               szBuffer[1] = (m_pACL[i].dwAccess & NXGRAPH_ACCESS_WRITE) ? _T('M') : _T('-');
+                               szBuffer[2] = 0;
+                               m_wndListCtrl.SetItemText(nItem, 1, szBuffer);
+                       }
+               }
+       }
+
+       EnableDlgItem(this, IDC_CHECK_READ, FALSE);
+       EnableDlgItem(this, IDC_CHECK_MODIFY, FALSE);
+       EnableDlgItem(this, IDC_BUTTON_DELETE, FALSE);
+       
+       return TRUE;
+}
diff --git a/src/console/win32/DefineGraphDlg.h b/src/console/win32/DefineGraphDlg.h
new file mode 100644 (file)
index 0000000..7c81a91
--- /dev/null
@@ -0,0 +1,51 @@
+#if !defined(AFX_DEFINEGRAPHDLG_H__0C8AA24D_C922_4275_A904_DC81CCFA4B25__INCLUDED_)
+#define AFX_DEFINEGRAPHDLG_H__0C8AA24D_C922_4275_A904_DC81CCFA4B25__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// DefineGraphDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CDefineGraphDlg dialog
+
+class CDefineGraphDlg : public CDialog
+{
+// Construction
+public:
+       NXC_GRAPH_ACL_ENTRY * m_pACL;
+       DWORD m_dwACLSize;
+       CDefineGraphDlg(CWnd* pParent = NULL);   // standard constructor
+       ~CDefineGraphDlg();
+
+// Dialog Data
+       //{{AFX_DATA(CDefineGraphDlg)
+       enum { IDD = IDD_DEFINE_GRAPH };
+       CListCtrl       m_wndListCtrl;
+       CString m_strName;
+       //}}AFX_DATA
+
+
+// Overrides
+       // ClassWizard generated virtual function overrides
+       //{{AFX_VIRTUAL(CDefineGraphDlg)
+       protected:
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+       //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+       CImageList m_imageList;
+
+       // Generated message map functions
+       //{{AFX_MSG(CDefineGraphDlg)
+       virtual BOOL OnInitDialog();
+       //}}AFX_MSG
+       DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_DEFINEGRAPHDLG_H__0C8AA24D_C922_4275_A904_DC81CCFA4B25__INCLUDED_)
index efe094e..b9457b7 100644 (file)
@@ -111,7 +111,7 @@ int CDeploymentView::OnCreate(LPCREATESTRUCT lpCreateStruct)
 // Deployment worker thread
 //
 
-static DWORD WINAPI DeploymentThread(DEPLOYMENT_JOB *pJob)
+static THREAD_RESULT THREAD_CALL DeploymentThread(DEPLOYMENT_JOB *pJob)
 {
    DWORD dwResult;
 
@@ -120,7 +120,7 @@ static DWORD WINAPI DeploymentThread(DEPLOYMENT_JOB *pJob)
    PostMessage(pJob->hWnd, NXCM_DEPLOYMENT_FINISHED, 0, dwResult);
    safe_free(pJob->pdwObjectList);
    free(pJob);
-   return 0;
+   return THREAD_OK;
 }
 
 
@@ -130,21 +130,13 @@ static DWORD WINAPI DeploymentThread(DEPLOYMENT_JOB *pJob)
 
 void CDeploymentView::OnStartDeployment(WPARAM wParam, DEPLOYMENT_JOB *pJob)
 {
-   DWORD dwThreadId;
-   HANDLE hThread;
-
    m_wndProgressCtrl.SetRange32(0, pJob->dwNumObjects);
    m_wndProgressCtrl.SetStep(1);
    m_wndProgressCtrl.SetPos(0);
 
    pJob->hWnd = m_hWnd;
    pJob->pdwRqId = &m_dwRqId;
-   hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DeploymentThread,
-                          pJob, 0, &dwThreadId);
-   if (hThread != NULL)
-   {
-      CloseHandle(hThread);
-   }
+       ThreadCreate((THREAD_RESULT (THREAD_CALL *)(void *))DeploymentThread, 0, pJob);
 }
 
 
index 6530e54..f9a6749 100644 (file)
@@ -172,10 +172,11 @@ void CEventBrowser::AddEvent(NXC_EVENT *pEvent, BOOL bAppend)
 // Event loading thread
 //
 
-static void LoadEvents(void *pArg)
+static THREAD_RESULT THREAD_CALL LoadEvents(void *pArg)
 {
    NXCSyncEvents(g_hSession, g_dwMaxLogRecords);
    PostMessage((HWND)pArg, WM_COMMAND, ID_REQUEST_COMPLETED, 0);
+       return THREAD_OK;
 }
 
 
@@ -192,7 +193,7 @@ void CEventBrowser::OnViewRefresh()
       m_wndListCtrl.ShowWindow(SW_HIDE);
       m_wndWaitView.Start();
       m_wndListCtrl.DeleteAllItems();
-      _beginthread(LoadEvents, 0, m_hWnd);
+      ThreadCreate(LoadEvents, 0, m_hWnd);
    }
 }
 
index 1b0ba37..d9cd6ea 100644 (file)
@@ -6,6 +6,7 @@
 #include "GraphFrame.h"
 #include "GraphSettingsPage.h"
 #include "GraphDataPage.h"
+#include "DefineGraphDlg.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -908,7 +909,41 @@ void CGraphFrame::OnUpdateGraphPresetsLastyear(CCmdUI* pCmdUI)
 void CGraphFrame::OnGraphDefine() 
 {
        DWORD dwResult;
-
-       char *p=NULL;*p=0;
-//     SendMessage(NXCM_GET_SAVE_INFO
+       TCHAR szBuffer[256], *ptr;
+       CDefineGraphDlg dlg;
+       WINDOW_SAVE_INFO *pInfo;
+       NXC_GRAPH graph;
+
+       GetWindowText(szBuffer, 256);
+       ptr = _tcschr(szBuffer, _T('['));
+       if (ptr != NULL)
+       {
+               ptr++;
+               memmove(szBuffer, ptr, (_tcslen(ptr) + 1) * sizeof(TCHAR));
+               ptr = _tcsrchr(szBuffer, _T(']'));
+               if (ptr != NULL)
+                       *ptr = 0;
+       }
+       dlg.m_strName = szBuffer;
+       if (dlg.DoModal() == IDOK)
+       {
+               pInfo = (WINDOW_SAVE_INFO *)malloc(sizeof(WINDOW_SAVE_INFO));
+               if (SendMessage(NXCM_GET_SAVE_INFO, 0, (LPARAM)pInfo) != 0)
+               {
+                       graph.dwId = 0; // New graph
+                       graph.pszName = (TCHAR *)((LPCTSTR)dlg.m_strName);
+                       graph.pszConfig = pInfo->szParameters;
+                       graph.dwAclSize = dlg.m_dwACLSize;
+                       graph.pACL = dlg.m_pACL;
+                       dwResult = DoRequestArg2(NXCDefineGraph, g_hSession, &graph, _T("Saving graph configuration on server..."));
+                       if (dwResult != RCC_SUCCESS)
+                       {
+                               theApp.ErrorBox(dwResult, _T("Cannot save graph configuration: %s"));
+                       }
+               }
+               else
+               {
+                       MessageBox(_T("Cannot save graph - internal console error"), _T("Error"), MB_OK | MB_ICONSTOP);
+               }
+       }
 }
index f1c5325..3f9b8f2 100644 (file)
@@ -9,6 +9,7 @@
 #include "LastValuesView.h"
 #include "AlarmBrowser.h"
 #include "ObjectBrowser.h"
+#include "FatalErrorDlg.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -41,6 +42,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
    ON_MESSAGE(NXCM_DEPLOYMENT_INFO, OnDeploymentInfo)
    ON_MESSAGE(NXCM_UPDATE_EVENT_LIST, OnUpdateEventList)
    ON_MESSAGE(NXCM_UPDATE_OBJECT_TOOLS, OnUpdateObjectTools)
+       ON_MESSAGE(NXCM_SHOW_FATAL_ERROR, OnShowFatalError)
 END_MESSAGE_MAP()
 
 static UINT indicators[] =
@@ -607,3 +609,13 @@ void CMainFrame::OnDesktopNew()
    m_szDesktopName[0] = 0;
    SetDesktopIndicator();
 }
+
+
+//
+// NXCM_SHOW_FATAL_ERROR message handler
+//
+
+void CMainFrame::OnShowFatalError(WPARAM wParam, LPARAM lParam)
+{
+       ((CFatalErrorDlg *)lParam)->DoModal();
+}
index e2430ef..d3f5917 100644 (file)
@@ -65,6 +65,7 @@ protected:
    afx_msg void OnDeploymentInfo(WPARAM wParam, LPARAM lParam);
    afx_msg void OnUpdateEventList(WPARAM wParam, LPARAM lParam);
    afx_msg void OnUpdateObjectTools(WPARAM wParam, LPARAM lParam);
+   afx_msg void OnShowFatalError(WPARAM wParam, LPARAM lParam);
        DECLARE_MESSAGE_MAP()
 };
 
index 09f290b..f39674a 100644 (file)
@@ -53,6 +53,7 @@ EXTRA_DIST = \
        DCIThresholdsPage.cpp DCIThresholdsPage.h \
        DCITransformPage.cpp DCITransformPage.h \
        DebugFrame.cpp DebugFrame.h \
+       DefineGraphDlg.cpp DefineGraphDlg.h \
        DeploymentView.cpp DeploymentView.h \
        DesktopManager.cpp DesktopManager.h \
        DetailsView.cpp DetailsView.h \
index e165fd5..0200134 100644 (file)
@@ -97,7 +97,7 @@ static void WalkerCallback(TCHAR *pszName, DWORD dwType, TCHAR *pszValue, void *
 // Walker thread
 //
 
-static void WalkerThread(void *pArg)
+static THREAD_RESULT THREAD_CALL WalkerThread(void *pArg)
 {
    DWORD dwResult;
 
@@ -107,6 +107,7 @@ static void WalkerThread(void *pArg)
    PostMessage(((WALKER_ARGS *)pArg)->hWnd, NXCM_REQUEST_COMPLETED, 0, dwResult);
    free(((WALKER_ARGS *)pArg)->pszRootOID);
    free(pArg);
+       return THREAD_OK;
 }
 
 
@@ -125,7 +126,7 @@ void CSNMPWalkDlg::OnViewRefresh()
    pArgs->pszRootOID = _tcsdup((LPCTSTR)m_strRootOID);
    EnableDlgItem(this, IDCANCEL, FALSE);
    m_wndStatus.SetWindowText(_T("Retrieving data..."));
-   _beginthread(WalkerThread, 0, pArgs);
+   ThreadCreate(WalkerThread, 0, pArgs);
    BeginWaitCursor();
 }
 
index af32d85..b965261 100644 (file)
@@ -147,10 +147,11 @@ void CSyslogBrowser::OnSetFocus(CWnd* pOldWnd)
 // Message loading thread
 //
 
-static void LoadMessages(void *pArg)
+static THREAD_RESULT THREAD_CALL LoadMessages(void *pArg)
 {
    NXCSyncSyslog(g_hSession, g_dwMaxLogRecords);
    PostMessage((HWND)pArg, WM_COMMAND, ID_REQUEST_COMPLETED, 0);
+       return THREAD_OK;
 }
 
 
@@ -167,7 +168,7 @@ void CSyslogBrowser::OnViewRefresh()
       m_wndListCtrl.ShowWindow(SW_HIDE);
       m_wndWaitView.Start();
       m_wndListCtrl.DeleteAllItems();
-      _beginthread(LoadMessages, 0, m_hWnd);
+      ThreadCreate(LoadMessages, 0, m_hWnd);
    }
 }
 
index 79dc3a9..b742e93 100644 (file)
@@ -71,9 +71,10 @@ END_MESSAGE_MAP()
 // Data requesting thread starter
 //
 
-static void RequestDataStarter(void *pArg)
+static THREAD_RESULT THREAD_CALL RequestDataStarter(void *pArg)
 {
    ((CTableView *)pArg)->RequestData();
+       return THREAD_OK;
 }
 
 
@@ -177,7 +178,7 @@ void CTableView::OnViewRefresh()
    m_wndStatusBar.SetText(_T("Requesting data..."), 0, 0);
    m_bIsBusy = TRUE;
 
-   _beginthread(RequestDataStarter, 0, this);
+   ThreadCreate(RequestDataStarter, 0, this);
 }
 
 
index f5befc8..de333c8 100644 (file)
@@ -140,10 +140,11 @@ void CTrapLogBrowser::OnSize(UINT nType, int cx, int cy)
 // Trap loading thread
 //
 
-static void LoadTraps(void *pArg)
+static THREAD_RESULT THREAD_CALL LoadTraps(void *pArg)
 {
    NXCSyncSNMPTrapLog(g_hSession, g_dwMaxLogRecords);
    PostMessage((HWND)pArg, WM_COMMAND, ID_REQUEST_COMPLETED, 0);
+       return THREAD_OK;
 }
 
 
@@ -160,7 +161,7 @@ void CTrapLogBrowser::OnViewRefresh()
       m_wndListCtrl.ShowWindow(SW_HIDE);
       m_wndWaitView.Start();
       m_wndListCtrl.DeleteAllItems();
-      _beginthread(LoadTraps, 0, m_hWnd);
+      ThreadCreate(LoadTraps, 0, m_hWnd);
    }
 }
 
index 301bcd8..f5c63ba 100644 (file)
@@ -62,7 +62,6 @@ BOOL CUserSelectDlg::OnInitDialog()
    NXC_USER *pUserList;
    DWORD i, dwNumUsers;
    int iItem;
-   CImageList *pImageList;
 
        CDialog::OnInitDialog();
 
@@ -78,12 +77,11 @@ BOOL CUserSelectDlg::OnInitDialog()
    }
 
    // Create image list
-   pImageList = new CImageList;
-   pImageList->Create(16, 16, ILC_COLOR8 | ILC_MASK, 8, 8);
-   pImageList->Add(AfxGetApp()->LoadIcon(IDI_USER));
-   pImageList->Add(AfxGetApp()->LoadIcon(IDI_USER_GROUP));
-   pImageList->Add(AfxGetApp()->LoadIcon(IDI_EVERYONE));
-   m_wndListCtrl.SetImageList(pImageList, LVSIL_SMALL);
+   m_imageList.Create(16, 16, ILC_COLOR8 | ILC_MASK, 8, 8);
+   m_imageList.Add(theApp.LoadIcon(IDI_USER));
+   m_imageList.Add(theApp.LoadIcon(IDI_USER_GROUP));
+   m_imageList.Add(theApp.LoadIcon(IDI_EVERYONE));
+   m_wndListCtrl.SetImageList(&m_imageList, LVSIL_SMALL);
 
    // Fill in list view
    if (m_bAddPublic)
index 8d9c56f..39be2b4 100644 (file)
@@ -38,6 +38,7 @@ public:
 
 // Implementation
 protected:
+       CImageList m_imageList;
 
        // Generated message map functions
        //{{AFX_MSG(CUserSelectDlg)
index a90dc0a..be58a9e 100644 (file)
@@ -357,6 +357,26 @@ static DWORD WINAPI LoginThread(void *pArg)
 }
 
 
+//
+// Starter for login thread
+//
+
+static DWORD WINAPI LoginThreadStarter(void *pArg)
+{
+       DWORD dwResult;
+
+       __try
+       {
+               dwResult = LoginThread(pArg);
+       }
+       __except(___ExceptionHandler((EXCEPTION_POINTERS *)_exception_info()))
+       {
+               ExitProcess(99);
+       }
+       return dwResult;
+}
+
+
 //
 // Perform login
 //
@@ -368,7 +388,7 @@ DWORD DoLogin(BOOL bClearCache)
    DWORD dwThreadId, dwResult;
 
    m_bClearCache = bClearCache;
-   hThread = CreateThread(NULL, 0, LoginThread, &hWnd, CREATE_SUSPENDED, &dwThreadId);
+   hThread = CreateThread(NULL, 0, LoginThreadStarter, &hWnd, CREATE_SUSPENDED, &dwThreadId);
    if (hThread != NULL)
    {
       CRequestProcessingDlg wndWaitDlg;
@@ -397,47 +417,54 @@ static DWORD WINAPI RequestThread(void *pArg)
    RqData *pData = (RqData *)pArg;
    DWORD dwResult;
 
-   switch(pData->dwNumParams)
-   {
-      case 0:
-         dwResult = pData->pFunc();
-         break;
-      case 1:
-         dwResult = pData->pFunc(pData->pArg1);
-         break;
-      case 2:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2);
-         break;
-      case 3:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3);
-         break;
-      case 4:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, pData->pArg4);
-         break;
-      case 5:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
-                                 pData->pArg4, pData->pArg5);
-         break;
-      case 6:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
-                                 pData->pArg4, pData->pArg5, pData->pArg6);
-         break;
-      case 7:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
-                                 pData->pArg4, pData->pArg5, pData->pArg6,
-                                 pData->pArg7);
-      case 8:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
-                                 pData->pArg4, pData->pArg5, pData->pArg6,
-                                 pData->pArg7, pData->pArg8);
-      case 9:
-         dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
-                                 pData->pArg4, pData->pArg5, pData->pArg6,
-                                 pData->pArg7, pData->pArg8, pData->pArg9);
-         break;
-   }
-   if (pData->hWnd != NULL)
-      PostMessage(pData->hWnd, NXCM_REQUEST_COMPLETED, 0, dwResult);
+       __try
+       {
+               switch(pData->dwNumParams)
+               {
+                       case 0:
+                               dwResult = pData->pFunc();
+                               break;
+                       case 1:
+                               dwResult = pData->pFunc(pData->pArg1);
+                               break;
+                       case 2:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2);
+                               break;
+                       case 3:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3);
+                               break;
+                       case 4:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, pData->pArg4);
+                               break;
+                       case 5:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
+                                                                                               pData->pArg4, pData->pArg5);
+                               break;
+                       case 6:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
+                                                                                               pData->pArg4, pData->pArg5, pData->pArg6);
+                               break;
+                       case 7:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
+                                                                                               pData->pArg4, pData->pArg5, pData->pArg6,
+                                                                                               pData->pArg7);
+                       case 8:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
+                                                                                               pData->pArg4, pData->pArg5, pData->pArg6,
+                                                                                               pData->pArg7, pData->pArg8);
+                       case 9:
+                               dwResult = pData->pFunc(pData->pArg1, pData->pArg2, pData->pArg3, 
+                                                                                               pData->pArg4, pData->pArg5, pData->pArg6,
+                                                                                               pData->pArg7, pData->pArg8, pData->pArg9);
+                               break;
+               }
+               if (pData->hWnd != NULL)
+                       PostMessage(pData->hWnd, NXCM_REQUEST_COMPLETED, 0, dwResult);
+       }
+       __except(___ExceptionHandler((EXCEPTION_POINTERS *)_exception_info()))
+       {
+               ExitProcess(99);
+       }
    return dwResult;
 }
 
@@ -790,6 +817,26 @@ static DWORD WINAPI DownloadThread(void *pArg)
 }
 
 
+//
+// Download thread
+//
+
+static DWORD WINAPI DownloadThreadStarter(void *pArg)
+{
+       DWORD dwResult;
+
+       __try
+       {
+               dwResult = DownloadThread(pArg);
+       }
+       __except(___ExceptionHandler((EXCEPTION_POINTERS *)_exception_info()))
+       {
+               ExitProcess(99);
+       }
+       return dwResult;
+}
+
+
 //
 // Download upgrade file
 //
@@ -804,7 +851,7 @@ BOOL DownloadUpgradeFile(HANDLE hFile)
        AfxLoadString(IDS_INTERNAL_ERROR, m_szErrorText, MAX_ERROR_TEXT);
        m_hLocalFile = hFile;
 
-   hThread = CreateThread(NULL, 0, DownloadThread, &hWnd, CREATE_SUSPENDED, &dwThreadId);
+   hThread = CreateThread(NULL, 0, DownloadThreadStarter, &hWnd, CREATE_SUSPENDED, &dwThreadId);
    if (hThread != NULL)
    {
       CRequestProcessingDlg wndWaitDlg;
index fc49207..26450b3 100644 (file)
@@ -130,6 +130,7 @@ extern CConsoleApp theApp;
 #define NXCM_SET_OBJECT            (WM_USER + 125)
 #define NXCM_ACTIVATE_OBJECT_TREE  (WM_USER + 126)
 #define NXCM_GRAPH_LIST_UPDATED    (WM_USER + 127)
+#define NXCM_SHOW_FATAL_ERROR      (WM_USER + 128)
 
 
 //
index d8d91ca..0c00bf5 100644 (file)
@@ -2,35 +2,35 @@
 
 [General Info]
 Version=1
-LastClass=CFatalErrorDlg
+LastClass=CDefineGraphDlg
 LastTemplate=CDialog
 NewFileInclude1=#include "stdafx.h"
 NewFileInclude2=#include "nxcon.h"
 LastPage=0
 
-ClassCount=152
+ClassCount=153
 Class1=CConsoleApp
 Class3=CMainFrame
 Class4=CChildFrame
 Class7=CEventBrowser
 Class9=CMapView
 
-ResourceCount=194
+ResourceCount=195
 Resource1=IDD_CP_GENERAL (English (U.S.))
-Resource2=IDD_OBJECT_NETSRV_GENERAL
+Resource2=IDA_OBJECT_BROWSER
 Resource3=IDD_DCI_DATA_EXPORT (English (U.S.))
-Resource4=IDA_SERVER_CFG_EDITOR
-Resource5=IDD_OBJECT_VPNC_GENERAL
+Resource4=IDD_OBJECT_NODE_POLL
+Resource5=IDA_SERVER_CFG_EDITOR
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDD_GRAPH_PROP_SETTINGS
+Resource6=IDA_EVENT_EDITOR
 Class11=CProgressDialog
-Resource7=IDD_SELECT_OBJECT
+Resource7=IDD_OBJECT_COND_GENERAL
 Class12=CAddrEntryDlg
-Resource8=IDD_CREATE_NETSRV
+Resource8=IDA_MDI_DEFAULT
 Class13=CObjectPropDlg
 Resource9=IDD_THRESHOLD (English (U.S.))
 Resource10=IDD_SELECT_OBJECT (English (U.S.))
@@ -46,45 +46,45 @@ Resource17=IDD_NEW_USER (English (U.S.))
 Class16=CDebugFrame
 Resource18=IDD_NEW_ACTION (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
-Resource20=IDD_ACTION_PROPERTIES
+Resource20=IDD_DISCOVERY_TARGETS
 Class17=CObjectPreview
 Resource21=IDA_OBJECT_BROWSER (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_DISCOVERY_TARGETS
+Resource22=IDD_MIB_BROWSER
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
 Resource23=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_OBJECT_CLUSTER_GENERAL
+Resource24=IDD_NEW_ACTION
 Class26=CRequestProcessingDlg
 Resource25=IDD_SELECT_USER (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDD_DISCOVERY_GENERAL
+Resource27=IDD_THRESHOLD
 Resource28=IDD_DCI_COLLECTION (English (U.S.))
 Class27=CObjectPropsGeneral
 Resource29=IDR_MAINFRAME (English (U.S.))
 Class28=CObjectPropsSecurity
 Resource30=IDD_SAVE_AGENT_CFG (English (U.S.))
-Resource31=IDA_TRAP_EDITOR
-Resource32=IDD_GROUP_PROPERTIES
+Resource31=IDD_SELECT_AGENT_PARAM
+Resource32=IDD_REMOVE_TEMPLATE
 Class29=CUserSelectDlg
-Resource33=IDD_EDIT_EVENT
+Resource33=IDD_OBJECT_VPNC_GENERAL
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDD_LASTVAL_PROP
-Resource36=IDD_AGENT_CONFIG
+Resource35=IDA_TRAP_EDITOR
+Resource36=IDD_DCI_COLLECTION
 Class32=CUserPropDlg
 Resource37=IDD_EDIT_VARIABLE (English (U.S.))
-Resource38=IDD_DESKTOP_SAVE_AS
+Resource38=IDA_NETMAP
 Class33=CGroupPropDlg
-Resource39=IDD_CLUSTER_RESOURCE
-Resource40=IDA_OBJECT_COMMENTS
-Resource41=IDA_DATA_VIEW
+Resource39=IDD_SELECT_ACTION
+Resource40=IDD_EDIT_VARIABLE
+Resource41=IDD_LASTVAL_PROP
 Resource42=IDA_ACTION_EDITOR (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
@@ -100,55 +100,55 @@ Class41=CGraphFrame
 Class42=CDCIThresholdsPage
 Resource46=IDA_OBJECT_TOOLS_EDITOR (English (U.S.))
 Resource47=IDM_CONTEXT (English (U.S.))
-Resource48=IDD_OBJTOOL_GENERAL
+Resource48=IDA_DATA_VIEW
 Class43=CThresholdDlg
 Resource49=IDD_DESKTOP_SAVE_AS (English (U.S.))
-Resource50=IDD_SET_PASSWORD
+Resource50=IDD_OBJTOOL_COLUMNS
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource52=IDD_DCI_DATA_EXPORT
+Resource52=IDA_GRAPH
 Class48=CObjectSelDlg
-Resource53=IDD_NEW_OBJECT_TOOL
-Resource54=IDD_SELECT_ACTION
+Resource53=IDA_AGENT_CONFIG_MANAGER
+Resource54=IDD_DISCOVERY_RANGES
 Class49=CRuleCommentDlg
-Resource55=IDA_NETMAP
+Resource55=IDD_EDIT_TRAP
 Class50=CEventSelDlg
-Resource56=IDD_CREATE_TG
+Resource56=IDD_SELECT_TRAP
 Resource57=IDA_EPP (English (U.S.))
-Resource58=IDA_OBJECT_BROWSER
+Resource58=IDD_CREATE_TG
 Resource59=IDA_PACKAGE_MGR (English (U.S.))
 Resource60=IDD_OBJTOOL_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_CREATE_TEMPLATE (English (U.S.))
-Resource62=IDA_OBJECT_TOOLS_EDITOR
+Resource62=IDD_GRAPH_PROP_SETTINGS
 Class52=CRuleSeverityDlg
-Resource63=IDD_CREATE_CLUSTER
+Resource63=IDD_CP_GENERAL
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDA_MDI_DEFAULT (English (U.S.))
-Resource65=IDD_OBJECT_CAPS
+Resource65=IDD_SAVE_AGENT_CFG
 Resource66=IDD_EDIT_IP_SUBNET (English (U.S.))
 Resource67=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Resource68=IDD_ACTION_PROPERTIES (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
-Resource69=IDD_ABOUTBOX
-Resource70=IDD_SELECT_AGENT_PARAM
+Resource69=IDD_CREATE_VPNC
+Resource70=IDD_FATAL_ERROR
 Class57=CNewActionDlg
-Resource71=IDD_OBJECT_COND_DATA
+Resource71=IDD_USER_PROPERTIES
 Class58=CEditActionDlg
-Resource72=IDD_DCI_TRANSFORM
+Resource72=IDD_SELECT_MP
 Class59=CActionSelDlg
-Resource73=IDD_EDIT_RULE_SCRIPT
+Resource73=IDD_DCI_THRESHOLDS
 Resource74=IDD_EDIT_TRAP (English (U.S.))
 Resource75=IDD_USER_PROPERTIES (English (U.S.))
-Resource76=IDD_REQUEST_PROCESSING
+Resource76=IDD_DCI_SCHEDULE
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDD_REMOVE_TEMPLATE
+Resource77=IDD_EDIT_EVENT
 Class62=CCreateNodeDlg
 Resource78=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Resource79=IDT_MAP (English (U.S.))
@@ -158,31 +158,31 @@ Resource81=IDD_LASTVAL_PROP (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
-Resource83=IDD_UPGRADE
-Resource84=IDD_OBJECT_RELATIONS
+Resource83=IDD_EDIT_RULE_ALARM
+Resource84=IDA_ALARM_BROWSER
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_MIB_BROWSER
-Resource86=IDA_ALARM_BROWSER
+Resource85=IDD_CREATE_CONDITION
+Resource86=IDD_DATA_QUERY
 Class68=CTrapEditor
-Resource87=IDD_OBJECT_SECURITY
-Resource88=IDD_EDIT_TRAP_ARG
-Resource89=IDD_CREATE_CONTAINER
+Resource87=IDD_OBJTOOL_GENERAL
+Resource88=IDD_OBJECT_CLUSTER_RESOURCES
+Resource89=IDD_ADDR_ENTRY
 Class69=CDataQueryDlg
-Resource90=IDD_CREATE_NODE
+Resource90=IDD_CREATE_MP
 Class70=CTrapEditDlg
 Resource91=IDM_VIEW_SPECIFIC (English (U.S.))
 Class71=CTrapParamDlg
-Resource92=IDD_NEW_USER
-Resource93=IDD_SELECT_EVENT
+Resource92=IDD_OBJTOOL_OPTIONS
+Resource93=IDD_OBJECT_COND_DATA
 Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
-Resource94=IDA_LAST_VALUES
+Resource94=IDD_OBJECT_NETSRV_GENERAL
 Resource95=IDA_SCRIPT_MANAGER (English (U.S.))
 Resource96=IDD_SET_PASSWORD (English (U.S.))
 Resource97=IDD_DCI_TRANSFORM (English (U.S.))
-Resource98=IDD_GRAPH_PROP_DATA
+Resource98=IDA_ACTION_EDITOR
 Resource99=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
 Resource100=IDD_OBJTOOL_OPTIONS (English (U.S.))
 Resource101=IDA_LAST_VALUES (English (U.S.))
@@ -244,7 +244,7 @@ Class102=CWaitView
 Class103=CWebBrowser
 Class104=CSyslogBrowser
 Class105=CLPPList
-Resource129=IDD_SELECT_USER
+Resource129=IDD_NEW_OBJECT_TOOL
 Class106=CDCISchedulePage
 Resource130=IDD_OBJECT_CAPS (English (U.S.))
 Class107=CObjectPropsStatus
@@ -270,93 +270,95 @@ Class119=CMapControlBox
 Resource138=IDD_OBJECT_GENERAL (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_SUBMAP_BKGND (English (U.S.))
-Resource140=IDD_CREATE_MP
-Resource141=IDA_EVENT_EDITOR
-Resource142=IDD_DCI_SCHEDULE
-Resource143=IDD_OBJECT_GENERAL
-Resource144=IDD_USER_PROPERTIES
-Resource145=IDD_ADD_DCI
-Resource146=IDD_EDIT_RULE_ALARM
-Resource147=IDD_COND_DCI_PROP
-Resource148=IDD_EDIT_RULE_COMMENT
-Resource149=IDR_MAINFRAME
+Resource140=IDD_SELECT_EVENT
+Resource141=IDD_EDIT_TRAP_ARG
+Resource142=IDA_OBJECT_TOOLS_EDITOR
+Resource143=IDD_OBJECT_STATUS
+Resource144=IDD_CHANGE_IP
+Resource145=IDD_GROUP_PROPERTIES
+Resource146=IDD_AGENT_CONFIG
+Resource147=IDD_SET_PASSWORD
+Resource148=IDD_OBJECT_COND_SCRIPT
+Resource149=IDD_CREATE_NODE
 Resource150=IDM_CONTEXT
-Resource151=IDD_SELECT_MP
-Resource152=IDD_OBJECT_NODE_POLL
-Resource153=IDD_OBJTOOL_OPTIONS
-Resource154=IDD_CP_GENERAL
-Resource155=IDD_DCI_COLLECTION
-Resource156=IDD_OBJECT_COND_GENERAL
-Resource157=IDA_AGENT_CONFIG_MANAGER
-Resource158=IDA_PACKAGE_MGR
-Resource159=IDD_CHANGE_IP
-Resource160=IDD_SAVE_AGENT_CFG
-Resource161=IDA_MDI_DEFAULT
-Resource162=IDD_OBJECT_NODE_GENERAL
-Resource163=IDD_CREATE_TEMPLATE
-Resource164=IDD_SELECT_TRAP
-Resource165=IDA_DC_EDITOR
-Resource166=IDD_SELECT_INTERNAL_ITEM
-Resource167=IDD_DATA_QUERY
-Resource168=IDA_ACTION_EDITOR
-Resource169=IDD_CHANGE_PASSWORD
-Resource170=IDD_THRESHOLD
-Resource171=IDD_OBJECT_STATUS
+Resource151=IDD_OBJECT_PRESENTATION
+Resource152=IDA_EPP
+Resource153=IDA_OBJECT_COMMENTS
+Resource154=IDD_EDIT_RULE_SCRIPT
+Resource155=IDD_SNMP_WALK
+Resource156=IDD_SELECT_USER
+Resource157=IDD_DCI_DATA_EXPORT
+Resource158=IDD_CREATE_NETSRV
+Resource159=IDD_ABOUTBOX
+Resource160=IDA_DC_EDITOR
+Resource161=IDD_DCI_TRANSFORM
+Resource162=IDD_EDIT_IP_SUBNET
+Resource163=IDD_UPGRADE
+Resource164=IDD_EDIT_RULE_SEVERITY
+Resource165=IDD_DESKTOP_SAVE_AS
+Resource166=IDD_CLUSTER_RESOURCE
+Resource167=IDD_CREATE_CLUSTER
+Resource168=IDD_SELECT_INTERNAL_ITEM
+Resource169=IDD_OBJECT_GENERAL
+Resource170=IDD_CHANGE_PASSWORD
+Resource171=IDA_SCRIPT_MANAGER
 Class121=CModuleManager
 Class122=CDesktopManager
-Resource172=IDA_AGENT_CFG_EDITOR
-Resource173=IDA_EPP
+Resource172=IDD_OBJECT_RELATIONS
+Resource173=IDD_CREATE_TEMPLATE
 Class123=CCreateCondDlg
 Class124=CCondPropsGeneral
 Class125=CCondPropsScript
 Class126=CCondPropsData
-Resource174=IDD_SUBMAP_BKGND
+Resource174=IDD_REQUEST_PROCESSING
 Class127=CAddDCIDlg
-Resource175=IDD_SNMP_WALK
+Resource175=IDD_OBJECT_CAPS
 Class128=CCondDCIPropDlg
-Resource176=IDD_DISCOVERY_RANGES
+Resource176=IDD_SELECT_OBJECT
 Class129=CAgentConfigMgr
-Resource177=IDD_ADDR_ENTRY
-Resource178=IDD_EDIT_RULE_SEVERITY
+Resource177=IDD_EDIT_RULE_COMMENT
+Resource178=IDD_COND_DCI_PROP
 Class130=CAgentCfgDlg
 Class131=CObjectCommentsEditor
-Resource179=IDD_EDIT_VARIABLE
+Resource179=IDA_PACKAGE_MGR
 Class132=CRuleScriptDlg
 Class133=CDetailsView
-Resource180=IDD_INPUT_BOX
+Resource180=IDR_MAINFRAME
 Class134=CDiscoveryPropGeneral
-Resource181=IDD_EDIT_IP_SUBNET
+Resource181=IDA_AGENT_CFG_EDITOR
 Class135=CDiscoveryPropTargets
-Resource182=IDD_OBJECT_CLUSTER_RESOURCES
+Resource182=IDD_ACTION_PROPERTIES
 Class136=CDiscoveryPropAddrList
-Resource183=IDD_NEW_ACTION
+Resource183=IDD_DISCOVERY_GENERAL
 Class138=CObjectView
 Class139=CObjectOverview
 Class140=CAlarmView
 Class141=CObjectDepView
-Resource184=IDD_EDIT_TRAP
+Resource184=IDD_OBJECT_CLUSTER_GENERAL
 Class137=CObjectBrowser
 Class142=CCreateMPDlg
-Resource185=IDD_OBJECT_COND_SCRIPT
+Resource185=IDD_NEW_USER
 Class143=CSelectMPDlg
 Resource186=IDM_VIEW_SPECIFIC
 Class144=CTrapSelDlg
-Resource187=IDA_GRAPH
+Resource187=IDD_INPUT_BOX
 Class145=CConsoleUpgradeDlg
-Resource188=IDD_CREATE_VPNC
+Resource188=IDA_LAST_VALUES
 Class146=CCreateClusterDlg
-Resource189=IDD_CREATE_CONDITION
+Resource189=IDD_OBJECT_SECURITY
 Class147=CClusterPropsGeneral
-Resource190=IDD_OBJTOOL_COLUMNS
+Resource190=IDD_OBJECT_NODE_GENERAL
 Class148=CClusterPropsResources
-Resource191=IDD_OBJECT_PRESENTATION
+Resource191=IDD_ADD_DCI
 Class149=CClusterResDlg
-Resource192=IDA_SCRIPT_MANAGER
+Resource192=IDD_GRAPH_PROP_DATA
 Class150=CClusterView
 Class151=CExtEditCtrl
-Resource193=IDD_DCI_THRESHOLDS
+Resource193=IDD_SUBMAP_BKGND
 Class152=CFatalErrorDlg
-Resource194=IDD_FATAL_ERROR
+Resource194=IDD_CREATE_CONTAINER
+Class153=CDefineGraphDlg
+Resource195=IDD_DEFINE_GRAPH
 
 [CLS:CConsoleApp]
 Type=0
@@ -5296,3 +5298,27 @@ Filter=D
 VirtualFilter=dWC
 LastObject=CFatalErrorDlg
 
+[DLG:IDD_DEFINE_GRAPH]
+Type=1
+Class=CDefineGraphDlg
+ControlCount=10
+Control1=IDC_EDIT_NAME,edit,1350631552
+Control2=IDC_LIST_USERS,SysListView32,1342275609
+Control3=IDC_BUTTON_ADD,button,1342242816
+Control4=IDC_BUTTON_DELETE,button,1342242816
+Control5=IDC_CHECK_READ,button,1342242819
+Control6=IDC_CHECK_MODIFY,button,1342242819
+Control7=IDOK,button,1342242817
+Control8=IDCANCEL,button,1342242816
+Control9=IDC_STATIC,static,1342308352
+Control10=IDC_STATIC,button,1342177287
+
+[CLS:CDefineGraphDlg]
+Type=0
+HeaderFile=DefineGraphDlg.h
+ImplementationFile=DefineGraphDlg.cpp
+BaseClass=CDialog
+Filter=D
+VirtualFilter=dWC
+LastObject=CDefineGraphDlg
+
index 96f6ad8..383d040 100644 (file)
@@ -131,6 +131,7 @@ BEGIN_MESSAGE_MAP(CConsoleApp, CWinApp)
        ON_COMMAND(ID_TOOLS_IMPORTMP, OnToolsImportmp)
        //}}AFX_MSG_MAP
        ON_THREAD_MESSAGE(NXCM_GRAPH_LIST_UPDATED, OnGraphListUpdate)
+       ON_COMMAND_RANGE(GRAPH_MENU_FIRST_ID, GRAPH_MENU_LAST_ID, OnPredefinedGraph)
 END_MESSAGE_MAP()
 
 
@@ -149,6 +150,7 @@ CConsoleApp::CConsoleApp()
    m_mutexAlarmList = MutexCreate();
    m_hDevMode = NULL;
    m_hDevNames = NULL;
+       m_dwMainThreadId = GetCurrentThreadId();
 }
 
 
@@ -3561,6 +3563,26 @@ BOOL CConsoleApp::StartConsoleUpgrade()
 }
 
 
+//
+// Open predefined graph
+//
+
+void CConsoleApp::OnPredefinedGraph(UINT nCmd)
+{
+   CGraphFrame *pWnd;
+       UINT nIndex;
+
+       nIndex = nCmd - GRAPH_MENU_FIRST_ID;
+       if (nIndex < g_dwNumGraphs)
+       {
+               pWnd = new CGraphFrame;
+               pWnd->RestoreFromServer(g_pGraphList[nIndex].pszConfig);
+               CreateChildFrameWithSubtitle(pWnd, IDR_DCI_HISTORY_GRAPH,
+                                                                                         pWnd->GetSubTitle(), m_hGraphMenu, m_hGraphAccel);
+       }
+}
+
+
 //
 // Update Tools->Graph submenu
 //
@@ -3784,13 +3806,23 @@ static void ExceptionHandler(EXCEPTION_POINTERS *pInfo)
       CloseHandle(hFile);
    }
 
+       // Prepare error dialog
        dwSize = 0;
        pData = LoadFile(szInfoFile, &dwSize);
        pData = (BYTE *)realloc(pData, dwSize + 1);
        pData[dwSize] = 0;
        dlg.m_strText = WideStringFromMBString(CHECK_NULL_A((char *)pData));
        dlg.m_strFile = szDumpFile;
-       dlg.DoModal();
+
+       // Dialog should be executed from GUI thread
+       if (GetCurrentThreadId() == theApp.m_dwMainThreadId)
+       {
+               dlg.DoModal();
+       }
+       else
+       {
+               theApp.m_pMainWnd->SendMessage(NXCM_SHOW_FATAL_ERROR, 0, (LPARAM)&dlg);
+       }
 }
 
 
index 410e50f..1b2fafe 100644 (file)
@@ -344,6 +344,10 @@ SOURCE=.\DebugFrame.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\DefineGraphDlg.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\DeploymentView.cpp
 # End Source File
 # Begin Source File
@@ -921,6 +925,10 @@ SOURCE=.\DebugFrame.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\DefineGraphDlg.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\DeploymentView.h
 # End Source File
 # Begin Source File
index 42f6120..d84077d 100644 (file)
@@ -265,12 +265,14 @@ public:
        afx_msg void OnToolsImportmp();
        //}}AFX_MSG
        afx_msg void OnGraphListUpdate(WPARAM wParam, LPARAM lParam);
+       afx_msg void OnPredefinedGraph(UINT nCmd);
        DECLARE_MESSAGE_MAP()
 private:
    CONSOLE_VIEW m_viewState[MAX_VIEW_ID];
    OBJECT_VIEW m_openObjectViews[MAX_OBJECT_VIEWS];
 
 public:
+       DWORD m_dwMainThreadId;
        void CreateCluster(DWORD dwParent);
        HGLOBAL GetProfileGMem(TCHAR *pszSection, TCHAR *pszKey);
        void WriteProfileGMem(TCHAR *pszSection, TCHAR *pszKey, HGLOBAL hMem);
index 62f3c76..c5d5aea 100644 (file)
@@ -2975,6 +2975,28 @@ BEGIN
                     IDC_STATIC,7,185,148,8
 END
 
+IDD_DEFINE_GRAPH DIALOGEX 0, 0, 279, 196
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Define Graph"
+FONT 8, "MS Sans Serif"
+BEGIN
+    EDITTEXT        IDC_EDIT_NAME,7,17,265,14,ES_AUTOHSCROLL
+    CONTROL         "List1",IDC_LIST_USERS,"SysListView32",LVS_REPORT | 
+                    LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | 
+                    WS_TABSTOP,13,50,196,110,WS_EX_CLIENTEDGE
+    PUSHBUTTON      "&Add...",IDC_BUTTON_ADD,215,50,50,14
+    PUSHBUTTON      "&Delete",IDC_BUTTON_DELETE,215,69,50,14
+    CONTROL         "&Read",IDC_CHECK_READ,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,215,98,33,10
+    CONTROL         "&Modify",IDC_CHECK_MODIFY,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,215,110,37,10
+    DEFPUSHBUTTON   "OK",IDOK,167,175,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,222,175,50,14
+    LTEXT           "Graph name (you can use -> to separate menu levels)",
+                    IDC_STATIC,7,7,169,8
+    GROUPBOX        "Access List",IDC_STATIC,7,38,265,130
+END
+
 
 #ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
@@ -3690,6 +3712,14 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 235
     END
+
+    IDD_DEFINE_GRAPH, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 272
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 189
+    END
 END
 #endif    // APSTUDIO_INVOKED
 
index 4ca2bb4..cbbbf26 100644 (file)
 #define IDB_CLOSE                       356
 #define IDI_AGAIN                       357
 #define IDD_FATAL_ERROR                 358
+#define IDD_DEFINE_GRAPH                359
 #define ID_EDIT_BOX                     525
 #define IDC_STATIC_TITLE                1003
 #define IDC_STATIC_TEXT                 1004
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        359
+#define _APS_NEXT_RESOURCE_VALUE        360
 #define _APS_NEXT_COMMAND_VALUE         33053
-#define _APS_NEXT_CONTROL_VALUE         1444
+#define _APS_NEXT_CONTROL_VALUE         1450
 #define _APS_NEXT_SYMED_VALUE           134
 #endif
 #endif
index a489cce..b27a237 100644 (file)
@@ -395,7 +395,7 @@ void UpdateActions(DWORD dwCode, NXC_ACTION *pAction)
 // Update graph list
 //
 
-static void GraphUpdater(void *)
+static THREAD_RESULT THREAD_CALL GraphUpdater(void *)
 {
        LockGraphs();
        if (g_pGraphList != NULL)
@@ -403,11 +403,12 @@ static void GraphUpdater(void *)
        NXCGetGraphList(g_hSession, &g_dwNumGraphs, &g_pGraphList);
        UnlockGraphs();
        theApp.PostThreadMessage(NXCM_GRAPH_LIST_UPDATED, 0, 0);
+       return THREAD_OK;
 }
 
 void UpdateGraphList(void)
 {
-       _beginthread(GraphUpdater, 0, NULL);
+       ThreadCreate(GraphUpdater, 0, NULL);
 }
 
 
index 0dc64f2..a15599e 100644 (file)
@@ -186,7 +186,9 @@ void LIBNETXMS_EXPORTABLE SEHShowCallStack(CONTEXT *pCtx)
 
 int LIBNETXMS_EXPORTABLE ___ExceptionHandler(EXCEPTION_POINTERS *pInfo)
 {
-       if (m_pfExceptionHandler != NULL)
+       if ((m_pfExceptionHandler != NULL) &&
+                (pInfo->ExceptionRecord->ExceptionCode != EXCEPTION_BREAKPOINT) &&
+                (pInfo->ExceptionRecord->ExceptionCode != EXCEPTION_SINGLE_STEP))
        {
                // Only one exception handler can be executed at a time
                // We will never release mutex because __except block