Leaked source code of windows server 2003
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.8 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. //#define STRSAFE_LIB
  17. #include <strsafe.h>
  18. VOID
  19. RouterAssert(
  20. IN PSTR pszFailedAssertion,
  21. IN PSTR pszFileName,
  22. IN DWORD dwLineNumber,
  23. IN PSTR pszMessage OPTIONAL
  24. ) {
  25. CHAR szResponse[2];
  26. while (TRUE) {
  27. DbgPrint(
  28. "\n***Assertion failed: %s%s\n*** Source File: %s, line %ld\n\n",
  29. pszMessage ? pszMessage : "",
  30. pszFailedAssertion,
  31. pszFileName,
  32. dwLineNumber
  33. );
  34. DbgPrompt(
  35. "Break, Ignore, Terminate Process or Terminate Thread (bipt)? ",
  36. szResponse,
  37. sizeof(szResponse)
  38. );
  39. switch (szResponse[0]) {
  40. case 'B':
  41. case 'b':
  42. DbgBreakPoint();
  43. break;
  44. case 'I':
  45. case 'i':
  46. return;
  47. case 'P':
  48. case 'p':
  49. TerminateProcess(
  50. GetCurrentProcess(), (DWORD)STATUS_UNSUCCESSFUL
  51. );
  52. break;
  53. case 'T':
  54. case 't':
  55. ExitThread(
  56. (DWORD)STATUS_UNSUCCESSFUL
  57. );
  58. break;
  59. }
  60. }
  61. DbgBreakPoint();
  62. TerminateProcess(GetCurrentProcess(), (DWORD)STATUS_UNSUCCESSFUL);
  63. }