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.

77 lines
1.7 KiB

  1. //============================================================================
  2. // Copyright (c) 1995, Microsoft Corporation
  3. //
  4. // File: assert.c
  5. //
  6. // History:
  7. // Abolade Gbadegesin Nov-19-1995 Created.
  8. //
  9. // Contains Assert functio for Router components.
  10. //============================================================================
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include <rtutils.h>
  16. VOID
  17. RouterAssert(
  18. IN PSTR pszFailedAssertion,
  19. IN PSTR pszFileName,
  20. IN DWORD dwLineNumber,
  21. IN PSTR pszMessage OPTIONAL
  22. ) {
  23. CHAR szResponse[2];
  24. while (TRUE) {
  25. DbgPrint(
  26. "\n***Assertion failed: %s%s\n*** Source File: %s, line %ld\n\n",
  27. pszMessage ? pszMessage : "",
  28. pszFailedAssertion,
  29. pszFileName,
  30. dwLineNumber
  31. );
  32. DbgPrompt(
  33. "Break, Ignore, Terminate Process or Terminate Thread (bipt)? ",
  34. szResponse,
  35. sizeof(szResponse)
  36. );
  37. switch (szResponse[0]) {
  38. case 'B':
  39. case 'b':
  40. DbgBreakPoint();
  41. break;
  42. case 'I':
  43. case 'i':
  44. return;
  45. case 'P':
  46. case 'p':
  47. TerminateProcess(
  48. GetCurrentProcess(), (DWORD)STATUS_UNSUCCESSFUL
  49. );
  50. break;
  51. case 'T':
  52. case 't':
  53. TerminateThread(
  54. GetCurrentThread(), (DWORD)STATUS_UNSUCCESSFUL
  55. );
  56. break;
  57. }
  58. }
  59. DbgBreakPoint();
  60. TerminateProcess(GetCurrentProcess(), (DWORD)STATUS_UNSUCCESSFUL);
  61. }