summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-09-26 21:50:14 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-09-26 21:50:14 +0000
commit1cacabc4a97dc5303964161dc0e5d8fd53c6e036 (patch)
tree9acf55cb920e724b339b9c8547f0fed547c2d7cd /plugins/CrashDumper
parented4041f2807d8aadad1e9701675ede59d1d8e417 (diff)
Crash Dumper:
- Removed folders support for CrashLog directory (too dangerous and only available after all plugins have been loaded) - menus are created inside Load() PluginUpdater: - Replace obsioleted plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@10606 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CrashDumper')
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp110
-rw-r--r--plugins/CrashDumper/src/utils.cpp14
-rw-r--r--plugins/CrashDumper/src/utils.h1
3 files changed, 55 insertions, 70 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index dfbd7d3557..14e9da4972 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -23,14 +23,14 @@ int hLangpack;
HINSTANCE hInst;
DWORD mirandaVersion;
LCID packlcid;
-HANDLE hCrashLogFolder, hVerInfoFolder;
+//HANDLE hCrashLogFolder, hVerInfoFolder;
+HANDLE hVerInfoFolder;
TCHAR* vertxt;
TCHAR* profname;
TCHAR* profpath;
-TCHAR CrashLogFolder[MAX_PATH];
-TCHAR VersionInfoFolder[MAX_PATH];
+TCHAR CrashLogFolder[MAX_PATH], VersionInfoFolder[MAX_PATH];
bool servicemode;
bool clsdates;
@@ -156,9 +156,9 @@ static int FoldersPathChanged(WPARAM, LPARAM)
FOLDERSGETDATA fgd = { 0 };
fgd.cbSize = sizeof(FOLDERSGETDATA);
fgd.nMaxPathSize = MAX_PATH;
- fgd.szPathT = CrashLogFolder;
fgd.flags = FF_TCHAR;
- CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd);
+// fgd.szPathT = CrashLogFolder;
+// CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd);
fgd.szPathT = VersionInfoFolder;
CallService(MS_FOLDERS_GET_PATH, (WPARAM)hVerInfoFolder, (LPARAM)&fgd);
@@ -215,21 +215,66 @@ static int ModulesLoaded(WPARAM, LPARAM)
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
replaceStrT(profpath, _T("%miranda_userdata%"));
- hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder);
+ // Removed because it isn't available on Load()
+// hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder);
hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder);
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
FoldersPathChanged(0, 0);
}
+ SetExceptionHandler();
+
+ HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
+
+ if (servicemode)
+ ViewVersionInfo(0, 0);
+ else if (db_get_b(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
+ UploadVersionInfo(0, 0xa1);
+
+ return 0;
+}
+
+static int PreShutdown(WPARAM, LPARAM)
+{
+ DestroyAllWindows();
+ UploadClose();
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Load(void)
+{
+ if (LoadLibraryA("riched20.dll") == NULL)
+ return 1;
+
+ clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
+
+ dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 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);
mir_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
- SetExceptionHandler();
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- UploadInit();
+ packlcid = (LCID)Langpack_GetDefaultLocale();
+
+ InitIcons();
+
+ InitExceptionHandler();
+
+ CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
+ CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
+ CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo);
+ CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo);
+ CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl);
+ CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch);
CLISTMENUITEM mi = { sizeof(mi) };
mi.popupPosition = 2000089999;
@@ -302,53 +347,8 @@ static int ModulesLoaded(WPARAM, LPARAM)
hk.pszName = "ShowVerInfo";
hk.pszService = MS_CRASHDUMPER_VIEWINFO;
Hotkey_Register(&hk);
-
- if (servicemode)
- ViewVersionInfo(0, 0);
- else if (db_get_b(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
- UploadVersionInfo(0, 0xa1);
-
- CheckForOtherCrashReportingPlugins();
- return 0;
-}
-
-static int PreShutdown(WPARAM, LPARAM)
-{
- DestroyAllWindows();
- UploadClose();
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Load(void)
-{
- if (LoadLibraryA("riched20.dll") == NULL)
- return 1;
-
- clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
-
- dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 1) != 0;
- mir_getLP(&pluginInfoEx);
-
- profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
- profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
-
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
- HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
- packlcid = (LCID)Langpack_GetDefaultLocale();
-
- InitIcons();
-
- InitExceptionHandler();
-
- CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
- CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
- CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo);
- CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo);
- CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl);
- CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch);
+
+ UploadInit();
return 0;
}
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp
index 4a8feb88b0..83e99f25c9 100644
--- a/plugins/CrashDumper/src/utils.cpp
+++ b/plugins/CrashDumper/src/utils.cpp
@@ -23,20 +23,6 @@ static HINSTANCE hKernel = GetModuleHandleA("kernel32.dll");
typedef BOOL (WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
tGetProductInfo pGetProductInfo = (tGetProductInfo)GetProcAddress(hKernel, "GetProductInfo");
-void CheckForOtherCrashReportingPlugins(void)
-{
- HMODULE hModule = GetModuleHandle(TEXT("attache.dll"));
- if (hModule == NULL)
- hModule = GetModuleHandle(TEXT("crashrpt.dll"));
- if (hModule == NULL)
- hModule = GetModuleHandle(TEXT("crashdmp.dll"));
-
- if (hModule == NULL) return;
-
- MessageBox(NULL, TranslateT("More then one crash reporting plugin installed. This will result in inability of creating crash reports"),
- TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST);
-}
-
void GetOSDisplayString(CMString &buffer)
{
OSVERSIONINFOEX osvi = { 0 };
diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h
index cbb540b039..c02f89abd1 100644
--- a/plugins/CrashDumper/src/utils.h
+++ b/plugins/CrashDumper/src/utils.h
@@ -139,7 +139,6 @@ void InitExceptionHandler(void);
void DestroyExceptionHandler(void);
void SetExceptionHandler(void);
void RemoveExceptionHandler(void);
-void CheckForOtherCrashReportingPlugins(void);
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);