中间件标准版5.1git,去除基础模块

ExceptionHandler.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // ExceptionHandler.h Version 1.1
  2. //
  3. // Copyright ?1998 Bruce Dawson
  4. //
  5. // Author: Bruce Dawson
  6. // brucedawson@cygnus-software.com
  7. //
  8. // Modified by: Hans Dietrich
  9. // hdietrich2@hotmail.com
  10. //
  11. // A paper by the original author can be found at:
  12. // http://www.cygnus-software.com/papers/release_debugging.html
  13. //
  14. ///////////////////////////////////////////////////////////////////////////////
  15. #ifndef EXCEPTIONHANDLER_H
  16. #define EXCEPTIONHANDLER_H
  17. // We forward declare PEXCEPTION_POINTERS so that the function
  18. // prototype doesn't needlessly require windows.h.
  19. typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
  20. int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message);
  21. /*
  22. // Sample usage - put the code that used to be in main into HandledMain.
  23. // To hook it in to an MFC app add ExceptionAttacher.cpp from the mfctest
  24. // application into your project.
  25. int main(int argc, char *argv[])
  26. {
  27. int Result = -1;
  28. __try
  29. {
  30. Result = HandledMain(argc, argv);
  31. }
  32. __except(RecordExceptionInfo(GetExceptionInformation(), "main thread"))
  33. {
  34. // Do nothing here - RecordExceptionInfo() has already done
  35. // everything that is needed. Actually this code won't even
  36. // get called unless you return EXCEPTION_EXECUTE_HANDLER from
  37. // the __except clause.
  38. }
  39. return Result;
  40. }
  41. */
  42. #endif