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.

278 lines
9.3 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. glob.c
  5. Abstract:
  6. Dumps critical global UL data.
  7. Author:
  8. Keith Moore (keithmo) 07-Apr-1999
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. //
  15. // Private types.
  16. //
  17. typedef struct _UL_SYMBOL
  18. {
  19. PSTR pSymbolName;
  20. ULONG_PTR Address;
  21. ULONG_PTR Value;
  22. ULONG Size;
  23. BOOLEAN Pointer;
  24. } UL_SYMBOL, *PUL_SYMBOL;
  25. #define MAKE_POINTER( name, type ) \
  26. { \
  27. "&http!" name, \
  28. 0, \
  29. 0, \
  30. (ULONG)sizeof(type), \
  31. TRUE \
  32. }
  33. #define MAKE_ORDINAL( name, type ) \
  34. { \
  35. "&http!" name, \
  36. 0, \
  37. 0, \
  38. (ULONG)sizeof(type), \
  39. FALSE \
  40. }
  41. UL_SYMBOL g_GlobalSymbols[] =
  42. {
  43. MAKE_ORDINAL( "g_UlNumberOfProcessors", CLONG ),
  44. MAKE_POINTER( "g_pUlNonpagedData", PUL_NONPAGED_DATA ),
  45. MAKE_POINTER( "g_pUlSystemProcess", PKPROCESS ),
  46. MAKE_POINTER( "g_UlDirectoryObject", HANDLE ),
  47. MAKE_POINTER( "g_pUlControlDeviceObject", PDEVICE_OBJECT ),
  48. MAKE_POINTER( "g_pUlFilterDeviceObject", PDEVICE_OBJECT ),
  49. MAKE_POINTER( "g_pUlAppPoolDeviceObject", PDEVICE_OBJECT ),
  50. MAKE_ORDINAL( "g_UlPriorityBoost", CCHAR ),
  51. MAKE_ORDINAL( "g_UlIrpStackSize", CCHAR ),
  52. MAKE_ORDINAL( "g_UlMinIdleConnections", USHORT ),
  53. MAKE_ORDINAL( "g_UlMaxIdleConnections", USHORT ),
  54. MAKE_ORDINAL( "g_UlReceiveBufferSize", ULONG ),
  55. MAKE_POINTER( "g_pFilterChannel", PUL_FILTER_CHANNEL ),
  56. MAKE_ORDINAL( "g_FilterOnlySsl", BOOLEAN )
  57. #if REFERENCE_DEBUG
  58. ,
  59. MAKE_POINTER( "g_pMondoGlobalTraceLog", PTRACE_LOG ),
  60. MAKE_POINTER( "g_pTdiTraceLog", PTRACE_LOG ),
  61. MAKE_POINTER( "g_pHttpRequestTraceLog", PTRACE_LOG ),
  62. MAKE_POINTER( "g_pHttpConnectionTraceLog", PTRACE_LOG ),
  63. MAKE_POINTER( "g_pHttpResponseTraceLog", PTRACE_LOG ),
  64. MAKE_POINTER( "g_pAppPoolTraceLog", PTRACE_LOG ),
  65. MAKE_POINTER( "g_pConfigGroupTraceLog", PTRACE_LOG ),
  66. MAKE_POINTER( "g_pMdlTraceLog", PTRACE_LOG ),
  67. MAKE_POINTER( "g_pIrpTraceLog", PTRACE_LOG ),
  68. MAKE_POINTER( "g_pFilterTraceLog", PTRACE_LOG ),
  69. MAKE_POINTER( "g_pTimeTraceLog", PTRACE_LOG ),
  70. MAKE_POINTER( "g_pReplenishTraceLog", PTRACE_LOG ),
  71. MAKE_POINTER( "g_pFiltQueueTraceLog", PTRACE_LOG ),
  72. MAKE_POINTER( "g_pSiteCounterTraceLog", PTRACE_LOG ),
  73. MAKE_POINTER( "g_pConfigGroupInfoTraceLog", PTRACE_LOG )
  74. #endif
  75. };
  76. #define NUM_SYMBOLS DIM(g_GlobalSymbols)
  77. //
  78. // Public functions.
  79. //
  80. DECLARE_API( glob )
  81. /*++
  82. Routine Description:
  83. Dumps critical global UL data.
  84. Arguments:
  85. None.
  86. Return Value:
  87. None.
  88. --*/
  89. {
  90. PUL_SYMBOL pSymbols;
  91. ULONG i;
  92. ULONG_PTR address;
  93. ULONG_PTR dataAddress;
  94. UL_NONPAGED_DATA data;
  95. CHAR configGroupResource[MAX_RESOURCE_STATE_LENGTH];
  96. CHAR appPoolResource[MAX_RESOURCE_STATE_LENGTH];
  97. CHAR disconnectResource[MAX_RESOURCE_STATE_LENGTH];
  98. CHAR uriZombieResource[MAX_RESOURCE_STATE_LENGTH];
  99. CHAR filterResource[MAX_RESOURCE_STATE_LENGTH];
  100. CHAR logListResource[MAX_RESOURCE_STATE_LENGTH];
  101. CHAR tciIfcResource[MAX_RESOURCE_STATE_LENGTH];
  102. CHAR dateHeaderResource[MAX_RESOURCE_STATE_LENGTH];
  103. SNAPSHOT_EXTENSION_DATA();
  104. //
  105. // Dump the simple data.
  106. //
  107. for (i = NUM_SYMBOLS, pSymbols = &g_GlobalSymbols[0] ;
  108. i > 0 ;
  109. i--, pSymbols++)
  110. {
  111. pSymbols->Address = GetExpression( pSymbols->pSymbolName );
  112. if (pSymbols->Address == 0)
  113. {
  114. dprintf(
  115. "glob: cannot find symbol for %s\n",
  116. pSymbols->pSymbolName
  117. );
  118. }
  119. else
  120. {
  121. pSymbols->Value = 0;
  122. if (ReadMemory(
  123. pSymbols->Address,
  124. &pSymbols->Value,
  125. pSymbols->Size,
  126. NULL
  127. ))
  128. {
  129. if (pSymbols->Pointer)
  130. {
  131. dprintf(
  132. "%-30s = %p\n",
  133. pSymbols->pSymbolName,
  134. pSymbols->Value
  135. );
  136. }
  137. else
  138. {
  139. dprintf(
  140. "%-30s = %lu\n",
  141. pSymbols->pSymbolName,
  142. (ULONG)pSymbols->Value
  143. );
  144. }
  145. }
  146. else
  147. {
  148. dprintf(
  149. "glob: cannot read memory for %s @ %p\n",
  150. pSymbols->pSymbolName,
  151. pSymbols->Address
  152. );
  153. }
  154. }
  155. }
  156. //
  157. // Dump the nonpaged data.
  158. //
  159. address = GetExpression( "&http!g_pUlNonpagedData" );
  160. if (address == 0)
  161. {
  162. dprintf(
  163. "glob: cannot find symbol for http!g_pUlNonpagedData\n"
  164. );
  165. }
  166. else
  167. {
  168. if (ReadMemory(
  169. address,
  170. &dataAddress,
  171. sizeof(dataAddress),
  172. NULL
  173. ))
  174. {
  175. if (ReadMemory(
  176. dataAddress,
  177. &data,
  178. sizeof(data),
  179. NULL
  180. ))
  181. {
  182. dprintf(
  183. "\n"
  184. "UL_NONPAGED_DATA @ %p:\n"
  185. " IrpContextLookaside @ %p\n"
  186. " ReceiveBufferLookaside @ %p\n"
  187. " ResourceLookaside @ %p\n"
  188. " ConfigGroupResource @ %p (%s)\n"
  189. " AppPoolResource @ %p (%s)\n"
  190. " DisconnectResource @ %p (%s)\n"
  191. " UriZombieResource @ %p (%s)\n"
  192. " FilterSpinLock @ %p (%s)\n"
  193. " LogListResource @ %p (%s)\n"
  194. " TciIfResource @ %p (%s)\n"
  195. " DateHeaderResource @ %p (%s)\n",
  196. dataAddress,
  197. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, IrpContextLookaside ),
  198. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, ReceiveBufferLookaside ),
  199. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, ResourceLookaside ),
  200. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, ConfigGroupResource ),
  201. BuildResourceState( &data.ConfigGroupResource, configGroupResource ),
  202. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, AppPoolResource ),
  203. BuildResourceState( &data.AppPoolResource, appPoolResource ),
  204. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, DisconnectResource ),
  205. BuildResourceState( &data.DisconnectResource, disconnectResource ),
  206. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, UriZombieResource ),
  207. BuildResourceState( &data.UriZombieResource, uriZombieResource ),
  208. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, FilterSpinLock ),
  209. GetSpinlockState( &data.FilterSpinLock ),
  210. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, LogListResource ),
  211. BuildResourceState( &data.LogListResource, logListResource ),
  212. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, TciIfcResource ),
  213. BuildResourceState( &data.TciIfcResource, tciIfcResource ),
  214. REMOTE_OFFSET( dataAddress, UL_NONPAGED_DATA, DateHeaderResource ),
  215. BuildResourceState( &data.DateHeaderResource, dateHeaderResource )
  216. );
  217. }
  218. else
  219. {
  220. dprintf(
  221. "glob: cannot read memory for http!g_pUlNonpagedData = %p\n",
  222. dataAddress
  223. );
  224. }
  225. }
  226. else
  227. {
  228. dprintf(
  229. "glob: cannot read memory for http!g_pUlNonpagedData @ %p\n",
  230. address
  231. );
  232. }
  233. }
  234. } // glob