summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CrashDumper')
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp4
-rw-r--r--plugins/CrashDumper/src/exhndlr.cpp20
-rw-r--r--plugins/CrashDumper/src/sdkstuff.h12
-rw-r--r--plugins/CrashDumper/src/utils.cpp77
4 files changed, 15 insertions, 98 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index beccc35107..cd4aed83a5 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -24,7 +24,6 @@ HINSTANCE hInst;
DWORD mirandaVersion;
LCID packlcid;
HANDLE hCrashLogFolder, hVerInfoFolder;
-HMODULE hRichModule;
TCHAR* vertxt;
TCHAR* profname;
@@ -128,8 +127,6 @@ INT_PTR UploadVersionInfo(WPARAM, LPARAM lParam)
INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM)
{
- if (hRichModule == NULL && GetModuleHandle(TEXT("Riched20.dll")) == NULL)
- hRichModule = LoadLibrary(TEXT("Riched20.dll"));
if(hViewWnd)
{
SetForegroundWindow(hViewWnd);
@@ -368,7 +365,6 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
DestroyAllWindows();
- FreeLibrary(hRichModule);
DestroyExceptionHandler();
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp
index cee6cb283c..305172a7c8 100644
--- a/plugins/CrashDumper/src/exhndlr.cpp
+++ b/plugins/CrashDumper/src/exhndlr.cpp
@@ -8,23 +8,15 @@ static PVOID exchndlr, exchndlrv;
static pfnExceptionFilter threadfltr;
static PEXCEPTION_POINTERS lastptr;
-static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
-
-tAddVectoredExceptionHandler pAddVectoredExceptionHandler = (tAddVectoredExceptionHandler)GetProcAddress(hKernel, "AddVectoredExceptionHandler");
-tRemoveVectoredExceptionHandler pRemoveVectoredExceptionHandler = (tRemoveVectoredExceptionHandler)GetProcAddress(hKernel, "RemoveVectoredExceptionHandler");
-tRtlCaptureContext pRtlCaptureContext = (tRtlCaptureContext)GetProcAddress(hKernel, "RtlCaptureContext");
-
void SetExceptionHandler(void)
{
-// if (pAddVectoredExceptionHandler && !exchndlrv)
-// exchndlrv = pAddVectoredExceptionHandler(0, myfilterv);
exchndlr = SetUnhandledExceptionFilter(myfilter);
}
void RemoveExceptionHandler(void)
{
- if (pRemoveVectoredExceptionHandler && exchndlrv)
- pRemoveVectoredExceptionHandler(exchndlrv);
+ if (exchndlrv)
+ RemoveVectoredExceptionHandler(exchndlrv);
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exchndlr);
exchndlr = NULL;
exchndlrv = NULL;
@@ -163,13 +155,7 @@ void InvalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*, uns
CONTEXT ContextRecord = {0};
EXCEPTION_POINTERS info = { &ExceptionRecord, &ContextRecord };
- if (pRtlCaptureContext)
- pRtlCaptureContext(&ContextRecord);
- else
- {
- ContextRecord.ContextFlags = CONTEXT_ALL;
- GetThreadContext(GetCurrentThread(), &ContextRecord);
- }
+ RtlCaptureContext(&ContextRecord);
#if defined(_AMD64_)
ExceptionRecord.ExceptionAddress = (PVOID)ContextRecord.Rip;
diff --git a/plugins/CrashDumper/src/sdkstuff.h b/plugins/CrashDumper/src/sdkstuff.h
index 4d160118fc..b1d8a5ad57 100644
--- a/plugins/CrashDumper/src/sdkstuff.h
+++ b/plugins/CrashDumper/src/sdkstuff.h
@@ -104,15 +104,3 @@ typedef struct _IMAGEHLP_MODULEW64_V2 {
#ifdef DBGHELP_TRANSLATE_TCHAR
#define IMAGEHLP_MODULE64_V2 IMAGEHLP_MODULEW64_V2
#endif
-
-typedef void (WINAPI *tGetNativeSystemInfo)(LPSYSTEM_INFO);
-typedef BOOL (WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
-typedef BOOL (WINAPI *tGlobalMemoryStatusEx)(LPMEMORYSTATUSEX lpBuffer);
-typedef BOOL (WINAPI *tGetDiskFreeSpaceEx)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
-typedef LANGID (WINAPI *tGetUserDefaultUILanguage)(void);
-typedef LANGID (WINAPI *tGetSystemDefaultUILanguage)(void);
-typedef BOOL (WINAPI *tIsWow64Process)(HANDLE, PBOOL);
-typedef PVOID (WINAPI *tAddVectoredExceptionHandler)(ULONG FirstHandler, PVECTORED_EXCEPTION_HANDLER VectoredHandler);
-typedef ULONG (WINAPI *tRemoveVectoredExceptionHandler)(PVOID Handler);
-typedef BOOL (WINAPI *tIsProcessorFeaturePresent)(DWORD ProcessorFeature);
-typedef VOID (WINAPI *tRtlCaptureContext)(PCONTEXT ContextRecord);
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp
index 87dbe25725..13102434c3 100644
--- a/plugins/CrashDumper/src/utils.cpp
+++ b/plugins/CrashDumper/src/utils.cpp
@@ -18,21 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h"
-static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
-
-tGetNativeSystemInfo pGetNativeSystemInfo = (tGetNativeSystemInfo)GetProcAddress(hKernel, "GetNativeSystemInfo");
-tGetProductInfo pGetProductInfo = (tGetProductInfo) GetProcAddress(hKernel, "GetProductInfo");
-tGlobalMemoryStatusEx pGlobalMemoryStatusEx = (tGlobalMemoryStatusEx) GetProcAddress(hKernel, "GlobalMemoryStatusEx");
-tGetUserDefaultUILanguage pGetUserDefaultUILanguage = (tGetUserDefaultUILanguage) GetProcAddress(hKernel, "GetUserDefaultUILanguage");
-tGetSystemDefaultUILanguage pGetSystemDefaultUILanguage = (tGetSystemDefaultUILanguage) GetProcAddress(hKernel, "GetSystemDefaultUILanguage");
-tIsWow64Process pIsWow64Process = (tIsWow64Process) GetProcAddress(hKernel, "IsWow64Process");
-tIsProcessorFeaturePresent pIsProcessorFeaturePresent = (tIsProcessorFeaturePresent) GetProcAddress(hKernel, "IsProcessorFeaturePresent");
-
-
-tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExW");
-
-
-
void CheckForOtherCrashReportingPlugins(void)
{
HMODULE hModule = GetModuleHandle(TEXT("attache.dll"));
@@ -64,10 +49,7 @@ void GetOSDisplayString(bkstring& buffer)
return;
}
- // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
- pGetNativeSystemInfo = (tGetNativeSystemInfo)GetProcAddress(hKernel, "GetNativeSystemInfo");
- if (NULL != pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
- else GetSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4)
{
@@ -100,8 +82,7 @@ void GetOSDisplayString(bkstring& buffer)
break;
}
- pGetProductInfo = (tGetProductInfo) GetProcAddress(hKernel, "GetProductInfo");
- if (pGetProductInfo != NULL) pGetProductInfo(6, 0, 0, 0, &dwType);
+ GetProductInfo(6, 0, 0, 0, &dwType);
switch(dwType)
{
@@ -472,7 +453,7 @@ void GetProcessorString(bkstring& buffer)
TrimMultiSpaces(cpuName);
buffer.appendfmt(TEXT("CPU: %s [%s]"), cpuName, cpuIdent);
- if (pIsProcessorFeaturePresent && pIsProcessorFeaturePresent(PF_NX_ENABLED))
+ if (IsProcessorFeaturePresent(PF_NX_ENABLED))
buffer.append(TEXT(" [DEP Enabled]"));
SYSTEM_INFO si = {0};
@@ -485,40 +466,17 @@ void GetProcessorString(bkstring& buffer)
void GetFreeMemoryString(bkstring& buffer)
{
unsigned ram;
- if (pGlobalMemoryStatusEx)
- {
- MEMORYSTATUSEX ms = {0};
- ms.dwLength = sizeof(ms);
- pGlobalMemoryStatusEx(&ms);
- ram = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
- }
- else
- {
- MEMORYSTATUS ms = {0};
- ZeroMemory(&ms, sizeof(ms));
- ms.dwLength = sizeof(ms);
- GlobalMemoryStatus(&ms);
- ram = (unsigned int)(ms.dwTotalPhys/(1024*1024))+1;
- }
+ MEMORYSTATUSEX ms = {0};
+ ms.dwLength = sizeof(ms);
+ GlobalMemoryStatusEx(&ms);
+ ram = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
buffer.appendfmt(TEXT("Installed RAM: %u MBytes"), ram);
}
void GetFreeDiskString(LPCTSTR dirname, bkstring& buffer)
{
ULARGE_INTEGER tnb, tfb, fs = {0};
- if (pGetDiskFreeSpaceEx)
- pGetDiskFreeSpaceEx(dirname, &fs, &tnb, &tfb);
- else
- {
- DWORD SectorsPerCluster, BytesPerSector;
- DWORD NumberOfFreeClusters, TotalNumberOfClusters;
-
- GetDiskFreeSpace(dirname, &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters);
-
- fs.QuadPart = BytesPerSector * SectorsPerCluster;
- fs.QuadPart *= NumberOfFreeClusters;
- }
+ GetDiskFreeSpaceEx(dirname, &fs, &tnb, &tfb);
fs.QuadPart /= (1024*1024);
buffer.appendfmt(TEXT("Free disk space on Miranda partition: %u MBytes"), fs.LowPart);
@@ -663,16 +621,8 @@ void GetLanguageString(bkstring& buffer)
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, name1, 256);
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, name2, 256);
- if (pGetUserDefaultUILanguage && pGetSystemDefaultUILanguage)
- {
- GetLocaleInfo(MAKELCID(pGetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name3, 256);
- GetLocaleInfo(MAKELCID(pGetSystemDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name4, 256);
- }
- else
- {
- _tcscpy(name3, name1);
- _tcscpy(name4, name2);
- }
+ GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name3, 256);
+ GetLocaleInfo(MAKELCID(GetSystemDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name4, 256);
buffer.appendfmt(TEXT("OS Languages: (UI | Locale (User/System)) : %s/%s | %s/%s"), name3, name4, name1, name2);
}
@@ -738,12 +688,9 @@ void GetLanguagePackString(bkstring& buffer)
void GetWow64String(bkstring& buffer)
{
BOOL wow64 = 0;
- if (pIsWow64Process)
+ if (!IsWow64Process(GetCurrentProcess(), &wow64))
{
- if (!pIsWow64Process(GetCurrentProcess(), &wow64))
- {
- wow64 = 0;
- }
+ wow64 = 0;
}
if (wow64) buffer.append(TEXT(" [running inside WOW64]"));
}