Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. RxAssert.c
  5. Abstract:
  6. This module implements the normal assert routine so that it can be used even on a debug build.
  7. Author:
  8. Revision History:
  9. --*/
  10. #include "precomp.h"
  11. #pragma hdrstop
  12. // i just got the stuff that i need from ntrtl.h because not it doesn't
  13. // protect against multiple include
  14. #if DBG
  15. ULONG RxContinueFromAssert = 1;
  16. #else
  17. ULONG RxContinueFromAssert = 0;
  18. #endif //DBG
  19. VOID
  20. RxDbgBreakPoint(
  21. ULONG LineNumber)
  22. {
  23. DbgBreakPoint();
  24. }
  25. ULONG
  26. NTAPI
  27. DbgPrompt(
  28. PCH Prompt,
  29. PCH Response,
  30. ULONG MaximumResponseLength
  31. );
  32. //#if DBG
  33. VOID
  34. RxAssert(
  35. IN PVOID FailedAssertion,
  36. IN PVOID FileName,
  37. IN ULONG LineNumber,
  38. IN PCHAR Message OPTIONAL
  39. )
  40. {
  41. char Response[ 2 ];
  42. CONTEXT Context;
  43. #ifndef BLDR_KERNEL_RUNTIME
  44. /// RtlCaptureContext( &Context );
  45. #endif
  46. if (!RxContinueFromAssert) {
  47. //
  48. // we're outta here
  49. KeBugCheckEx (RDBSS_FILE_SYSTEM,
  50. 0xa55a0000|LineNumber,
  51. 0,0,0);
  52. }
  53. while (TRUE) {
  54. DbgPrint(
  55. "\n*** Assertion failed: %s%s\n*** Source File: %s, line %ld\n\n",
  56. Message ? Message : "",
  57. FailedAssertion,
  58. FileName ? FileName : "",
  59. LineNumber
  60. );
  61. DbgPrompt( "Break, Ignore (bi)? ",
  62. Response,
  63. sizeof( Response )
  64. );
  65. switch (Response[0]) {
  66. case 'B':
  67. case 'b':
  68. DbgPrint( "Execute '!cxr %lx' to dump context\n", &Context);
  69. DbgBreakPoint();
  70. break;
  71. case 'I':
  72. case 'i':
  73. return;
  74. }
  75. }
  76. DbgBreakPoint();
  77. }
  78. //#endif //if DBG
  79.