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.

313 lines
8.8 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. #define IDPRINT7(_Severity, _Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6, _p7) \
  76. if (_Info) { \
  77. IPRINT7(_Info, _Format, _p1, _p2, _p3, _p4, _p5, _p6, _p7); \
  78. } else { \
  79. DPRINT7(_Severity, _Format, _p1, _p2, _p3, _p4, _p5, _p6, _p7); \
  80. }
  81. //
  82. // Used by FrsPrintType and its subroutines
  83. //
  84. // WARNING - THESE MACROS DEPEND ON LOCAL VARIABLES!
  85. //
  86. #define ITPRINT0(_Format) \
  87. { \
  88. if (Info) { \
  89. IPRINT0(Info, _Format); \
  90. } else { \
  91. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo); \
  92. } \
  93. }
  94. #define ITPRINT1(_Format, _p1) \
  95. { \
  96. if (Info) { \
  97. IPRINT1(Info, _Format, _p1); \
  98. } else { \
  99. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1); \
  100. } \
  101. }
  102. #define ITPRINT2(_Format, _p1, _p2) \
  103. { \
  104. if (Info) { \
  105. IPRINT2(Info, _Format, _p1, _p2); \
  106. } else { \
  107. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2); \
  108. } \
  109. }
  110. #define ITPRINT3(_Format, _p1, _p2, _p3) \
  111. { \
  112. if (Info) { \
  113. IPRINT3(Info, _Format, _p1, _p2, _p3); \
  114. } else { \
  115. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3); \
  116. } \
  117. }
  118. #define ITPRINT4(_Format, _p1, _p2, _p3, _p4) \
  119. { \
  120. if (Info) { \
  121. IPRINT4(Info, _Format, _p1, _p2, _p3, _p4); \
  122. } else { \
  123. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3, _p4); \
  124. } \
  125. }
  126. #define ITPRINT5(_Format, _p1, _p2, _p3, _p4, _p5) \
  127. { \
  128. if (Info) { \
  129. IPRINT3(Info, _Format, _p1, _p2, _p3, _p4, _p5); \
  130. } else { \
  131. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, _p1, _p2, _p3, _p4, _p5); \
  132. } \
  133. }
  134. #define ITPRINTGNAME(_GName, _Format) \
  135. { \
  136. if ((_GName) && (_GName)->Guid && (_GName)->Name) { \
  137. GuidToStr(_GName->Guid, Guid); \
  138. if (Info) { \
  139. IPRINT3(Info, _Format, TabW, (_GName)->Name, Guid); \
  140. } else { \
  141. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, TabW, (_GName)->Name, Guid); \
  142. } \
  143. } \
  144. }
  145. #define ITPRINTGUID(_Guid, _Format) \
  146. { \
  147. if ((_Guid)) { \
  148. GuidToStr((_Guid), Guid); \
  149. if (Info) { \
  150. IPRINT2(Info, _Format, TabW, Guid); \
  151. } else { \
  152. DebPrintNoLock(Severity, TRUE, _Format, Debsub, uLineNo, TabW, Guid); \
  153. } \
  154. } \
  155. }
  156. VOID
  157. FrsPrintAllocStats(
  158. IN ULONG Severity,
  159. IN PNTFRSAPI_INFO Info, OPTIONAL
  160. IN DWORD Tabs
  161. );
  162. /*++
  163. Routine Description:
  164. Print the memory stats into the info buffer or using DPRINT (Info == NULL).
  165. Arguments:
  166. Severity - for DPRINT
  167. Info - for IPRINT (use DPRINT if NULL)
  168. Tabs - indentation for prettyprint
  169. Return Value:
  170. None.
  171. --*/
  172. //
  173. // PrettyPrint (set tabs at 3 wchars)
  174. //
  175. #define MAX_TABS (16)
  176. #define MAX_TAB_WCHARS (MAX_TABS * 3)
  177. VOID
  178. InfoTabs(
  179. IN DWORD Tabs,
  180. IN PWCHAR TabW
  181. );
  182. /*++
  183. Routine Description:
  184. Create a string of tabs for prettyprint
  185. Arguments:
  186. Tabs - number of tabs
  187. TabW - preallocated string to receive tabs
  188. Return Value:
  189. Win32 Status
  190. --*/
  191. DWORD
  192. Info(
  193. IN ULONG BlobSize,
  194. IN OUT PBYTE Blob
  195. );
  196. /*++
  197. Routine Description:
  198. Return internal info (see private\net\inc\ntfrsapi.h).
  199. Arguments:
  200. BlobSize - total bytes of Blob
  201. Blob - details desired info and provides buffer for info
  202. Return Value:
  203. Win32 Status
  204. --*/
  205. VOID
  206. InfoPrint(
  207. IN PNTFRSAPI_INFO Info,
  208. IN PCHAR Format,
  209. IN ... );
  210. /*++
  211. Routine Description:
  212. Format and print a line of information output into the info buffer.
  213. Arguments:
  214. Info - Info buffer
  215. Format - printf format
  216. Return Value:
  217. None.
  218. --*/
  219. DWORD
  220. InfoVerify(
  221. IN ULONG BlobSize,
  222. IN OUT PBYTE Blob
  223. );
  224. /*++
  225. Routine Description:
  226. Verify the consistency of the blob.
  227. Arguments:
  228. BlobSize - total bytes of Blob
  229. Blob - details desired info and provides buffer for info
  230. Return Value:
  231. Win32 Status
  232. --*/
  233. //
  234. // Context global to InfoPrintIDTable...
  235. //
  236. typedef struct _INFO_TABLE{
  237. PREPLICA Replica;
  238. PTHREAD_CTX ThreadCtx;
  239. PTABLE_CTX TableCtx;
  240. PNTFRSAPI_INFO Info;
  241. DWORD Tabs;
  242. } INFO_TABLE, *PINFO_TABLE;
  243. //
  244. // Context used to resume dumps of ntfrs tables across calls from ntfrsutl.exe
  245. // see info.c
  246. //
  247. typedef struct _FRS_INFO_CONTEXT{
  248. ULONG ContextIndex; // Index into the Hash table of contexts.
  249. ULONG SaveTotalChars; // Saved value from Info struct.
  250. // Needed to continue non table dumps (threads, stage).
  251. FILETIME LastAccessTime; // Last time this context was used.
  252. PINFO_TABLE InfoTable; // Info about the open table.
  253. ULONG ReplicaNumber;
  254. PWCHAR TableName;
  255. TABLE_TYPE TableType;
  256. ULONG Indexx;
  257. PVOID KeyValue;
  258. INT ScanDirection; // -1,0,1 (only -1 and 1 used at this point)
  259. } FRS_INFO_CONTEXT, *PFRS_INFO_CONTEXT;
  260. #ifdef __cplusplus
  261. }
  262. #endif