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.

170 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. poll.c
  5. Abstract:
  6. Implements the poll command
  7. Author:
  8. Vadim Eydelman (vadime) 25-Oct-2000
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "afdkdp.h"
  14. #pragma hdrstop
  15. //
  16. // Private prototypes.
  17. //
  18. //
  19. // Public functions.
  20. //
  21. DECLARE_API( poll )
  22. /*++
  23. Routine Description:
  24. Dumps the AFD_POLL_INFO_INTERNAL structure
  25. Arguments:
  26. None.
  27. Return Value:
  28. None.
  29. --*/
  30. {
  31. ULONG result;
  32. INT i;
  33. CHAR expr[MAX_ADDRESS_EXPRESSION];
  34. PCHAR argp;
  35. ULONG64 address;
  36. gClient = pClient;
  37. if (!CheckKmGlobals ()) {
  38. return E_INVALIDARG;
  39. }
  40. argp = ProcessOptions ((PCHAR)args);
  41. if (argp==NULL)
  42. return E_INVALIDARG;
  43. if (argp[0]==0) {
  44. LIST_ENTRY64 listEntry;
  45. ULONG64 nextEntry;
  46. ULONG64 listHead;
  47. dprintf (AFDKD_BRIEF_POLL_DISPLAY_HEADER);
  48. listHead = GetExpression( "afd!AfdPollListHead" );
  49. if( listHead == 0 ) {
  50. dprintf( "\npoll: Could not find afd!AfdPollListHead\n" );
  51. return E_INVALIDARG;
  52. }
  53. if( !ReadListEntry(
  54. listHead,
  55. &listEntry) ) {
  56. dprintf(
  57. "\npoll: Could not read afd!AfdPollListHead @ %p\n",
  58. listHead
  59. );
  60. return E_INVALIDARG;
  61. }
  62. nextEntry = listEntry.Flink;
  63. address = listHead;
  64. while( nextEntry != listHead ) {
  65. if (nextEntry==0) {
  66. dprintf ("\npoll: Flink is NULL, last poll: %p\n", address);
  67. break;
  68. }
  69. if( CheckControlC() ) {
  70. break;
  71. }
  72. address = nextEntry;
  73. result = (ULONG)InitTypeRead (address, AFD!AFD_POLL_INFO_INTERNAL);
  74. if( result!=0) {
  75. dprintf(
  76. "\npoll: Could not read AFD_POLL_INFO_INTERNAL @ %p, err: %d\n",
  77. address, result
  78. );
  79. return E_INVALIDARG;
  80. }
  81. nextEntry = ReadField (PollListEntry.Flink);
  82. if (!(Options & AFDKD_CONDITIONAL) ||
  83. CheckConditional (address, "AFD!AFD_POLL_INFO_INTERNAL") ) {
  84. if (Options & AFDKD_BRIEF_DISPLAY) {
  85. DumpAfdPollInfoBrief (address);
  86. }
  87. else {
  88. DumpAfdPollInfo (address);
  89. }
  90. if (Options & AFDKD_FIELD_DISPLAY) {
  91. ProcessFieldOutput (address, "AFD!AFD_POLL_INFO_INTERNAL");
  92. }
  93. }
  94. else
  95. dprintf (".");
  96. }
  97. dprintf (AFDKD_BRIEF_POLL_DISPLAY_TRAILER);
  98. }
  99. else {
  100. //
  101. // Snag the address from the command line.
  102. //
  103. while (sscanf( argp, "%s%n", expr, &i )==1) {
  104. if( CheckControlC() ) {
  105. break;
  106. }
  107. argp += i;
  108. address = GetExpression (expr);
  109. result = (ULONG)InitTypeRead (address, AFD!AFD_POLL_INFO_INTERNAL);
  110. if (result!=0) {
  111. dprintf ("\npoll: Could not read AFD_POLL_INFO_INTERNAL @ %p, err: %d\n",
  112. address, result);
  113. break;
  114. }
  115. if (Options & AFDKD_BRIEF_DISPLAY) {
  116. DumpAfdPollInfoBrief (address);
  117. }
  118. else {
  119. DumpAfdPollInfo (address);
  120. }
  121. if (Options & AFDKD_FIELD_DISPLAY) {
  122. ProcessFieldOutput (address, "AFD!AFD_POLL_INFO_INTERNAL");
  123. }
  124. }
  125. dprintf ("\n");
  126. }
  127. return S_OK;
  128. } // poll