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.

211 lines
5.2 KiB

  1. //When invoked from WDM makefile the debug condition is different
  2. #ifdef COMPILE_FOR_WDM_KERNEL_MODE
  3. #if (DBG==1)
  4. #undef _NDEBUG
  5. #else
  6. #define _NDEBUG
  7. #endif
  8. #endif
  9. // If not debug the module just makes the three entry points no-ops
  10. #ifdef _NDEBUG
  11. #define CIC_DBG_DumpCommandBlock(_X_)
  12. #define CIC_DBG_SetDumpFunc(_X_)
  13. #define CIC_DBG_InitDumpModule(_X_)
  14. #else
  15. //This module only works in debug mode
  16. #define CIC_DBG_DumpCommandBlock(_X_) DumpCommandBlock _X_
  17. #define CIC_DBG_SetDumpFunc(_X_) SetDumpFunc _X_
  18. #define CIC_DBG_InitDumpModule(_X_) InitDumpModule _X_
  19. #ifdef COMPILE_FOR_WDM_KERNEL_MODE
  20. #define DCB_TRACE(_x_) DbgPrint(_x_)
  21. #else
  22. #define DCB_TRACE(_x_) OutputDebugString(_x_)
  23. #endif
  24. typedef void (*PFNSTRING_DUMP_FUNC)(LPSTR);
  25. //
  26. // Interface of exported functions
  27. //
  28. void InitDumpModule(ULONG ulVidPid);
  29. void SetDumpFunc(PFNSTRING_DUMP_FUNC pfnDumpFunc);
  30. BOOLEAN DumpCommandBlock(PUCHAR pucBlock, ULONG rulSize);
  31. //
  32. // Internals - for dumping info from small chuncks.
  33. //
  34. void DumpString(LPSTR lpszDumpString);
  35. BOOLEAN DumpRecurse(PUCHAR pucBlock, ULONG ulSize, ULONG ulDepth);
  36. BOOLEAN DumpDirectory(PUCHAR pucBlock, ULONG ulSize, ULONG ulDepth);
  37. BOOLEAN DumpAssignmentTarget(PUCHAR pucBlock, ULONG ulSize);
  38. BOOLEAN DumpTimedMacro(PUCHAR pucBlock, ULONG ulSize);
  39. BOOLEAN DumpKeyString(PUCHAR pucBlock, ULONG ulSize);
  40. BOOLEAN DumpMouseFxAxisMap(PUCHAR pucBlock, ULONG ulSize);
  41. BOOLEAN DumpTimedEvent(PTIMED_EVENT pTimedEvent);
  42. BOOLEAN DumpEvent(PEVENT pEvent);
  43. BOOLEAN DumpTriggerXfer(PCONTROL_ITEM_XFER pControlItemXfer);
  44. BOOLEAN DumpEventXfer(PCONTROL_ITEM_XFER pControlItemXfer);
  45. BOOLEAN DumpKeyboardData(PCONTROL_ITEM_XFER pControlItemXfer);
  46. //
  47. // Dumping Xfers it more complicated and requires a derivative of CControlItemCollection
  48. //
  49. class CDumpItem : public virtual CControlItem
  50. {
  51. public:
  52. CDumpItem(){}
  53. virtual void DumpItemInfo(ULONG ulDumpFlags);
  54. //
  55. // Static functions
  56. //
  57. static void SetDumpFunc(PFNSTRING_DUMP_FUNC pfnDumpFunc)
  58. {
  59. ms_pfnDumpFunc = pfnDumpFunc;
  60. }
  61. static void DumpString(LPSTR lpszDumpString)
  62. {
  63. if(NULL == ms_pfnDumpFunc)
  64. {
  65. DCB_TRACE(lpszDumpString);
  66. }
  67. else
  68. {
  69. ms_pfnDumpFunc(lpszDumpString);
  70. }
  71. }
  72. private:
  73. static PFNSTRING_DUMP_FUNC ms_pfnDumpFunc;
  74. };
  75. class CAxesDump : public CDumpItem, public CAxesItem
  76. {
  77. public:
  78. CAxesDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  79. : CAxesItem(cpControlItemDesc)
  80. {
  81. }
  82. virtual void DumpItemInfo(ULONG ulDumpFlags);
  83. };
  84. class CDPADDump : public CDumpItem, public CDPADItem
  85. {
  86. public:
  87. CDPADDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  88. : CDPADItem(cpControlItemDesc)
  89. {
  90. }
  91. virtual void DumpItemInfo(ULONG ulDumpFlags);
  92. };
  93. class CPropDPADDump : public CDumpItem, public CPropDPADItem
  94. {
  95. public:
  96. CPropDPADDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  97. : CPropDPADItem(cpControlItemDesc)
  98. {
  99. }
  100. virtual void DumpItemInfo(ULONG ulDumpFlags);
  101. };
  102. class CButtonsDump : public CDumpItem, public CButtonsItem
  103. {
  104. public:
  105. CButtonsDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  106. : CButtonsItem(cpControlItemDesc)
  107. {
  108. }
  109. virtual void DumpItemInfo(ULONG ulDumpFlags);
  110. };
  111. class CPOVDump : public CDumpItem, public CPOVItem
  112. {
  113. public:
  114. CPOVDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  115. : CPOVItem(cpControlItemDesc)
  116. {
  117. }
  118. virtual void DumpItemInfo(ULONG ulDumpFlags);
  119. };
  120. class CThrottleDump : public CDumpItem, public CThrottleItem
  121. {
  122. public:
  123. CThrottleDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  124. : CThrottleItem(cpControlItemDesc)
  125. {}
  126. virtual void DumpItemInfo(ULONG ulDumpFlags);
  127. };
  128. class CRudderDump : public CDumpItem, public CRudderItem
  129. {
  130. public:
  131. CRudderDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  132. : CRudderItem(cpControlItemDesc)
  133. {
  134. }
  135. virtual void DumpItemInfo(ULONG ulDumpFlags);
  136. };
  137. class CWheelDump : public CDumpItem, public CWheelItem
  138. {
  139. public:
  140. CWheelDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  141. : CWheelItem(cpControlItemDesc)
  142. {
  143. }
  144. virtual void DumpItemInfo(ULONG ulDumpFlags);
  145. };
  146. class CPedalDump : public CDumpItem, public CPedalItem
  147. {
  148. public:
  149. CPedalDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  150. : CPedalItem(cpControlItemDesc)
  151. {
  152. }
  153. virtual void DumpItemInfo(ULONG ulDumpFlags);
  154. };
  155. class CZoneIndicatorDump : public CDumpItem, public CZoneIndicatorItem
  156. {
  157. public:
  158. CZoneIndicatorDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  159. : CZoneIndicatorItem(cpControlItemDesc)
  160. {
  161. }
  162. virtual void DumpItemInfo(ULONG ulDumpFlags);
  163. };
  164. class CDualZoneIndicatorDump : public CDumpItem, public CDualZoneIndicatorItem
  165. {
  166. public:
  167. CDualZoneIndicatorDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  168. : CDualZoneIndicatorItem(cpControlItemDesc)
  169. {
  170. }
  171. virtual void DumpItemInfo(ULONG ulDumpFlags);
  172. };
  173. class CForceMapDump : public CDumpItem, public CForceMapItem
  174. {
  175. public:
  176. CForceMapDump(const CONTROL_ITEM_DESC *cpControlItemDesc)
  177. : CForceMapItem(cpControlItemDesc)
  178. {
  179. }
  180. virtual void DumpItemInfo(ULONG ulDumpFlags);
  181. };
  182. //NEWDEVICE
  183. HRESULT DumpItemFactory
  184. (
  185. USHORT usType,
  186. const CONTROL_ITEM_DESC* cpControlItemDesc,
  187. CDumpItem **ppControlItem
  188. );
  189. #endif //NOT _NDEBUG