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.

180 lines
4.7 KiB

  1. /***************************************************************************
  2. *
  3. * File: hwsdebug.c
  4. *
  5. * INTEL Corporation Proprietary Information
  6. * Copyright (c) 1996 Intel Corporation.
  7. *
  8. * This listing is supplied under the terms of a license agreement
  9. * with INTEL Corporation and may not be used, copied, nor disclosed
  10. * except in accordance with the terms of that agreement.
  11. *
  12. ***************************************************************************
  13. *
  14. * $Workfile: hwsdebug.c $
  15. * $Revision: 1.13 $
  16. * $Modtime: 13 Dec 1996 11:44:24 $
  17. * $Log: S:\sturgeon\src\h245ws\vcs\hwsdebug.c_v $
  18. *
  19. * Rev 1.13 13 Dec 1996 12:12:50 SBELL1
  20. * moved ifdef _cplusplus to after includes
  21. *
  22. * Rev 1.12 11 Dec 1996 13:41:56 SBELL1
  23. * Put in UNICODE tracing stuff.
  24. *
  25. * Rev 1.11 01 Oct 1996 14:49:22 EHOWARDX
  26. * Revision 1.9 copied to tip.
  27. *
  28. * Rev 1.9 May 28 1996 10:40:14 plantz
  29. * Change vsprintf to wvsprintf.
  30. *
  31. * Rev 1.8 29 Apr 1996 17:13:16 unknown
  32. * Fine-tuning instance-specific name.
  33. *
  34. * Rev 1.7 29 Apr 1996 13:04:56 EHOWARDX
  35. *
  36. * Added timestamp and instance-specific short name.
  37. *
  38. * Rev 1.6 Apr 24 1996 16:20:56 plantz
  39. * Removed include winsock2.h and incommon.h
  40. *
  41. * Rev 1.4.1.0 Apr 24 1996 16:19:54 plantz
  42. * Removed include winsock2.h and callcont.h
  43. *
  44. * Rev 1.4 01 Apr 1996 14:20:34 unknown
  45. * Shutdown redesign.
  46. *
  47. * Rev 1.3 22 Mar 1996 16:04:18 EHOWARDX
  48. * Added #if defined(_DEBUG) around whole file.
  49. *
  50. * Rev 1.2 22 Mar 1996 15:25:28 EHOWARDX
  51. * Changed to use ISR_HookDbgStr instead of OutputDebugString.
  52. *
  53. * Rev 1.1 14 Mar 1996 17:01:00 EHOWARDX
  54. *
  55. * NT4.0 testing; got rid of HwsAssert(); got rid of TPKT/WSCB.
  56. *
  57. * Rev 1.0 08 Mar 1996 20:22:14 unknown
  58. * Initial revision.
  59. *
  60. ***************************************************************************/
  61. #if defined(_DEBUG)
  62. #ifndef STRICT
  63. #define STRICT
  64. #endif // not defined STRICT
  65. #undef _WIN32_WINNT // override bogus platform definition in our common build environment
  66. #pragma warning ( disable : 4115 4201 4214 4514 )
  67. #include "precomp.h"
  68. #include "queue.h"
  69. #include "linkapi.h"
  70. #include "h245ws.h"
  71. #include "isrg.h"
  72. #if defined(__cplusplus)
  73. extern "C"
  74. {
  75. #endif // (__cplusplus)
  76. /*****************************************************************************
  77. *
  78. * TYPE: Global System
  79. *
  80. * PROCEDURE: HwsTrace
  81. *
  82. * DESCRIPTION:
  83. * Trace function for HWS
  84. *
  85. * INPUT:
  86. * dwInst Instance identifier for trace message
  87. * dwLevel Trace level as defined below
  88. * pszFormat sprintf string format with 1-N parameters
  89. *
  90. * Trace Level (byLevel) Definitions:
  91. * HWS_CRITICAL Progammer errors that should never happen
  92. * HWS_ERROR Errors that need to be fixed
  93. * HWS_WARNING The user could have problems if not corrected
  94. * HWS_NOTIFY Status, events, settings...
  95. * HWS_TRACE Trace info that will not overrun the system
  96. * HWS_TEMP Trace info that may be reproduced in heavy loops
  97. *
  98. * RETURN VALUE:
  99. * None
  100. *
  101. *****************************************************************************/
  102. void HwsTrace (DWORD dwInst,
  103. BYTE byLevel,
  104. #ifdef UNICODE_TRACE
  105. LPTSTR pszFormat,
  106. #else
  107. LPSTR pszFormat,
  108. #endif
  109. ...)
  110. {
  111. #ifdef UNICODE_TRACE
  112. TCHAR szBuffer[128];
  113. static TCHAR szName[] = __TEXT("H245WS-1");
  114. #else
  115. char szBuffer[128];
  116. static char szName[] = "H245WS-1";
  117. #endif
  118. va_list pParams;
  119. static WORD wIsrInst = 0xFFFF;
  120. ASSERT(pszFormat != NULL);
  121. switch (byLevel)
  122. {
  123. case HWS_CRITICAL:
  124. case HWS_ERROR:
  125. case HWS_WARNING:
  126. case HWS_NOTIFY:
  127. case HWS_TRACE:
  128. case HWS_TEMP:
  129. break;
  130. default:
  131. byLevel = HWS_CRITICAL;
  132. } // switch
  133. if (wIsrInst == 0xFFFF)
  134. {
  135. UINT hMod;
  136. ptISRModule pMod;
  137. for (hMod = 0; hMod < kMaxModules; ++hMod)
  138. {
  139. pMod = ISR_GetModule(hMod);
  140. if (pMod)
  141. {
  142. if (memcmp(szName, pMod->zSName, sizeof(szName)) == 0)
  143. {
  144. szName[7] += 1;
  145. }
  146. }
  147. }
  148. ISR_RegisterModule(&wIsrInst, szName, szName);
  149. }
  150. #ifdef UNICODE_TRACE
  151. wsprintf(szBuffer, __TEXT("%9d:"), GetTickCount());
  152. #else
  153. wsprintf(szBuffer, "%9d:", GetTickCount());
  154. #endif
  155. va_start(pParams, pszFormat);
  156. wvsprintf(&szBuffer[10], pszFormat, pParams);
  157. ISR_HookDbgStr((UINT)dwInst, wIsrInst, byLevel, szBuffer, 0);
  158. } // HwsTrace()
  159. #if defined(__cplusplus)
  160. }
  161. #endif // (__cplusplus)
  162. #endif // (_DEBUG)