diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-12 18:36:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-12 18:36:38 +0300 |
commit | a70058727e91037ca532a52decbcc8c3aea2d03e (patch) | |
tree | 01a995fe17b4e80e7445948f086d72e2555d1998 /plugins/CrashDumper/src/exhndlr.cpp | |
parent | 83f3e1dee4b5b3a27a2ca5c177b4ecfd1b02411f (diff) |
CrashDumper:
- fixes #1186 (Hide DbChecker from VersionInfo);
- massive code cleaning;
- version bump
Diffstat (limited to 'plugins/CrashDumper/src/exhndlr.cpp')
-rw-r--r-- | plugins/CrashDumper/src/exhndlr.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 14cc07f3b0..32b4b224d1 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -47,30 +47,28 @@ int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)
{
wchar_t path[MAX_PATH];
- SYSTEMTIME st;
HANDLE hDumpFile = nullptr;
+ SYSTEMTIME st;
GetLocalTime(&st);
CreateDirectoryTreeW(CrashLogFolder);
__try {
if (dtsubfldr) {
- mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_snwprintf(path, L"%s\\%02d.%02d.%02d", CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, nullptr);
- mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_snwprintf(path, L"%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_snwprintf(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);
+ mir_snwprintf(path, L"%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, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDumpFile != INVALID_HANDLE_VALUE)
CreateMiniDump(hDumpFile, exc_ptr);
else if (GetLastError() != ERROR_ALREADY_EXISTS)
- MessageBox(nullptr, TranslateT("Crash Report write location is not available"),
- TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
-
+ MessageBox(nullptr, TranslateT("Crash Report write location is not available"), L"Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -78,18 +76,19 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) bool empty = GetFileSize(hDumpFile, nullptr) == 0;
CloseHandle(hDumpFile);
- if (empty) DeleteFile(path);
+ if (empty)
+ DeleteFile(path);
__try {
if (dtsubfldr) {
- mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_snwprintf(path, L"%s\\%02d.%02d.%02d", CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, nullptr);
- mir_snwprintf(path, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_snwprintf(path, L"%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_snwprintf(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);
+ else
+ mir_snwprintf(path, L"%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, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
@@ -100,27 +99,29 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) }
__except (myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {}
- bool empty1 = GetFileSize(hDumpFile, nullptr) == 0;
+ empty = GetFileSize(hDumpFile, nullptr) == 0;
CloseHandle(hDumpFile);
- if (empty1) DeleteFile(path);
+ if (empty)
+ DeleteFile(path);
}
LONG WINAPI myfilter(PEXCEPTION_POINTERS exc_ptr)
{
- if (exc_ptr == lastptr) return EXCEPTION_EXECUTE_HANDLER;
+ if (exc_ptr == lastptr)
+ return EXCEPTION_EXECUTE_HANDLER;
+
lastptr = exc_ptr;
-
myfilterWorker(exc_ptr, true);
-
return exchndlr ? ((LPTOP_LEVEL_EXCEPTION_FILTER)exchndlr)(exc_ptr) : EXCEPTION_CONTINUE_SEARCH;
}
LONG WINAPI myfilterv(PEXCEPTION_POINTERS exc_ptr)
{
if (0xC0000000L <= exc_ptr->ExceptionRecord->ExceptionCode && 0xC0000500L >= exc_ptr->ExceptionRecord->ExceptionCode) {
- if (exc_ptr == lastptr) return EXCEPTION_EXECUTE_HANDLER;
+ if (exc_ptr == lastptr)
+ return EXCEPTION_EXECUTE_HANDLER;
+
lastptr = exc_ptr;
-
myfilterWorker(exc_ptr, true);
}
return EXCEPTION_CONTINUE_SEARCH;
|