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.

60 lines
1.4 KiB

  1. /****************************************************************************/
  2. // trace.c
  3. //
  4. // Tracing code and definitions. See trace.h for other info.
  5. //
  6. // Copyright (C) 1999-2000 Microsoft Corporation
  7. /****************************************************************************/
  8. #include "stdafx.h"
  9. #include <windows.h>
  10. #include "trace.h"
  11. #if DBG || defined(_DEBUG)
  12. struct _ZoneInfo
  13. {
  14. UINT32 Zone;
  15. char *Prefix;
  16. } TRC_ZI[] =
  17. {
  18. { Z_ASSRT, "TERMSRV@TSCFGWMI: !!! ASSERT: " },
  19. { Z_ERR, "TERMSRV@TSCFGWMI: *** ERROR: " },
  20. { Z_WRN, "TERMSRV@TSCFGWMI: Warning: " },
  21. { Z_TRC1, "TERMSRV@TSCFGWMI: " },
  22. { Z_TRC2, "TERMSRV@TSCFGWMI: " },
  23. };
  24. int NumTRC_ZIEntries = sizeof(TRC_ZI) / sizeof(struct _ZoneInfo);
  25. // Globals.
  26. //UINT32 g_TraceMask = 0xFFFFFFFF;
  27. UINT32 g_TraceMask = 0x0000000F;
  28. char TB[1024];
  29. char TB2[1024];
  30. // Main output function.
  31. void TracePrintZ(UINT32 ZoneFlag, char *OutString)
  32. {
  33. int i;
  34. char *Prefix = "";
  35. // Find the zone information in the zone table.
  36. for (i = 0; i < NumTRC_ZIEntries; i++)
  37. if (TRC_ZI[i].Zone == ZoneFlag)
  38. Prefix = TRC_ZI[i].Prefix;
  39. if(sizeof(TB2) < (2 + strlen(OutString) + strlen(Prefix)) * sizeof(TCHAR))
  40. return;
  41. // Now create the final string.
  42. wsprintfA(TB2, "%s%s\n", Prefix, OutString);
  43. // Send to output.
  44. OutputDebugStringA(TB2);
  45. }
  46. #endif // DBG