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.

91 lines
1.8 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright (C) Microsoft Corp., 1992 **/
  4. /*****************************************************************************/
  5. //***
  6. // File Name: debug.c
  7. //
  8. // Function: debug functions
  9. //
  10. // History:
  11. //
  12. // 05/21/92 Narendra Gidwani - Original Version 1.0
  13. //***
  14. #include <ctype.h>
  15. #include <stdarg.h>
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include "afpsvcp.h"
  19. #include "debug.h"
  20. #ifdef DBG
  21. VOID
  22. AfpAssert(
  23. IN PVOID FailedAssertion,
  24. IN PVOID FileName,
  25. IN ULONG LineNumber
  26. )
  27. {
  28. BOOL ok;
  29. CHAR choice[16];
  30. DWORD bytes;
  31. DWORD error;
  32. AfpPrintf( "\nAssertion failed: %s\n at line %ld of %s\n",
  33. FailedAssertion, LineNumber, FileName );
  34. do {
  35. AfpPrintf( "Break or Ignore [bi]? " );
  36. bytes = sizeof(choice);
  37. ok = ReadFile(
  38. GetStdHandle(STD_INPUT_HANDLE),
  39. &choice,
  40. bytes,
  41. &bytes,
  42. NULL
  43. );
  44. if ( ok ) {
  45. if ( toupper(choice[0]) == 'I' ) {
  46. break;
  47. }
  48. if ( toupper(choice[0]) == 'B' ) {
  49. DbgUserBreakPoint( );
  50. }
  51. } else {
  52. error = GetLastError( );
  53. }
  54. } while ( TRUE );
  55. return;
  56. } // AfpAssert
  57. VOID
  58. AfpPrintf (
  59. char *Format,
  60. ...
  61. )
  62. {
  63. va_list arglist;
  64. char OutputBuffer[1024];
  65. ULONG length;
  66. va_start( arglist, Format );
  67. vsprintf( OutputBuffer, Format, arglist );
  68. va_end( arglist );
  69. length = strlen( OutputBuffer );
  70. WriteFile( GetStdHandle(STD_OUTPUT_HANDLE), (LPVOID )OutputBuffer, length, &length, NULL );
  71. } // AfpPrintf
  72. #endif
  73.