- DIAG: Add an easy way for projects to initialize the diagnostics

framework for graphics applications.
    - DIAG: Make SetDllDirectory work for Win2k3, Vista, and Win2k8
    
    lib/
        diagnostics.C, .h
        stackwalker_win.cpp

svn path=/trunk/boinc/; revision=15105
This commit is contained in:
Rom Walton 2008-04-30 05:42:06 +00:00
parent db1079aeb2
commit e796847658
4 changed files with 32 additions and 12 deletions

View File

@ -3415,3 +3415,11 @@ Rom April 28 2008 (HEAD)
configure.ac
version.h
Rom April 30 2008
- DIAG: Add an easy way for projects to initialize the diagnostics
framework for graphics applications.
- DIAG: Make SetDllDirectory work for Win2k3, Vista, and Win2k8
lib/
diagnostics.C, .h
stackwalker_win.cpp

View File

@ -116,7 +116,7 @@ int __cdecl boinc_message_reporting(int reportType, char *szMsg, int *retVal){
#endif // _WIN32 && _DEBUG
// stub function for initializing the diagnostics environment.
// stub function for initializing the worker diagnostic environment.
//
int boinc_init_diagnostics(int _flags) {
int modified_flags = BOINC_DIAG_BOINCAPPLICATION | _flags;
@ -124,6 +124,14 @@ int boinc_init_diagnostics(int _flags) {
}
// stub function for initializing the graphic diagnostic environment.
//
int boinc_init_graphics_diagnostics(int _flags) {
int modified_flags = BOINC_DIAG_BOINCAPPLICATION | _flags;
return diagnostics_init(modified_flags, BOINC_DIAG_GFX_STDOUT, BOINC_DIAG_GFX_STDERR);
}
// Used to cleanup the diagnostics environment.
//
int boinc_finish_diag() {

View File

@ -60,6 +60,8 @@
//
#define BOINC_DIAG_STDERR "stderr"
#define BOINC_DIAG_STDOUT "stdout"
#define BOINC_DIAG_GFX_STDERR "stderrgfx"
#define BOINC_DIAG_GFX_STDOUT "stdoutgfx"
#ifdef __cplusplus
@ -69,6 +71,7 @@ extern "C" {
// These are functions common to all platforms
extern int boinc_init_diagnostics( int flags );
extern int boinc_init_graphics_diagnostics( int flags );
extern int boinc_install_signal_handlers();
extern int boinc_finish_diag();

View File

@ -368,12 +368,6 @@ int DebuggerInitialize( LPCSTR pszBOINCLocation, LPCSTR pszSymbolStore, BOOL bPr
if (g_bInitialized != FALSE)
return 0;
// Detect which version of Windows we are running on.
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx((OSVERSIONINFO*)&osvi);
// Get a real handle to the current process and store it for future use.
DuplicateHandle(
GetCurrentProcess(),
@ -385,6 +379,12 @@ int DebuggerInitialize( LPCSTR pszBOINCLocation, LPCSTR pszSymbolStore, BOOL bPr
DUPLICATE_SAME_ACCESS
);
// Detect which version of Windows we are running on.
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx((OSVERSIONINFO*)&osvi);
// For the most part the dbghelp.dll does the right stuff, but there are
// conditions where things go off into never never land. Most of the
// time the error comes back ERROR_MOD_NOT_FOUND. Most of the info
@ -396,7 +396,8 @@ int DebuggerInitialize( LPCSTR pszBOINCLocation, LPCSTR pszSymbolStore, BOOL bPr
// that is before the System and Windows directories which is what we
// want.
if ((VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) &&
(5 == osvi.dwMajorVersion) && (1 == osvi.dwMinorVersion))
((6 >= osvi.dwMajorVersion) || // == Vista, Win2008, +
(5 == osvi.dwMajorVersion) && (0 != osvi.dwMinorVersion))) // == Win XP, Win2003
{
HMODULE hKernel32 = LoadLibraryA("kernel32.dll");
if (hKernel32) {
@ -425,7 +426,10 @@ int DebuggerInitialize( LPCSTR pszBOINCLocation, LPCSTR pszSymbolStore, BOOL bPr
return 1;
}
DebuggerLoadLibrary(&g_hSymSrvDll, pszBOINCLocation, "symsrv.dll");
DebuggerLoadLibrary(&g_hSymSrvDll, pszBOINCLocation, "symsrv.dll");
DebuggerLoadLibrary(&g_hSrcSrvDll, pszBOINCLocation, "srcsrv.dll");
DebuggerLoadLibrary(&g_hVersionDll, pszBOINCLocation, "version.dll");
if (g_hSymSrvDll) {
pSSSO = (tSSSO)GetProcAddress(g_hSymSrvDll, "SymbolServerSetOptions");
if (pSSSO) {
@ -450,9 +454,6 @@ int DebuggerInitialize( LPCSTR pszBOINCLocation, LPCSTR pszSymbolStore, BOOL bPr
}
}
DebuggerLoadLibrary(&g_hSrcSrvDll, pszBOINCLocation, "srcsrv.dll");
DebuggerLoadLibrary(&g_hVersionDll, pszBOINCLocation, "version.dll");
if (g_hVersionDll) {
pGFVIS = (tGFVIS)GetProcAddress(g_hVersionDll, "GetFileVersionInfoSizeA");
pGFVI = (tGFVI)GetProcAddress(g_hVersionDll, "GetFileVersionInfoA");