Ignore:
Timestamp:
Oct 7, 2012, 3:33:42 PM (11 years ago)
Author:
roman
Message:

Added property pages for filters and email notification

Location:
trunk/Utilities/LogProcessExceptions
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/LogProcessExceptions

    • Property svn:ignore
      •  

        old new  
        44*.suo
        55*.user
         6*.opensdf
  • trunk/Utilities/LogProcessExceptions/LogProcessExceptions.rc

    r64 r130  
    4747#endif    // APSTUDIO_INVOKED
    4848
     49
     50/////////////////////////////////////////////////////////////////////////////
     51//
     52// TYPELIB
     53//
     54
     55IDR_EMAILTOOLS          TYPELIB                 "..\\..\\..\\Repository-Private\\Utilities\\EmailTools\\_Bin\\Win32\\Release\\EmailTools\\EmailTools.tlb"
    4956
    5057/////////////////////////////////////////////////////////////////////////////
     
    125132FONT 8, "MS Shell Dlg", 400, 0, 0x1
    126133BEGIN
    127     LTEXT           "Please choose minidump type using controls below. To proceed and start/continue debug session, click Next.",IDC_STATIC,6,6,306,18
     134    LTEXT           "Please choose minidump type using controls below. To proceed to exception filter rules, click Next.",IDC_STATIC,6,6,306,18
    128135    CONTROL         "Data Segments ",IDC_MAIN_MINIDUMPTYPE_DATASEGMENTS,
    129136                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,30,67,10
     
    167174FONT 8, "MS Shell Dlg", 400, 0, 0x1
    168175BEGIN
    169     LTEXT           "Debug session is in progress. To stop debugging, click Next. To review options without stopping debugging, click Back.",IDC_STATIC,6,6,306,18
    170     EDITTEXT        IDC_MAIN_OPERATION_LOG,6,30,306,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
     176    LTEXT           "Debug session is in progress. To stop debugging, click Next. To review options without stopping debugging, click Back.",IDC_STATIC,6,0,306,18
     177    EDITTEXT        IDC_MAIN_OPERATION_LOG,6,24,306,102,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
    171178    LTEXT           "<A>Write Minidump File Now</A>",IDC_MAIN_OPERATION_WRITEMINIDUMPNOW,6,132,112,8
    172179    LTEXT           "<A>Open Minidump File Directory</A>",IDC_MAIN_OPERATION_OPENMINIDUMPFILEDIRECTORY,108,132,127,8,WS_TABSTOP
    173180END
    174181
     182IDD_MAIN_FILTER DIALOGEX 0, 0, 317, 144
     183STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
     184FONT 8, "MS Shell Dlg", 400, 0, 0x1
     185BEGIN
     186    LTEXT           "Use controls below to provide rules that define whether an exception to occur should be skipped, or a minidump file needs to be created. To proceed to configuring email notifications, click Next.",IDC_STATIC,6,0,306,24
     187    EDITTEXT        IDC_MAIN_FILTER_TEXT,6,30,306,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
     188    LTEXT           "<A>Reset to Default</A>",IDC_MAIN_FILTER_RESET,6,132,90,8
     189    LTEXT           "<A HREF=""http://alax.info/blog/1409"">Help on Filters</A>",IDC_MAIN_FILTER_HELP,114,132,186,8
     190END
     191
     192IDD_MAIN_EMAIL DIALOGEX 0, 0, 317, 144
     193STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
     194FONT 8, "MS Shell Dlg", 400, 0, 0x1
     195BEGIN
     196    LTEXT           "Use controls below to enable email notification on exception occurred. To proceed and start/continue debug session, click Next.",IDC_STATIC,6,0,306,18
     197    CONTROL         "&Send an email on occurred and logged exception",IDC_MAIN_EMAIL_ENABLED,
     198                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,24,300,10
     199    LTEXT           "&From: ",IDC_STATIC,12,44,22,8
     200    EDITTEXT        IDC_MAIN_EMAIL_FROM,36,42,90,14,ES_AUTOHSCROLL
     201    LTEXT           "&To: ",IDC_STATIC,138,44,14,8
     202    EDITTEXT        IDC_MAIN_EMAIL_TO,156,42,150,14,ES_AUTOHSCROLL
     203    LTEXT           "&Method: ",IDC_STATIC,12,62,30,8
     204    COMBOBOX        IDC_MAIN_EMAIL_METHOD,48,60,258,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     205    LTEXT           "SMTP S&erver Host and Port: ",IDC_STATIC,24,80,92,8
     206    EDITTEXT        IDC_MAIN_EMAIL_HOST,126,78,120,14,ES_AUTOHSCROLL
     207    LTEXT           "&Username: ",IDC_STATIC,24,98,38,8
     208    EDITTEXT        IDC_MAIN_EMAIL_USERNAME,66,96,90,14,ES_AUTOHSCROLL
     209    LTEXT           "P&assword: ",IDC_STATIC,168,98,36,8
     210    EDITTEXT        IDC_MAIN_EMAIL_PASSWORD,204,96,90,14,ES_PASSWORD | ES_AUTOHSCROLL
     211    CONTROL         "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,114,300,20
     212    LTEXT           "Ma&ximal Dump File Size to Attach, MB: ",IDC_STATIC,12,122,124,8
     213    EDITTEXT        IDC_MAIN_EMAIL_MAXIMALATTACHMENTSIZE,144,120,60,14,ES_AUTOHSCROLL
     214END
     215
    175216
    176217/////////////////////////////////////////////////////////////////////////////
     
    205246    BEGIN
    206247    END
     248
     249    IDD_MAIN_FILTER, DIALOG
     250    BEGIN
     251    END
     252
     253    IDD_MAIN_EMAIL, DIALOG
     254    BEGIN
     255    END
    207256END
    208257#endif    // APSTUDIO_INVOKED
     
    215264
    216265VS_VERSION_INFO VERSIONINFO
    217  FILEVERSION  1, 0, 0, 226
     266 FILEVERSION  1, 0, 0, 269
    218267 PRODUCTVERSION 1,0,0,1
    219268 FILEFLAGSMASK 0x3fL
     
    234283            VALUE "Created By", "Roman Ryltsov <roman@alax.info>"
    235284            VALUE "FileDescription", "Log Process Exceptions Utility"
    236             VALUE "FileVersion",  "1, 0, 0, 226\0"
     285            VALUE "FileVersion",  "1, 0, 0, 269\0"
    237286            VALUE "InternalName", "LogProcessExceptions"
    238287            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2012"
     
    361410STRINGTABLE
    362411BEGIN
     412    IDD_MAIN_FILTER         "Exception Filter\nDefine rules to filter out exceptions of interest"
     413END
     414
     415STRINGTABLE
     416BEGIN
     417    IDD_MAIN_EMAIL          "Email Notification\nConfigure email notifications for detected exceptions"
     418END
     419
     420STRINGTABLE
     421BEGIN
     422    IDC_MAIN_EMAIL_METHOD   "Google Mail (SMTP, TLS Connection)\nSMTP, TLS Connection, Plain Text Authentication (TLS, PLAIN)\nSMTP, SSL Connection, Plain Text Authentication (SSL, PLAIN)\nSMTP, Digest Authentication (CRAM-MD5)\nSMTP, Plain Text Authentication (PLAIN)\nSMTP, No Authentication\n"
     423END
     424
     425STRINGTABLE
     426BEGIN
    363427    IDD_MAIN_OPERATION      "Debug Operation\nReview debug session status and notifications"
     428        IDC_MAIN_EMAIL_MAXIMALATTACHMENTSIZE "1, 0xB, , 2, Maximal Attachment Size, ""Maximal minidump file attachment size is a size threshold in megabytes, under which the file is to be attached to the email, and should be a non-negative integer value""\n"
    364429END
    365430
  • trunk/Utilities/LogProcessExceptions/LogProcessExceptions.vcxproj

    r61 r130  
    308308  </ItemGroup>
    309309  <ItemGroup>
     310    <None Include="..\..\..\Repository-Private\Utilities\EmailTools\_Bin\Win32\Release\EmailTools\EmailTools.tlb" />
    310311    <None Include="LogProcessExceptions.ico" />
    311312    <None Include="Module.ico" />
  • trunk/Utilities/LogProcessExceptions/LogProcessExceptions.vcxproj.filters

    r61 r130  
    4747      <Filter>Resource Files</Filter>
    4848    </None>
     49    <None Include="..\..\..\Repository-Private\Utilities\EmailTools\_Bin\Win32\Release\EmailTools\EmailTools.tlb" />
    4950  </ItemGroup>
    5051  <ItemGroup>
  • trunk/Utilities/LogProcessExceptions/MainWizard.h

    r64 r130  
    774774                INT OnSetActive() throw()
    775775                {
     776                        #if defined(_DEBUG) && FALSE
     777                                return -1;
     778                        #endif // defined(_DEBUG)
    776779                        _ATLTRY
    777780                        {
     
    808811                                }
    809812                                if(!m_Wizard.m_ProcessPropertyPage.IsSelectedProcessActive())
    810                                 {
    811                                         UpdateButtons();
    812                                         __C(E_UNNAMED);
    813                                 }
     813                                        return CProcessPropertyPage::IDD;
     814                        }
     815                        _ATLCATCHALL()
     816                        {
     817                                MessageBeep(MB_ICONERROR);
     818                                return -1;
     819                        }
     820                        return 0;
     821                }
     822        };
     823
     824        ////////////////////////////////////////////////////////
     825        // CFilterPropertyPage
     826
     827        class CFilterPropertyPage :
     828                public CWizardPropertyPageT<CFilterPropertyPage>
     829        {
     830        public:
     831                enum { IDD = IDD_MAIN_FILTER };
     832
     833        BEGIN_MSG_MAP_EX(CFilterPropertyPage)
     834                CHAIN_MSG_MAP(CWizardPropertyPageT<CFilterPropertyPage>)
     835                MSG_WM_INITDIALOG(OnInitDialog)
     836                NOTIFY_HANDLER_EX(IDC_MAIN_FILTER_RESET, CRoHyperStatic::NC_ANCHORCLICKED, OnResetStaticAnchorClicked)
     837                //NOTIFY_HANDLER_EX(IDC_MAIN_FILTER_HELP, CRoHyperStatic::NC_ANCHORCLICKED, OnHelpStaticAnchorClicked)
     838                REFLECT_NOTIFICATIONS()
     839        END_MSG_MAP()
     840
     841        public:
     842
     843                ////////////////////////////////////////////////////
     844                // CFilter
     845
     846                class CFilter
     847                {
     848                public:
     849
     850                        ////////////////////////////////////////////////
     851                        // CValueRange
     852
     853                        class CValueRange
     854                        {
     855                        public:
     856                                LONG m_nMinimalValue;
     857                                LONG m_nMaximalValue;
     858                       
     859                        public:
     860                        // CValueRange
     861                                VOID Initialize(CString sValue)
     862                                {
     863                                        CRoArrayT<CString> Array;
     864                                        _StringHelper::Split(sValue, _T('-'), Array);
     865                                        __D(!Array.IsEmpty(), E_INVALIDARG);
     866                                        INT nMinimalValue, nMaximalValue;
     867                                        __D(StrToIntEx(Array[0], STIF_SUPPORT_HEX, &nMinimalValue), E_INVALIDARG);
     868                                        if(Array.GetCount() >= 2)
     869                                        {
     870                                                __D(StrToIntEx(Array[1], STIF_SUPPORT_HEX, &nMaximalValue), E_INVALIDARG);
     871                                                if(nMaximalValue < nMinimalValue)
     872                                                        SwapMemory(&nMinimalValue, &nMaximalValue);
     873                                        } else
     874                                                nMaximalValue = nMinimalValue;
     875                                        m_nMinimalValue = nMinimalValue;
     876                                        m_nMaximalValue = nMaximalValue;
     877                                }
     878                                BOOL Compare(LONG nValue) const throw()
     879                                {
     880                                        return nValue >= m_nMinimalValue && nValue <= m_nMinimalValue;
     881                                }
     882                        };
     883
     884                public:
     885                        INT m_nAction;
     886                        BOOL m_bExceptionCodeAvailable;
     887                        CValueRange m_ExceptionCode;
     888                        BOOL m_bNativeExceptionCodeAvailable;
     889                        CValueRange m_NativeExceptionCode;
     890
     891                public:
     892                // CFilter
     893                        CFilter() throw() :
     894                                m_nAction(0),
     895                                m_bExceptionCodeAvailable(FALSE),
     896                                m_bNativeExceptionCodeAvailable(FALSE)
     897                        {
     898                        }
     899                        static VOID PreprocessExceptionCode(CString& sValue)
     900                        {
     901                                if(sValue.CompareNoCase(_T("*")) == 0)
     902                                        sValue = _T("0x80000000-0x7FFFFFFF");
     903                                else if(sValue.CompareNoCase(_T("C++")) == 0)
     904                                        sValue = _T("0xE06D7363");
     905                        }
     906                        static VOID PreprocessNativeExceptionCode(CString& sValue)
     907                        {
     908                                if(sValue.CompareNoCase(_T("*")) == 0)
     909                                        sValue = _T("0x80000000-0x7FFFFFFF");
     910                        }
     911                        VOID Initialize(CString sValue)
     912                        {
     913                                for(; sValue.Replace(_T("  "), _T(" ")); )
     914                                        ;
     915                                CRoArrayT<CString> Array;
     916                                _StringHelper::Split(sValue, _T(' '), Array);
     917                                __D(!Array.IsEmpty(), E_UNNAMED);
     918                                #pragma region Action
     919                                __D(!Array[0].IsEmpty(), E_UNNAMED);
     920                                static LPCTSTR g_ppszActions = _T("-+");
     921                                LPCTSTR pszAction = _tcschr(g_ppszActions, Array[0][0]);
     922                                __D(pszAction, E_UNNAMED);
     923                                m_nAction = (pszAction - g_ppszActions) * 2 - 1;
     924                                _A(m_nAction == -1 || m_nAction == +1);
     925                                #pragma endregion
     926                                m_bExceptionCodeAvailable = FALSE;
     927                                m_bNativeExceptionCodeAvailable = FALSE;
     928                                if(Array.GetCount() >= 2)
     929                                {
     930                                        CString sExceptionCode = Array[1];
     931                                        PreprocessExceptionCode(sExceptionCode);
     932                                        m_ExceptionCode.Initialize(sExceptionCode);
     933                                        m_bExceptionCodeAvailable = TRUE;
     934                                        if(Array.GetCount() >= 3)
     935                                        {
     936                                                CString sNativeExceptionCode = Array[2];
     937                                                PreprocessNativeExceptionCode(sNativeExceptionCode);
     938                                                m_NativeExceptionCode.Initialize(sNativeExceptionCode);
     939                                                m_bNativeExceptionCodeAvailable = TRUE;
     940                                        }
     941                                }
     942                        }
     943                        BOOL Apply(LONG nExceptionCode, const LONG* pnNativeExceptionCode, INT& nAction) const throw()
     944                        {
     945                                if(m_bExceptionCodeAvailable)
     946                                {
     947                                        if(!m_ExceptionCode.Compare(nExceptionCode))
     948                                                return FALSE; // Exception Code Mismatch
     949                                        if(m_bNativeExceptionCodeAvailable)
     950                                        {
     951                                                if(!pnNativeExceptionCode)
     952                                                        return FALSE; // No Native Exception Code
     953                                                if(!m_NativeExceptionCode.Compare(*pnNativeExceptionCode))
     954                                                        return FALSE; // Native Exception Code Mismatch
     955                                        }
     956                                }
     957                                nAction = m_nAction;
     958                                return TRUE;
     959                        }
     960                        VOID Trace() const
     961                        {
     962                                #if defined(_DEBUG)
     963                                        CString sText;
     964                                        if(m_bExceptionCodeAvailable)
     965                                        {
     966                                                if(m_ExceptionCode.m_nMinimalValue < m_ExceptionCode.m_nMaximalValue)
     967                                                        sText += AtlFormatString(_T("0x%08X-0x%08X "), m_ExceptionCode.m_nMinimalValue, m_ExceptionCode.m_nMaximalValue);
     968                                                else if(m_ExceptionCode.m_nMinimalValue == 0xE06D7363)
     969                                                        sText += _T("C++ ");
     970                                                else
     971                                                        sText += AtlFormatString(_T("0x%08X "), m_ExceptionCode.m_nMinimalValue);
     972                                                if(m_bNativeExceptionCodeAvailable)
     973                                                {
     974                                                        if(m_NativeExceptionCode.m_nMinimalValue < m_NativeExceptionCode.m_nMaximalValue)
     975                                                                sText += AtlFormatString(_T("0x%08X-0x%08X "), m_NativeExceptionCode.m_nMinimalValue, m_NativeExceptionCode.m_nMaximalValue);
     976                                                        else
     977                                                                sText += AtlFormatString(_T("0x%08X "), m_NativeExceptionCode.m_nMinimalValue);
     978                                                }
     979                                        }
     980                                        _Z4(atlTraceGeneral, 4, _T("m_nAction %d, %s\n"), m_nAction, sText);
     981                                #endif // defined(_DEBUG)
     982                        }
     983                };
     984
     985                ////////////////////////////////////////////////////
     986                // CFilterArray
     987
     988                class CFilterArray :
     989                        public CRoAssignableArrayT<CRoArrayT<CFilter> >
     990                {
     991                public:
     992                // CFilterArray
     993                        CFilterArray()
     994                        {
     995                        }
     996                        CFilterArray(const CString& sValue)
     997                        {
     998                                Initialize(sValue);
     999                        }
     1000                        VOID Initialize(CString sValue)
     1001                        {
     1002                                RemoveAll();
     1003                                sValue.Replace(_T("\r\n"), _T("\n"));
     1004                                sValue.Replace(_T("\t"), _T(" "));
     1005                                CRoArrayT<CString> Array;
     1006                                _StringHelper::Split(sValue, _T('\n'), Array);
     1007                                for(SIZE_T nIndex = 0; nIndex < Array.GetCount(); nIndex++)
     1008                                {
     1009                                        CString sLine = Array[nIndex];
     1010                                        const INT nPosition = sLine.Find(_T("//"));
     1011                                        if(nPosition >= 0)
     1012                                                sLine = sLine.Left(nPosition);
     1013                                        sLine.Trim();
     1014                                        if(sLine.IsEmpty())
     1015                                                continue;
     1016                                        GetAt(Add()).Initialize(sLine);
     1017                                }
     1018                        }
     1019                        BOOL Apply(LONG nExceptionCode, const LONG* pnNativeExceptionCode, INT& nAction) const throw()
     1020                        {
     1021                                for(SIZE_T nIndex = 0; nIndex < GetCount(); nIndex++)
     1022                                        if(GetAt(nIndex).Apply(nExceptionCode, pnNativeExceptionCode, nAction))
     1023                                                return TRUE;
     1024                                return FALSE;
     1025                        }
     1026                        VOID Trace() const
     1027                        {
     1028                                #if defined(_DEBUG)
     1029                                        _Z4(atlTraceGeneral, 4, _T("GetCount() %d\n"), GetCount());
     1030                                        for(SIZE_T nIndex = 0; nIndex < GetCount(); nIndex++)
     1031                                                GetAt(nIndex).Trace();
     1032
     1033                                #endif // defined(_DEBUG)
     1034                        }
     1035                };
     1036
     1037        private:
     1038                CMainWizard& m_Wizard;
     1039                BOOL m_bActivating;
     1040                CRoEdit m_TextEdit;
     1041                CFont m_TextEditFont;
     1042                CRoHyperStatic m_ResetStatic;
     1043                CRoHyperStatic m_HelpStatic;
     1044                mutable CRoCriticalSection m_DataCriticalSection;
     1045                CFilterArray m_FilterArray;
     1046
     1047                static LPCTSTR GetDefaultText() throw()
     1048                {
     1049                        return
     1050                                _T("// Filters are processed top to bottom until a match is found.") _T("\r\n")
     1051                                _T("// One filter per line, syntax: ") _T("\r\n")
     1052                                _T("//   (+ or -) [(Exception Code) [(C++ ATL Exception HRESULT)]]") _T("\r\n")
     1053                                _T("") _T("\r\n")
     1054                                _T("+")
     1055                                _T("");
     1056                }
     1057                VOID UpdateButtons() throw()
     1058                {
     1059                        const BOOL bAllowNext = m_Wizard.m_ProcessPropertyPage.IsSelectedProcessActive();
     1060                        SetWizardButtons(PSWIZB_BACK | (bAllowNext ? PSWIZB_NEXT : 0));
     1061                }
     1062
     1063        public:
     1064        // CFilterPropertyPage
     1065                CFilterPropertyPage(CMainWizard* pWizard) throw() :
     1066                        m_Wizard(*pWizard)
     1067                {
     1068                        SetHeaderTitles();
     1069                }
     1070                BOOL ApplyFilters(LONG nExceptionCode, const LONG* pnNativeExceptionCode, INT& nAction) const
     1071                {
     1072                        CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     1073                        return m_FilterArray.Apply(nExceptionCode, pnNativeExceptionCode, nAction);
     1074                }
     1075
     1076        // Window message handlers
     1077                LRESULT OnInitDialog(HWND, LPARAM)
     1078                {
     1079                        m_bActivating = TRUE;
     1080                        _ATLTRY
     1081                        {
     1082                                CWaitCursor WaitCursor;
     1083                                m_TextEdit = GetDlgItem(IDC_MAIN_FILTER_TEXT);
     1084                                CLogFont LogFont;
     1085                                LogFont.SetMessageBoxFont();
     1086                                _tcsncpy_s(LogFont.lfFaceName, DIM(LogFont.lfFaceName), _T("Courier New"), _TRUNCATE);
     1087                                m_TextEditFont = LogFont.CreateFontIndirect();
     1088                                m_TextEdit.SetFont(m_TextEditFont);
     1089                                _W(m_ResetStatic.SubclassWindow(GetDlgItem(IDC_MAIN_FILTER_RESET)));
     1090                                _W(m_HelpStatic.SubclassWindow(GetDlgItem(IDC_MAIN_FILTER_HELP)));
     1091                                CRoHyperStatic::SetIdealExtentHorizontally(2, &m_ResetStatic, &m_HelpStatic);
     1092                                #pragma region Initialize from Registry
     1093                                CString sText = GetDefaultText();
     1094                                _RegKeyHelper::QueryStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Filter"), sText);
     1095                                m_TextEdit.SetValue(sText);
     1096                                #pragma endregion
     1097                                UpdateButtons();
     1098                                m_bActivating = FALSE;
     1099                        }
     1100                        _ATLCATCHALL()
     1101                        {
     1102                                _Z_EXCEPTION();
     1103                        }
     1104                        return TRUE;
     1105                }
     1106                LRESULT OnResetStaticAnchorClicked(NMHDR*)
     1107                {
     1108                        m_TextEdit.SetValue(GetDefaultText());
     1109                        UpdateButtons();
     1110                        return 0;
     1111                }
     1112                INT OnSetActive() throw()
     1113                {
     1114                        #if defined(_DEBUG) && FALSE
     1115                                return -1;
     1116                        #endif // defined(_DEBUG)
     1117                        _ATLTRY
     1118                        {
     1119                                UpdateButtons();
     1120                        }
     1121                        _ATLCATCHALL()
     1122                        {
     1123                                MessageBeep(MB_ICONERROR);
     1124                                return -1;
     1125                        }
     1126                        return 0;
     1127                }
     1128                BOOL OnQueryCancel()
     1129                {
     1130                        return m_Wizard.m_OperationPropertyPage.OnQueryCancel();
     1131                }
     1132                INT OnWizardNext() throw()
     1133                {
     1134                        _ATLTRY
     1135                        {
     1136                                CString sText = m_TextEdit.GetValue();
     1137                                CFilterArray FilterArray;
     1138                                _ATLTRY
     1139                                {
     1140                                        FilterArray.Initialize(sText);
     1141                                }
     1142                                _ATLCATCH(Exception)
     1143                                {
     1144                                        _Z_ATLEXCEPTION(Exception);
     1145                                        AtlExceptionMessageBox(m_hWnd, Exception);
     1146                                        m_TextEdit.SetFocus();
     1147                                        return -1;
     1148                                }
     1149                                _RegKeyHelper::SetStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Filter"), sText);
     1150                                {
     1151                                        CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     1152                                        m_FilterArray = FilterArray;
     1153                                        m_FilterArray.Trace();
     1154                                }
     1155                                if(!m_Wizard.m_ProcessPropertyPage.IsSelectedProcessActive())
     1156                                        return CProcessPropertyPage::IDD;
     1157                        }
     1158                        _ATLCATCHALL()
     1159                        {
     1160                                MessageBeep(MB_ICONERROR);
     1161                                return -1;
     1162                        }
     1163                        return 0;
     1164                }
     1165        };
     1166
     1167        ////////////////////////////////////////////////////////
     1168        // CEmailPropertyPage
     1169
     1170        class CEmailPropertyPage :
     1171                public CWizardPropertyPageT<CEmailPropertyPage>
     1172        {
     1173        public:
     1174                enum { IDD = IDD_MAIN_EMAIL };
     1175
     1176        BEGIN_MSG_MAP_EX(CEmailPropertyPage)
     1177                CHAIN_MSG_MAP(CWizardPropertyPageT<CEmailPropertyPage>)
     1178                MSG_WM_INITDIALOG(OnInitDialog)
     1179                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_ENABLED, BN_CLICKED, OnEnabledButtonClicked)
     1180                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_FROM, EN_CHANGE, OnChanged)
     1181                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_TO, EN_CHANGE, OnChanged)
     1182                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_METHOD, CBN_SELENDOK, OnChanged)
     1183                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_HOST, EN_CHANGE, OnChanged)
     1184                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_USERNAME, EN_CHANGE, OnChanged)
     1185                COMMAND_HANDLER_EX(IDC_MAIN_EMAIL_PASSWORD, EN_CHANGE, OnChanged)
     1186                NOTIFY_HANDLER_EX(IDC_MAIN_EMAIL_MAXIMALATTACHMENTSIZE, CRoLongEdit::NC_VALUECHANGED, OnChanged)
     1187                REFLECT_NOTIFICATIONS()
     1188        END_MSG_MAP()
     1189
     1190        public:
     1191
     1192        private:
     1193                CMainWizard& m_Wizard;
     1194                BOOL m_bActivating;
     1195                CButton m_EnabledButton;
     1196                CFont m_BolderFont;
     1197                CRoEdit m_FromEdit;
     1198                CRoEdit m_ToEdit;
     1199                CRoComboBoxT<> m_MethodComboBox;
     1200                CRoEdit m_HostEdit;
     1201                CRoEdit m_UsernameEdit;
     1202                CRoEdit m_PasswordEdit;
     1203                CRoLongEdit m_MaximalAttachmentSizeEdit;
     1204                BOOL m_bEnabled;
     1205                CStringA m_sMessageString;
     1206                ULONG m_nMaximalAttachmentSize;
     1207
     1208                VOID UpdateButtons() throw()
     1209                {
     1210                        BOOL bAllowNext = m_Wizard.m_ProcessPropertyPage.IsSelectedProcessActive();
     1211                        if(m_EnabledButton.GetCheck())
     1212                        {
     1213                                if(m_ToEdit.GetValue().Trim().IsEmpty())
     1214                                        bAllowNext = FALSE;
     1215                                const INT nMethod = m_MethodComboBox.GetCurSel();
     1216                                if(nMethod != 0) // Google Mail
     1217                                        if(m_HostEdit.GetValue().Trim().IsEmpty())
     1218                                                bAllowNext = FALSE;
     1219                                if(nMethod != 5) // No Authentication
     1220                                {
     1221                                        if(m_UsernameEdit.GetValue().Trim().IsEmpty())
     1222                                                bAllowNext = FALSE;
     1223                                        if(m_PasswordEdit.GetValue().Trim().IsEmpty())
     1224                                                bAllowNext = FALSE;
     1225                                }
     1226                        }
     1227                        SetWizardButtons(PSWIZB_BACK | (bAllowNext ? PSWIZB_NEXT : 0));
     1228                }
     1229                VOID UpdateControls()
     1230                {
     1231                        if(m_EnabledButton.GetCheck())
     1232                        {
     1233                                for(CWindow Window = m_EnabledButton.GetWindow(GW_HWNDNEXT); Window; Window = Window.GetWindow(GW_HWNDNEXT))
     1234                                        Window.ShowWindow(SW_SHOW);
     1235                                const INT nMethod = m_MethodComboBox.GetCurSel();
     1236                                m_HostEdit.GetWindow(GW_HWNDPREV).EnableWindow(nMethod != 0); // Google Mail
     1237                                m_HostEdit.EnableWindow(nMethod != 0); // Google Mail
     1238                                m_UsernameEdit.GetWindow(GW_HWNDPREV).EnableWindow(nMethod != 5); // No Authentication
     1239                                m_UsernameEdit.EnableWindow(nMethod != 5); // No Authentication
     1240                                m_PasswordEdit.GetWindow(GW_HWNDPREV).EnableWindow(nMethod != 5); // No Authentication
     1241                                m_PasswordEdit.EnableWindow(nMethod != 5); // No Authentication
     1242                        } else
     1243                        {
     1244                                for(CWindow Window = m_EnabledButton.GetWindow(GW_HWNDNEXT); Window; Window = Window.GetWindow(GW_HWNDNEXT))
     1245                                        Window.ShowWindow(SW_HIDE);
     1246                        }
     1247                        UpdateButtons();
     1248                }
     1249
     1250        public:
     1251        // CEmailPropertyPage
     1252                CEmailPropertyPage(CMainWizard* pWizard) throw() :
     1253                        m_Wizard(*pWizard)
     1254                {
     1255                        SetHeaderTitles();
     1256                }
     1257                CObjectPtr<CMessage> CreateMessage() const
     1258                {
     1259                        if(!m_bEnabled)
     1260                                return NULL;
     1261                        CObjectPtr<CMessage> pMessage;
     1262                        pMessage.Construct();
     1263                        pMessage->LoadTypeInfo(IDR_EMAILTOOLS);
     1264                        pMessage->SetAsString(m_sMessageString);
     1265                        return pMessage;
     1266                }
     1267                ULONG GetMaximalAttachmentSize() const throw()
     1268                {
     1269                        return m_nMaximalAttachmentSize;
     1270                }
     1271
     1272        // Window message handlers
     1273                LRESULT OnInitDialog(HWND, LPARAM)
     1274                {
     1275                        m_bActivating = TRUE;
     1276                        _ATLTRY
     1277                        {
     1278                                CWaitCursor WaitCursor;
     1279                                m_EnabledButton = GetDlgItem(IDC_MAIN_EMAIL_ENABLED);
     1280                                CFontHandle Font(GetFont());
     1281                                if(!m_BolderFont)
     1282                                {
     1283                                        CLogFont LogFont;
     1284                                        _W(Font.GetLogFont(LogFont));
     1285                                        LogFont.SetBold();
     1286                                        m_BolderFont = LogFont.CreateFontIndirect();
     1287                                }
     1288                                m_EnabledButton.SetFont(m_BolderFont);
     1289                                m_FromEdit = GetDlgItem(IDC_MAIN_EMAIL_FROM);
     1290                                m_ToEdit = GetDlgItem(IDC_MAIN_EMAIL_TO);
     1291                                m_MethodComboBox.Initialize(GetDlgItem(IDC_MAIN_EMAIL_METHOD));
     1292                                m_MethodComboBox.SetCurSel(0);
     1293                                m_HostEdit = GetDlgItem(IDC_MAIN_EMAIL_HOST);
     1294                                m_UsernameEdit = GetDlgItem(IDC_MAIN_EMAIL_USERNAME);
     1295                                m_PasswordEdit = GetDlgItem(IDC_MAIN_EMAIL_PASSWORD);
     1296                                _W(m_MaximalAttachmentSizeEdit.SubclassWindow(GetDlgItem(IDC_MAIN_EMAIL_MAXIMALATTACHMENTSIZE)));
     1297                                #pragma region Initialize from Registry
     1298                                CRegKey Key;
     1299                                Key.Open(HKEY_CURRENT_USER, REGISTRY_ROOT, KEY_READ);
     1300                                if(Key)
     1301                                {
     1302                                        m_EnabledButton.SetCheck(_RegKeyHelper::QueryIntegerValue(Key, _T("Email Enabled")));
     1303                                        CString sMessageString = _RegKeyHelper::QueryStringValue(Key, _T("Email Message Template"));
     1304                                        if(!sMessageString.IsEmpty())
     1305                                                _ATLTRY
     1306                                                {
     1307                                                        CObjectPtr<CMessage> pMessage;
     1308                                                        pMessage.Construct();
     1309                                                        pMessage->LoadTypeInfo(IDR_EMAILTOOLS);
     1310                                                        pMessage->SetAsString(CStringA(sMessageString));
     1311                                                        #pragma region Sender and Recipients
     1312                                                        CComBSTR sSender, sToRecipients;
     1313                                                        __C(pMessage->get_Sender(&sSender));
     1314                                                        __C(pMessage->get_ToRecipients(&sToRecipients));
     1315                                                        m_FromEdit.SetValue(CString(sSender));
     1316                                                        m_ToEdit.SetValue(CString(sToRecipients));
     1317                                                        #pragma endregion
     1318                                                        CComBSTR sAuthMethods;
     1319                                                        __C(pMessage->get_AuthMethods(&sAuthMethods));
     1320                                                        VARIANT_BOOL bSecureSocketsLayer, bTransportLayerSecurity;
     1321                                                        __C(pMessage->get_SecureSocketsLayer(&bSecureSocketsLayer));
     1322                                                        __C(pMessage->get_TransportLayerSecurity(&bTransportLayerSecurity));
     1323                                                        #pragma region Host and Port
     1324                                                        CComBSTR sHost;
     1325                                                        __C(pMessage->get_ServerHost(&sHost));
     1326                                                        LONG nPort = 0;
     1327                                                        __C(pMessage->get_ServerPort(&nPort));
     1328                                                        CString sHostT(sHost);
     1329                                                        if(nPort)
     1330                                                                sHostT += AtlFormatString(_T(":%d"), nPort);
     1331                                                        m_HostEdit.SetValue(sHostT);
     1332                                                        #pragma endregion
     1333                                                        #pragma region User Name and Password
     1334                                                        CComBSTR sAuthName, sAuthPassword;
     1335                                                        __C(pMessage->get_AuthName(&sAuthName));
     1336                                                        __C(pMessage->get_AuthPassword(&sAuthPassword));
     1337                                                        m_UsernameEdit.SetValue(CString(sAuthName));
     1338                                                        m_PasswordEdit.SetValue(CString(sAuthPassword));
     1339                                                        #pragma endregion
     1340                                                        m_MethodComboBox.SetCurSel(0);
     1341                                                        if(bTransportLayerSecurity != ATL_VARIANT_FALSE && sHostT.CompareNoCase(_T("smtp.gmail.com")) == 0)
     1342                                                        {
     1343                                                                //m_MethodComboBox.SetCurSel(0);
     1344                                                        } else
     1345                                                        {
     1346                                                                if(bTransportLayerSecurity != ATL_VARIANT_FALSE)
     1347                                                                        m_MethodComboBox.SetCurSel(1);
     1348                                                                else if(bSecureSocketsLayer != ATL_VARIANT_FALSE)
     1349                                                                        m_MethodComboBox.SetCurSel(2);
     1350                                                                else if(CString(sAuthMethods).CompareNoCase(_T("cram-md5")) == 0)
     1351                                                                        m_MethodComboBox.SetCurSel(3);
     1352                                                                else if(!CString(sAuthName).IsEmpty())
     1353                                                                        m_MethodComboBox.SetCurSel(4);
     1354                                                                else
     1355                                                                        m_MethodComboBox.SetCurSel(5);
     1356                                                        }
     1357                                                }
     1358                                                _ATLCATCHALL()
     1359                                                {
     1360                                                        _Z_EXCEPTION();
     1361                                                }
     1362                                        const DWORD nMaximalAttachmentSize = _RegKeyHelper::QueryIntegerValue(Key, _T("Email Maximal Attachment Minidump File Size"));
     1363                                        if(nMaximalAttachmentSize)
     1364                                                m_MaximalAttachmentSizeEdit.SetValue(nMaximalAttachmentSize);
     1365                                }
     1366                                #pragma endregion
     1367                                UpdateControls();
     1368                                UpdateButtons();
     1369                                m_bActivating = FALSE;
     1370                        }
     1371                        _ATLCATCHALL()
     1372                        {
     1373                                _Z_EXCEPTION();
     1374                        }
     1375                        return TRUE;
     1376                }
     1377                LRESULT OnEnabledButtonClicked(UINT, INT, HWND)
     1378                {
     1379                        UpdateControls();
     1380                        return 0;
     1381                }
     1382                LRESULT OnChanged(UINT, INT, HWND)
     1383                {
     1384                        if(!m_bActivating)
     1385                                UpdateControls();
     1386                        return 0;
     1387                }
     1388                LRESULT OnChanged(NMHDR*)
     1389                {
     1390                        if(!m_bActivating)
     1391                                UpdateControls();
     1392                        return 0;
     1393                }
     1394                INT OnSetActive() throw()
     1395                {
     1396                        _ATLTRY
     1397                        {
     1398                                UpdateButtons();
     1399                        }
     1400                        _ATLCATCHALL()
     1401                        {
     1402                                MessageBeep(MB_ICONERROR);
     1403                                return -1;
     1404                        }
     1405                        return 0;
     1406                }
     1407                BOOL OnQueryCancel()
     1408                {
     1409                        return m_Wizard.m_OperationPropertyPage.OnQueryCancel();
     1410                }
     1411                INT OnWizardNext() throw()
     1412                {
     1413                        _ATLTRY
     1414                        {
     1415                                m_bEnabled = m_EnabledButton.GetCheck();
     1416                                _RegKeyHelper::SetIntegerValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Enabled"), m_bEnabled);
     1417                                if(m_bEnabled)
     1418                                {
     1419                                        CObjectPtr<CMessage> pMessage;
     1420                                        pMessage.Construct();
     1421                                        pMessage->LoadTypeInfo(IDR_EMAILTOOLS);
     1422                                        __C(pMessage->put_Sender(CComBSTR(m_FromEdit.GetValue())));
     1423                                        __C(pMessage->put_ToRecipients(CComBSTR(m_ToEdit.GetValue())));
     1424                                        // NOTE:
     1425                                        // 0 Google Mail (SMTP, TLS Connection)
     1426                                        // 1 SMTP, TLS Connection, Plain Text Authentication (TLS, PLAIN)
     1427                                        // 2 SMTP, SSL Connection, Plain Text Authentication (SSL, PLAIN)
     1428                                        // 3 SMTP, Digest Authentication (CRAM-MD5)
     1429                                        // 4 SMTP, Plain Text Authentication (PLAIN)
     1430                                        // 5 SMTP, No Authentication
     1431                                        const INT nMethod = m_MethodComboBox.GetCurSel();
     1432                                        __C(pMessage->put_SecureSocketsLayer((nMethod == 2) ? ATL_VARIANT_TRUE : ATL_VARIANT_FALSE));
     1433                                        __C(pMessage->put_TransportLayerSecurity((nMethod < 2) ? ATL_VARIANT_TRUE : ATL_VARIANT_FALSE));
     1434                                        if(nMethod != 5)
     1435                                        {
     1436                                                __C(pMessage->put_AuthMethods(CComBSTR(_T("plain"))));
     1437                                                __C(pMessage->put_AuthName(CComBSTR(m_UsernameEdit.GetValue())));
     1438                                                __C(pMessage->put_AuthPassword(CComBSTR(m_PasswordEdit.GetValue())));
     1439                                        }
     1440                                        switch(nMethod)
     1441                                        {
     1442                                        case 0:
     1443                                                __C(pMessage->put_ServerHost(CComBSTR(_T("smtp.gmail.com"))));
     1444                                                break;
     1445                                        default:
     1446                                                CString sHost = m_HostEdit.GetValue();
     1447                                                sHost.Trim();
     1448                                                const INT nPortPosition = sHost.Find(_T(":"));
     1449                                                if(nPortPosition >= 0)
     1450                                                {
     1451                                                        INT nPort;
     1452                                                        __D(AtlStringToInteger(sHost.Mid(nPortPosition + 1), nPort), E_UNNAMED);
     1453                                                        __C(pMessage->put_ServerPort(nPort));
     1454                                                        sHost = sHost.Left(nPortPosition);
     1455                                                }
     1456                                                __C(pMessage->put_ServerHost(CComBSTR(sHost)));
     1457                                                break;
     1458                                        }
     1459                                        switch(nMethod)
     1460                                        {
     1461                                        case 3:
     1462                                                __C(pMessage->put_AuthMethods(CComBSTR(_T("cram-md5"))));
     1463                                                break;
     1464                                        }
     1465                                        m_sMessageString = pMessage->GetAsString();
     1466                                        m_nMaximalAttachmentSize = (ULONG) m_MaximalAttachmentSizeEdit.GetValue();
     1467                                        _RegKeyHelper::SetStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Message Template"), CString(m_sMessageString));
     1468                                        _RegKeyHelper::SetIntegerValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Maximal Attachment Minidump File Size"), (DWORD) m_nMaximalAttachmentSize);
     1469                                }
     1470                                if(!m_Wizard.m_ProcessPropertyPage.IsSelectedProcessActive())
     1471                                        return CProcessPropertyPage::IDD;
    8141472                        }
    8151473                        _ATLCATCHALL()
     
    9231581                                        _Z4(atlTraceGeneral, 4, _T("Debug event, DebugEvent.dwDebugEventCode %d, .dwProcessId %d, .dwThreadId %d\n"), DebugEvent.dwDebugEventCode, DebugEvent.dwProcessId, DebugEvent.dwThreadId);
    9241582                                        // TODO: Handle load/unload DLL, output debug strings (configurable)
     1583                                        CObjectPtr<CMessage> pMessage;
     1584                                        CPath sMessageAttachmentPath;
    9251585                                        BOOL bExitProcess = FALSE;
    9261586                                        switch(DebugEvent.dwDebugEventCode)
    9271587                                        {
     1588                                        #pragma region CREATE_PROCESS_DEBUG_EVENT
    9281589                                        case CREATE_PROCESS_DEBUG_EVENT:
    9291590                                                {
     
    9311592                                                }
    9321593                                                break;
     1594                                        #pragma endregion
     1595                                        #pragma region EXIT_PROCESS_DEBUG_EVENT
    9331596                                        case EXIT_PROCESS_DEBUG_EVENT:
    9341597                                                {
     
    9381601                                                }
    9391602                                                break;
     1603                                        #pragma endregion
     1604                                        #pragma region EXCEPTION_DEBUG_EVENT
    9401605                                        case EXCEPTION_DEBUG_EVENT:
    9411606                                                {
     
    9581623                                                        }
    9591624                                                        #pragma endregion
    960                                                         #pragma region Skip C++ Exceptions (Debug)
    961                                                         #if _DEVELOPMENT //&& FALSE
    962                                                         #if !defined(_WIN64)
    963                                                         COMPILER_MESSAGE("Debug: Skip C++ Exceptions")
    964                                                         if(DebugInformation.ExceptionRecord.ExceptionCode == 0xE06D7363)
     1625                                                        #pragma region Apply Exception Filter
     1626                                                        const LONG nExceptionCode = DebugInformation.ExceptionRecord.ExceptionCode;
     1627                                                        const LONG* pnNativeExceptionCode = NULL;
     1628                                                        LONG nNativeExceptionCode;
     1629                                                        if(nExceptionCode == 0xE06D7363 && DebugInformation.ExceptionRecord.NumberParameters >= 2)
    9651630                                                        {
    966                                                                 BOOL bSkip = TRUE;
    967                                                                 if(DebugInformation.ExceptionRecord.NumberParameters >= 2)
    968                                                                 {
    969                                                                         HRESULT nNativeExceptionCode = S_OK;
    970                                                                         SIZE_T nReadDataSize = 0;
    971                                                                         if(ReadProcessMemory(Process, (const VOID*) DebugInformation.ExceptionRecord.ExceptionInformation[1], &nNativeExceptionCode, sizeof nNativeExceptionCode, &nReadDataSize))
    972                                                                                 if(nReadDataSize == sizeof nNativeExceptionCode)
    973                                                                                 {
    974                                                                                         if((nNativeExceptionCode & 0x0FFF0000) != 0x01390000) // DVRServerStretch
    975                                                                                         {
    976                                                                                                 AppendLog(AtlFormatString(_T("Skipping C++ exception (0x%08X, 0x%08X)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode, nNativeExceptionCode));
    977                                                                                                 break;
    978                                                                                         } else
    979                                                                                                 bSkip = FALSE;
    980                                                                                 }
    981                                                                 }
    982                                                                 if(bSkip)
    983                                                                 {
    984                                                                         AppendLog(AtlFormatString(_T("Skipping C++ exception (0x%08X)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode));
    985                                                                         break;
    986                                                                 }
     1631                                                                SIZE_T nReadDataSize = 0;
     1632                                                                if(ReadProcessMemory(Process, (const VOID*) DebugInformation.ExceptionRecord.ExceptionInformation[1], &nNativeExceptionCode, sizeof nNativeExceptionCode, &nReadDataSize))
     1633                                                                        if(nReadDataSize == sizeof nNativeExceptionCode)
     1634                                                                                pnNativeExceptionCode = &nNativeExceptionCode;
    9871635                                                        }
    988                                                         #endif // !defined(_WIN64)
    989                                                         #endif // _DEVELOPMENT
     1636                                                        INT nAction = 1;
     1637                                                        m_Wizard.m_FilterPropertyPage.ApplyFilters(nExceptionCode, pnNativeExceptionCode, nAction);
     1638                                                        if(nAction < 1)
     1639                                                        {
     1640                                                                if(pnNativeExceptionCode)
     1641                                                                        AppendLog(AtlFormatString(_T("Skipping C++ exception (0x%08X, 0x%08X)\r\n"), nExceptionCode, nNativeExceptionCode));
     1642                                                                else
     1643                                                                        AppendLog(AtlFormatString(_T("Skipping exception (0x%08X)\r\n"), nExceptionCode));
     1644                                                                break;
     1645                                                        }
    9901646                                                        #pragma endregion
    9911647                                                        _ATLTRY
     
    10041660                                                                ExceptionInformation.ExceptionPointers = &ExceptionPointers;
    10051661                                                                ExceptionInformation.ClientPointers = FALSE;
     1662                                                                #pragma region File Name
    10061663                                                                CString sName;
    10071664                                                                sName.AppendFormat(_T("%s-%d-%03d"), pszProcessFileName, nProcessIdentifier, m_nExceptionIndex++);
     
    10181675                                                                CPath sPath;
    10191676                                                                sPath.Combine(m_sDataDirectory, sName);
     1677                                                                #pragma endregion
    10201678                                                                CAtlFile File;
    10211679                                                                __C(File.Create(sPath, GENERIC_WRITE, CREATE_ALWAYS, FILE_SHARE_READ));
     
    10261684                                                                _ATLTRY
    10271685                                                                {
    1028                                                                         if(!m_pMessageQueue)
    1029                                                                                 m_pMessageQueue.Construct();
    1030                                                                         CObjectPtr<CMessage> pMessage;
    1031                                                                         pMessage.Construct();
    1032                                                                         #pragma region Fixed Initialization
    1033                                                                         __C(pMessage->put_ServerHost(CComBSTR(_T("smtp.gmail.com"))));
    1034                                                                         __C(pMessage->put_Sender(CComBSTR(_T("Roman Ryltsov <ryltsov@gmail.com>"))));
    1035                                                                         __C(pMessage->put_ToRecipients(CComBSTR(_T("Roman Ryltsov <ryltsov@gmail.com>"))));
    1036                                                                         __C(pMessage->put_TransportLayerSecurity(ATL_VARIANT_TRUE));
    1037                                                                         __C(pMessage->put_AuthMethods(CComBSTR(_T("login"))));
    1038                                                                         __C(pMessage->put_AuthName(CComBSTR(_T("ryltsov@gmail.com"))));
    1039                                                                         __C(pMessage->put_AuthPassword(CComBSTR(_T(""))));
    1040                                                                         #pragma endregion
    1041                                                                         TCHAR pszComputerName[MAX_COMPUTERNAME_LENGTH] = { 0 };
    1042                                                                         DWORD nComputerNameLength = DIM(pszComputerName);
    1043                                                                         _W(GetComputerName(pszComputerName, &nComputerNameLength));
    1044                                                                         CString sSubject = AtlFormatString(_T("Exception 0x%08X in %s on %s"), DebugInformation.ExceptionRecord.ExceptionCode, pszProcessFileName, pszComputerName);
    1045                                                                         CString sBody;
    1046                                                                         sBody += _T("Hi,") _T("\r\n")
    1047                                                                                 _T("\r\n");
    1048                                                                         sBody += AtlFormatString(_T("This is Log Process Exception notifying on exception occurred:") _T("\r\n")
    1049                                                                                 _T("\r\n"),
    1050                                                                                 pszComputerName);
    1051                                                                         sBody += AtlFormatString(_T(" * ") _T("Code: 0x%08X") _T("\r\n"), DebugInformation.ExceptionRecord.ExceptionCode);
    1052                                                                         if(nNativeExceptionCode != S_OK)
    1053                                                                                 sBody += AtlFormatString(_T(" * ") _T("Native ATL Code: 0x%08X") _T("\r\n"), nNativeExceptionCode);
    1054                                                                         sBody += AtlFormatString(_T(" * ") _T("Local Time: %s") _T("\r\n"), _StringHelper::FormatDateTime());
    1055                                                                         sBody += AtlFormatString(_T(" * ") _T("Computer Name: %s") _T("\r\n"), pszComputerName);
    1056                                                                         // WARN: Attaching a minidump file requires it being closed by API (should we do ContinueDebugEvent and/or wait?)
    1057                                                                         //sBody += _T("\r\n")
    1058                                                                         //      _T("Minidump attached.") _T("\r\n");
    1059                                                                         __C(pMessage->put_Subject(CComBSTR(sSubject)));
    1060                                                                         __C(pMessage->put_Body(CComBSTR(sBody)));
    1061                                                                         //CObjectPtr<CMessage::CComAttachment> pAttachment = pMessage->GetAttachments()->Add();
    1062                                                                         //__C(pAttachment->put_Name(CComBSTR(sName)));
    1063                                                                         //__C(pAttachment->LoadFromFile(CComBSTR(sPath)));
    1064                                                                         m_pMessageQueue->Add(pMessage);
     1686                                                                        pMessage = m_Wizard.m_EmailPropertyPage.CreateMessage();
     1687                                                                        if(pMessage)
     1688                                                                        {
     1689                                                                                TCHAR pszComputerName[MAX_COMPUTERNAME_LENGTH] = { 0 };
     1690                                                                                DWORD nComputerNameLength = DIM(pszComputerName);
     1691                                                                                _W(GetComputerName(pszComputerName, &nComputerNameLength));
     1692                                                                                CString sSubject = AtlFormatString(_T("Exception 0x%08X in %s on %s"), DebugInformation.ExceptionRecord.ExceptionCode, pszProcessFileName, pszComputerName);
     1693                                                                                CString sBody;
     1694                                                                                sBody += _T("Hi,") _T("\r\n")
     1695                                                                                        _T("\r\n");
     1696                                                                                sBody += AtlFormatString(_T("This is Log Process Exceptions notifying on exception occurred:") _T("\r\n")
     1697                                                                                        _T("\r\n"),
     1698                                                                                        pszComputerName);
     1699                                                                                sBody += AtlFormatString(_T(" * ") _T("Code: 0x%08X") _T("\r\n"), DebugInformation.ExceptionRecord.ExceptionCode);
     1700                                                                                if(nNativeExceptionCode != S_OK)
     1701                                                                                        sBody += AtlFormatString(_T(" * ") _T("Native ATL Code: 0x%08X") _T("\r\n"), nNativeExceptionCode);
     1702                                                                                sBody += AtlFormatString(_T(" * ") _T("Local Time: %s") _T("\r\n"), _StringHelper::FormatDateTime());
     1703                                                                                sBody += AtlFormatString(_T(" * ") _T("Computer Name: %s") _T("\r\n"), pszComputerName);
     1704                                                                                __C(pMessage->put_Subject(CComBSTR(sSubject)));
     1705                                                                                __C(pMessage->put_Body(CComBSTR(sBody)));
     1706                                                                                sMessageAttachmentPath = sPath;
     1707                                                                        }
    10651708                                                                }
    10661709                                                                _ATLCATCHALL()
    10671710                                                                {
    10681711                                                                        _Z_EXCEPTION();
     1712                                                                        pMessage.Release();
    10691713                                                                }
    10701714                                                                #pragma endregion
     
    10761720                                                }
    10771721                                                break;
     1722                                        #pragma endregion
    10781723                                        }
    10791724                                        __E(ContinueDebugEvent(DebugEvent.dwProcessId, DebugEvent.dwThreadId, DBG_EXCEPTION_NOT_HANDLED));
     1725                                        #pragma region Message Notification (Delivery)
     1726                                        if(pMessage)
     1727                                                _ATLTRY
     1728                                                {
     1729                                                        // WARN: Attaching a minidump file requires it being closed by API (should we do ContinueDebugEvent and/or wait?)
     1730                                                        if(_tcslen(sMessageAttachmentPath))
     1731                                                                _ATLTRY
     1732                                                                {
     1733                                                                        ULONGLONG nFileSize;
     1734                                                                        {
     1735                                                                                CAtlFile File;
     1736                                                                                __C(File.Create(sMessageAttachmentPath, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING));
     1737                                                                                __C(File.GetSize(nFileSize));
     1738                                                                        }
     1739                                                                        if((ULONG) (nFileSize >> 20) < m_Wizard.m_EmailPropertyPage.GetMaximalAttachmentSize())
     1740                                                                        {
     1741                                                                                CComBSTR sBody;
     1742                                                                                __C(pMessage->get_Body(&sBody));
     1743                                                                                CString sBodyT(sBody);
     1744                                                                                sBodyT += _T("\r\n")
     1745                                                                                        _T("Minidump attached.") _T("\r\n");
     1746                                                                                __C(pMessage->put_Body(CComBSTR(sBodyT)));
     1747                                                                                CObjectPtr<CMessage::CComAttachment> pAttachment = pMessage->GetAttachments()->Add();
     1748                                                                                __C(pAttachment->put_Name(CComBSTR((LPCTSTR) sMessageAttachmentPath + sMessageAttachmentPath.FindFileName())));
     1749                                                                                __C(pAttachment->put_Type(CComBSTR(_T("application/x-mdmp"))));
     1750                                                                                __C(pAttachment->LoadFromFile(CComBSTR(sMessageAttachmentPath)));
     1751                                                                        }
     1752                                                                }
     1753                                                                _ATLCATCHALL()
     1754                                                                {
     1755                                                                        _Z_EXCEPTION();
     1756                                                                }
     1757                                                        if(!m_pMessageQueue)
     1758                                                                m_pMessageQueue.Construct();
     1759                                                        m_pMessageQueue->Add(pMessage);
     1760                                                }
     1761                                                _ATLCATCHALL()
     1762                                                {
     1763                                                        _Z_EXCEPTION();
     1764                                                }
     1765                                        #pragma endregion
    10801766                                        if(bExitProcess)
    10811767                                                break;
     1768                                        #pragma endregion
    10821769                                }
    10831770                        }
     
    13332020        CProcessPropertyPage m_ProcessPropertyPage;
    13342021        CMinidumpTypePropertyPage m_MinidumpTypePropertyPage;
     2022        CFilterPropertyPage m_FilterPropertyPage;
     2023        CEmailPropertyPage m_EmailPropertyPage;
    13352024        COperationPropertyPage m_OperationPropertyPage;
    13362025        CCompletionPropertyPage m_CompletionPropertyPage;
     
    13742063                m_ProcessPropertyPage(this),
    13752064                m_MinidumpTypePropertyPage(this),
     2065                m_FilterPropertyPage(this),
     2066                m_EmailPropertyPage(this),
    13762067                m_OperationPropertyPage(this),
    13772068                m_CompletionPropertyPage(this)
     
    13842075                AddPage(m_ProcessPropertyPage);
    13852076                AddPage(m_MinidumpTypePropertyPage);
     2077                AddPage(m_FilterPropertyPage);
     2078                AddPage(m_EmailPropertyPage);
    13862079                AddPage(m_OperationPropertyPage);
    13872080                AddPage(m_CompletionPropertyPage);
  • trunk/Utilities/LogProcessExceptions/_Bin/Win32/Release

    • Property svn:ignore
      •  

        old new  
        11LogProcessExceptions
        22*.pdb
         3PeriodicException
  • trunk/Utilities/LogProcessExceptions/resource.h

    r61 r130  
    55#define IDI_MODULE                      10
    66#define IDS_PROJNAME                    100
     7#define IDR_EMAILTOOLS                  101
    78#define IDS_MAINWIZARD_CAPTION          1000
    89#define IDB_WIZARDWATERMARK             1011
    910#define IDB_WIZARDHEADER                1012
    10 #define IDC_MAIN_OPERATION_OPENMINIDUMPFILEDIRECTORY 1512
    11 #define IDC_MAIN_OPERATION_WRITEMINIDUMPNOW 1511
    1211#define IDD_MAIN_INTRODUCTION           1100
    1312#define IDC_WIZARDINTRODUCTION_TITLE    1110
     
    4645#define IDD_MAIN_OPERATION              1500
    4746#define IDC_MAIN_OPERATION_LOG          1510
     47#define IDC_MAIN_OPERATION_WRITEMINIDUMPNOW 1511
     48#define IDC_MAIN_OPERATION_OPENMINIDUMPFILEDIRECTORY 1512
     49#define IDD_MAIN_FILTER                 1600
     50#define IDC_MAIN_FILTER_TEXT            1610
     51#define IDC_MAIN_FILTER_HELP            1611
     52#define IDC_MAIN_FILTER_RESET           1612
     53
     54#define IDD_MAIN_EMAIL                  1700
     55#define IDC_MAIN_EMAIL_ENABLED          1710
     56#define IDC_MAIN_EMAIL_FROM             1712
     57#define IDC_MAIN_EMAIL_TO               1713
     58#define IDC_MAIN_EMAIL_METHOD           1714
     59#define IDC_MAIN_EMAIL_HOST             1715
     60#define IDC_MAIN_EMAIL_USERNAME         1716
     61#define IDC_MAIN_EMAIL_PASSWORD         1717
     62#define IDC_MAIN_EMAIL_MAXIMALATTACHMENTSIZE 1718
     63
    4864#define IDD_ABOUT                       29900
    4965#define IDC_ABOUT_ICON                  29901
     
    6581#define _APS_NEXT_RESOURCE_VALUE        202
    6682#define _APS_NEXT_COMMAND_VALUE         32775
    67 #define _APS_NEXT_CONTROL_VALUE         1065
     83#define _APS_NEXT_CONTROL_VALUE         1072
    6884#define _APS_NEXT_SYMED_VALUE           101
    6985#endif
  • trunk/Utilities/LogProcessExceptions/stdafx.h

    r64 r130  
    6868#define SRWLOCK_THROUGH_CRITICALSECTION // Legacy Compatibility
    6969
    70 #define REGISTRY_PRODUCTROOT    _T("SOFTWARE\\Alax.Info\\Utilities\\Log Process Exceptions")
     70#define REGISTRY_PRODUCTROOT    _T("SOFTWARE\\Alax.Info\\Utility\\LogProcessExceptions")
    7171#define REGISTRY_FILEROOT               REGISTRY_PRODUCTROOT
    7272#define REGISTRY_ROOT                   REGISTRY_FILEROOT
Note: See TracChangeset for help on using the changeset viewer.