- DIAG: Visual Studio 2005 enforces parameter checking, and if

a parameter is wrong it just terminates the process with
        a 0xc000000d. This is a shot in the dark but I think it
        is a good guess as to what is happening right now.
        
    lib/
        diagnostics.C, .h
        diagnostics_win.C

svn path=/trunk/boinc/; revision=13042
This commit is contained in:
Rom Walton 2007-06-27 21:12:13 +00:00
parent 2d688ca625
commit 4da66bfaa8
4 changed files with 45 additions and 0 deletions

View File

@ -6815,3 +6815,14 @@ Matt 27 June 2007
html/inc/
util.inc
uotd.inc
Rom 27 June 2007
- DIAG: Visual Studio 2005 enforces parameter checking, and if
a parameter is wrong it just terminates the process with
a 0xc000000d. This is a shot in the dark but I think it
is a good guess as to what is happening right now.
lib/
diagnostics.C, .h
diagnostics_win.C

View File

@ -137,6 +137,9 @@ int boinc_finish_diag() {
int boinc_install_signal_handlers() {
#ifdef _WIN32
SetUnhandledExceptionFilter(boinc_catch_signal);
#if _MSC_VER >= 1400
_set_invalid_parameter_handler(boinc_catch_signal_invalid_parameter);
#endif
#else //_WIN32
// register handlers for fatal internal signals

View File

@ -114,6 +114,7 @@ extern int diagnostics_finish_unhandled_exception_monitor();
#ifdef _WIN32
extern UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID lpParameter);
extern LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *ExceptionInfo);
extern void boinc_catch_signal_invalid_parameter(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved);
#else
extern void boinc_catch_signal(int signal);
extern void boinc_set_signal_handler(int sig, void(*handler)(int));

View File

@ -2164,4 +2164,34 @@ LONG CALLBACK boinc_catch_signal(PEXCEPTION_POINTERS pExPtrs) {
}
// Starting with Visual Studio 2005 the C Runtime Library has really started to
// enforce parameter validation. Problem is that the parameter validation code
// uses its own structured exception handler and terminates without writing
// any useful output to stderr. Microsoft has created a hook an application
// developer can use to get more debugging information which is the purpose
// of this function. When an invalid parameter is passed to the C Runtime
// library this function will write whatever trace information it can and
// then throw a breakpoint exception to dump all the rest of the useful
// information.
void boinc_catch_signal_invalid_parameter(
const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t /* pReserved */
) {
fprintf(
stderr,
"ERROR: Invalid parameter detected in function %s. File: %s Line: %d\n",
function,
file,
line
);
fprintf(
stderr,
"ERROR: Expression: %s\n",
expression
);
// Cause a Debug Breakpoint.
DebugBreak();
}
const char *BOINC_RCSID_5967ad204d = "$Id$";