Changeset 64
- Timestamp:
- May 12, 2012, 10:23:26 AM (11 years ago)
- Location:
- trunk/Utilities/LogProcessExceptions
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/LogProcessExceptions/LogProcessExceptions.cpp
r61 r64 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 12 // Copyright (C) Roman Ryltsov, 2008-2012 3 3 // Created by Roman Ryltsov roman@alax.info 4 4 // -
trunk/Utilities/LogProcessExceptions/LogProcessExceptions.rc
r61 r64 83 83 LTEXT "Email:",IDC_ABOUT_EMAILTITLE,60,72,20,8 84 84 LTEXT "<A HREF=""mailto:support@alax.info"">support@alax.info</A>",IDC_ABOUT_EMAIL,108,72,162,8,NOT WS_GROUP | WS_TABSTOP 85 LTEXT "Copyright © Alax.Info, Roman Ryltsov, 2008-201 1",IDC_ABOUT_COPYRIGHT,60,84,210,8,SS_NOPREFIX85 LTEXT "Copyright © Alax.Info, Roman Ryltsov, 2008-2012",IDC_ABOUT_COPYRIGHT,60,84,210,8,SS_NOPREFIX 86 86 DEFPUSHBUTTON "OK",1,220,102,50,14 87 87 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,122,267,1 … … 215 215 216 216 VS_VERSION_INFO VERSIONINFO 217 FILEVERSION 1, 0, 0, 2 04217 FILEVERSION 1, 0, 0, 226 218 218 PRODUCTVERSION 1,0,0,1 219 219 FILEFLAGSMASK 0x3fL … … 234 234 VALUE "Created By", "Roman Ryltsov <roman@alax.info>" 235 235 VALUE "FileDescription", "Log Process Exceptions Utility" 236 VALUE "FileVersion", "1, 0, 0, 2 04\0"236 VALUE "FileVersion", "1, 0, 0, 226\0" 237 237 VALUE "InternalName", "LogProcessExceptions" 238 VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-201 1"238 VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2012" 239 239 VALUE "OriginalFilename", "LogProcessExceptions.exe" 240 240 VALUE "ProductName", "Log Process Exceptions Utility" -
trunk/Utilities/LogProcessExceptions/MainWizard.h
r61 r64 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 12 // Copyright (C) Roman Ryltsov, 2008-2012 3 3 // Created by Roman Ryltsov roman@alax.info 4 4 // … … 11 11 #include <atlsecurity.h> 12 12 #include "AboutDialog.h" 13 #include "..\..\..\Repository-Private\Utilities\EmailTools\Message.h" 13 14 14 15 #if PSAPI_VERSION == 1 … … 869 870 CObjectPtr<CThread> m_pDebugThread; 870 871 UINT m_nExceptionIndex; 872 BOOL m_bSkipInitialException; 871 873 UINT m_nUserIndex; 874 CObjectPtr<CMessageQueue> m_pMessageQueue; 872 875 873 876 VOID UpdateButtons() throw() … … 940 943 _Z4(atlTraceGeneral, 4, _T(".ExceptionCode %d, .ExceptionFlags %d, .dwFirstChance %d\n"), DebugInformation.ExceptionRecord.ExceptionCode, DebugInformation.ExceptionRecord.ExceptionFlags, DebugInformation.dwFirstChance); 941 944 #pragma region Skip Initial Debugger Attachment Exception 942 if(DebugInformation.ExceptionRecord.ExceptionCode == 0x80000003 && !m_nExceptionIndex)945 if(DebugInformation.ExceptionRecord.ExceptionCode == 0x80000003 && m_bSkipInitialException) 943 946 { 944 AppendLog(AtlFormatString(_T("Skipping initial debugger attachment exception (0x%08x)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode)); 947 AppendLog(AtlFormatString(_T("Skipping initial debugger attachment exception (0x%08X)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode)); 948 m_bSkipInitialException = FALSE; 945 949 break; 946 950 } … … 950 954 if(DebugInformation.ExceptionRecord.ExceptionCode == 0x406D1388) 951 955 { 952 AppendLog(AtlFormatString(_T("Skipping thread name setting exception (0x%08 x)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode));956 AppendLog(AtlFormatString(_T("Skipping thread name setting exception (0x%08X)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode)); 953 957 break; 954 958 } 955 959 #pragma endregion 956 960 #pragma region Skip C++ Exceptions (Debug) 957 #if _DEVELOPMENT && FALSE 961 #if _DEVELOPMENT //&& FALSE 962 #if !defined(_WIN64) 958 963 COMPILER_MESSAGE("Debug: Skip C++ Exceptions") 959 964 if(DebugInformation.ExceptionRecord.ExceptionCode == 0xE06D7363) 960 965 { 961 AppendLog(AtlFormatString(_T("Skipping C++ exception (0x%08x)\r\n"), DebugInformation.ExceptionRecord.ExceptionCode)); 962 break; 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 } 963 987 } 988 #endif // !defined(_WIN64) 964 989 #endif // _DEVELOPMENT 965 990 #pragma endregion … … 982 1007 sName.AppendFormat(_T("%s-%d-%03d"), pszProcessFileName, nProcessIdentifier, m_nExceptionIndex++); 983 1008 sName.AppendFormat(_T("-%08x"), DebugInformation.ExceptionRecord.ExceptionCode); 1009 HRESULT nNativeExceptionCode = S_OK; 984 1010 if(DebugInformation.ExceptionRecord.ExceptionCode == 0xE06D7363 && DebugInformation.ExceptionRecord.NumberParameters >= 2) 985 1011 { 986 HRESULT nNativeExceptionCode = 0;987 1012 SIZE_T nReadDataSize = 0; 988 1013 if(ReadProcessMemory(Process, (const VOID*) DebugInformation.ExceptionRecord.ExceptionInformation[1], &nNativeExceptionCode, sizeof nNativeExceptionCode, &nReadDataSize)) … … 998 1023 __E(MiniDumpWriteDump(Process, nProcessIdentifier, File, Type, ExceptionPointers.ContextRecord ? &ExceptionInformation : NULL, NULL, NULL)); 999 1024 AppendLog(AtlFormatString(_T("Written exception minidump into file %s\r\n"), sName)); 1025 #pragma region Message Notification 1026 _ATLTRY 1027 { 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); 1065 } 1066 _ATLCATCHALL() 1067 { 1068 _Z_EXCEPTION(); 1069 } 1070 #pragma endregion 1000 1071 } 1001 1072 _ATLCATCHALL() … … 1099 1170 AppendLog(AtlFormatString(_T("Attaching to process %d (%s)...\r\n"), ProcessData.m_nIdentifier, ProcessData.GetFileName())); 1100 1171 EnableTokenDebugPrivilege(); 1172 m_bSkipInitialException = TRUE; 1101 1173 AttachDebug(); 1102 1174 } -
trunk/Utilities/LogProcessExceptions/stdafx.cpp
r61 r64 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 12 // Copyright (C) Roman Ryltsov, 2008-2012 3 3 // Created by Roman Ryltsov roman@alax.info 4 4 // -
trunk/Utilities/LogProcessExceptions/stdafx.h
r61 r64 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 12 // Copyright (C) Roman Ryltsov, 2008-2012 3 3 // Created by Roman Ryltsov roman@alax.info 4 4 //
Note: See TracChangeset
for help on using the changeset viewer.