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.

101 lines
1.8 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // satrace.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the API into the SA trace facility.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 08/18/1998 Original version.
  16. // 10/06/1998 Trace is always on.
  17. // 01/27/1999 Stolen from IAS
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #ifndef _SATRACE_H_
  21. #define _SATRACE_H_
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. DWORD
  26. WINAPI
  27. SAFormatSysErr(
  28. IN DWORD dwError,
  29. IN PSTR lpBuffer,
  30. IN DWORD nSize
  31. );
  32. VOID
  33. WINAPIV
  34. SATracePrintf(
  35. IN PCSTR szFormat,
  36. ...
  37. );
  38. VOID
  39. WINAPI
  40. SATraceString(
  41. IN PCSTR szString
  42. );
  43. VOID
  44. WINAPI
  45. SATraceBinary(
  46. IN CONST BYTE* lpbBytes,
  47. IN DWORD dwByteCount
  48. );
  49. VOID
  50. WINAPI
  51. SATraceFailure(
  52. IN PCSTR szFunction,
  53. IN DWORD dwError
  54. );
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #ifdef __cplusplus
  59. const DWORD MAX_TRACEFUNCTION_NAMELENGTH = 512;
  60. // C++ only!
  61. class CSATraceFunc
  62. {
  63. public:
  64. CSATraceFunc(PCSTR pszFuncName)
  65. {
  66. strncpy(m_szFuncName, pszFuncName, MAX_TRACEFUNCTION_NAMELENGTH);
  67. m_szFuncName[MAX_TRACEFUNCTION_NAMELENGTH] = '\0';
  68. SATracePrintf("Enter %s", m_szFuncName);
  69. }
  70. ~CSATraceFunc()
  71. {
  72. SATracePrintf("Leave %s", m_szFuncName);
  73. }
  74. private:
  75. CHAR m_szFuncName[MAX_TRACEFUNCTION_NAMELENGTH +1]; // maximum function name: 512
  76. };
  77. //
  78. // use SATraceFunc() in the beginning of a function to generate
  79. // "entering Func..." and "Leaving Func..." trace message
  80. //
  81. #define SATraceFunction(szFuncName) \
  82. CSATraceFunc temp_TraceFunc(szFuncName)
  83. #endif // __cplusplus
  84. #endif // _SATRACE_H_