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.

206 lines
7.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: trace.hxx
  7. //
  8. // Contents: TraceInfo macros and functions
  9. //
  10. // History: 14-Jul-95 t-stevan Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __TRACE_HXX__
  14. #define __TRACE_HXX__
  15. #if DBG==1
  16. #include <exports.hxx>
  17. // Our flags for the level of information we wish to print out, need to be OR'd together
  18. #define INF_OFF 0x00000000 // No information printed out
  19. #define INF_BASE 0x00000001 // base level of information
  20. // minus cmn APIs like StringFromGUID2
  21. #define INF_CMN 0x00000002 // cmn APIs also
  22. #define INF_SYM 0x00000004 // try to print out symbols
  23. #define INF_STRUCT 0x00000008 // expand structures
  24. #define INF_NOTLOADED 0x80000000 // we haven't retrieved the information level from the registry yet
  25. // *** Function Prototypes ***
  26. // functions to print out trace information
  27. void _oletracein(DWORD dwApiID, ...);
  28. void _oletracecmnin(DWORD dwApiID, ...);
  29. void _oletraceout(DWORD dwApiID, HRESULT hr);
  30. void _oletracecmnout(DWORD dwApiID, HRESULT hr);
  31. void _oletraceoutex(DWORD dwApiID,...);
  32. void _oletracecmnoutex(DWORD dwApiID,...);
  33. // *** Macros ***
  34. // ************************************************************
  35. // The following macros use these type specifiers in any passed format strings
  36. // note that I tried to keep them similar to printf in most cases, but not always
  37. // in general, the type specifiers are case-sensitive. Also, a caps type specifier
  38. // usually means that the output will be in caps, as opposed to lowercase (i.e. BOOLs
  39. // and HEX numbers)
  40. // *** Basic types
  41. // int, LONG -> %d, %D
  42. // UINT, ULONG, DWORD ->%ud, %uD, %x, %X
  43. // BOOL -> %b, %B
  44. // pointer -> %p, %P (hex)
  45. // string -> %s
  46. // wide string -> %ws
  47. // HANDLE -> %h
  48. // LARGE_INTEGER, ULARGE_INTEGER -> %ld, %uld
  49. // GUID -> %I
  50. // LPOLESTR, OLECHAR -> %ws
  51. // *** Structures
  52. // BIND_OPTS -> %tb
  53. // DVTARGETDEVICE -> %td
  54. // FORMATETC -> %te
  55. // FILETIME -> %tf
  56. // INTERFACEINFO -> %ti
  57. // LOGPALETTE -> %tl
  58. // MSG -> %tm
  59. // OLEINPLACEFRAMEINFO -> %to
  60. // POINT -> %tp
  61. // RECT -> %tr
  62. // STGMEDIUM -> %ts
  63. // STATSTG -> %tt
  64. // OLEMENUGROUPWIDTHS -> %tw
  65. // SIZE -> %tz
  66. //+---------------------------------------------------------------------------
  67. //
  68. // Macro: OLETRACEIN
  69. //
  70. // Synopsis: Handle all trace-related tasks at function entry.
  71. // Current tasks:
  72. // Print out function name and parameter list
  73. //
  74. // Arguments:
  75. // Note: There are two forms of this macro, determined at run time
  76. //
  77. // One form: (API)
  78. //
  79. // OLETRACEIN((API_ID, format_str, param1, ...))
  80. //
  81. // [API_ID] - the integeter API identifier
  82. // [format_str] - the format string to pass to oleprintf
  83. // [param1, ...] - the parameters to pass to oleprintf
  84. //
  85. // Second form (Method)
  86. //
  87. // OLETRACEIN((METHOD_ID, this_ptr, format_str, param1, ...))
  88. //
  89. // [METHOD_ID] - the integer object/method identifier
  90. // [this_ptr] - the this pointer of the object
  91. // the other args are the same as above
  92. //
  93. // Returns: nothing
  94. //
  95. // History: 15-Jul-95 t-stevan Created
  96. //
  97. // Note: Which form of the function used is determined by the id passed.
  98. // object IDs have a non-zero value in the upper 16 bits,
  99. // API id's have a zero value in the upper 16 bits
  100. //----------------------------------------------------------------------------
  101. #define OLETRACEIN(args) _oletracein args
  102. #define OLETRACECMNIN(args) _oletracecmnin args
  103. //+---------------------------------------------------------------------------
  104. //
  105. // Macro: OLETRACEOUT
  106. //
  107. // Synopsis: Handle all trace-related tasks at function exit.
  108. // Current tasks:
  109. // Print out function name and return value
  110. //
  111. // Arguments: API form: OLETRACEOUT((API_ID, hr))
  112. //
  113. // [API_ID]- integer API identifier (API_xxx)
  114. // [hr] - HRESULT return value
  115. //
  116. // Method form: OLETRACEOUT((METHOD_ID, this, hr))
  117. //
  118. // [METHOD_ID]-integer object/method identifier
  119. // [this] - this pointer of object
  120. // [hr] - HRESULT return value
  121. //
  122. // Returns: nothing
  123. //
  124. // History: 15-Jul-95 t-stevan Created
  125. //
  126. //----------------------------------------------------------------------------
  127. #define OLETRACEOUT(args) _oletraceout args
  128. #define OLETRACECMNOUT(args) _oletracecmnout args
  129. //+---------------------------------------------------------------------------
  130. //
  131. // Macro: OLETRACEOUTEX
  132. //
  133. // Synopsis: Handle all trace-related tasks at function exit.
  134. // Current tasks:
  135. // Print out function name and return value
  136. //
  137. // Arguments: API form: OLETRACEOUTEX((API_ID, format, result))
  138. //
  139. // [API_ID]- integer API identifier (API_xxx)
  140. // [format]- format string
  141. // [result]- return value
  142. //
  143. // Method form: OLETRACEOUTEX((METHOD_ID, this, hr))
  144. //
  145. // [METHOD_ID]-integer object/method identifier
  146. // [this] - this pointer of object
  147. // [format]- format string
  148. // [result]- return value
  149. //
  150. // Returns: nothing
  151. //
  152. // History: 15-Jul-95 t-stevan Created
  153. //
  154. //----------------------------------------------------------------------------
  155. #define OLETRACEOUTEX(args) _oletraceoutex args
  156. #define OLETRACECMNOUTEX(args) _oletracecmnoutex args
  157. // use this to make a nicely formatted parameter string
  158. #define PARAMFMT(paramstr) ( "("##paramstr")\n" )
  159. // use this for a functions which take no parameters
  160. #define NOPARAM (PARAMFMT(""))
  161. // use this to make a " returns %meef" format for OLETRACEOUT_
  162. #define RETURNFMT(str) ( " returned "##str##"\n" )
  163. // use this for a function which returns void
  164. #define NORETURN (RETURNFMT(""))
  165. void InitializeTraceInfo(); // function to load the trace info level on
  166. void CleanupTraceInfo(); // function to clean up the trace info process detatch
  167. #else // #ifdef _TRACE
  168. #define OLETRACEIN(X)
  169. #define OLETRACECMNIN(X)
  170. #define OLETRACEOUT(x)
  171. #define OLETRACECMNOUT(x)
  172. #define OLETRACEOUTEX(x)
  173. #define OLETRACECMNOUTEX(x)
  174. #define PARAMFMT(paramstr) ("")
  175. #define NOPARAM
  176. #define NORETURN
  177. #define RETURNFMT(str) ("")
  178. #define InitializeTraceInfo()
  179. #define CleanupTraceInfo()
  180. #endif // DBG==1
  181. #endif // #ifdef __TRACE_HXX__