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.

58 lines
1.2 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. #if DBG==1
  15. #include <ctype.h>
  16. #include <stdarg.h>
  17. #include <stdio.h>
  18. #include <string.h>
  19. #include <windows.h>
  20. #include "debug.h"
  21. VOID
  22. DbgPrintf (
  23. char *Format,
  24. ...
  25. )
  26. {
  27. va_list arglist;
  28. char OutputBuffer[1024];
  29. ULONG length;
  30. try {
  31. if (hLogFile != INVALID_HANDLE_VALUE) {
  32. va_start( arglist, Format );
  33. vsprintf( OutputBuffer, Format, arglist );
  34. va_end( arglist );
  35. length = strlen( OutputBuffer );
  36. WriteFile( hLogFile, (LPVOID )OutputBuffer, length, &length, NULL );
  37. FlushFileBuffers (hLogFile) ;
  38. }
  39. } except (EXCEPTION_EXECUTE_HANDLER) {
  40. sprintf (OutputBuffer, "exception entered while printing error message\n") ;
  41. WriteFile (hLogFile, (LPVOID)OutputBuffer, length, &length, NULL) ;
  42. FlushFileBuffers (hLogFile) ;
  43. }
  44. }
  45. #endif
  46.