From 86aeba4cc39e3179341f7899ecf4d7e77f28ed30 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Sep 2013 20:07:53 +0000 Subject: fix for broken VS2012 headers git-svn-id: http://svn.miranda-ng.org/main/trunk@6049 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/exhndlr.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'plugins/CrashDumper') 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(); } - -- cgit v1.2.3