summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper
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
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')
-rw-r--r--plugins/CrashDumper/crshdmp_12.vcxproj7
-rw-r--r--plugins/CrashDumper/crshdmp_12.vcxproj.filters20
-rw-r--r--plugins/CrashDumper/res/crshdmp.rc23
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp42
-rw-r--r--plugins/CrashDumper/src/resource.h4
-rw-r--r--plugins/CrashDumper/src/ui.cpp25
-rw-r--r--plugins/CrashDumper/src/utils.h6
7 files changed, 86 insertions, 41 deletions
diff --git a/plugins/CrashDumper/crshdmp_12.vcxproj b/plugins/CrashDumper/crshdmp_12.vcxproj
index a7ddcc80af..895acadfe6 100644
--- a/plugins/CrashDumper/crshdmp_12.vcxproj
+++ b/plugins/CrashDumper/crshdmp_12.vcxproj
@@ -219,6 +219,13 @@
<ResourceCompile Include="res\crshdmp.rc" />
<ResourceCompile Include="res\Version.rc" />
</ItemGroup>
+ <ItemGroup>
+ <Image Include="res\Vi show.ico" />
+ <Image Include="res\Vi to clipboard.ico" />
+ <Image Include="res\Vi to file.ico" />
+ <Image Include="res\Vi upload.ico" />
+ <Image Include="res\Vi.ico" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/plugins/CrashDumper/crshdmp_12.vcxproj.filters b/plugins/CrashDumper/crshdmp_12.vcxproj.filters
index 00edb7103a..aa2111816c 100644
--- a/plugins/CrashDumper/crshdmp_12.vcxproj.filters
+++ b/plugins/CrashDumper/crshdmp_12.vcxproj.filters
@@ -58,5 +58,25 @@
<Filter Include="Source Files">
<UniqueIdentifier>{62e505d1-3764-4225-b4dd-cf2341c4f783}</UniqueIdentifier>
</Filter>
+ <Filter Include="Resource Files\Icons">
+ <UniqueIdentifier>{4ac2fffa-c726-460d-a233-b057b4367069}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="res\Vi show.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
+ <Image Include="res\Vi to clipboard.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
+ <Image Include="res\Vi to file.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
+ <Image Include="res\Vi upload.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
+ <Image Include="res\Vi.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/CrashDumper/res/crshdmp.rc b/plugins/CrashDumper/res/crshdmp.rc
index 13fdee8606..899acc5584 100644
--- a/plugins/CrashDumper/res/crshdmp.rc
+++ b/plugins/CrashDumper/res/crshdmp.rc
@@ -8,8 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
-#include "richedit.h"
-
+#include "richedit.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -36,7 +35,7 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
- "#include ""richedit.h""\r\n"
+ "#include ""richedit.h""\r\0"
END
3 TEXTINCLUDE
@@ -63,7 +62,7 @@ BEGIN
CONTROL "",IDC_VIEWVERSIONINFO,RICHEDIT_CLASS,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,7,7,361,203,WS_EX_CLIENTEDGE
END
-IDD_OPTIONS DIALOGEX 0, 0, 209, 163
+IDD_OPTIONS DIALOGEX 0, 0, 209, 179
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -74,9 +73,12 @@ BEGIN
LTEXT "Password",IDC_STATIC,14,52,107,8
EDITTEXT IDC_PASSWORD,14,65,107,14,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Upload automatically when changed",IDC_UPLOADCHN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,84,161,10
- GROUPBOX "General",IDC_STATIC,7,104,195,42
- CONTROL "Use classic dates",IDC_CLASSICDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,118,157,10
- CONTROL "Create reports in subfolders naming as current date",IDC_DATESUBFOLDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,132,180,10
+ GROUPBOX "Crash reports",IDC_STATIC,7,104,195,54
+ CONTROL "Use classic dates",IDC_CLASSICDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,127,157,10
+ CONTROL "Create reports in subfolders naming as current date",IDC_DATESUBFOLDER,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,141,180,10
+ CONTROL "Catch crashes",IDC_CATCHCRASHES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,113,169,10
+ LTEXT "* You need to restart Miranda NG to apply changes",IDC_RESTARTNOTE,9,160,186,8,NOT WS_VISIBLE
END
@@ -86,7 +88,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_VIEWVERSION, DIALOG
BEGIN
@@ -101,7 +103,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 202
TOPMARGIN, 7
- BOTTOMMARGIN, 147
+ BOTTOMMARGIN, 173
END
END
#endif // APSTUDIO_INVOKED
@@ -112,7 +114,7 @@ END
// Menu
//
-IDR_CONTEXT MENU
+IDR_CONTEXT MENU
BEGIN
POPUP "View"
BEGIN
@@ -146,6 +148,7 @@ IDI_VIUPLOAD ICON "Vi upload.ico"
//
// Generated from the TEXTINCLUDE 3 resource.
//
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
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];