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.

378 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. cgroup.c
  5. Abstract:
  6. Dumps config group structures.
  7. Author:
  8. Michael Courage (MCourage) 4-Nov-1999
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. //
  15. // Public functions.
  16. //
  17. DECLARE_API( cgentry )
  18. /*++
  19. Routine Description:
  20. Dumps UL_CG_URL_TREE_ENTRY structures.
  21. Arguments:
  22. None.
  23. Return Value:
  24. None.
  25. --*/
  26. {
  27. ULONG_PTR address = 0;
  28. ULONG result;
  29. UL_CG_URL_TREE_ENTRY entry;
  30. SNAPSHOT_EXTENSION_DATA();
  31. //
  32. // Snag the address from the command line.
  33. //
  34. address = GetExpression( args );
  35. if (address == 0)
  36. {
  37. PrintUsage( "cgentry" );
  38. return;
  39. }
  40. //
  41. // Read the entry.
  42. //
  43. if (!ReadMemory(
  44. address,
  45. &entry,
  46. sizeof(entry),
  47. &result
  48. ))
  49. {
  50. dprintf(
  51. "cgentry: cannot read UL_CG_URL_TREE_ENTRY @ %p\n",
  52. address
  53. );
  54. return;
  55. }
  56. //
  57. // Dump it.
  58. //
  59. DumpCgroupEntry(
  60. "",
  61. "cgentry: ",
  62. address,
  63. &entry
  64. );
  65. } // cgentry
  66. DECLARE_API( cghead )
  67. /*++
  68. Routine Description:
  69. Dumps UL_CG_HEADER_ENTRY structures.
  70. Arguments:
  71. None.
  72. Return Value:
  73. None.
  74. --*/
  75. {
  76. ULONG_PTR address = 0;
  77. ULONG result;
  78. UL_CG_HEADER_ENTRY header;
  79. UL_CG_URL_TREE_ENTRY entry;
  80. SNAPSHOT_EXTENSION_DATA();
  81. //
  82. // Snag the address from the command line.
  83. //
  84. address = GetExpression( args );
  85. if (address == 0)
  86. {
  87. PrintUsage( "cghead" );
  88. return;
  89. }
  90. //
  91. // read the header
  92. //
  93. if (!ReadMemory(
  94. address,
  95. &header,
  96. sizeof(header),
  97. &result
  98. ))
  99. {
  100. dprintf(
  101. "cghead: cannot read UL_CG_HEADER_ENTRY @ %p\n",
  102. address
  103. );
  104. return;
  105. }
  106. //
  107. // Read the entry.
  108. //
  109. if (!ReadMemory(
  110. (ULONG_PTR)header.pEntry,
  111. &entry,
  112. sizeof(entry),
  113. &result
  114. ))
  115. {
  116. dprintf(
  117. "cghead: cannot read UL_CG_URL_TREE_ENTRY @ %p\n",
  118. address
  119. );
  120. return;
  121. }
  122. //
  123. // Dump 'em.
  124. //
  125. DumpCgroupHeader(
  126. "",
  127. "cghead: ",
  128. address,
  129. &header
  130. );
  131. DumpCgroupEntry(
  132. " ",
  133. "cghead: ",
  134. (ULONG_PTR)header.pEntry,
  135. &entry
  136. );
  137. } // cghead
  138. DECLARE_API( cgroup )
  139. /*++
  140. Routine Description:
  141. Dumps UL_CONFIG_GROUP_OBJECT structures.
  142. Arguments:
  143. None.
  144. Return Value:
  145. None.
  146. --*/
  147. {
  148. ULONG_PTR address = 0;
  149. ULONG result;
  150. UL_CONFIG_GROUP_OBJECT object;
  151. SNAPSHOT_EXTENSION_DATA();
  152. //
  153. // Snag the address from the command line.
  154. //
  155. address = GetExpression( args );
  156. if (address == 0)
  157. {
  158. PrintUsage( "cgroup" );
  159. return;
  160. }
  161. //
  162. // Read the object.
  163. //
  164. if (!ReadMemory(
  165. address,
  166. &object,
  167. sizeof(object),
  168. &result
  169. ))
  170. {
  171. dprintf(
  172. "cgroup: cannot read UL_CONFIG_GROUP_OBJECT @ %p\n",
  173. address
  174. );
  175. return;
  176. }
  177. //
  178. // Dump it.
  179. //
  180. DumpConfigGroup(
  181. "",
  182. "cgroup: ",
  183. address,
  184. &object
  185. );
  186. } // cgroup
  187. DECLARE_API( cgtree )
  188. /*++
  189. Routine Description:
  190. Dumps UL_CG_TREE_HEADER structures.
  191. Arguments:
  192. None.
  193. Return Value:
  194. None.
  195. --*/
  196. {
  197. ULONG_PTR address = 0;
  198. ULONG result;
  199. ULONG i;
  200. UL_CG_URL_TREE_HEADER header;
  201. SNAPSHOT_EXTENSION_DATA();
  202. //
  203. // Snag the address from the command line.
  204. //
  205. address = GetExpression( args );
  206. if (address == 0)
  207. {
  208. ULONG_PTR globaladdr;
  209. globaladdr = GetExpression("&http!g_pSites");
  210. if (globaladdr == 0) {
  211. dprintf("cgtree: couldn't evaluate &http!g_pSites\n");
  212. return;
  213. }
  214. if (!ReadMemory(
  215. globaladdr,
  216. &address,
  217. sizeof(address),
  218. &result
  219. ))
  220. {
  221. dprintf(
  222. "cgtree: couldn't read PUL_CG_URL_TREE_HEADER g_pSites @ %p\n",
  223. globaladdr
  224. );
  225. }
  226. }
  227. //
  228. // Read the object.
  229. //
  230. if (!ReadMemory(
  231. address,
  232. &header,
  233. sizeof(header),
  234. &result
  235. ))
  236. {
  237. dprintf(
  238. "cgtree: cannot read UL_CG_URL_TREE_HEADER @ %p\n",
  239. address
  240. );
  241. return;
  242. }
  243. //
  244. // Dump it.
  245. //
  246. DumpConfigTree(
  247. "",
  248. "cgtree: ",
  249. address,
  250. &header
  251. );
  252. for (i = 0; i < header.UsedCount; i++) {
  253. ULONG_PTR entryaddr;
  254. UL_CG_HEADER_ENTRY entry;
  255. entryaddr = (ULONG_PTR)REMOTE_OFFSET(address, UL_CG_URL_TREE_HEADER, pEntries);
  256. entryaddr += i * sizeof(entry);
  257. if (!ReadMemory(
  258. entryaddr,
  259. &entry,
  260. sizeof(entry),
  261. &result
  262. ))
  263. {
  264. dprintf(
  265. "cgtree: cannot read UL_CG_HEADER_ENTRY @ %p\n",
  266. entryaddr
  267. );
  268. break;
  269. }
  270. DumpCgroupHeader(
  271. " ",
  272. "cgtree: ",
  273. entryaddr,
  274. &entry
  275. );
  276. }
  277. } // cgtree