/util/drmingw: 87a51e1139bc: Add the OS Version and any Version ...
Daniel Atallah
datallah at pidgin.im
Mon Sep 10 12:11:13 EDT 2012
Changeset: 87a51e1139bc15c0bd234af2e2c8b0c413bf12dd
Author: Daniel Atallah <datallah at pidgin.im>
Date: 2012-09-08 12:49 -0400
Branch: default
URL: http://hg.pidgin.im/util/drmingw/rev/87a51e1139bc
Description:
Add the OS Version and any Version Info available in the modules to the report.
diffstat:
SConscript | 1 +
exchndl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diffs (87 lines):
diff --git a/SConscript b/SConscript
--- a/SConscript
+++ b/SConscript
@@ -22,6 +22,7 @@ env.Append(LINKFLAGS = [
env.Prepend(LIBS = [
'bfd',
'iberty',
+ 'version',
])
env.Program(
diff --git a/exchndl.c b/exchndl.c
--- a/exchndl.c
+++ b/exchndl.c
@@ -614,6 +614,33 @@ BOOL WINAPI IntelStackWalk(
}
static
+BOOL GetModuleVersionInfo(const TCHAR *szModule, DWORD *dwVInfo)
+{
+
+ DWORD dummy, size;
+ BOOL success = FALSE;
+
+ size = GetFileVersionInfoSize(szModule, &dummy);
+ if (size > 0) {
+ LPVOID pVer = malloc(size);
+ ZeroMemory(pVer, size);
+ if (GetFileVersionInfo(szModule, 0, size, pVer)) {
+ VS_FIXEDFILEINFO *ffi;
+ if (VerQueryValue(pVer, "\\", (LPVOID *) &ffi, (UINT *) &dummy)) {
+ dwVInfo[0] = ffi->dwFileVersionMS >> 16;
+ dwVInfo[1] = ffi->dwFileVersionMS & 0xFFFF;
+ dwVInfo[2] = ffi->dwFileVersionLS >> 16;
+ dwVInfo[3] = ffi->dwFileVersionLS & 0xFFFF;
+ success = TRUE;
+ }
+ }
+ free(pVer);
+ }
+
+ return success;
+}
+
+static
BOOL StackBackTrace(HANDLE hProcess, HANDLE hThread, PCONTEXT pContext)
{
STACKFRAME StackFrame;
@@ -726,6 +753,16 @@ BOOL StackBackTrace(HANDLE hProcess, HAN
if(hModule != hPrevModule)
{
+ DWORD dwVInfo[4];
+
+ if (GetModuleVersionInfo(szModule, dwVInfo))
+ {
+ rprintf(_T(" %s [%d.%d.%d.%d]\r\n"),
+ szModule,
+ dwVInfo[0], dwVInfo[1], dwVInfo[2], dwVInfo[3]);
+
+ }
+
if(syms)
{
free(syms);
@@ -829,6 +866,7 @@ void GenerateExceptionReport(PEXCEPTION_
TCHAR szModule[MAX_PATH];
HMODULE hModule;
PCONTEXT pContext;
+ OSVERSIONINFO osvi;
// Start out with a banner
rprintf(_T("-------------------\r\n\r\n"));
@@ -872,6 +910,13 @@ void GenerateExceptionReport(PEXCEPTION_
);
}
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ if (GetVersionEx(&osvi)) {
+ rprintf(_T("Windows Version %d.%d Build %d %s\r\n\r\n"), osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.szCSDVersion);
+ }
+
// First print information about the type of fault
if (GetModuleFileName(NULL, szModule, sizeof(szModule) / sizeof(TCHAR)))
szModule[sizeof(szModule) / sizeof(TCHAR) - 1] = _T('\0');
More information about the Commits
mailing list