diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-22 06:41:04 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-22 06:41:04 +0000 |
commit | de1292e9f4e979e70c568eb2247cefbdf470fcec (patch) | |
tree | febb0d287e86875d9481ec003892744e7eb07bc6 | |
parent | 9ec2ba379f413bc3817a49f374c5faa1ee23c01a (diff) |
Svc_crshdmp - patch from Mataes
git-svn-id: http://svn.miranda-ng.org/main/trunk@126 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Svc_crshdmp/crshdmp.cpp | 94 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/crshdmp.rc | 5 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/dumper.cpp | 4 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/exhndlr.cpp | 34 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/resource.h | 3 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/ui.cpp | 6 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/utils.h | 1 |
7 files changed, 99 insertions, 48 deletions
diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 76b0d94715..6818b9dad6 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -37,25 +37,27 @@ HMODULE hRichModule; TCHAR* vertxt;
TCHAR* profname;
TCHAR* profpath;
+TCHAR* mirpath;
TCHAR CrashLogFolder[MAX_PATH];
TCHAR VersionInfoFolder[MAX_PATH];
bool servicemode;
bool clsdates;
+bool dtsubfldr;
static const PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
#if defined(_WIN64)
- "Crash Dumper x64",
+ "Crash Dumper (x64) Mataes Release",
#elif defined(_UNICODE)
- "Crash Dumper Unicode",
+ "Crash Dumper (Unicode) Mataes Release",
#else
- "Crash Dumper",
+ "Crash Dumper Mataes Release",
#endif
__VERSION_DWORD,
- "Crash Dumper for Miranda IM",
+ "Crash Dumper for Miranda IM. Mod for Mataes Pack.",
"borkra",
"borkra@miranda-im.org",
"Copyright© 2008 - 2012 Boris Krasnovskiy All Rights Reserved",
@@ -265,6 +267,39 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM) static int ModulesLoaded(WPARAM, LPARAM)
{
+ char temp[MAX_PATH];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp);
+ crs_a2t(vertxt, temp);
+
+ if (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(0,9,0,12))
+ {
+ profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
+ if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
+ {
+ profpath = _T("%miranda_userdata%");
+ mirpath = _T("%miranda_path%");
+ }
+ else
+ {
+ profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
+ mirpath = Utils_ReplaceVarsT(_T("%miranda_path%"));
+ }
+ }
+ else
+ {
+ CallService(MS_DB_GETPROFILENAME, SIZEOF(temp), (LPARAM)temp);
+ crs_a2t(profname, temp);
+
+ CallService(MS_DB_GETPROFILEPATH, SIZEOF(temp), (LPARAM)temp);
+ crs_a2t(profpath, temp);
+
+ CallService(MS_DB_GETPROFILEPATH, SIZEOF(temp), (LPARAM)temp);
+ crs_a2t(mirpath, temp);
+ }
+
+ crs_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
+ crs_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), mirpath);
+
SetExceptionHandler();
hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, "Crash Reports", CrashLogFolder);
@@ -288,57 +323,57 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.popupPosition = 2000089999;
mi.position = 2000089999;
- mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
+ mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.icolibItem = GetIconHandle("versionInfo");
- mi.pszName = LPGEN("Version Information");
+ mi.ptszName = LPGENT("Version Information");
mi.pszPopupName = (char *)-1;
HANDLE hMenuRoot = (HANDLE)CallService( MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
- mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB;
+ mi.flags = CMIF_CHILDPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.pszPopupName = (char *)hMenuRoot;
mi.popupPosition = 0;
mi.position = 2000089995;
- mi.pszName = LPGEN("Copy to clipboard");
+ mi.ptszName = LPGENT("Copy to clipboard");
mi.icolibItem = GetIconHandle("storeToClip");
mi.pszService = MS_CRASHDUMPER_STORETOCLIP;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.position = 2000089996;
- mi.pszName = LPGEN("Store to file");
+ mi.ptszName = LPGENT("Store to file");
mi.icolibItem = GetIconHandle("storeToFile");
mi.pszService = MS_CRASHDUMPER_STORETOFILE;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.position = 2000089997;
- mi.pszName = LPGEN("Show");
+ mi.ptszName = LPGENT("Show");
mi.icolibItem = GetIconHandle("showInfo");
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.popupPosition = 1;
mi.position = 2000089998;
- mi.pszName = LPGEN("Show with DLLs");
+ mi.ptszName = LPGENT("Show with DLLs");
mi.icolibItem = GetIconHandle("showInfo");
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.popupPosition = 0;
mi.position = 2000089999;
- mi.pszName = LPGEN("Upload");
+ mi.ptszName = LPGENT("Upload");
mi.icolibItem = GetIconHandle("uploadInfo");
mi.pszService = MS_CRASHDUMPER_UPLOAD;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.position = 2000099990;
- mi.pszName = LPGEN("Open crash report directory");
+ mi.ptszName = LPGENT("Open crash report directory");
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
mi.pszService = MS_CRASHDUMPER_URL;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.popupPosition = 1;
mi.position = 2000099991;
- mi.pszName = LPGEN("Open miranda-vi.org");
+ mi.ptszName = LPGENT("Open miranda-vi.org");
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_URL);
mi.pszService = MS_CRASHDUMPER_URL;
CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
@@ -388,7 +423,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) {
pluginLink = link;
- clsdates = DBGetContactSettingByte(NULL, PluginName, "ClassicDates", 0) != 0;
+ clsdates = DBGetContactSettingByte(NULL, PluginName, "ClassicDates", 1) != 0;
+
+ dtsubfldr = DBGetContactSettingByte(NULL, PluginName, "SubFolders", 1) != 0;
mir_getMMI(&mmi);
mir_getMD5I(&md5i);
@@ -404,27 +441,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) InitIcons();
- char temp[MAX_PATH];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp);
- crs_a2t(vertxt, temp);
-
- if (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(0,9,0,12))
- {
- profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
- profpath = Utils_ReplaceVarsT(_T("%miranda_profile%\\%miranda_profilename%"));
- }
- else
- {
- CallService(MS_DB_GETPROFILENAME, SIZEOF(temp), (LPARAM)temp);
- crs_a2t(profname, temp);
-
- CallService(MS_DB_GETPROFILEPATH, SIZEOF(temp), (LPARAM)temp);
- crs_a2t(profpath, temp);
- }
-
- crs_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
- crs_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
-
InitExceptionHandler();
hServices[0] = CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
@@ -448,7 +464,11 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyExceptionHandler();
- mir_free(profpath);
+ if (!_tcsstr(profpath, _T("%miranda")))
+ {
+ mir_free(profpath);
+ mir_free(mirpath);
+ }
mir_free(profname);
mir_free(vertxt);
diff --git a/plugins/Svc_crshdmp/crshdmp.rc b/plugins/Svc_crshdmp/crshdmp.rc index 116ccda9be..ca4c05bbb3 100644 --- a/plugins/Svc_crshdmp/crshdmp.rc +++ b/plugins/Svc_crshdmp/crshdmp.rc @@ -65,7 +65,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, 154
+IDD_OPTIONS DIALOGEX 0, 0, 209, 163
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -76,8 +76,9 @@ 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,39
+ 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
END
diff --git a/plugins/Svc_crshdmp/dumper.cpp b/plugins/Svc_crshdmp/dumper.cpp index f2f7f43930..2d6a0a5f1a 100644 --- a/plugins/Svc_crshdmp/dumper.cpp +++ b/plugins/Svc_crshdmp/dumper.cpp @@ -517,8 +517,10 @@ void PrintVersionInfo(bkstring& buffer, unsigned flags) TCHAR profpn[MAX_PATH];
crs_sntprintf(profpn, sizeof(profpn), TEXT("%s\\%s"), profpath, profname);
+ TCHAR* tszFolder = Utils_ReplaceVarsT(profpn);
- buffer.appendfmt(TEXT("Profile: %s\r\n"), profpn);
+ buffer.appendfmt(TEXT("Profile: %s\r\n"), tszFolder);
+ mir_free(tszFolder);
if (flags & VI_FLAG_PRNVAR)
{
diff --git a/plugins/Svc_crshdmp/exhndlr.cpp b/plugins/Svc_crshdmp/exhndlr.cpp index 84432e82e4..93406efaa8 100644 --- a/plugins/Svc_crshdmp/exhndlr.cpp +++ b/plugins/Svc_crshdmp/exhndlr.cpp @@ -64,7 +64,7 @@ int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify)
{
TCHAR path[MAX_PATH];
- SYSTEMTIME st;
+ SYSTEMTIME st;
HANDLE hDumpFile = NULL;
GetLocalTime(&st);
@@ -72,8 +72,18 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
- st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
+ if (dtsubfldr)
+ {
+ crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ CreateDirectory(path, NULL);
+ crs_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
+ {
+ crs_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)
CreateMiniDump(hDumpFile, exc_ptr);
@@ -90,15 +100,25 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) __try
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
- st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
+ if (dtsubfldr)
+ {
+ crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ CreateDirectory(path, NULL);
+ crs_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
+ {
+ crs_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);
crs_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)
+ if (hDumpFile != INVALID_HANDLE_VALUE)
CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL);
- }
+ }
__except(myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {}
bool empty1 = GetFileSize(hDumpFile, NULL) == 0;
diff --git a/plugins/Svc_crshdmp/resource.h b/plugins/Svc_crshdmp/resource.h index 7a81e83648..83d8a491e4 100644 --- a/plugins/Svc_crshdmp/resource.h +++ b/plugins/Svc_crshdmp/resource.h @@ -17,6 +17,7 @@ #define IDC_PASSWORD 1007
#define IDC_UPLOADCHN 1008
#define IDC_CLASSICDATES 1009
+#define IDC_DATESUBFOLDER 1010
#define IDM_COPY 40002
#define IDM_COPYALL 40003
#define IDM_SELECTALL 40004
@@ -27,7 +28,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40005
-#define _APS_NEXT_CONTROL_VALUE 1010
+#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/Svc_crshdmp/ui.cpp b/plugins/Svc_crshdmp/ui.cpp index 8eb1e048f2..6aa37a72bd 100644 --- a/plugins/Svc_crshdmp/ui.cpp +++ b/plugins/Svc_crshdmp/ui.cpp @@ -226,6 +226,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
CheckDlgButton(hwndDlg, IDC_UPLOADCHN, DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0));
CheckDlgButton(hwndDlg, IDC_CLASSICDATES, clsdates);
+ CheckDlgButton(hwndDlg, IDC_DATESUBFOLDER, dtsubfldr);
}
break;
@@ -253,6 +254,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBWriteContactSettingByte(NULL, PluginName, "ClassicDates", 1);
else
DBDeleteContactSetting(NULL, PluginName, "ClassicDates");
+ dtsubfldr = IsDlgButtonChecked(hwndDlg, IDC_DATESUBFOLDER) == BST_CHECKED;
+ if (dtsubfldr)
+ DBWriteContactSettingByte(NULL, PluginName, "SubFolders", 1);
+ else
+ DBDeleteContactSetting(NULL, PluginName, "SubFolders");
}
break;
}
diff --git a/plugins/Svc_crshdmp/utils.h b/plugins/Svc_crshdmp/utils.h index 88a903c028..06770ae9b5 100644 --- a/plugins/Svc_crshdmp/utils.h +++ b/plugins/Svc_crshdmp/utils.h @@ -116,6 +116,7 @@ extern DWORD mirandaVersion; extern LCID packlcid;
extern bool servicemode;
extern bool clsdates;
+extern bool dtsubfldr;
extern TCHAR CrashLogFolder[MAX_PATH];
extern TCHAR VersionInfoFolder[MAX_PATH];
|