diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-11-08 13:47:14 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-11-08 13:47:14 +0000 |
commit | 631784c6fc67761742280e1fb876867bc1bb50fe (patch) | |
tree | 35e5c44553899e45dbb5364fbf47d1a7162976ed /plugins/CrashDumper/src | |
parent | 0bf13f208abe2713455ba8e2d9ffb752233fcc24 (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')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 42 | ||||
-rw-r--r-- | plugins/CrashDumper/src/resource.h | 4 | ||||
-rw-r--r-- | plugins/CrashDumper/src/ui.cpp | 25 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.h | 6 |
4 files changed, 46 insertions, 31 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;
}
diff --git a/plugins/CrashDumper/src/resource.h b/plugins/CrashDumper/src/resource.h index 83d8a491e4..ae5e2e260f 100644 --- a/plugins/CrashDumper/src/resource.h +++ b/plugins/CrashDumper/src/resource.h @@ -18,6 +18,8 @@ #define IDC_UPLOADCHN 1008
#define IDC_CLASSICDATES 1009
#define IDC_DATESUBFOLDER 1010
+#define IDC_CATCHCRASHES 1011
+#define IDC_RESTARTNOTE 1012
#define IDM_COPY 40002
#define IDM_COPYALL 40003
#define IDM_SELECTALL 40004
@@ -28,7 +30,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40005
-#define _APS_NEXT_CONTROL_VALUE 1011
+#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 5566165478..2619ac0e5c 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -202,10 +202,26 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CheckDlgButton(hwndDlg, IDC_UPLOADCHN, db_get_b(NULL, PluginName, "UploadChanged", 0));
CheckDlgButton(hwndDlg, IDC_CLASSICDATES, clsdates);
CheckDlgButton(hwndDlg, IDC_DATESUBFOLDER, dtsubfldr);
+ CheckDlgButton(hwndDlg, IDC_CATCHCRASHES, catchcrashes);
+ if (needrestart)
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RESTARTNOTE), SW_SHOW);
}
break;
case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CATCHCRASHES:
+ if (IsDlgButtonChecked(hwndDlg, IDC_CATCHCRASHES)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLASSICDATES), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATESUBFOLDER), TRUE);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLASSICDATES), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DATESUBFOLDER), FALSE);
+ }
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RESTARTNOTE), SW_SHOW);
+ needrestart = 1;
+ }
if ((HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -225,12 +241,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (clsdates)
db_set_b(NULL, PluginName, "ClassicDates", 1);
else
- db_unset(NULL, PluginName, "ClassicDates");
+ db_set_b(NULL, PluginName, "ClassicDates", 0);
dtsubfldr = IsDlgButtonChecked(hwndDlg, IDC_DATESUBFOLDER) == BST_CHECKED;
if (dtsubfldr)
db_set_b(NULL, PluginName, "SubFolders", 1);
else
- db_unset(NULL, PluginName, "SubFolders");
+ db_set_b(NULL, PluginName, "SubFolders", 0);
+ catchcrashes = IsDlgButtonChecked(hwndDlg, IDC_CATCHCRASHES) == BST_CHECKED;
+ if (catchcrashes)
+ db_set_b(NULL, PluginName, "CatchCrashes", 1);
+ else
+ db_set_b(NULL, PluginName, "CatchCrashes", 0);
}
break;
}
diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index c02f89abd1..c538506f2e 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -66,8 +66,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. -#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
-
#define MS_CRASHDUMPER_STORETOFILE "CrashDmp/StoreVerInfoToFile"
#define MS_CRASHDUMPER_STORETOCLIP "CrashDmp/StoreVerInfoToClip"
#define MS_CRASHDUMPER_GETINFO "Versioninfo/GetInfo"
@@ -91,9 +89,7 @@ struct VerTrnsfr extern HMODULE hInst;
extern DWORD mirandaVersion;
extern LCID packlcid;
-extern bool servicemode;
-extern bool clsdates;
-extern bool dtsubfldr;
+extern bool servicemode, clsdates, dtsubfldr, catchcrashes, needrestart;
extern TCHAR CrashLogFolder[MAX_PATH];
extern TCHAR VersionInfoFolder[MAX_PATH];
|