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.

187 lines
6.2 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. //
  4. // File: fifoqdbg.h
  5. //
  6. // Description: Debugger extension for base AQ queue classes
  7. //
  8. // Author: Mike Swafford (MikeSwa)
  9. //
  10. // History:
  11. // 9/13/99 - MikeSwa Created
  12. //
  13. // Copyright (C) 1999 Microsoft Corporation
  14. //
  15. //-----------------------------------------------------------------------------
  16. #ifndef __FIFOQDBG_H__
  17. #define __FIFOQDBG_H__
  18. #ifdef PLATINUM
  19. #include <phatqdbg.h>
  20. #else
  21. #include <aqdbgext.h>
  22. #endif // PLATINUM
  23. #include <fifoq.h>
  24. #include <destmsgq.h>
  25. #include <linkmsgq.h>
  26. enum AQ_QUEUE_TYPE {
  27. AQ_QUEUE_TYPE_UNKNOWN,
  28. AQ_QUEUE_TYPE_FIFOQ,
  29. AQ_QUEUE_TYPE_DMQ,
  30. AQ_QUEUE_TYPE_LMQ,
  31. };
  32. //---[ IQueueDbgIterator ]-----------------------------------------------------
  33. //
  34. //
  35. // Description:
  36. // Generic queue iterator for the debug extensions. Users should
  37. // use CQueueDbgIterator directly
  38. // Hungarian:
  39. // qdbgi, pqdbgi
  40. //
  41. //-----------------------------------------------------------------------------
  42. class IQueueDbgIterator
  43. {
  44. public:
  45. virtual BOOL fInit(HANDLE hCurrentProcess, PVOID pvAddressOtherProc) = 0;
  46. virtual DWORD cGetCount() = 0;
  47. virtual PVOID pvGetNext() = 0;
  48. virtual VOID SetApis(PWINDBG_EXTENSION_APIS pApis) = 0;
  49. virtual LPSTR szGetName() = 0;
  50. };
  51. //---[ CFifoQueueDbgIterator ]-------------------------------------------------
  52. //
  53. //
  54. // Description:
  55. // Iterator class that will iterate over all the elements of a fifoq
  56. // Hungarian:
  57. // fifoqdbg, pfifoqdbg
  58. //
  59. //-----------------------------------------------------------------------------
  60. class CFifoQueueDbgIterator :
  61. public IQueueDbgIterator
  62. {
  63. protected:
  64. BYTE m_pbQueueBuffer[sizeof(CFifoQueue<PVOID>)];
  65. DWORD m_iCurrentPage;
  66. DWORD m_iCurrentIndexInPage;
  67. DWORD m_cPagesLoaded;
  68. DWORD m_iHeadIndex;
  69. DWORD m_iTailIndex;
  70. PWINDBG_EXTENSION_APIS pExtensionApis;
  71. public:
  72. CFifoQueueDbgIterator(PWINDBG_EXTENSION_APIS pApis = NULL);
  73. ~CFifoQueueDbgIterator();
  74. virtual BOOL fInit(HANDLE hCurrentProcess, PVOID pvAddressOtherProc);
  75. virtual DWORD cGetCount();
  76. virtual PVOID pvGetNext();
  77. virtual VOID SetApis(PWINDBG_EXTENSION_APIS pApis) {pExtensionApis = pApis;};
  78. virtual LPSTR szGetName() {return NULL;};
  79. };
  80. //---[ CDMQDbgIterator ]-------------------------------------------------------
  81. //
  82. //
  83. // Description:
  84. // Iterartor class for DMQ... will dump every item on all its fifo queues
  85. // Hungarian:
  86. // dmqdbg, pdmqdbg
  87. //
  88. //-----------------------------------------------------------------------------
  89. class CDMQDbgIterator :
  90. public IQueueDbgIterator
  91. {
  92. protected:
  93. BYTE m_pbDMQBuffer[sizeof(CDestMsgQueue)];
  94. CDestMsgQueue *m_pdmq;
  95. DWORD m_iCurrentFifoQ;
  96. DWORD m_cCount;
  97. DWORD m_cItemsReturnedThisQueue;
  98. PWINDBG_EXTENSION_APIS pExtensionApis;
  99. PVOID m_pvFifoQOtherProc[NUM_PRIORITIES+1];
  100. CFifoQueueDbgIterator m_rgfifoqdbg[NUM_PRIORITIES+1];
  101. CHAR m_szName[MAX_PATH];
  102. public:
  103. CDMQDbgIterator(PWINDBG_EXTENSION_APIS pApis = NULL);
  104. ~CDMQDbgIterator() {};
  105. virtual BOOL fInit(HANDLE hCurrentProcess, PVOID pvAddressOtherProc);
  106. virtual DWORD cGetCount() {return m_cCount;};
  107. virtual PVOID pvGetNext();
  108. virtual VOID SetApis(PWINDBG_EXTENSION_APIS pApis) {pExtensionApis = pApis;};
  109. virtual LPSTR szGetName() {return m_szName;};
  110. };
  111. //---[ CLMQDbgIterator ]-------------------------------------------------------
  112. //
  113. //
  114. // Description:
  115. // Debug iterator for CLinkMsgQueue
  116. // Hungarian:
  117. // lmqdbg, plmqdbg
  118. //
  119. //-----------------------------------------------------------------------------
  120. const DWORD MAX_QUEUES_PER_LMQ = QUICK_LIST_PAGE_SIZE;
  121. const DWORD MAX_CONNECTIONS_PER_LMQ = QUICK_LIST_PAGE_SIZE;
  122. class CLMQDbgIterator :
  123. public IQueueDbgIterator
  124. {
  125. protected:
  126. BYTE m_pbLMQBuffer[sizeof(CLinkMsgQueue)];
  127. CLinkMsgQueue *m_plmq;
  128. DWORD m_iCurrentDMQ;
  129. PVOID m_rgpvDMQOtherProc[MAX_QUEUES_PER_LMQ];
  130. CDMQDbgIterator m_rgdmqdbg[MAX_QUEUES_PER_LMQ];
  131. PVOID m_rgpvItemsPendingDelivery[MAX_CONNECTIONS_PER_LMQ];
  132. PVOID m_rgpvConnectionsOtherProc[MAX_CONNECTIONS_PER_LMQ];
  133. DWORD m_cPending;
  134. DWORD m_cCount;
  135. DWORD m_cItemsThisDMQ;
  136. PWINDBG_EXTENSION_APIS pExtensionApis;
  137. CHAR m_szName[MAX_PATH];
  138. public:
  139. CLMQDbgIterator(PWINDBG_EXTENSION_APIS pApis = NULL);
  140. ~CLMQDbgIterator() {};
  141. virtual BOOL fInit(HANDLE hCurrentProcess, PVOID pvAddressOtherProc);
  142. virtual DWORD cGetCount() {return m_cCount;};
  143. virtual PVOID pvGetNext();
  144. virtual VOID SetApis(PWINDBG_EXTENSION_APIS pApis) {pExtensionApis = pApis;};
  145. virtual LPSTR szGetName() {return m_szName;};
  146. };
  147. //---[ CQueueDbgIterator ]-----------------------------------------------------
  148. //
  149. //
  150. // Description:
  151. // "Smart" iterator that will figure out what kind of queue it is being
  152. // called on, and will use the correct kind of iterator for it.
  153. // Hungarian:
  154. // qdbg, pqdbg
  155. //
  156. //-----------------------------------------------------------------------------
  157. class CQueueDbgIterator :
  158. public IQueueDbgIterator
  159. {
  160. protected:
  161. AQ_QUEUE_TYPE m_QueueType;
  162. IQueueDbgIterator *m_pqdbgi;
  163. CFifoQueueDbgIterator m_fifoqdbg;
  164. CDMQDbgIterator m_dmqdbg;
  165. CLMQDbgIterator m_lmqdbg;
  166. PWINDBG_EXTENSION_APIS pExtensionApis;
  167. public:
  168. CQueueDbgIterator(PWINDBG_EXTENSION_APIS pApis);
  169. virtual BOOL fInit(HANDLE hCurrentProcess, PVOID pvAddressOtherProc);
  170. virtual DWORD cGetCount();
  171. virtual PVOID pvGetNext();
  172. virtual VOID SetApis(PWINDBG_EXTENSION_APIS pApis) {pExtensionApis = pApis;};
  173. virtual LPSTR szGetName();
  174. AQ_QUEUE_TYPE GetQueueType(HANDLE hCurrentProcess, PVOID pvAddressOtherProc);
  175. };
  176. #endif //__FIFOQDBG_H__