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.

385 lines
8.0 KiB

  1. #include <wanhelp.h>
  2. DECLARE_API(ndiswancb)
  3. {
  4. DWORD Address, BytesRead;
  5. NDISWANCB NdisWanCB;
  6. Address = GetExpression("ndiswan!ndiswancb");
  7. if (!ReadMemory(Address, &NdisWanCB, sizeof(NDISWANCB), &BytesRead)) {
  8. return;
  9. }
  10. if (BytesRead >= sizeof(NDISWANCB)) {
  11. DisplayNdisWanCB(Address, &NdisWanCB);
  12. } else {
  13. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(NdisWanCB));
  14. }
  15. return;
  16. }
  17. DECLARE_API(enumwanadaptercb)
  18. {
  19. DWORD Address, BytesRead;
  20. WAN_GLOBAL_LIST AdapterList;
  21. PWAN_GLOBAL_LIST Address1;
  22. Address = GetExpression("ndiswan!wanadaptercblist");
  23. Address1 = (PWAN_GLOBAL_LIST)Address;
  24. if (!ReadMemory(Address, &AdapterList, sizeof(WAN_GLOBAL_LIST), &BytesRead)) {
  25. return;
  26. }
  27. if (BytesRead >= sizeof(WAN_GLOBAL_LIST)) {
  28. dprintf("WanAdapterCBList: 0x%8.8x\n",Address);
  29. dprintf(" Lock: 0x%8.8x Irql: 0x%8.8x\n",
  30. AdapterList.Lock.SpinLock, AdapterList.Lock.OldIrql);
  31. dprintf(" Count: %ld MaxCount: %ld\n",
  32. AdapterList.ulCount, AdapterList.ulMaxCount);
  33. Address = AdapterList.List.Flink;
  34. while ((PVOID)Address != (PVOID)&Address1->List) {
  35. WAN_ADAPTERCB WanAdapterCB;
  36. if (ReadMemory(Address, &WanAdapterCB, sizeof(WAN_ADAPTERCB), &BytesRead)) {
  37. DisplayWanAdapterCB(Address, &WanAdapterCB);
  38. }
  39. Address = (DWORD)WanAdapterCB.Linkage.Flink;
  40. }
  41. } else {
  42. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(WAN_GLOBAL_LIST));
  43. }
  44. }
  45. DECLARE_API(wanadaptercb)
  46. {
  47. DWORD Address, BytesRead;
  48. WAN_ADAPTERCB WanAdapterCB;
  49. PUCHAR s = (PSTR)args;
  50. BOOLEAN Verbose = FALSE;
  51. //
  52. // Did they forget something...
  53. //
  54. if (0 == args[0])
  55. {
  56. Usage:
  57. dprintf("wanadapter <PWANADAPTERCB>\n");
  58. return;
  59. }
  60. sscanf(args, "%lx", &Address);
  61. if (!ReadMemory(Address, &WanAdapterCB, sizeof(WAN_ADAPTERCB), &BytesRead)) {
  62. return;
  63. }
  64. if (BytesRead >= sizeof(WAN_ADAPTERCB)) {
  65. DisplayWanAdapterCB(Address, &WanAdapterCB);
  66. } else {
  67. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(WanAdapterCB));
  68. }
  69. }
  70. DECLARE_API(enumadaptercb)
  71. {
  72. DWORD Address, BytesRead;
  73. WAN_GLOBAL_LIST AdapterList;
  74. PWAN_GLOBAL_LIST Address1;
  75. Address = GetExpression("ndiswan!adaptercblist");
  76. Address1 = (PWAN_GLOBAL_LIST)Address;
  77. if (!ReadMemory(Address, &AdapterList, sizeof(WAN_GLOBAL_LIST), &BytesRead)) {
  78. return;
  79. }
  80. if (BytesRead >= sizeof(WAN_GLOBAL_LIST)) {
  81. dprintf("AdapterCBList: 0x%8.8x\n",Address);
  82. dprintf(" Lock: 0x%8.8x Irql: 0x%8.8x\n",
  83. AdapterList.Lock.SpinLock, AdapterList.Lock.OldIrql);
  84. dprintf(" Count: %ld MaxCount: %ld\n",
  85. AdapterList.ulCount, AdapterList.ulMaxCount);
  86. Address = AdapterList.List.Flink;
  87. while ((PVOID)Address != (PVOID)&Address1->List) {
  88. ADAPTERCB AdapterCB;
  89. if (ReadMemory(Address, &AdapterCB, sizeof(ADAPTERCB), &BytesRead)) {
  90. DisplayAdapterCB(Address, &AdapterCB);
  91. }
  92. Address = (DWORD)AdapterCB.Linkage.Flink;
  93. }
  94. } else {
  95. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(WAN_GLOBAL_LIST));
  96. }
  97. }
  98. DECLARE_API(adaptercb)
  99. {
  100. DWORD Address, BytesRead;
  101. ADAPTERCB AdapterCB;
  102. PUCHAR s = (PSTR)args;
  103. BOOLEAN Verbose = FALSE;
  104. //
  105. // Did they forget something...
  106. //
  107. if (0 == args[0])
  108. {
  109. Usage:
  110. dprintf("adapter <PADAPTERCB>\n");
  111. return;
  112. }
  113. sscanf(args, "%lx", &Address);
  114. if (!ReadMemory(Address, &AdapterCB, sizeof(ADAPTERCB), &BytesRead)) {
  115. return;
  116. }
  117. if (BytesRead >= sizeof(ADAPTERCB)) {
  118. DisplayAdapterCB(Address, &AdapterCB);
  119. } else {
  120. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(AdapterCB));
  121. }
  122. }
  123. DECLARE_API(connectiontable)
  124. {
  125. DWORD Address, Address1, BytesRead, i, j;
  126. CONNECTION_TABLE ConnectionTable;
  127. Address = GetExpression("ndiswan!connectiontable");
  128. if (!ReadMemory(Address, &Address1, sizeof(DWORD), &BytesRead)) {
  129. return;
  130. }
  131. if (!ReadMemory(Address1, &ConnectionTable, sizeof(CONNECTION_TABLE), &BytesRead)) {
  132. return;
  133. }
  134. if (BytesRead >= sizeof(CONNECTION_TABLE)) {
  135. DisplayConnectionTable(Address, &ConnectionTable);
  136. for (i = 0, j = 0; j < ConnectionTable.ulNumActiveLinks; i++) {
  137. LINKCB LinkCB;
  138. //
  139. // Get pointer to location in Linktable
  140. //
  141. Address = ConnectionTable.LinkArray + i;
  142. if (!ReadMemory(Address, &Address1, sizeof(DWORD), &BytesRead)) {
  143. continue;
  144. }
  145. if (Address1 != NULL) {
  146. if (ReadMemory(Address1, &LinkCB, sizeof(LINKCB), &BytesRead)) {
  147. DisplayLinkCB(Address1, &LinkCB);
  148. j++;
  149. }
  150. }
  151. }
  152. for (i = 0, j = 0; j < ConnectionTable.ulNumActiveBundles; i++) {
  153. BUNDLECB BundleCB;
  154. //
  155. // Get pointer to location in bundletable
  156. //
  157. Address = ConnectionTable.BundleArray + i;
  158. if (!ReadMemory(Address, &Address1, sizeof(DWORD), &BytesRead)) {
  159. continue;
  160. }
  161. if (Address1 != NULL) {
  162. if (ReadMemory(Address1, &BundleCB, sizeof(BUNDLECB), &BytesRead)) {
  163. DisplayBundleCB(Address1, &BundleCB);
  164. j++;
  165. }
  166. }
  167. }
  168. } else {
  169. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(CONNECTION_TABLE));
  170. }
  171. }
  172. DECLARE_API(bundlecb)
  173. {
  174. DWORD Address, BytesRead;
  175. BUNDLECB BundleCB;
  176. //
  177. // Did they forget something...
  178. //
  179. if (0 == args[0])
  180. {
  181. Usage:
  182. dprintf("bundlecb <PBUNDLECB>\n");
  183. return;
  184. }
  185. sscanf(args, "%lx", &Address);
  186. if (!ReadMemory(Address, &BundleCB, sizeof(BUNDLECB), &BytesRead)) {
  187. return;
  188. }
  189. if (BytesRead >= sizeof(BUNDLECB)) {
  190. DisplayBundleCB(Address, &BundleCB);
  191. } else {
  192. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(BUNDLECB));
  193. }
  194. }
  195. DECLARE_API(linkcb)
  196. {
  197. DWORD Address, BytesRead;
  198. LINKCB LinkCB;
  199. //
  200. // Did they forget something...
  201. //
  202. if (0 == args[0])
  203. {
  204. Usage:
  205. dprintf("linkcb <PLINKCB>\n");
  206. return;
  207. }
  208. sscanf(args, "%lx", &Address);
  209. if (!ReadMemory(Address, &LinkCB, sizeof(LINKCB), &BytesRead)) {
  210. return;
  211. }
  212. if (BytesRead >= sizeof(LINKCB)) {
  213. DisplayLinkCB(Address, &LinkCB);
  214. } else {
  215. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(LINKCB));
  216. }
  217. }
  218. DECLARE_API(protocolcb)
  219. {
  220. DWORD Address, BytesRead;
  221. PROTOCOLCB ProtocolCB;
  222. //
  223. // Did they forget something...
  224. //
  225. if (0 == args[0])
  226. {
  227. Usage:
  228. dprintf("protocolcb <PPROTOCOLCB>\n");
  229. return;
  230. }
  231. sscanf(args, "%lx", &Address);
  232. if (!ReadMemory(Address, &ProtocolCB, sizeof(PROTOCOLCB), &BytesRead)) {
  233. return;
  234. }
  235. if (BytesRead >= sizeof(PROTOCOLCB)) {
  236. DisplayProtocolCB(Address, &ProtocolCB);
  237. } else {
  238. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(PROTOCOLCB));
  239. }
  240. }
  241. DECLARE_API(wanpacket)
  242. {
  243. DWORD Address, BytesRead;
  244. NDIS_WAN_PACKET Packet;
  245. //
  246. // Did they forget something...
  247. //
  248. if (0 == args[0])
  249. {
  250. Usage:
  251. dprintf("wanpacket <PNDIS_WAN_PACKET>\n");
  252. return;
  253. }
  254. sscanf(args, "%lx", &Address);
  255. if (!ReadMemory(Address, &Packet, sizeof(NDIS_WAN_PACKET), &BytesRead)) {
  256. return;
  257. }
  258. if (BytesRead >= sizeof(NDIS_WAN_PACKET)) {
  259. DisplayWanPacket(Address, &Packet);
  260. } else {
  261. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(NDIS_WAN_PACKET));
  262. }
  263. }
  264. DECLARE_API(ndispacket)
  265. {
  266. DWORD Address, BytesRead;
  267. NDIS_PACKET Packet;
  268. //
  269. // Did they forget something...
  270. //
  271. if (0 == args[0])
  272. {
  273. Usage:
  274. dprintf("ndispacket <PNDIS_PACKET>\n");
  275. return;
  276. }
  277. sscanf(args, "%lx", &Address);
  278. if (!ReadMemory(Address, &Packet, sizeof(NDIS_PACKET), &BytesRead)) {
  279. return;
  280. }
  281. if (BytesRead >= sizeof(NDIS_PACKET)) {
  282. DisplayNdisPacket(Address, &Packet);
  283. } else {
  284. dprintf("Only read %d bytes, expected %d bytes\n", BytesRead, sizeof(NDIS_PACKET));
  285. }
  286. }