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.

288 lines
7.5 KiB

  1. /*++ BUILD Version: 0001 Increment if a change has global effects
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. info.h
  5. Abstract:
  6. Header file for the internal information interfaces (util\info.c)
  7. Environment:
  8. User Mode - Win32
  9. Notes:
  10. --*/
  11. #ifndef _NTFRS_INFO_INCLUDED_
  12. #define _NTFRS_INFO_INCLUDED_
  13. #endif
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define IPRINT0(_Info, _Format) \
  18. InfoPrint(_Info, _Format)
  19. #define IPRINT1(_Info, _Format, _p1) \
  20. InfoPrint(_Info, _Format, _p1)
  21. #define IPRINT2(_Info, _Format, _p1, _p2) \
  22. InfoPrint(_Info, _Format, _p1, _p2)
  23. #define IPRINT3(_Info, _Format, _p1, _p2, _p3) \
  24. InfoPrint(_Info, _Format, _p1, _p2, _p3)
  25. #define IPRINT4(_Info, _Format, _p1, _p2, _p3, _p4) \
  26. InfoPrint(_Info, _Format, _p1, _p2, _p3, _p4)
  27. #define IPRINT5(_Info, _Format, _p1, _p2, _p3, _p4, _p5) \
  28. InfoPrint(_Info, _Format, _p1, _p2, _p3, _p4, _p5)
  29. #define IPRINT6(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6) \
  30. InfoPrint(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6)
  31. #define IPRINT7(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
  32. InfoPrint(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6, _p7)
  33. #define IDPRINT0(_Severity, _Info, _Format) \
  34. if (_Info) { \
  35. IPRINT0(_Info, _Format); \
  36. } else { \
  37. DPRINT(_Severity, _Format); \
  38. }
  39. #define IDPRINT1(_Severity, _Info, _Format, _p1) \
  40. if (_Info) { \
  41. IPRINT1(_Info, _Format, _p1); \
  42. } else { \
  43. DPRINT1(_Severity, _Format, _p1); \
  44. }
  45. #define IDPRINT2(_Severity, _Info, _Format, _p1, _p2) \
  46. if (_Info) { \
  47. IPRINT2(_Info, _Format, _p1, _p2); \
  48. } else { \
  49. DPRINT2(_Severity, _Format, _p1, _p2); \
  50. }
  51. #define IDPRINT3(_Severity, _Info, _Format, _p1, _p2, _p3) \
  52. if (_Info) { \
  53. IPRINT3(_Info, _Format, _p1, _p2, _p3); \
  54. } else { \
  55. DPRINT3(_Severity, _Format, _p1, _p2, _p3); \
  56. }
  57. #define IDPRINT4(_Severity, _Info, _Format, _p1, _p2, _p3, _p4) \
  58. if (_Info) { \
  59. IPRINT4(_Info, _Format, _p1, _p2, _p3, _p4); \
  60. } else { \
  61. DPRINT4(_Severity, _Format, _p1, _p2, _p3, _p4); \
  62. }
  63. #define IDPRINT5(_Severity, _Info, _Format, _p1, _p2, _p3, _p4, _p5) \
  64. if (_Info) { \
  65. IPRINT5(_Info, _Format, _p1, _p2, _p3, _p4, _p5); \
  66. } else { \
  67. DPRINT5(_Severity, _Format, _p1, _p2, _p3, _p4, _p5); \
  68. }
  69. #define IDPRINT6(_Severity, _Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6) \
  70. if (_Info) { \
  71. IPRINT6(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6); \
  72. } else { \
  73. DPRINT6(_Severity, _Format, _p1, _p2, _p3, _p4, _p5, _p6); \
  74. }
  75. //
  76. // Used by FrsPrintType and its subroutines
  77. //
  78. // WARNING - THESE MACROS DEPEND ON LOCAL VARIABLES!
  79. //
  80. #define ITPRINT0(_Format) \
  81. { \
  82. if (Info) { \
  83. IPRINT0(Info, _Format); \
  84. } else { \
  85. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo); \
  86. } \
  87. }
  88. #define ITPRINT1(_Format, _p1) \
  89. { \
  90. if (Info) { \
  91. IPRINT1(Info, _Format, _p1); \
  92. } else { \
  93. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1); \
  94. } \
  95. }
  96. #define ITPRINT2(_Format, _p1, _p2) \
  97. { \
  98. if (Info) { \
  99. IPRINT2(Info, _Format, _p1, _p2); \
  100. } else { \
  101. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2); \
  102. } \
  103. }
  104. #define ITPRINT3(_Format, _p1, _p2, _p3) \
  105. { \
  106. if (Info) { \
  107. IPRINT3(Info, _Format, _p1, _p2, _p3); \
  108. } else { \
  109. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3); \
  110. } \
  111. }
  112. #define ITPRINT4(_Format, _p1, _p2, _p3, _p4) \
  113. { \
  114. if (Info) { \
  115. IPRINT4(Info, _Format, _p1, _p2, _p3, _p4); \
  116. } else { \
  117. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3, _p4); \
  118. } \
  119. }
  120. #define ITPRINT5(_Format, _p1, _p2, _p3, _p4, _p5) \
  121. { \
  122. if (Info) { \
  123. IPRINT3(Info, _Format, _p1, _p2, _p3, _p4, _p5); \
  124. } else { \
  125. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3, _p4, _p5); \
  126. } \
  127. }
  128. #define ITPRINTGNAME(_GName, _Format) \
  129. { \
  130. if ((_GName) && (_GName)->Guid && (_GName)->Name) { \
  131. GuidToStr(_GName->Guid, Guid); \
  132. if (Info) { \
  133. IPRINT3(Info, _Format, TabW, (_GName)->Name, Guid); \
  134. } else { \
  135. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, TabW, (_GName)->Name, Guid); \
  136. } \
  137. } \
  138. }
  139. #define ITPRINTGUID(_Guid, _Format) \
  140. { \
  141. if ((_Guid)) { \
  142. GuidToStr((_Guid), Guid); \
  143. if (Info) { \
  144. IPRINT2(Info, _Format, TabW, Guid); \
  145. } else { \
  146. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, TabW, Guid); \
  147. } \
  148. } \
  149. }
  150. VOID
  151. FrsPrintAllocStats(
  152. IN ULONG Severity,
  153. IN PNTFRSAPI_INFO Info, OPTIONAL
  154. IN DWORD Tabs
  155. );
  156. /*++
  157. Routine Description:
  158. Print the memory stats into the info buffer or using DPRINT (Info == NULL).
  159. Arguments:
  160. Severity - for DPRINT
  161. Info - for IPRINT (use DPRINT if NULL)
  162. Tabs - indentation for prettyprint
  163. Return Value:
  164. None.
  165. --*/
  166. //
  167. // PrettyPrint (set tabs at 3 wchars)
  168. //
  169. #define MAX_TABS (16)
  170. #define MAX_TAB_WCHARS (MAX_TABS * 3)
  171. VOID
  172. InfoTabs(
  173. IN DWORD Tabs,
  174. IN PWCHAR TabW
  175. );
  176. /*++
  177. Routine Description:
  178. Create a string of tabs for prettyprint
  179. Arguments:
  180. Tabs - number of tabs
  181. TabW - preallocated string to receive tabs
  182. Return Value:
  183. Win32 Status
  184. --*/
  185. DWORD
  186. Info(
  187. IN ULONG BlobSize,
  188. IN OUT PBYTE Blob
  189. );
  190. /*++
  191. Routine Description:
  192. Return internal info (see private\net\inc\ntfrsapi.h).
  193. Arguments:
  194. BlobSize - total bytes of Blob
  195. Blob - details desired info and provides buffer for info
  196. Return Value:
  197. Win32 Status
  198. --*/
  199. VOID
  200. InfoPrint(
  201. IN PNTFRSAPI_INFO Info,
  202. IN PCHAR Format,
  203. IN ... );
  204. /*++
  205. Routine Description:
  206. Format and print a line of information output into the info buffer.
  207. Arguments:
  208. Info - Info buffer
  209. Format - printf format
  210. Return Value:
  211. None.
  212. --*/
  213. DWORD
  214. InfoVerify(
  215. IN ULONG BlobSize,
  216. IN OUT PBYTE Blob
  217. );
  218. /*++
  219. Routine Description:
  220. Verify the consistency of the blob.
  221. Arguments:
  222. BlobSize - total bytes of Blob
  223. Blob - details desired info and provides buffer for info
  224. Return Value:
  225. Win32 Status
  226. --*/
  227. //
  228. // Context global to InfoPrintIDTable...
  229. //
  230. typedef struct _INFO_TABLE{
  231. PREPLICA Replica;
  232. PTHREAD_CTX ThreadCtx;
  233. PTABLE_CTX TableCtx;
  234. PNTFRSAPI_INFO Info;
  235. DWORD Tabs;
  236. } INFO_TABLE, *PINFO_TABLE;
  237. #ifdef __cplusplus
  238. }
  239. #endif