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.

231 lines
7.9 KiB

  1. #ifndef __HIDTEST_H__
  2. #define __HIDTEST_H__
  3. /*****************************************************************************
  4. /* Exportable typedefs
  5. /*****************************************************************************/
  6. typedef PTSTR DEVICE_STRING;
  7. typedef struct _HidTestStatus
  8. {
  9. ULONG nOperationsPerformed;
  10. ULONG nOperationsPassed;
  11. ULONG nOperationsFailed;
  12. } HIDTEST_STATUS, *PHIDTEST_STATUS;
  13. typedef struct _HidDeviceInfo
  14. {
  15. HANDLE HidDeviceHandle;
  16. DEVICE_STRING HidDeviceString;
  17. PHIDP_PREPARSED_DATA HidDevicePpd;
  18. PHIDD_ATTRIBUTES HidDeviceAttributes;
  19. PHIDP_CAPS HidDeviceCaps;
  20. BOOL IsPhysicalDevice;
  21. } HIDTEST_DEVICEINFO, *PHIDTEST_DEVICEINFO;
  22. typedef VOID HIDTEST_API(PHIDTEST_DEVICEINFO, ULONG, PHIDTEST_STATUS);
  23. typedef HIDTEST_API *PHIDTEST_API;
  24. typedef BOOL (*PCREATE_PHYSICAL_DEVICE_INFO_PROC)(DEVICE_STRING,
  25. BOOL,
  26. PHIDTEST_DEVICEINFO
  27. );
  28. typedef BOOL (*PCREATE_LOGICAL_DEVICE_INFO_PROC)(PCHAR,
  29. ULONG,
  30. PHIDTEST_DEVICEINFO
  31. );
  32. typedef VOID (*PCREATE_FREE_DEVICE_INFO_PROC)(PHIDTEST_DEVICEINFO);
  33. typedef BOOL (*PCREATE_TEST_LOG_PROC)(PCHAR);
  34. typedef VOID (*PSET_LOG_ON_PROC)(BOOL);
  35. typedef VOID (*PCLOSE_TEST_LOG_PROC)(VOID);
  36. typedef struct _functions {
  37. PHIDTEST_API HIDTest_VerifyHidGuid;
  38. PHIDTEST_API HIDTest_VerifyStrings;
  39. PHIDTEST_API HIDTest_VerifyPreparsedData;
  40. PHIDTEST_API HIDTest_VerifyAttributes;
  41. PHIDTEST_API HIDTest_VerifyCapabilities;
  42. PCREATE_PHYSICAL_DEVICE_INFO_PROC HIDTest_CreatePhysicalDeviceInfo;
  43. PCREATE_LOGICAL_DEVICE_INFO_PROC HIDTest_CreateLogicalDeviceInfo;
  44. PCREATE_FREE_DEVICE_INFO_PROC HIDTest_FreeDeviceInfo;
  45. PCREATE_TEST_LOG_PROC HIDTest_CreateTestLog;
  46. PSET_LOG_ON_PROC HIDTest_SetLogOn;
  47. PCLOSE_TEST_LOG_PROC HIDTest_CloseTestLog;
  48. } HIDTEST_FUNCTIONS, *PHIDTEST_FUNCTIONS;
  49. typedef VOID (*PINIT_PROC)(PHIDTEST_FUNCTIONS);
  50. #define HIDTest_AllocateDeviceString(nChars) ALLOC(((nChars)+1) * sizeof(TCHAR))
  51. #define HIDTest_FreeDeviceString(String) FREE(String)
  52. /*
  53. // Declare the exportable function as normal function declarations when
  54. // this file is include in HIDTEST.C. Otherwise, we want to declare
  55. // our pointers to these functions as external variables
  56. */
  57. #ifdef __HIDTEST_C__
  58. VOID
  59. HIDTest_InitExportAddress(
  60. PHIDTEST_FUNCTIONS Exports
  61. );
  62. HIDTEST_API HIDTest_VerifyHidGuidA;
  63. HIDTEST_API HIDTest_VerifyStringsA;
  64. HIDTEST_API HIDTest_VerifyPreparsedDataA;
  65. HIDTEST_API HIDTest_VerifyAttributesA;
  66. HIDTEST_API HIDTest_VerifyCapabilitiesA;
  67. VOID
  68. HIDTest_VerifyPhysicalDesc(
  69. IN HANDLE HidDevice,
  70. IN PCHAR PhysDesc,
  71. IN ULONG PhysDescLength,
  72. IN ULONG nIterations,
  73. OUT PHIDTEST_STATUS Status
  74. );
  75. VOID
  76. HIDTest_VerifyFeatures(
  77. IN HANDLE HidDevice,
  78. IN PHIDP_BUTTON_CAPS FeatureButtonCaps,
  79. IN PHIDP_VALUE_CAPS FeatureValueCaps,
  80. IN ULONG nIterations,
  81. OUT PHIDTEST_STATUS Status
  82. );
  83. VOID
  84. HIDTest_VerifyConfiguratons(
  85. IN HANDLE HidDevice,
  86. IN ULONG nConfigurations,
  87. IN BOOL RestoreCurrentConfig,
  88. IN ULONG nIterations,
  89. OUT PHIDTEST_STATUS Status
  90. );
  91. VOID
  92. HIDTest_VerifyInputButtons(
  93. IN HANDLE HidDevice,
  94. IN ULONG nBuffers,
  95. IN BOOL RestoreCurrentCount,
  96. IN ULONG nIterations,
  97. OUT PHIDTEST_STATUS Status
  98. );
  99. VOID
  100. HIDTest_VerifyDevices(
  101. IN ULONG nStrings,
  102. IN DEVICE_STRING DeviceStrings[],
  103. IN ULONG nIterations,
  104. OUT PHIDTEST_STATUS Status
  105. );
  106. VOID
  107. HIDTest_VerifyLinkCollections(
  108. IN PHIDP_PREPARSED_DATA Ppd,
  109. IN PHIDP_LINK_COLLECTION_NODE CollectionList,
  110. IN ULONG nCollections,
  111. IN ULONG nIterations,
  112. OUT PHIDTEST_STATUS Status
  113. );
  114. BOOL
  115. HIDTest_CreatePhysicalDeviceInfoA(
  116. IN DEVICE_STRING DeviceName,
  117. IN BOOL OpenOverlapped,
  118. OUT PHIDTEST_DEVICEINFO DeviceInfo
  119. );
  120. BOOL
  121. HIDTest_CreateLogicalDeviceInfoA(
  122. IN PCHAR DevicePpd,
  123. IN ULONG DevicePpdLength,
  124. OUT PHIDTEST_DEVICEINFO DeviceInfo
  125. );
  126. VOID
  127. HIDTest_FreeDeviceInfoA(
  128. IN PHIDTEST_DEVICEINFO DeviceInfo
  129. );
  130. BOOL
  131. HIDTest_CreateTestLogA(
  132. IN PCHAR LogFileName
  133. );
  134. VOID
  135. HIDTest_SetLogOnA(
  136. BOOL TurnOn
  137. );
  138. VOID
  139. HIDTest_CloseTestLogA(
  140. VOID
  141. );
  142. #else
  143. /*
  144. // Declare this structure. This structure will be mapped into an user
  145. // space which might possibly use HIDTEST.DLL. Any program that
  146. // uses HIDTest needs to use the HIDTEST_INIT() macro before calling
  147. // any of the functions. This macro will take care of resolving all
  148. // the function addresses.
  149. */
  150. HIDTEST_FUNCTIONS HIDTest_Exports;
  151. /*
  152. // This is the definition of the HIDTEST_INIT() macro which initializes
  153. // all the function address that are exported by the DLL.
  154. */
  155. #define HIDTEST_INIT() \
  156. { \
  157. PINIT_PROC INIT_PROC; \
  158. \
  159. INIT_PROC = (PINIT_PROC) GetProcAddress(GetModuleHandle("HIDTEST.DLL"), \
  160. "HIDTest_InitExportAddress" \
  161. ); \
  162. \
  163. INIT_PROC(&HIDTest_Exports); \
  164. }
  165. /*
  166. // These are the defines that are used by the HIDTest to access the
  167. // exported testing functions.
  168. */
  169. #define HIDTest_VerifyHidGuid HIDTest_Exports.HIDTest_VerifyHidGuid
  170. #define HIDTest_VerifyStrings HIDTest_Exports.HIDTest_VerifyStrings
  171. #define HIDTest_VerifyPreparsedData HIDTest_Exports.HIDTest_VerifyPreparsedData
  172. #define HIDTest_VerifyAttributes HIDTest_Exports.HIDTest_VerifyAttributes
  173. #define HIDTest_VerifyCapabilities HIDTest_Exports.HIDTest_VerifyCapabilities
  174. #define HIDTest_CreatePhysicalDeviceInfo HIDTest_Exports.HIDTest_CreatePhysicalDeviceInfo
  175. #define HIDTest_CreateLogicalDeviceInfo HIDTest_Exports.HIDTest_CreateLogicalDeviceInfo
  176. #define HIDTest_FreeDeviceInfo HIDTest_Exports.HIDTest_FreeDeviceInfo
  177. #define HIDTest_CreateTestLog HIDTest_Exports.HIDTest_CreateTestLog
  178. #define HIDTest_SetLogOn HIDTest_Exports.HIDTest_SetLogOn
  179. #define HIDTest_CloseTestLog HIDTest_Exports.HIDTest_CloseTestLog
  180. #endif
  181. #endif