diff options
Diffstat (limited to 'plugins/CrashDumper/src/exhndlr.cpp')
-rw-r--r-- | plugins/CrashDumper/src/exhndlr.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 7876389280..f39e955e64 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -1,10 +1,14 @@ #include "utils.h"
+#ifndef FACILITY_VISUALCPP
+ #define FACILITY_VISUALCPP ((LONG)0x6d)
+#endif
+
static PVOID exchndlr, exchndlrv;
static pfnExceptionFilter threadfltr;
static PEXCEPTION_POINTERS lastptr;
-static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
+static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
tAddVectoredExceptionHandler pAddVectoredExceptionHandler = (tAddVectoredExceptionHandler)GetProcAddress(hKernel, "AddVectoredExceptionHandler");
tRemoveVectoredExceptionHandler pRemoveVectoredExceptionHandler = (tRemoveVectoredExceptionHandler)GetProcAddress(hKernel, "RemoveVectoredExceptionHandler");
@@ -69,51 +73,51 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) GetLocalTime(&st);
CreateDirectoryTree(CrashLogFolder);
- __try
+ __try
{
if (dtsubfldr)
{
mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
{
- mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hDumpFile != INVALID_HANDLE_VALUE)
+ if (hDumpFile != INVALID_HANDLE_VALUE)
CreateMiniDump(hDumpFile, exc_ptr);
else if (GetLastError() != ERROR_ALREADY_EXISTS)
MessageBox(NULL, TranslateT("Crash Report write location is inaccesible"),
TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
- }
+ }
__except(EXCEPTION_EXECUTE_HANDLER) {}
bool empty = GetFileSize(hDumpFile, NULL) == 0;
CloseHandle(hDumpFile);
if (empty) DeleteFile(path);
- __try
+ __try
{
if (dtsubfldr)
{
mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
{
- mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- mir_sntprintf(path, MAX_PATH, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
+ mir_sntprintf(path, MAX_PATH, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
if (hDumpFile != INVALID_HANDLE_VALUE)
CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL);
@@ -203,4 +207,3 @@ void DestroyExceptionHandler(void) Miranda_SetExceptFilter(threadfltr);
RemoveExceptionHandler();
}
-
|