summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper/src/crshdmp.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-11-08 13:47:14 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-11-08 13:47:14 +0000
commit631784c6fc67761742280e1fb876867bc1bb50fe (patch)
tree35e5c44553899e45dbb5364fbf47d1a7162976ed /plugins/CrashDumper/src/crshdmp.cpp
parent0bf13f208abe2713455ba8e2d9ffb752233fcc24 (diff)
added option to enable\diable catching exaptions
git-svn-id: http://svn.miranda-ng.org/main/trunk@10924 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CrashDumper/src/crshdmp.cpp')
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp42
1 files changed, 19 insertions, 23 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index a6f68eeb21..0389f03a53 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -32,9 +32,7 @@ TCHAR* profpath;
TCHAR CrashLogFolder[MAX_PATH], VersionInfoFolder[MAX_PATH];
-bool servicemode;
-bool clsdates;
-bool dtsubfldr;
+bool servicemode, clsdates, dtsubfldr, catchcrashes, needrestart = 0;
extern HWND hViewWnd;
@@ -268,11 +266,13 @@ static int ModulesLoaded(WPARAM, LPARAM)
mi.pszService = MS_CRASHDUMPER_UPLOAD;
Menu_AddMainMenuItem(&mi);
- mi.position = 2000099990;
- mi.ptszName = LPGENT("Open crash report directory");
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
- mi.pszService = MS_CRASHDUMPER_URL;
- Menu_AddMainMenuItem(&mi);
+ if (catchcrashes && !needrestart) {
+ mi.position = 2000099990;
+ mi.ptszName = LPGENT("Open crash report directory");
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
+ mi.pszService = MS_CRASHDUMPER_URL;
+ Menu_AddMainMenuItem(&mi);
+ }
mi.popupPosition = 1;
mi.position = 2000099991;
@@ -297,7 +297,8 @@ static int ModulesLoaded(WPARAM, LPARAM)
UploadInit();
- SetExceptionHandler();
+ if (catchcrashes && !needrestart)
+ SetExceptionHandler();
HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
@@ -322,13 +323,15 @@ extern "C" int __declspec(dllexport) Load(void)
return 1;
clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
-
dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 1) != 0;
+ catchcrashes = db_get_b(NULL, PluginName, "CatchCrashes", 1) != 0;
+
mir_getLP(&pluginInfoEx);
profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- mir_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
+ if (catchcrashes && !needrestart)
+ mir_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
mir_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
@@ -340,7 +343,8 @@ extern "C" int __declspec(dllexport) Load(void)
InitIcons();
- InitExceptionHandler();
+ if (catchcrashes && !needrestart)
+ InitExceptionHandler();
CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
@@ -355,7 +359,8 @@ extern "C" int __declspec(dllexport) Unload(void)
{
DestroyAllWindows();
- DestroyExceptionHandler();
+ if ((catchcrashes && !needrestart) || (!catchcrashes && needrestart))
+ DestroyExceptionHandler();
mir_free(profpath);
mir_free(profname);
@@ -365,15 +370,6 @@ extern "C" int __declspec(dllexport) Unload(void)
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/)
{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hinstDLL);
- hInst = hinstDLL;
- break;
-
- case DLL_PROCESS_DETACH:
- break;
- }
-
+ hInst = hinstDLL;
return TRUE;
}