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.

2847 lines
97 KiB

  1. /*****************************************************************************
  2. * portcls.h - WDM Streaming port class driver
  3. *****************************************************************************
  4. * Copyright (c) Microsoft Corporation. All rights reserved.
  5. */
  6. #ifndef _PORTCLS_H_
  7. #define _PORTCLS_H_
  8. #ifdef __cplusplus
  9. // WDM.H does not play well with C++.
  10. extern "C"
  11. {
  12. #include <wdm.h>
  13. }
  14. #else
  15. #include <wdm.h>
  16. #endif
  17. #ifndef IRP_MN_FILTER_RESOURCE_REQUIREMENTS
  18. #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
  19. #endif
  20. #include <windef.h>
  21. #define NOBITMAP
  22. #include <mmreg.h>
  23. #undef NOBITMAP
  24. #include <ks.h>
  25. #include <ksmedia.h>
  26. #include <punknown.h>
  27. #include <drmk.h>
  28. #define PORTCLASSAPI EXTERN_C
  29. #define _100NS_UNITS_PER_SECOND 10000000L
  30. #define PORT_CLASS_DEVICE_EXTENSION_SIZE (64*sizeof(ULONG_PTR))
  31. //
  32. // N.B.: If you are having problems building your driver,
  33. // #define PC_OLD_NAMES in your sources file.
  34. // This flag is no longer turned on by default.
  35. //
  36. //#ifndef PC_NEW_NAMES
  37. //#define PC_OLD_NAMES
  38. //#endif
  39. #define IID_IAdapterPowerManagment IID_IAdapterPowerManagement
  40. #define PADAPTERPOWERMANAGMENT PADAPTERPOWERMANAGEMENT
  41. /*****************************************************************************
  42. * Interface identifiers.
  43. */
  44. DEFINE_GUID(IID_IMiniport,
  45. 0xb4c90a24L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  46. DEFINE_GUID(IID_IPort,
  47. 0xb4c90a25L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  48. DEFINE_GUID(IID_IResourceList,
  49. 0x22C6AC60L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  50. DEFINE_GUID(IID_IMusicTechnology,
  51. 0x80396C3CL, 0xCBCB, 0x409B, 0x9F, 0x65, 0x4F, 0x1E, 0x74, 0x67, 0xCD, 0xAF);
  52. DEFINE_GUID(IID_IDmaChannel,
  53. 0x22C6AC61L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  54. DEFINE_GUID(IID_IDmaChannelSlave,
  55. 0x22C6AC62L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  56. DEFINE_GUID(IID_IInterruptSync,
  57. 0x22C6AC63L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  58. DEFINE_GUID(IID_IServiceSink,
  59. 0x22C6AC64L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  60. DEFINE_GUID(IID_IServiceGroup,
  61. 0x22C6AC65L, 0x851B, 0x11D0, 0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE);
  62. DEFINE_GUID(IID_IRegistryKey,
  63. 0xE8DA4302l, 0xF304, 0x11D0, 0x95, 0x8B, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3);
  64. DEFINE_GUID(IID_IPortMidi,
  65. 0xb4c90a40L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  66. DEFINE_GUID(IID_IMiniportMidi,
  67. 0xb4c90a41L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  68. DEFINE_GUID(IID_IMiniportMidiStream,
  69. 0xb4c90a42L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  70. DEFINE_GUID(IID_IPortTopology,
  71. 0xb4c90a30L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  72. DEFINE_GUID(IID_IMiniportTopology,
  73. 0xb4c90a31L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  74. DEFINE_GUID(IID_IPortWaveCyclic,
  75. 0xb4c90a26L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  76. DEFINE_GUID(IID_IMiniportWaveCyclic,
  77. 0xb4c90a27L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  78. DEFINE_GUID(IID_IMiniportWaveCyclicStream,
  79. 0xb4c90a28L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  80. DEFINE_GUID(IID_IPortWavePci,
  81. 0xb4c90a50L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  82. DEFINE_GUID(IID_IPortWavePciStream,
  83. 0xb4c90a51L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  84. DEFINE_GUID(IID_IMiniportWavePci,
  85. 0xb4c90a52L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  86. DEFINE_GUID(IID_IMiniportWavePciStream,
  87. 0xb4c90a53L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  88. DEFINE_GUID(IID_IAdapterPowerManagement,
  89. 0x793417D0L, 0x35FE, 0x11D1, 0xAD, 0x08, 0x00, 0xA0, 0xC9, 0x0A, 0xB1, 0xB0);
  90. DEFINE_GUID(IID_IPowerNotify,
  91. 0x3DD648B8L, 0x969F, 0x11D1, 0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3);
  92. DEFINE_GUID(IID_IWaveCyclicClock,
  93. 0xdec1ec78L, 0x419a, 0x11d1, 0xad, 0x09, 0x00, 0xc0, 0x4f, 0xb9, 0x1b, 0xc4);
  94. DEFINE_GUID(IID_IWavePciClock,
  95. 0xd5d7a256L, 0x5d10, 0x11d1, 0xad, 0xae, 0x00, 0xc0, 0x4f, 0xb9, 0x1b, 0xc4);
  96. DEFINE_GUID(IID_IPortEvents,
  97. 0xA80F29C4L, 0x5498, 0x11D2, 0x95, 0xD9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3);
  98. DEFINE_GUID(IID_IDrmPort,
  99. 0x286D3DF8L, 0xCA22, 0x4E2E, 0xB9, 0xBC, 0x20, 0xB4, 0xF0, 0xE2, 0x01, 0xCE);
  100. DEFINE_GUID(IID_IDrmPort2,
  101. 0x1ACCE59CL, 0x7311, 0x4B6B, 0x9F, 0xBA, 0xCC, 0x3B, 0xA5, 0x9A, 0xCD, 0xCE);
  102. DEFINE_GUID(IID_IPortClsVersion,
  103. 0x7D89A7BBL, 0x869B, 0x4567, 0x8D, 0xBE, 0x1E, 0x16, 0x8C, 0xC8, 0x53, 0xDE);
  104. DEFINE_GUID(IID_IDmaOperations,
  105. 0xe5372d4cL, 0x0ecb, 0x4df8, 0xa5, 0x00, 0xa6, 0x5c, 0x86, 0x78, 0xbb, 0xe4);
  106. DEFINE_GUID(IID_IPinCount,
  107. 0x5dadb7dcL, 0xa2cb, 0x4540, 0xa4, 0xa8, 0x42, 0x5e, 0xe4, 0xae, 0x90, 0x51);
  108. DEFINE_GUID(IID_IPreFetchOffset,
  109. 0x7000f480L, 0xed44, 0x4e8b, 0xb3, 0x8a, 0x41, 0x2f, 0x8d, 0x7a, 0x50, 0x4d);
  110. /*****************************************************************************
  111. * Class identifiers.
  112. */
  113. DEFINE_GUID(CLSID_PortMidi,
  114. 0xb4c90a43L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  115. DEFINE_GUID(CLSID_PortTopology,
  116. 0xb4c90a32L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  117. DEFINE_GUID(CLSID_PortWaveCyclic,
  118. 0xb4c90a2aL, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  119. DEFINE_GUID(CLSID_PortWavePci,
  120. 0xb4c90a54L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  121. DEFINE_GUID(CLSID_MiniportDriverFmSynth,
  122. 0xb4c90ae0L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  123. DEFINE_GUID(CLSID_MiniportDriverUart,
  124. 0xb4c90ae1L, 0x5791, 0x11d0, 0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44);
  125. DEFINE_GUID(CLSID_MiniportDriverFmSynthWithVol,
  126. 0xe5a3c139L, 0xf0f2, 0x11d1, 0x81, 0xaf, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1);
  127. /*****************************************************************************
  128. * Interfaces
  129. */
  130. #if !defined(DEFINE_ABSTRACT_UNKNOWN)
  131. #define DEFINE_ABSTRACT_UNKNOWN() \
  132. STDMETHOD_(NTSTATUS, QueryInterface)(THIS_ \
  133. REFIID InterfaceId, \
  134. PVOID* Interface \
  135. ) PURE; \
  136. STDMETHOD_(ULONG,AddRef)(THIS) PURE; \
  137. STDMETHOD_(ULONG,Release)(THIS) PURE;
  138. #endif //!defined(DEFINE_ABSTRACT_UNKNOWN)
  139. #if !defined(DEFINE_ABSTRACT_PORT)
  140. #ifdef PC_OLD_NAMES
  141. #define DEFINE_ABSTRACT_PORT() \
  142. STDMETHOD_(NTSTATUS,Init) \
  143. ( THIS_ \
  144. IN PVOID DeviceObject, \
  145. IN PVOID Irp, \
  146. IN PUNKNOWN UnknownMiniport, \
  147. IN PUNKNOWN UnknownAdapter OPTIONAL, \
  148. IN PRESOURCELIST ResourceList \
  149. ) PURE; \
  150. STDMETHOD_(NTSTATUS,GetDeviceProperty) \
  151. ( THIS_ \
  152. IN DEVICE_REGISTRY_PROPERTY DeviceProperty, \
  153. IN ULONG BufferLength, \
  154. OUT PVOID PropertyBuffer, \
  155. OUT PULONG ResultLength \
  156. ) PURE; \
  157. STDMETHOD_(NTSTATUS,NewRegistryKey) \
  158. ( THIS_ \
  159. OUT PREGISTRYKEY * OutRegistryKey, \
  160. IN PUNKNOWN OuterUnknown OPTIONAL, \
  161. IN ULONG RegistryKeyType, \
  162. IN ACCESS_MASK DesiredAccess, \
  163. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, \
  164. IN ULONG CreateOptions OPTIONAL, \
  165. OUT PULONG Disposition OPTIONAL \
  166. ) PURE;
  167. #else // !PC_OLD_NAMES
  168. #define DEFINE_ABSTRACT_PORT() \
  169. STDMETHOD_(NTSTATUS,Init) \
  170. ( THIS_ \
  171. IN PDEVICE_OBJECT DeviceObject, \
  172. IN PIRP Irp, \
  173. IN PUNKNOWN UnknownMiniport, \
  174. IN PUNKNOWN UnknownAdapter OPTIONAL, \
  175. IN PRESOURCELIST ResourceList \
  176. ) PURE; \
  177. STDMETHOD_(NTSTATUS,GetDeviceProperty) \
  178. ( THIS_ \
  179. IN DEVICE_REGISTRY_PROPERTY DeviceProperty, \
  180. IN ULONG BufferLength, \
  181. OUT PVOID PropertyBuffer, \
  182. OUT PULONG ResultLength \
  183. ) PURE; \
  184. STDMETHOD_(NTSTATUS,NewRegistryKey) \
  185. ( THIS_ \
  186. OUT PREGISTRYKEY * OutRegistryKey, \
  187. IN PUNKNOWN OuterUnknown OPTIONAL, \
  188. IN ULONG RegistryKeyType, \
  189. IN ACCESS_MASK DesiredAccess, \
  190. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, \
  191. IN ULONG CreateOptions OPTIONAL, \
  192. OUT PULONG Disposition OPTIONAL \
  193. ) PURE;
  194. #endif // !PC_OLD_NAMES
  195. #endif //!defined(DEFINE_ABSTRACT_PORT)
  196. #if !defined(DEFINE_ABSTRACT_MINIPORT)
  197. #define DEFINE_ABSTRACT_MINIPORT() \
  198. STDMETHOD_(NTSTATUS,GetDescription) \
  199. ( THIS_ \
  200. OUT PPCFILTER_DESCRIPTOR * Description \
  201. ) PURE; \
  202. STDMETHOD_(NTSTATUS,DataRangeIntersection) \
  203. ( THIS_ \
  204. IN ULONG PinId, \
  205. IN PKSDATARANGE DataRange, \
  206. IN PKSDATARANGE MatchingDataRange, \
  207. IN ULONG OutputBufferLength, \
  208. OUT PVOID ResultantFormat OPTIONAL, \
  209. OUT PULONG ResultantFormatLength \
  210. ) PURE;
  211. #endif //!defined(DEFINE_ABSTRACT_MINIPORT)
  212. #if !defined(DEFINE_ABSTRACT_DMACHANNEL)
  213. #define DEFINE_ABSTRACT_DMACHANNEL() \
  214. STDMETHOD_(NTSTATUS,AllocateBuffer) \
  215. ( THIS_ \
  216. IN ULONG BufferSize, \
  217. IN PPHYSICAL_ADDRESS PhysicalAddressConstraint OPTIONAL \
  218. ) PURE; \
  219. STDMETHOD_(void,FreeBuffer) \
  220. ( THIS \
  221. ) PURE; \
  222. STDMETHOD_(ULONG,TransferCount) \
  223. ( THIS \
  224. ) PURE; \
  225. STDMETHOD_(ULONG,MaximumBufferSize) \
  226. ( THIS \
  227. ) PURE; \
  228. STDMETHOD_(ULONG,AllocatedBufferSize) \
  229. ( THIS \
  230. ) PURE; \
  231. STDMETHOD_(ULONG,BufferSize) \
  232. ( THIS \
  233. ) PURE; \
  234. STDMETHOD_(void,SetBufferSize) \
  235. ( THIS_ \
  236. IN ULONG BufferSize \
  237. ) PURE; \
  238. STDMETHOD_(PVOID,SystemAddress) \
  239. ( THIS \
  240. ) PURE; \
  241. STDMETHOD_(PHYSICAL_ADDRESS,PhysicalAddress) \
  242. ( THIS \
  243. ) PURE; \
  244. STDMETHOD_(PADAPTER_OBJECT,GetAdapterObject) \
  245. ( THIS \
  246. ) PURE; \
  247. STDMETHOD_(void,CopyTo) \
  248. ( THIS_ \
  249. IN PVOID Destination, \
  250. IN PVOID Source, \
  251. IN ULONG ByteCount \
  252. ) PURE; \
  253. STDMETHOD_(void,CopyFrom) \
  254. ( THIS_ \
  255. IN PVOID Destination, \
  256. IN PVOID Source, \
  257. IN ULONG ByteCount \
  258. ) PURE;
  259. #endif //!defined(DEFINE_ABSTRACT_DMACHANNEL)
  260. #if !defined(DEFINE_ABSTRACT_DMACHANNELSLAVE)
  261. #define DEFINE_ABSTRACT_DMACHANNELSLAVE() \
  262. STDMETHOD_(NTSTATUS,Start) \
  263. ( THIS_ \
  264. IN ULONG MapSize, \
  265. IN BOOLEAN WriteToDevice \
  266. ) PURE; \
  267. STDMETHOD_(NTSTATUS,Stop) \
  268. ( THIS \
  269. ) PURE; \
  270. STDMETHOD_(ULONG,ReadCounter) \
  271. ( THIS \
  272. ) PURE; \
  273. STDMETHOD_(NTSTATUS,WaitForTC) \
  274. ( THIS_ \
  275. ULONG Timeout \
  276. ) PURE;
  277. #endif //!defined(DEFINE_ABSTRACT_DMACHANNELSLAVE)
  278. #if !defined(DEFINE_ABSTRACT_DRMPORT)
  279. #define DEFINE_ABSTRACT_DRMPORT() \
  280. STDMETHOD_(NTSTATUS,CreateContentMixed) \
  281. ( THIS_ \
  282. IN PULONG paContentId, \
  283. IN ULONG cContentId, \
  284. OUT PULONG pMixedContentId \
  285. ) PURE; \
  286. STDMETHOD_(NTSTATUS,DestroyContent) \
  287. ( THIS_ \
  288. IN ULONG ContentId \
  289. ) PURE; \
  290. STDMETHOD_(NTSTATUS,ForwardContentToFileObject) \
  291. ( THIS_ \
  292. IN ULONG ContentId, \
  293. IN PFILE_OBJECT FileObject \
  294. ) PURE; \
  295. STDMETHOD_(NTSTATUS,ForwardContentToInterface) \
  296. ( THIS_ \
  297. IN ULONG ContentId, \
  298. IN PUNKNOWN pUnknown, \
  299. IN ULONG NumMethods \
  300. ) PURE; \
  301. STDMETHOD_(NTSTATUS,GetContentRights) \
  302. ( THIS_ \
  303. IN ULONG ContentId, \
  304. OUT PDRMRIGHTS DrmRights \
  305. ) PURE;
  306. #endif //!defined(DEFINE_ABSTRACT_DRMPORT)
  307. /*****************************************************************************
  308. * IResourceList
  309. *****************************************************************************
  310. * List of resources.
  311. */
  312. DECLARE_INTERFACE_(IResourceList,IUnknown)
  313. {
  314. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  315. STDMETHOD_(ULONG,NumberOfEntries)
  316. ( THIS
  317. ) PURE;
  318. STDMETHOD_(ULONG,NumberOfEntriesOfType)
  319. ( THIS_
  320. IN CM_RESOURCE_TYPE Type
  321. ) PURE;
  322. STDMETHOD_(PCM_PARTIAL_RESOURCE_DESCRIPTOR,FindTranslatedEntry)
  323. ( THIS_
  324. IN CM_RESOURCE_TYPE Type,
  325. IN ULONG Index
  326. ) PURE;
  327. STDMETHOD_(PCM_PARTIAL_RESOURCE_DESCRIPTOR,FindUntranslatedEntry)
  328. ( THIS_
  329. IN CM_RESOURCE_TYPE Type,
  330. IN ULONG Index
  331. ) PURE;
  332. STDMETHOD_(NTSTATUS,AddEntry)
  333. ( THIS_
  334. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Translated,
  335. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Untranslated
  336. ) PURE;
  337. STDMETHOD_(NTSTATUS,AddEntryFromParent)
  338. ( THIS_
  339. IN struct IResourceList * Parent,
  340. IN CM_RESOURCE_TYPE Type,
  341. IN ULONG Index
  342. ) PURE;
  343. STDMETHOD_(PCM_RESOURCE_LIST,TranslatedList)
  344. ( THIS
  345. ) PURE;
  346. STDMETHOD_(PCM_RESOURCE_LIST,UntranslatedList)
  347. ( THIS
  348. ) PURE;
  349. };
  350. typedef IResourceList *PRESOURCELIST;
  351. #ifdef PC_IMPLEMENTATION
  352. #define IMP_IResourceList\
  353. STDMETHODIMP_(ULONG)NumberOfEntries\
  354. ( void\
  355. );\
  356. STDMETHODIMP_(ULONG) NumberOfEntriesOfType\
  357. ( IN CM_RESOURCE_TYPE Type\
  358. );\
  359. STDMETHODIMP_(PCM_PARTIAL_RESOURCE_DESCRIPTOR) FindTranslatedEntry\
  360. ( IN CM_RESOURCE_TYPE Type,\
  361. IN ULONG Index\
  362. );\
  363. STDMETHODIMP_(PCM_PARTIAL_RESOURCE_DESCRIPTOR) FindUntranslatedEntry\
  364. ( IN CM_RESOURCE_TYPE Type,\
  365. IN ULONG Index\
  366. );\
  367. STDMETHODIMP_(NTSTATUS) AddEntry\
  368. ( IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Translated,\
  369. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Untranslated\
  370. );\
  371. STDMETHODIMP_(NTSTATUS) AddEntryFromParent\
  372. ( IN struct IResourceList * Parent,\
  373. IN CM_RESOURCE_TYPE Type,\
  374. IN ULONG Index\
  375. );\
  376. STDMETHODIMP_(PCM_RESOURCE_LIST) TranslatedList\
  377. ( void\
  378. );\
  379. STDMETHODIMP_(PCM_RESOURCE_LIST) UntranslatedList\
  380. ( void\
  381. )
  382. #endif
  383. #define NumberOfPorts() NumberOfEntriesOfType(CmResourceTypePort)
  384. #define FindTranslatedPort(n) FindTranslatedEntry(CmResourceTypePort,(n))
  385. #define FindUntranslatedPort(n) FindUntranslatedEntry(CmResourceTypePort,(n))
  386. #define AddPortFromParent(p,n) AddEntryFromParent((p),CmResourceTypePort,(n))
  387. #define NumberOfInterrupts() NumberOfEntriesOfType(CmResourceTypeInterrupt)
  388. #define FindTranslatedInterrupt(n) FindTranslatedEntry(CmResourceTypeInterrupt,(n))
  389. #define FindUntranslatedInterrupt(n) FindUntranslatedEntry(CmResourceTypeInterrupt,(n))
  390. #define AddInterruptFromParent(p,n) AddEntryFromParent((p),CmResourceTypeInterrupt,(n))
  391. #define NumberOfMemories() NumberOfEntriesOfType(CmResourceTypeMemory)
  392. #define FindTranslatedMemory(n) FindTranslatedEntry(CmResourceTypeMemory,(n))
  393. #define FindUntranslatedMemory(n) FindUntranslatedEntry(CmResourceTypeMemory,(n))
  394. #define AddMemoryFromParent(p,n) AddEntryFromParent((p),CmResourceTypeMemory,(n))
  395. #define NumberOfDmas() NumberOfEntriesOfType(CmResourceTypeDma)
  396. #define FindTranslatedDma(n) FindTranslatedEntry(CmResourceTypeDma,(n))
  397. #define FindUntranslatedDma(n) FindUntranslatedEntry(CmResourceTypeDma,(n))
  398. #define AddDmaFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDma,(n))
  399. #define NumberOfDeviceSpecifics() NumberOfEntriesOfType(CmResourceTypeDeviceSpecific)
  400. #define FindTranslatedDeviceSpecific(n) FindTranslatedEntry(CmResourceTypeDeviceSpecific,(n))
  401. #define FindUntranslatedDeviceSpecific(n) FindUntranslatedEntry(CmResourceTypeDeviceSpecific,(n))
  402. #define AddDeviceSpecificFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDeviceSpecific,(n))
  403. #define NumberOfBusNumbers() NumberOfEntriesOfType(CmResourceTypeBusNumber)
  404. #define FindTranslatedBusNumber(n) FindTranslatedEntry(CmResourceTypeBusNumber,(n))
  405. #define FindUntranslatedBusNumber(n) FindUntranslatedEntry(CmResourceTypeBusNumber,(n))
  406. #define AddBusNumberFromParent(p,n) AddEntryFromParent((p),CmResourceTypeBusNumber,(n))
  407. #define NumberOfDevicePrivates() NumberOfEntriesOfType(CmResourceTypeDevicePrivate)
  408. #define FindTranslatedDevicePrivate(n) FindTranslatedEntry(CmResourceTypeDevicePrivate,(n))
  409. #define FindUntranslatedDevicePrivate(n) FindUntranslatedEntry(CmResourceTypeDevicePrivate,(n))
  410. #define AddDevicePrivateFromParent(p,n) AddEntryFromParent((p),CmResourceTypeDevicePrivate,(n))
  411. #define NumberOfAssignedResources() NumberOfEntriesOfType(CmResourceTypeAssignedResource)
  412. #define FindTranslatedAssignedResource(n) FindTranslatedEntry(CmResourceTypeAssignedResource,(n))
  413. #define FindUntranslatedAssignedResource(n) FindUntranslatedEntry(CmResourceTypeAssignedResource,(n))
  414. #define AddAssignedResourceFromParent(p,n) AddEntryFromParent((p),CmResourceTypeAssignedResource,(n))
  415. #define NumberOfSubAllocateFroms() NumberOfEntriesOfType(CmResourceTypeSubAllocateFrom)
  416. #define FindTranslatedSubAllocateFrom(n) FindTranslatedEntry(CmResourceTypeSubAllocateFrom,(n))
  417. #define FindUntranslatedSubAllocateFrom(n) FindUntranslatedEntry(CmResourceTypeSubAllocateFrom,(n))
  418. #define AddSubAllocateFromFromParent(p,n) AddEntryFromParent((p),CmResourceTypeSubAllocateFrom,(n))
  419. /*****************************************************************************
  420. * IDmaChannel
  421. *****************************************************************************
  422. * Interface for DMA channel.
  423. */
  424. DECLARE_INTERFACE_(IDmaChannel,IUnknown)
  425. {
  426. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  427. DEFINE_ABSTRACT_DMACHANNEL() // For IDmaChannel
  428. };
  429. typedef IDmaChannel *PDMACHANNEL;
  430. #ifdef PC_IMPLEMENTATION
  431. #define IMP_IDmaChannel\
  432. STDMETHODIMP_(NTSTATUS) AllocateBuffer\
  433. ( IN ULONG BufferSize,\
  434. IN PPHYSICAL_ADDRESS PhysicalAddressConstraint OPTIONAL\
  435. );\
  436. STDMETHODIMP_(void) FreeBuffer\
  437. ( void\
  438. );\
  439. STDMETHODIMP_(ULONG) TransferCount\
  440. ( void\
  441. );\
  442. STDMETHODIMP_(ULONG) MaximumBufferSize\
  443. ( void\
  444. );\
  445. STDMETHODIMP_(ULONG) AllocatedBufferSize\
  446. ( void\
  447. );\
  448. STDMETHODIMP_(ULONG) BufferSize\
  449. ( void\
  450. );\
  451. STDMETHODIMP_(void) SetBufferSize\
  452. ( IN ULONG BufferSize\
  453. );\
  454. STDMETHODIMP_(PVOID) SystemAddress\
  455. ( void\
  456. );\
  457. STDMETHODIMP_(PHYSICAL_ADDRESS) PhysicalAddress\
  458. ( void\
  459. );\
  460. STDMETHODIMP_(PADAPTER_OBJECT) GetAdapterObject\
  461. ( void\
  462. );\
  463. STDMETHODIMP_(void) CopyTo\
  464. ( IN PVOID Destination,\
  465. IN PVOID Source,\
  466. IN ULONG ByteCount\
  467. );\
  468. STDMETHODIMP_(void) CopyFrom\
  469. ( IN PVOID Destination,\
  470. IN PVOID Source,\
  471. IN ULONG ByteCount\
  472. )
  473. #endif
  474. /*****************************************************************************
  475. * IDmaChannelSlave
  476. *****************************************************************************
  477. * Interface for slave DMA channel.
  478. */
  479. DECLARE_INTERFACE_(IDmaChannelSlave,IDmaChannel)
  480. {
  481. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  482. DEFINE_ABSTRACT_DMACHANNEL() // For IDmaChannel
  483. DEFINE_ABSTRACT_DMACHANNELSLAVE() // For IDmaChannelSlave
  484. };
  485. typedef IDmaChannelSlave *PDMACHANNELSLAVE;
  486. #ifdef PC_IMPLEMENTATION
  487. #define IMP_IDmaChannelSlave\
  488. IMP_IDmaChannel;\
  489. STDMETHODIMP_(NTSTATUS) Start\
  490. ( IN ULONG MapSize,\
  491. IN BOOLEAN WriteToDevice\
  492. );\
  493. STDMETHODIMP_(NTSTATUS) Stop\
  494. ( void\
  495. );\
  496. STDMETHODIMP_(ULONG) ReadCounter\
  497. ( void\
  498. );\
  499. STDMETHODIMP_(NTSTATUS) WaitForTC\
  500. ( ULONG Timeout\
  501. )
  502. #endif
  503. /*****************************************************************************
  504. * INTERRUPTSYNCMODE
  505. *****************************************************************************
  506. * Interrupt sync mode of operation.
  507. */
  508. typedef enum
  509. {
  510. InterruptSyncModeNormal = 1, // One pass, stop when successful.
  511. InterruptSyncModeAll, // One pass regardless of success.
  512. InterruptSyncModeRepeat // Repeat until all return unsuccessful.
  513. } INTERRUPTSYNCMODE;
  514. /*****************************************************************************
  515. * PINTERRUPTSYNCROUTINE
  516. *****************************************************************************
  517. * Pointer to an interrupt synchronization routine. Both interrupt service
  518. * routines and routines that are synchronized with ISRs use this type.
  519. */
  520. typedef NTSTATUS
  521. (*PINTERRUPTSYNCROUTINE)
  522. (
  523. IN struct IInterruptSync * InterruptSync,
  524. IN PVOID DynamicContext
  525. );
  526. /*****************************************************************************
  527. * IInterruptSync
  528. *****************************************************************************
  529. * Interface for objects providing access synchronization with interrupts.
  530. */
  531. DECLARE_INTERFACE_(IInterruptSync,IUnknown)
  532. {
  533. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  534. STDMETHOD_(NTSTATUS,CallSynchronizedRoutine)
  535. ( THIS_
  536. IN PINTERRUPTSYNCROUTINE Routine,
  537. IN PVOID DynamicContext
  538. ) PURE;
  539. STDMETHOD_(PKINTERRUPT,GetKInterrupt)
  540. ( THIS
  541. ) PURE;
  542. STDMETHOD_(NTSTATUS,Connect)
  543. ( THIS
  544. ) PURE;
  545. STDMETHOD_(void,Disconnect)
  546. ( THIS
  547. ) PURE;
  548. STDMETHOD_(NTSTATUS,RegisterServiceRoutine)
  549. ( THIS_
  550. IN PINTERRUPTSYNCROUTINE Routine,
  551. IN PVOID DynamicContext,
  552. IN BOOLEAN First
  553. ) PURE;
  554. };
  555. typedef IInterruptSync *PINTERRUPTSYNC;
  556. #ifdef PC_IMPLEMENTATION
  557. #define IMP_IInterruptSync\
  558. STDMETHODIMP_(NTSTATUS) CallSynchronizedRoutine\
  559. ( IN PINTERRUPTSYNCROUTINE Routine,\
  560. IN PVOID DynamicContext\
  561. );\
  562. STDMETHODIMP_(PKINTERRUPT) GetKInterrupt\
  563. ( void\
  564. );\
  565. STDMETHODIMP_(NTSTATUS) Connect\
  566. ( void\
  567. );\
  568. STDMETHODIMP_(void) Disconnect\
  569. ( void\
  570. );\
  571. STDMETHODIMP_(NTSTATUS) RegisterServiceRoutine\
  572. ( IN PINTERRUPTSYNCROUTINE Routine,\
  573. IN PVOID DynamicContext,\
  574. IN BOOLEAN First\
  575. )
  576. #endif
  577. /*****************************************************************************
  578. * IServiceSink
  579. *****************************************************************************
  580. * Interface for notification sinks for service groups.
  581. */
  582. DECLARE_INTERFACE_(IServiceSink,IUnknown)
  583. {
  584. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  585. // For IServiceSink
  586. STDMETHOD_(void,RequestService)
  587. ( THIS
  588. ) PURE;
  589. };
  590. typedef IServiceSink *PSERVICESINK;
  591. #ifdef PC_IMPLEMENTATION
  592. #define IMP_IServiceSink\
  593. STDMETHODIMP_(void) RequestService\
  594. ( void\
  595. )
  596. #endif
  597. /*****************************************************************************
  598. * IServiceGroup
  599. *****************************************************************************
  600. * Interface for objects representing a group that is serviced collectively.
  601. */
  602. DECLARE_INTERFACE_(IServiceGroup,IServiceSink)
  603. {
  604. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  605. // For IServiceSink
  606. STDMETHOD_(void,RequestService)
  607. ( THIS
  608. ) PURE;
  609. // For IServiceGroup
  610. STDMETHOD_(NTSTATUS,AddMember)
  611. ( THIS_
  612. IN PSERVICESINK pServiceSink
  613. ) PURE;
  614. STDMETHOD_(void,RemoveMember)
  615. ( THIS_
  616. IN PSERVICESINK pServiceSink
  617. ) PURE;
  618. STDMETHOD_(void,SupportDelayedService)
  619. ( THIS
  620. ) PURE;
  621. STDMETHOD_(void,RequestDelayedService)
  622. ( THIS_
  623. IN ULONGLONG ullDelay
  624. ) PURE;
  625. STDMETHOD_(void,CancelDelayedService)
  626. ( THIS
  627. ) PURE;
  628. };
  629. typedef IServiceGroup *PSERVICEGROUP;
  630. #ifdef PC_IMPLEMENTATION
  631. #define IMP_IServiceGroup\
  632. IMP_IServiceSink;\
  633. STDMETHODIMP_(NTSTATUS) AddMember\
  634. ( IN PSERVICESINK pServiceSink\
  635. );\
  636. STDMETHODIMP_(void) RemoveMember\
  637. ( IN PSERVICESINK pServiceSink\
  638. );\
  639. STDMETHODIMP_(void) SupportDelayedService\
  640. ( void\
  641. );\
  642. STDMETHODIMP_(void) RequestDelayedService\
  643. ( IN ULONGLONG ullDelay\
  644. );\
  645. STDMETHODIMP_(void) CancelDelayedService\
  646. ( void\
  647. )
  648. #endif
  649. /*****************************************************************************
  650. * IRegistryKey
  651. *****************************************************************************
  652. * Interface for objects providing access to a registry key.
  653. */
  654. DECLARE_INTERFACE_(IRegistryKey,IUnknown)
  655. {
  656. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  657. STDMETHOD_(NTSTATUS,QueryKey)
  658. ( THIS_
  659. IN KEY_INFORMATION_CLASS KeyInformationClass,
  660. OUT PVOID KeyInformation,
  661. IN ULONG Length,
  662. OUT PULONG ResultLength
  663. ) PURE;
  664. STDMETHOD_(NTSTATUS,EnumerateKey)
  665. ( THIS_
  666. IN ULONG Index,
  667. IN KEY_INFORMATION_CLASS KeyInformationClass,
  668. OUT PVOID KeyInformation,
  669. IN ULONG Length,
  670. OUT PULONG ResultLength
  671. ) PURE;
  672. STDMETHOD_(NTSTATUS,QueryValueKey)
  673. ( THIS_
  674. IN PUNICODE_STRING ValueName,
  675. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
  676. OUT PVOID KeyValueInformation,
  677. IN ULONG Length,
  678. OUT PULONG ResultLength
  679. ) PURE;
  680. STDMETHOD_(NTSTATUS,EnumerateValueKey)
  681. ( THIS_
  682. IN ULONG Index,
  683. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
  684. OUT PVOID KeyValueInformation,
  685. IN ULONG Length,
  686. OUT PULONG ResultLength
  687. ) PURE;
  688. STDMETHOD_(NTSTATUS,SetValueKey)
  689. ( THIS_
  690. IN PUNICODE_STRING ValueName OPTIONAL,
  691. IN ULONG Type,
  692. IN PVOID Data,
  693. IN ULONG DataSize
  694. ) PURE;
  695. STDMETHOD_(NTSTATUS,QueryRegistryValues)
  696. ( THIS_
  697. IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
  698. IN PVOID Context OPTIONAL
  699. ) PURE;
  700. STDMETHOD_(NTSTATUS,NewSubKey)
  701. ( THIS_
  702. OUT IRegistryKey ** RegistrySubKey,
  703. IN PUNKNOWN OuterUnknown,
  704. IN ACCESS_MASK DesiredAccess,
  705. IN PUNICODE_STRING SubKeyName,
  706. IN ULONG CreateOptions,
  707. OUT PULONG Disposition OPTIONAL
  708. ) PURE;
  709. STDMETHOD_(NTSTATUS,DeleteKey)
  710. ( THIS
  711. ) PURE;
  712. };
  713. typedef IRegistryKey *PREGISTRYKEY;
  714. #ifdef PC_IMPLEMENTATION
  715. #define IMP_IRegistryKey\
  716. STDMETHODIMP_(NTSTATUS) QueryKey\
  717. ( IN KEY_INFORMATION_CLASS KeyInformationClass,\
  718. OUT PVOID KeyInformation,\
  719. IN ULONG Length,\
  720. OUT PULONG ResultLength\
  721. );\
  722. STDMETHODIMP_(NTSTATUS) EnumerateKey\
  723. ( IN ULONG Index,\
  724. IN KEY_INFORMATION_CLASS KeyInformationClass,\
  725. OUT PVOID KeyInformation,\
  726. IN ULONG Length,\
  727. OUT PULONG ResultLength\
  728. );\
  729. STDMETHODIMP_(NTSTATUS) QueryValueKey\
  730. ( IN PUNICODE_STRING ValueName,\
  731. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,\
  732. OUT PVOID KeyValueInformation,\
  733. IN ULONG Length,\
  734. OUT PULONG ResultLength\
  735. );\
  736. STDMETHODIMP_(NTSTATUS) EnumerateValueKey\
  737. ( IN ULONG Index,\
  738. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,\
  739. OUT PVOID KeyValueInformation,\
  740. IN ULONG Length,\
  741. OUT PULONG ResultLength\
  742. );\
  743. STDMETHODIMP_(NTSTATUS) SetValueKey\
  744. ( IN PUNICODE_STRING ValueName OPTIONAL,\
  745. IN ULONG Type,\
  746. IN PVOID Data,\
  747. IN ULONG DataSize\
  748. );\
  749. STDMETHODIMP_(NTSTATUS) QueryRegistryValues\
  750. ( IN PRTL_QUERY_REGISTRY_TABLE QueryTable,\
  751. IN PVOID Context OPTIONAL\
  752. );\
  753. STDMETHODIMP_(NTSTATUS) NewSubKey\
  754. ( OUT IRegistryKey ** RegistrySubKey,\
  755. IN PUNKNOWN OuterUnknown,\
  756. IN ACCESS_MASK DesiredAccess,\
  757. IN PUNICODE_STRING SubKeyName,\
  758. IN ULONG CreateOptions,\
  759. OUT PULONG Disposition OPTIONAL\
  760. );\
  761. STDMETHODIMP_(NTSTATUS) DeleteKey\
  762. ( void\
  763. )
  764. #endif
  765. /*****************************************************************************
  766. * IMusicTechnology
  767. *****************************************************************************
  768. * Interface for setting MusicTechnology.
  769. */
  770. DECLARE_INTERFACE_(IMusicTechnology,IUnknown)
  771. {
  772. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  773. // For IMusicTechnology
  774. STDMETHOD_(NTSTATUS,SetTechnology)
  775. ( THIS_
  776. IN const GUID * Technology
  777. ) PURE;
  778. };
  779. typedef IMusicTechnology *PMUSICTECHNOLOGY;
  780. #define IMP_IMusicTechnology\
  781. STDMETHODIMP_(NTSTATUS) SetTechnology\
  782. ( IN const GUID * Technology\
  783. )
  784. typedef struct _PCPROPERTY_REQUEST PCPROPERTY_REQUEST, *PPCPROPERTY_REQUEST;
  785. typedef struct _PCMETHOD_REQUEST PCMETHOD_REQUEST, *PPCMETHOD_REQUEST;
  786. typedef struct _PCEVENT_REQUEST PCEVENT_REQUEST, *PPCEVENT_REQUEST;
  787. /*****************************************************************************
  788. * PCPFNPROPERTY_HANDLER
  789. *****************************************************************************
  790. * Property handler function prototype.
  791. *
  792. * All property accesses and support queries for a given property on a given
  793. * filter, pin or node are routed to a single handler. The parameter contains
  794. * complete information regarding the request. The handler may return
  795. * STATUS_PENDING, in which case it must eventually call
  796. * PcCompletePendingPropertyRequest() to complete the request.
  797. */
  798. typedef
  799. NTSTATUS
  800. (*PCPFNPROPERTY_HANDLER)
  801. (
  802. IN PPCPROPERTY_REQUEST PropertyRequest
  803. );
  804. /*****************************************************************************
  805. * PCPFNMETHOD_HANDLER
  806. *****************************************************************************
  807. * Method handler function prototype.
  808. *
  809. * All method calls and support queries for a given method on a given filter,
  810. * pin or node are routed to a single handler. The parameter contains
  811. * complete information regarding the request. The handler may return
  812. * STATUS_PENDING, in which case it must eventually call
  813. * PcCompletePendingMethodRequest() to complete the request.
  814. */
  815. typedef
  816. NTSTATUS
  817. (*PCPFNMETHOD_HANDLER)
  818. (
  819. IN PPCMETHOD_REQUEST MethodRequest
  820. );
  821. /*****************************************************************************
  822. * PCPFNEVENT_HANDLER
  823. *****************************************************************************
  824. * Event handler function prototype.
  825. *
  826. * All event add and remove requests and all event support queries for a
  827. * given event on a given filter, pin or node are routed to a single handler.
  828. * The parameter contains complete information regarding the request. The
  829. * handler may return STATUS_PENDING, in which case it must eventually call
  830. * PcCompletePendingEventRequest() to complete the request.
  831. */
  832. typedef
  833. NTSTATUS
  834. (*PCPFNEVENT_HANDLER)
  835. (
  836. IN PPCEVENT_REQUEST EventRequest
  837. );
  838. /*****************************************************************************
  839. * PCPROPERTY_ITEM
  840. *****************************************************************************
  841. * Property table entry.
  842. *
  843. * A property item describes a property supported by a given filter, pin or
  844. * node. The flags indicate what operations regarding the property are
  845. * supported and specify selected options with respect to the port's handling
  846. * of property requests.
  847. */
  848. typedef struct
  849. {
  850. const GUID * Set;
  851. ULONG Id;
  852. ULONG Flags;
  853. #define PCPROPERTY_ITEM_FLAG_GET KSPROPERTY_TYPE_GET
  854. #define PCPROPERTY_ITEM_FLAG_SET KSPROPERTY_TYPE_SET
  855. #define PCPROPERTY_ITEM_FLAG_BASICSUPPORT KSPROPERTY_TYPE_BASICSUPPORT
  856. //not supported #define PCPROPERTY_ITEM_FLAG_RELATIONS KSPROPERTY_TYPE_RELATIONS
  857. #define PCPROPERTY_ITEM_FLAG_SERIALIZERAW KSPROPERTY_TYPE_SERIALIZERAW
  858. #define PCPROPERTY_ITEM_FLAG_UNSERIALIZERAW KSPROPERTY_TYPE_UNSERIALIZERAW
  859. #define PCPROPERTY_ITEM_FLAG_SERIALIZESIZE KSPROPERTY_TYPE_SERIALIZESIZE
  860. #define PCPROPERTY_ITEM_FLAG_SERIALIZE\
  861. (PCPROPERTY_ITEM_FLAG_SERIALIZERAW\
  862. |PCPROPERTY_ITEM_FLAG_UNSERIALIZERAW\
  863. |PCPROPERTY_ITEM_FLAG_SERIALIZESIZE\
  864. )
  865. #define PCPROPERTY_ITEM_FLAG_DEFAULTVALUES KSPROPERTY_TYPE_DEFAULTVALUES
  866. PCPFNPROPERTY_HANDLER Handler;
  867. }
  868. PCPROPERTY_ITEM, *PPCPROPERTY_ITEM;
  869. /*****************************************************************************
  870. * PCMETHOD_ITEM
  871. *****************************************************************************
  872. * Method table entry.
  873. *
  874. * A method item describes a method supported by a given filter, pin or node.
  875. * The flags indicate what operations regarding the method are supported and
  876. * specify selected options with respect to the port's handling of method
  877. * requests.
  878. */
  879. typedef struct
  880. {
  881. const GUID * Set;
  882. ULONG Id;
  883. ULONG Flags;
  884. #define PCMETHOD_ITEM_FLAG_NONE KSMETHOD_TYPE_NONE
  885. #define PCMETHOD_ITEM_FLAG_READ KSMETHOD_TYPE_READ
  886. #define PCMETHOD_ITEM_FLAG_WRITE KSMETHOD_TYPE_WRITE
  887. #define PCMETHOD_ITEM_FLAG_MODIFY KSMETHOD_TYPE_MODIFY
  888. #define PCMETHOD_ITEM_FLAG_SOURCE KSMETHOD_TYPE_SOURCE
  889. #define PCMETHOD_ITEM_FLAG_BASICSUPPORT KSMETHOD_TYPE_BASICSUPPORT
  890. PCPFNMETHOD_HANDLER Handler;
  891. }
  892. PCMETHOD_ITEM, *PPCMETHOD_ITEM;
  893. /*****************************************************************************
  894. * PCEVENT_ITEM
  895. *****************************************************************************
  896. * Event table entry.
  897. *
  898. * An event item describes an event supported by a given filter, pin or node.
  899. * The flags indicate what operations regarding the event are supported and
  900. * specify selected options with respect to the port's handling of event
  901. * requests.
  902. */
  903. typedef struct
  904. {
  905. const GUID * Set;
  906. ULONG Id;
  907. ULONG Flags;
  908. #define PCEVENT_ITEM_FLAG_ENABLE KSEVENT_TYPE_ENABLE
  909. #define PCEVENT_ITEM_FLAG_ONESHOT KSEVENT_TYPE_ONESHOT
  910. #define PCEVENT_ITEM_FLAG_BASICSUPPORT KSEVENT_TYPE_BASICSUPPORT
  911. PCPFNEVENT_HANDLER Handler;
  912. }
  913. PCEVENT_ITEM, *PPCEVENT_ITEM;
  914. /*****************************************************************************
  915. * PCPROPERTY_REQUEST
  916. *****************************************************************************
  917. * Property request submitted to a property handler.
  918. *
  919. * This is the form that a property request takes. Although the major target
  920. * is generic, in the case of miniports, it will be a pointer to the miniport
  921. * object. Likewise, the minor target is the stream or voice if the request
  922. * is specific to a stream or voice. Otherwise, the minor target is NULL.
  923. * If the request is targeted at a node, the Node parameter will specify which
  924. * one, otherwise it will be ULONG(-1). If the target is a node, the minor
  925. * target may be specified to indicate the stream or voice with which the
  926. * targeted node instance is associated.
  927. */
  928. typedef struct _PCPROPERTY_REQUEST
  929. {
  930. PUNKNOWN MajorTarget;
  931. PUNKNOWN MinorTarget;
  932. ULONG Node;
  933. const PCPROPERTY_ITEM * PropertyItem;
  934. ULONG Verb;
  935. ULONG InstanceSize;
  936. PVOID Instance;
  937. ULONG ValueSize;
  938. PVOID Value;
  939. PIRP Irp;
  940. }
  941. PCPROPERTY_REQUEST, *PPCPROPERTY_REQUEST;
  942. /*****************************************************************************
  943. * PCMETHOD_REQUEST
  944. *****************************************************************************
  945. * Method request submitted to a property handler.
  946. *
  947. * Comments in the description of PCPROPERTY_REQUEST regarding the target
  948. * fields apply to this structure as well.
  949. */
  950. typedef struct _PCMETHOD_REQUEST
  951. {
  952. PUNKNOWN MajorTarget;
  953. PUNKNOWN MinorTarget;
  954. ULONG Node;
  955. const PCMETHOD_ITEM * MethodItem;
  956. ULONG Verb;
  957. // TODO
  958. }
  959. PCMETHOD_REQUEST, *PPCMETHOD_REQUEST;
  960. /*****************************************************************************
  961. * PCEVENT_REQUEST
  962. *****************************************************************************
  963. * Event request submitted to a property handler.
  964. *
  965. * Comments in the description of PCPROPERTY_REQUEST regarding the target
  966. * fields apply to this structure as well.
  967. */
  968. typedef struct _PCEVENT_REQUEST
  969. {
  970. PUNKNOWN MajorTarget;
  971. PUNKNOWN MinorTarget;
  972. ULONG Node;
  973. const PCEVENT_ITEM * EventItem;
  974. PKSEVENT_ENTRY EventEntry;
  975. ULONG Verb;
  976. PIRP Irp;
  977. }
  978. PCEVENT_REQUEST, *PPCEVENT_REQUEST;
  979. #define PCEVENT_VERB_NONE 0
  980. #define PCEVENT_VERB_ADD 1
  981. #define PCEVENT_VERB_REMOVE 2
  982. #define PCEVENT_VERB_SUPPORT 4
  983. /*****************************************************************************
  984. * PCAUTOMATION_TABLE
  985. *****************************************************************************
  986. * Master table of properties, methods and events.
  987. *
  988. * Any of the item pointers may be NULL, in which case, corresponding counts
  989. * must be zero. For item tables that are not zero length, the item size must
  990. * not be smaller than the size of the item structure defined by port class.
  991. * The item size may be larger, in which case the port class item structure is
  992. * assumed to be followed by private data. Item sizes must be a multiple of
  993. * 8.
  994. */
  995. typedef struct
  996. {
  997. ULONG PropertyItemSize;
  998. ULONG PropertyCount;
  999. const PCPROPERTY_ITEM * Properties;
  1000. ULONG MethodItemSize;
  1001. ULONG MethodCount;
  1002. const PCMETHOD_ITEM * Methods;
  1003. ULONG EventItemSize;
  1004. ULONG EventCount;
  1005. const PCEVENT_ITEM * Events;
  1006. ULONG Reserved;
  1007. }
  1008. PCAUTOMATION_TABLE, *PPCAUTOMATION_TABLE;
  1009. #define DEFINE_PCAUTOMATION_TABLE_PROP(AutomationTable,PropertyTable)\
  1010. const PCAUTOMATION_TABLE AutomationTable =\
  1011. {\
  1012. sizeof(PropertyTable[0]),\
  1013. SIZEOF_ARRAY(PropertyTable),\
  1014. (const PCPROPERTY_ITEM *) PropertyTable,\
  1015. 0,0,NULL,\
  1016. 0,0,NULL,\
  1017. 0\
  1018. }
  1019. #define DEFINE_PCAUTOMATION_TABLE_PROP_EVENT(AutomationTable,PropertyTable,EventTable)\
  1020. const PCAUTOMATION_TABLE AutomationTable =\
  1021. {\
  1022. sizeof(PropertyTable[0]),\
  1023. SIZEOF_ARRAY(PropertyTable),\
  1024. (const PCPROPERTY_ITEM *) PropertyTable,\
  1025. 0,0,NULL,\
  1026. sizeof(EventTable[0]),\
  1027. SIZEOF_ARRAY(EventTable),\
  1028. (const PCEVENT_ITEM *) EventTable,\
  1029. 0\
  1030. }
  1031. /*****************************************************************************
  1032. * PCPIN_DESCRIPTOR for IMiniport::GetDescription()
  1033. *****************************************************************************
  1034. * Description of a pin on the filter implemented by the miniport.
  1035. *
  1036. * MaxGlobalInstanceCount and MaxFilterInstanceCount may be zero to indicate
  1037. * that the pin may not be instantiated, ULONG(-1) to indicate the pin may be
  1038. * allocated any number of times, or any other value to indicate a specific
  1039. * number of times the pin may be allocated. MinFilterInstanceCount may not
  1040. * be ULONG(-1) because it specifies a definite lower bound on the number of
  1041. * instances of a pin that must exist in order for a filter to function.
  1042. *
  1043. * The KS pin descriptor may have zero interfaces and zero mediums. The list
  1044. * of interfaces is ignored in all cases. The medium list will default to
  1045. * a list containing only the standard medium (device I/O).
  1046. *
  1047. * The automation table pointer may be NULL indicating that no automation is
  1048. * supported.
  1049. */
  1050. typedef struct
  1051. {
  1052. ULONG MaxGlobalInstanceCount;
  1053. ULONG MaxFilterInstanceCount;
  1054. ULONG MinFilterInstanceCount;
  1055. const PCAUTOMATION_TABLE * AutomationTable;
  1056. KSPIN_DESCRIPTOR KsPinDescriptor;
  1057. }
  1058. PCPIN_DESCRIPTOR, *PPCPIN_DESCRIPTOR;
  1059. /*****************************************************************************
  1060. * PCNODE_DESCRIPTOR for IMiniport::GetDescription()
  1061. *****************************************************************************
  1062. * Description of a node in the filter implemented by the miniport.
  1063. *
  1064. * The automation table pointer may be NULL indicating that no automation is
  1065. * supported. The name GUID pointer may be NULL indicating that the type GUID
  1066. * should be used to determine the node name.
  1067. */
  1068. typedef struct
  1069. {
  1070. ULONG Flags;
  1071. const PCAUTOMATION_TABLE * AutomationTable;
  1072. const GUID * Type;
  1073. const GUID * Name;
  1074. }
  1075. PCNODE_DESCRIPTOR, *PPCNODE_DESCRIPTOR;
  1076. /*****************************************************************************
  1077. * PCCONNECTION_DESCRIPTOR for IMiniport::GetDescription()
  1078. *****************************************************************************
  1079. * Description of a node connection in the topology of the filter implemented
  1080. * by the miniport.
  1081. */
  1082. typedef KSTOPOLOGY_CONNECTION
  1083. PCCONNECTION_DESCRIPTOR, *PPCCONNECTION_DESCRIPTOR;
  1084. /*****************************************************************************
  1085. * PCFILTER_DESCRIPTOR for IMiniport::GetDescription()
  1086. *****************************************************************************
  1087. * Description of the of the filter implemented by a miniport, including
  1088. * pins, nodes, connections and properties.
  1089. *
  1090. * The version number should be zero.
  1091. */
  1092. typedef struct
  1093. {
  1094. ULONG Version;
  1095. const PCAUTOMATION_TABLE * AutomationTable;
  1096. ULONG PinSize;
  1097. ULONG PinCount;
  1098. const PCPIN_DESCRIPTOR * Pins;
  1099. ULONG NodeSize;
  1100. ULONG NodeCount;
  1101. const PCNODE_DESCRIPTOR * Nodes;
  1102. ULONG ConnectionCount;
  1103. const PCCONNECTION_DESCRIPTOR * Connections;
  1104. ULONG CategoryCount;
  1105. const GUID * Categories;
  1106. }
  1107. PCFILTER_DESCRIPTOR, *PPCFILTER_DESCRIPTOR;
  1108. /*****************************************************************************
  1109. * PCFILTER_NODE for IMiniport::GetTopology()
  1110. *****************************************************************************
  1111. * The placeholder for the FromNode or ToNode fields in connections which
  1112. * describe connections to the filter's pins.
  1113. */
  1114. #define PCFILTER_NODE KSFILTER_NODE
  1115. /*****************************************************************************
  1116. * IMiniport
  1117. *****************************************************************************
  1118. * Interface common to all miniports.
  1119. */
  1120. DECLARE_INTERFACE_(IMiniport,IUnknown)
  1121. {
  1122. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1123. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  1124. };
  1125. typedef IMiniport *PMINIPORT;
  1126. #define IMP_IMiniport\
  1127. STDMETHODIMP_(NTSTATUS) GetDescription\
  1128. ( OUT PPCFILTER_DESCRIPTOR * Description\
  1129. );\
  1130. STDMETHODIMP_(NTSTATUS) DataRangeIntersection\
  1131. ( IN ULONG PinId,\
  1132. IN PKSDATARANGE DataRange,\
  1133. IN PKSDATARANGE MatchingDataRange,\
  1134. IN ULONG OutputBufferLength,\
  1135. OUT PVOID ResultantFormat OPTIONAL,\
  1136. OUT PULONG ResultantFormatLength\
  1137. )
  1138. /*****************************************************************************
  1139. * IPort
  1140. *****************************************************************************
  1141. * Interface common to all port lower edges.
  1142. */
  1143. DECLARE_INTERFACE_(IPort,IUnknown)
  1144. {
  1145. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1146. DEFINE_ABSTRACT_PORT() // For IPort
  1147. };
  1148. typedef IPort *PPORT;
  1149. #ifdef PC_IMPLEMENTATION
  1150. #define IMP_IPort\
  1151. STDMETHODIMP_(NTSTATUS) Init\
  1152. ( IN PDEVICE_OBJECT DeviceObject,\
  1153. IN PIRP Irp,\
  1154. IN PUNKNOWN UnknownMiniport,\
  1155. IN PUNKNOWN UnknownAdapter OPTIONAL,\
  1156. IN PRESOURCELIST ResourceList\
  1157. );\
  1158. STDMETHODIMP_(NTSTATUS) GetDeviceProperty\
  1159. ( IN DEVICE_REGISTRY_PROPERTY DeviceProperty,\
  1160. IN ULONG BufferLength,\
  1161. OUT PVOID PropertyBuffer,\
  1162. OUT PULONG ResultLength\
  1163. );\
  1164. STDMETHODIMP_(NTSTATUS) NewRegistryKey\
  1165. ( OUT PREGISTRYKEY * OutRegistryKey,\
  1166. IN PUNKNOWN OuterUnknown OPTIONAL,\
  1167. IN ULONG RegistryKeyType,\
  1168. IN ACCESS_MASK DesiredAccess,\
  1169. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,\
  1170. IN ULONG CreateOptions OPTIONAL,\
  1171. OUT PULONG Disposition OPTIONAL\
  1172. )
  1173. #endif
  1174. /*****************************************************************************
  1175. * IPortMidi
  1176. *****************************************************************************
  1177. * Interface for MIDI port lower edge.
  1178. */
  1179. DECLARE_INTERFACE_(IPortMidi,IPort)
  1180. {
  1181. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1182. DEFINE_ABSTRACT_PORT() // For IPort
  1183. // For IPortMidi
  1184. STDMETHOD_(void,Notify)
  1185. ( THIS_
  1186. IN PSERVICEGROUP ServiceGroup OPTIONAL
  1187. ) PURE;
  1188. STDMETHOD_(void,RegisterServiceGroup)
  1189. ( THIS_
  1190. IN PSERVICEGROUP ServiceGroup
  1191. ) PURE;
  1192. };
  1193. typedef IPortMidi *PPORTMIDI;
  1194. #ifdef PC_IMPLEMENTATION
  1195. #define IMP_IPortMidi\
  1196. IMP_IPort;\
  1197. STDMETHODIMP_(void) Notify\
  1198. ( IN PSERVICEGROUP ServiceGroup OPTIONAL\
  1199. );\
  1200. STDMETHODIMP_(void) RegisterServiceGroup\
  1201. ( IN PSERVICEGROUP ServiceGroup\
  1202. )
  1203. #endif
  1204. /*****************************************************************************
  1205. * IMiniportMidiStream
  1206. *****************************************************************************
  1207. * Interface for MIDI miniport streams.
  1208. */
  1209. DECLARE_INTERFACE_(IMiniportMidiStream,IUnknown)
  1210. {
  1211. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1212. STDMETHOD_(NTSTATUS,SetFormat)
  1213. ( THIS_
  1214. IN PKSDATAFORMAT DataFormat
  1215. ) PURE;
  1216. STDMETHOD_(NTSTATUS,SetState)
  1217. ( THIS_
  1218. IN KSSTATE State
  1219. ) PURE;
  1220. STDMETHOD_(NTSTATUS,Read)
  1221. ( THIS_
  1222. IN PVOID BufferAddress,
  1223. IN ULONG BufferLength,
  1224. OUT PULONG BytesRead
  1225. ) PURE;
  1226. STDMETHOD_(NTSTATUS,Write)
  1227. ( THIS_
  1228. IN PVOID BufferAddress,
  1229. IN ULONG BytesToWrite,
  1230. OUT PULONG BytesWritten
  1231. ) PURE;
  1232. };
  1233. typedef IMiniportMidiStream *PMINIPORTMIDISTREAM;
  1234. #define IMP_IMiniportMidiStream\
  1235. STDMETHODIMP_(NTSTATUS) SetFormat\
  1236. ( IN PKSDATAFORMAT DataFormat\
  1237. );\
  1238. STDMETHODIMP_(NTSTATUS) SetState\
  1239. ( IN KSSTATE State\
  1240. );\
  1241. STDMETHODIMP_(NTSTATUS) Read\
  1242. ( IN PVOID BufferAddress,\
  1243. IN ULONG BufferLength,\
  1244. OUT PULONG BytesRead\
  1245. );\
  1246. STDMETHODIMP_(NTSTATUS) Write\
  1247. ( IN PVOID BufferAddress,\
  1248. IN ULONG BytesToWrite,\
  1249. OUT PULONG BytesWritten\
  1250. )
  1251. /*****************************************************************************
  1252. * IMiniportMidi
  1253. *****************************************************************************
  1254. * Interface for MIDI miniports.
  1255. */
  1256. DECLARE_INTERFACE_(IMiniportMidi,IMiniport)
  1257. {
  1258. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1259. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  1260. // For IMiniportMidi
  1261. STDMETHOD_(NTSTATUS,Init)
  1262. ( THIS_
  1263. IN PUNKNOWN UnknownAdapter,
  1264. IN PRESOURCELIST ResourceList,
  1265. IN PPORTMIDI Port,
  1266. OUT PSERVICEGROUP * ServiceGroup
  1267. ) PURE;
  1268. STDMETHOD_(void,Service)
  1269. ( THIS
  1270. ) PURE;
  1271. STDMETHOD_(NTSTATUS,NewStream)
  1272. ( THIS_
  1273. OUT PMINIPORTMIDISTREAM * Stream,
  1274. IN PUNKNOWN OuterUnknown OPTIONAL,
  1275. IN POOL_TYPE PoolType,
  1276. IN ULONG Pin,
  1277. IN BOOLEAN Capture,
  1278. IN PKSDATAFORMAT DataFormat,
  1279. OUT PSERVICEGROUP * ServiceGroup
  1280. ) PURE;
  1281. };
  1282. typedef IMiniportMidi *PMINIPORTMIDI;
  1283. #define IMP_IMiniportMidi\
  1284. IMP_IMiniport;\
  1285. STDMETHODIMP_(NTSTATUS) Init\
  1286. ( IN PUNKNOWN UnknownAdapter,\
  1287. IN PRESOURCELIST ResourceList,\
  1288. IN PPORTMIDI Port,\
  1289. OUT PSERVICEGROUP * ServiceGroup\
  1290. );\
  1291. STDMETHODIMP_(void) Service\
  1292. ( void\
  1293. );\
  1294. STDMETHODIMP_(NTSTATUS) NewStream\
  1295. ( OUT PMINIPORTMIDISTREAM * Stream,\
  1296. IN PUNKNOWN OuterUnknown OPTIONAL,\
  1297. IN POOL_TYPE PoolType,\
  1298. IN ULONG Pin,\
  1299. IN BOOLEAN Capture,\
  1300. IN PKSDATAFORMAT DataFormat,\
  1301. OUT PSERVICEGROUP * ServiceGroup\
  1302. )
  1303. /*****************************************************************************
  1304. * IPortDMus
  1305. *****************************************************************************
  1306. * See DMusicKS.h
  1307. */
  1308. /*****************************************************************************
  1309. * IMXF
  1310. *****************************************************************************
  1311. * See DMusicKS.h
  1312. */
  1313. /*****************************************************************************
  1314. * IAllocatorMXF
  1315. *****************************************************************************
  1316. * See DMusicKS.h
  1317. */
  1318. /*****************************************************************************
  1319. * IMiniportDMus
  1320. *****************************************************************************
  1321. * See DMusicKS.h
  1322. */
  1323. /*****************************************************************************
  1324. * IPortTopology
  1325. *****************************************************************************
  1326. * Interface for topology port lower edge.
  1327. */
  1328. DECLARE_INTERFACE_(IPortTopology,IPort)
  1329. {
  1330. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1331. DEFINE_ABSTRACT_PORT() // For IPort
  1332. };
  1333. typedef IPortTopology *PPORTTOPOLOGY;
  1334. #ifdef PC_IMPLEMENTATION
  1335. #define IMP_IPortTopology IMP_IPort
  1336. #endif
  1337. /*****************************************************************************
  1338. * IMiniportTopology
  1339. *****************************************************************************
  1340. * Interface for topology miniports.
  1341. */
  1342. DECLARE_INTERFACE_(IMiniportTopology,IMiniport)
  1343. {
  1344. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1345. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  1346. // For IMiniportTopology
  1347. STDMETHOD_(NTSTATUS,Init)
  1348. ( THIS_
  1349. IN PUNKNOWN UnknownAdapter,
  1350. IN PRESOURCELIST ResourceList,
  1351. IN PPORTTOPOLOGY Port
  1352. ) PURE;
  1353. };
  1354. typedef IMiniportTopology *PMINIPORTTOPOLOGY;
  1355. #define IMP_IMiniportTopology\
  1356. IMP_IMiniport;\
  1357. STDMETHODIMP_(NTSTATUS) Init\
  1358. ( IN PUNKNOWN UnknownAdapter,\
  1359. IN PRESOURCELIST ResourceList,\
  1360. IN PPORTTOPOLOGY Port\
  1361. )
  1362. /*****************************************************************************
  1363. * IPortWaveCyclic
  1364. *****************************************************************************
  1365. * Interface for cyclic wave port lower edge.
  1366. */
  1367. DECLARE_INTERFACE_(IPortWaveCyclic,IPort)
  1368. {
  1369. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1370. DEFINE_ABSTRACT_PORT() // For IPort
  1371. // For IPortWaveCyclic
  1372. STDMETHOD_(void,Notify)
  1373. ( THIS_
  1374. IN PSERVICEGROUP ServiceGroup
  1375. ) PURE;
  1376. STDMETHOD_(NTSTATUS,NewSlaveDmaChannel)
  1377. ( THIS_
  1378. OUT PDMACHANNELSLAVE * DmaChannel,
  1379. IN PUNKNOWN OuterUnknown,
  1380. IN PRESOURCELIST ResourceList,
  1381. IN ULONG DmaIndex,
  1382. IN ULONG MaximumLength,
  1383. IN BOOLEAN DemandMode,
  1384. IN DMA_SPEED DmaSpeed
  1385. ) PURE;
  1386. STDMETHOD_(NTSTATUS,NewMasterDmaChannel)
  1387. ( THIS_
  1388. OUT PDMACHANNEL * DmaChannel,
  1389. IN PUNKNOWN OuterUnknown,
  1390. IN PRESOURCELIST ResourceList OPTIONAL,
  1391. IN ULONG MaximumLength,
  1392. IN BOOLEAN Dma32BitAddresses,
  1393. IN BOOLEAN Dma64BitAddresses,
  1394. IN DMA_WIDTH DmaWidth,
  1395. IN DMA_SPEED DmaSpeed
  1396. ) PURE;
  1397. };
  1398. typedef IPortWaveCyclic *PPORTWAVECYCLIC;
  1399. #ifdef PC_IMPLEMENTATION
  1400. #define IMP_IPortWaveCyclic\
  1401. IMP_IPort;\
  1402. STDMETHODIMP_(void) Notify\
  1403. ( IN PSERVICEGROUP ServiceGroup\
  1404. );\
  1405. STDMETHODIMP_(NTSTATUS) NewSlaveDmaChannel\
  1406. ( OUT PDMACHANNELSLAVE * DmaChannel,\
  1407. IN PUNKNOWN OuterUnknown,\
  1408. IN PRESOURCELIST ResourceList,\
  1409. IN ULONG DmaIndex,\
  1410. IN ULONG MaximumLength,\
  1411. IN BOOLEAN DemandMode,\
  1412. IN DMA_SPEED DmaSpeed\
  1413. );\
  1414. STDMETHODIMP_(NTSTATUS) NewMasterDmaChannel\
  1415. ( OUT PDMACHANNEL * DmaChannel,\
  1416. IN PUNKNOWN OuterUnknown,\
  1417. IN PRESOURCELIST ResourceList OPTIONAL,\
  1418. IN ULONG MaximumLength,\
  1419. IN BOOLEAN Dma32BitAddresses,\
  1420. IN BOOLEAN Dma64BitAddresses,\
  1421. IN DMA_WIDTH DmaWidth,\
  1422. IN DMA_SPEED DmaSpeed\
  1423. )
  1424. #endif
  1425. /*****************************************************************************
  1426. * IMiniportWaveCyclicStream
  1427. *****************************************************************************
  1428. * Interface for cyclic wave miniport streams.
  1429. */
  1430. DECLARE_INTERFACE_(IMiniportWaveCyclicStream,IUnknown)
  1431. {
  1432. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1433. STDMETHOD_(NTSTATUS,SetFormat)
  1434. ( THIS_
  1435. IN PKSDATAFORMAT DataFormat
  1436. ) PURE;
  1437. STDMETHOD_(ULONG,SetNotificationFreq)
  1438. ( THIS_
  1439. IN ULONG Interval,
  1440. OUT PULONG FrameSize
  1441. ) PURE;
  1442. STDMETHOD_(NTSTATUS,SetState)
  1443. ( THIS_
  1444. IN KSSTATE State
  1445. ) PURE;
  1446. STDMETHOD_(NTSTATUS,GetPosition)
  1447. ( THIS_
  1448. OUT PULONG Position
  1449. ) PURE;
  1450. STDMETHOD_(NTSTATUS,NormalizePhysicalPosition)
  1451. ( THIS_
  1452. IN OUT PLONGLONG PhysicalPosition
  1453. ) PURE;
  1454. STDMETHOD_(void,Silence)
  1455. ( THIS_
  1456. IN PVOID Buffer,
  1457. IN ULONG ByteCount
  1458. ) PURE;
  1459. };
  1460. typedef IMiniportWaveCyclicStream *PMINIPORTWAVECYCLICSTREAM;
  1461. #define IMP_IMiniportWaveCyclicStream\
  1462. STDMETHODIMP_(NTSTATUS) SetFormat\
  1463. ( IN PKSDATAFORMAT DataFormat\
  1464. );\
  1465. STDMETHODIMP_(ULONG) SetNotificationFreq\
  1466. ( IN ULONG Interval,\
  1467. OUT PULONG FrameSize\
  1468. );\
  1469. STDMETHODIMP_(NTSTATUS) SetState\
  1470. ( IN KSSTATE State\
  1471. );\
  1472. STDMETHODIMP_(NTSTATUS) GetPosition\
  1473. ( OUT PULONG Position\
  1474. );\
  1475. STDMETHODIMP_(NTSTATUS) NormalizePhysicalPosition\
  1476. ( IN OUT PLONGLONG PhysicalPosition\
  1477. );\
  1478. STDMETHODIMP_(void) Silence\
  1479. ( IN PVOID Buffer,\
  1480. IN ULONG ByteCount\
  1481. )
  1482. /*****************************************************************************
  1483. * IMiniportWaveCyclic
  1484. *****************************************************************************
  1485. * Interface for cyclic wave miniports.
  1486. */
  1487. DECLARE_INTERFACE_(IMiniportWaveCyclic,IMiniport)
  1488. {
  1489. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1490. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  1491. // For IMiniportWaveCyclic
  1492. STDMETHOD_(NTSTATUS,Init)
  1493. ( THIS_
  1494. IN PUNKNOWN UnknownAdapter,
  1495. IN PRESOURCELIST ResourceList,
  1496. IN PPORTWAVECYCLIC Port
  1497. ) PURE;
  1498. STDMETHOD_(NTSTATUS,NewStream)
  1499. ( THIS_
  1500. OUT PMINIPORTWAVECYCLICSTREAM * Stream,
  1501. IN PUNKNOWN OuterUnknown OPTIONAL,
  1502. IN POOL_TYPE PoolType,
  1503. IN ULONG Pin,
  1504. IN BOOLEAN Capture,
  1505. IN PKSDATAFORMAT DataFormat,
  1506. OUT PDMACHANNEL * DmaChannel,
  1507. OUT PSERVICEGROUP * ServiceGroup
  1508. ) PURE;
  1509. };
  1510. typedef IMiniportWaveCyclic *PMINIPORTWAVECYCLIC;
  1511. #define IMP_IMiniportWaveCyclic\
  1512. IMP_IMiniport;\
  1513. STDMETHODIMP_(NTSTATUS) Init\
  1514. ( IN PUNKNOWN UnknownAdapter,\
  1515. IN PRESOURCELIST ResourceList,\
  1516. IN PPORTWAVECYCLIC Port\
  1517. );\
  1518. STDMETHODIMP_(NTSTATUS) NewStream\
  1519. ( OUT PMINIPORTWAVECYCLICSTREAM * Stream,\
  1520. IN PUNKNOWN OuterUnknown OPTIONAL,\
  1521. IN POOL_TYPE PoolType,\
  1522. IN ULONG Pin,\
  1523. IN BOOLEAN Capture,\
  1524. IN PKSDATAFORMAT DataFormat,\
  1525. OUT PDMACHANNEL * DmaChannel,\
  1526. OUT PSERVICEGROUP * ServiceGroup\
  1527. )
  1528. /*****************************************************************************
  1529. * IPortWavePci
  1530. *****************************************************************************
  1531. * Interface for PCI wave port lower edge.
  1532. */
  1533. DECLARE_INTERFACE_(IPortWavePci,IPort)
  1534. {
  1535. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1536. DEFINE_ABSTRACT_PORT() // For IPort
  1537. // For IPortWavePci
  1538. STDMETHOD_(void,Notify)
  1539. ( THIS_
  1540. IN PSERVICEGROUP ServiceGroup
  1541. ) PURE;
  1542. STDMETHOD_(NTSTATUS,NewMasterDmaChannel)
  1543. ( THIS_
  1544. OUT PDMACHANNEL * OutDmaChannel,
  1545. IN PUNKNOWN OuterUnknown OPTIONAL,
  1546. IN POOL_TYPE PoolType,
  1547. IN PRESOURCELIST ResourceList OPTIONAL,
  1548. IN BOOLEAN ScatterGather,
  1549. IN BOOLEAN Dma32BitAddresses,
  1550. IN BOOLEAN Dma64BitAddresses,
  1551. IN BOOLEAN IgnoreCount,
  1552. IN DMA_WIDTH DmaWidth,
  1553. IN DMA_SPEED DmaSpeed,
  1554. IN ULONG MaximumLength,
  1555. IN ULONG DmaPort
  1556. ) PURE;
  1557. };
  1558. typedef IPortWavePci *PPORTWAVEPCI;
  1559. #ifdef PC_IMPLEMENTATION
  1560. #define IMP_IPortWavePci\
  1561. IMP_IPort;\
  1562. STDMETHODIMP_(void) Notify\
  1563. ( IN PSERVICEGROUP ServiceGroup\
  1564. );\
  1565. STDMETHODIMP_(NTSTATUS) NewMasterDmaChannel\
  1566. ( OUT PDMACHANNEL * OutDmaChannel,\
  1567. IN PUNKNOWN OuterUnknown OPTIONAL,\
  1568. IN POOL_TYPE PoolType,\
  1569. IN PRESOURCELIST ResourceList OPTIONAL,\
  1570. IN BOOLEAN ScatterGather,\
  1571. IN BOOLEAN Dma32BitAddresses,\
  1572. IN BOOLEAN Dma64BitAddresses,\
  1573. IN BOOLEAN IgnoreCount,\
  1574. IN DMA_WIDTH DmaWidth,\
  1575. IN DMA_SPEED DmaSpeed,\
  1576. IN ULONG MaximumLength,\
  1577. IN ULONG DmaPort\
  1578. )
  1579. #endif
  1580. /*****************************************************************************
  1581. * IPortWavePciStream
  1582. *****************************************************************************
  1583. * Interface for PCI wave port pin lower edge.
  1584. */
  1585. DECLARE_INTERFACE_(IPortWavePciStream,IUnknown)
  1586. {
  1587. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1588. STDMETHOD_(NTSTATUS,GetMapping)
  1589. ( THIS_
  1590. IN PVOID Tag,
  1591. OUT PPHYSICAL_ADDRESS PhysicalAddress,
  1592. OUT PVOID * VirtualAddress,
  1593. OUT PULONG ByteCount,
  1594. OUT PULONG Flags
  1595. ) PURE;
  1596. STDMETHOD_(NTSTATUS,ReleaseMapping)
  1597. ( THIS_
  1598. IN PVOID Tag
  1599. ) PURE;
  1600. STDMETHOD_(NTSTATUS,TerminatePacket)
  1601. ( THIS
  1602. ) PURE;
  1603. };
  1604. typedef IPortWavePciStream *PPORTWAVEPCISTREAM;
  1605. #ifdef PC_IMPLEMENTATION
  1606. #define IMP_IPortWavePciStream\
  1607. STDMETHODIMP_(NTSTATUS) GetMapping\
  1608. ( IN PVOID Tag,\
  1609. OUT PPHYSICAL_ADDRESS PhysicalAddress,\
  1610. OUT PVOID * VirtualAddress,\
  1611. OUT PULONG ByteCount,\
  1612. OUT PULONG Flags\
  1613. );\
  1614. STDMETHODIMP_(NTSTATUS) ReleaseMapping\
  1615. ( IN PVOID Tag\
  1616. );\
  1617. STDMETHODIMP_(NTSTATUS) TerminatePacket\
  1618. ( void\
  1619. )
  1620. #endif
  1621. /*****************************************************************************
  1622. * IMiniportWavePciStream
  1623. *****************************************************************************
  1624. * Interface for PCI wave miniport streams.
  1625. */
  1626. DECLARE_INTERFACE_(IMiniportWavePciStream,IUnknown)
  1627. {
  1628. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1629. STDMETHOD_(NTSTATUS,SetFormat)
  1630. ( THIS_
  1631. IN PKSDATAFORMAT DataFormat
  1632. ) PURE;
  1633. STDMETHOD_(NTSTATUS,SetState)
  1634. ( THIS_
  1635. IN KSSTATE State
  1636. ) PURE;
  1637. STDMETHOD_(NTSTATUS,GetPosition)
  1638. ( THIS_
  1639. OUT PULONGLONG Position
  1640. ) PURE;
  1641. STDMETHOD_(NTSTATUS,NormalizePhysicalPosition)
  1642. (
  1643. THIS_
  1644. IN OUT PLONGLONG PhysicalPosition
  1645. ) PURE;
  1646. STDMETHOD_(NTSTATUS,GetAllocatorFraming)
  1647. (
  1648. THIS_
  1649. OUT PKSALLOCATOR_FRAMING AllocatorFraming
  1650. ) PURE;
  1651. STDMETHOD_(NTSTATUS,RevokeMappings)
  1652. ( THIS_
  1653. IN PVOID FirstTag,
  1654. IN PVOID LastTag,
  1655. OUT PULONG MappingsRevoked
  1656. ) PURE;
  1657. STDMETHOD_(void,MappingAvailable)
  1658. ( THIS
  1659. ) PURE;
  1660. STDMETHOD_(void,Service)
  1661. ( THIS
  1662. ) PURE;
  1663. };
  1664. typedef IMiniportWavePciStream *PMINIPORTWAVEPCISTREAM;
  1665. #define IMP_IMiniportWavePciStream\
  1666. STDMETHODIMP_(NTSTATUS) SetFormat\
  1667. ( IN PKSDATAFORMAT DataFormat\
  1668. );\
  1669. STDMETHODIMP_(NTSTATUS) SetState\
  1670. ( IN KSSTATE State\
  1671. );\
  1672. STDMETHODIMP_(NTSTATUS) GetPosition\
  1673. ( OUT PULONGLONG Position\
  1674. );\
  1675. STDMETHODIMP_(NTSTATUS) NormalizePhysicalPosition\
  1676. ( IN OUT PLONGLONG PhysicalPosition\
  1677. );\
  1678. STDMETHODIMP_(NTSTATUS) GetAllocatorFraming\
  1679. ( OUT PKSALLOCATOR_FRAMING AllocatorFraming\
  1680. );\
  1681. STDMETHODIMP_(NTSTATUS) RevokeMappings\
  1682. ( IN PVOID FirstTag,\
  1683. IN PVOID LastTag,\
  1684. OUT PULONG MappingsRevoked\
  1685. );\
  1686. STDMETHODIMP_(void) MappingAvailable\
  1687. ( void\
  1688. );\
  1689. STDMETHODIMP_(void) Service\
  1690. ( void\
  1691. )
  1692. /*****************************************************************************
  1693. * IMiniportWavePci
  1694. *****************************************************************************
  1695. * Interface for PCI wave miniports.
  1696. */
  1697. DECLARE_INTERFACE_(IMiniportWavePci,IMiniport)
  1698. {
  1699. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1700. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  1701. // For IMiniportWavePci
  1702. STDMETHOD_(NTSTATUS,Init)
  1703. ( THIS_
  1704. IN PUNKNOWN UnknownAdapter,
  1705. IN PRESOURCELIST ResourceList,
  1706. IN PPORTWAVEPCI Port,
  1707. OUT PSERVICEGROUP * ServiceGroup
  1708. ) PURE;
  1709. STDMETHOD_(NTSTATUS,NewStream)
  1710. ( THIS_
  1711. OUT PMINIPORTWAVEPCISTREAM * Stream,
  1712. IN PUNKNOWN OuterUnknown OPTIONAL,
  1713. IN POOL_TYPE PoolType,
  1714. IN PPORTWAVEPCISTREAM PortStream,
  1715. IN ULONG Pin,
  1716. IN BOOLEAN Capture,
  1717. IN PKSDATAFORMAT DataFormat,
  1718. OUT PDMACHANNEL * DmaChannel,
  1719. OUT PSERVICEGROUP * ServiceGroup
  1720. ) PURE;
  1721. STDMETHOD_(void,Service)
  1722. ( THIS
  1723. ) PURE;
  1724. };
  1725. typedef IMiniportWavePci *PMINIPORTWAVEPCI;
  1726. #define IMP_IMiniportWavePci\
  1727. IMP_IMiniport;\
  1728. STDMETHODIMP_(NTSTATUS) Init\
  1729. ( IN PUNKNOWN UnknownAdapter,\
  1730. IN PRESOURCELIST ResourceList,\
  1731. IN PPORTWAVEPCI Port,\
  1732. OUT PSERVICEGROUP * ServiceGroup\
  1733. );\
  1734. STDMETHODIMP_(NTSTATUS) NewStream\
  1735. ( OUT PMINIPORTWAVEPCISTREAM * Stream,\
  1736. IN PUNKNOWN OuterUnknown OPTIONAL,\
  1737. IN POOL_TYPE PoolType,\
  1738. IN PPORTWAVEPCISTREAM PortStream,\
  1739. IN ULONG Pin,\
  1740. IN BOOLEAN Capture,\
  1741. IN PKSDATAFORMAT DataFormat,\
  1742. OUT PDMACHANNEL * DmaChannel,\
  1743. OUT PSERVICEGROUP * ServiceGroup\
  1744. );\
  1745. STDMETHODIMP_(void) Service\
  1746. ( void\
  1747. )
  1748. /*****************************************************************************
  1749. * IAdapterPowerManagement
  1750. *****************************************************************************
  1751. * An interface that adapters should implement and
  1752. * register if they want power management messages.
  1753. * Register this interface with PortCls via the
  1754. * PcRegisterAdapterPowerManagement() call.
  1755. *
  1756. * NOTE: If you want to fill in the caps struct
  1757. * for your device, register the interface
  1758. * with PortCls in or before your AddDevice()
  1759. * function. The OS queries devices before
  1760. * StartDevice() gets called.
  1761. */
  1762. DECLARE_INTERFACE_(IAdapterPowerManagement,IUnknown)
  1763. {
  1764. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1765. // Called by PortCls to tell the device
  1766. // to change to the new power state.
  1767. //
  1768. STDMETHOD_(void,PowerChangeState)
  1769. ( THIS_
  1770. IN POWER_STATE NewState
  1771. ) PURE;
  1772. // Called by PortCls to ask whether the device
  1773. // can change to the requested power state.
  1774. //
  1775. STDMETHOD_(NTSTATUS,QueryPowerChangeState)
  1776. ( THIS_
  1777. IN POWER_STATE NewStateQuery
  1778. ) PURE;
  1779. // Called by PortCls to get the power management
  1780. // capabilities of the device. See ACPI documentation
  1781. // for data about the DEVICE_CAPABILITIES struct.
  1782. //
  1783. STDMETHOD_(NTSTATUS,QueryDeviceCapabilities)
  1784. ( THIS_
  1785. IN PDEVICE_CAPABILITIES PowerDeviceCaps
  1786. ) PURE;
  1787. };
  1788. typedef IAdapterPowerManagement *PADAPTERPOWERMANAGEMENT;
  1789. #define IMP_IAdapterPowerManagement\
  1790. STDMETHODIMP_(void) PowerChangeState\
  1791. ( IN POWER_STATE NewState\
  1792. );\
  1793. STDMETHODIMP_(NTSTATUS) QueryPowerChangeState\
  1794. ( IN POWER_STATE NewStateQuery\
  1795. );\
  1796. STDMETHODIMP_(NTSTATUS) QueryDeviceCapabilities\
  1797. ( IN PDEVICE_CAPABILITIES PowerDeviceCaps\
  1798. )
  1799. /*****************************************************************************
  1800. * IPowerNotify
  1801. *****************************************************************************
  1802. * An OPTIONAL interface for miniports and pins to implement to
  1803. * enable them to get device power state change notifications.
  1804. */
  1805. DECLARE_INTERFACE_(IPowerNotify,IUnknown)
  1806. {
  1807. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1808. // Called by the port to notify registered miniports
  1809. // and pins of device power state changes, so that
  1810. // appropriate context save/restore can take place.
  1811. //
  1812. STDMETHOD_(void,PowerChangeNotify)
  1813. ( THIS_
  1814. IN POWER_STATE PowerState
  1815. ) PURE;
  1816. };
  1817. typedef IPowerNotify *PPOWERNOTIFY;
  1818. #define IMP_IPowerNotify\
  1819. STDMETHODIMP_(void) PowerChangeNotify\
  1820. ( IN POWER_STATE PowerState\
  1821. )
  1822. /*****************************************************************************
  1823. * IPinCount
  1824. *****************************************************************************
  1825. * An OPTIONAL interface for miniports to implement to
  1826. * enable them to get pin count queries, for dynamic pin counts.
  1827. */
  1828. DECLARE_INTERFACE_(IPinCount,IUnknown)
  1829. {
  1830. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1831. // Called by the port to notify registered miniports
  1832. // of pin count queries, so that appropriate pin
  1833. // count manipulation can take place.
  1834. //
  1835. STDMETHOD_(void,PinCount)
  1836. ( THIS_
  1837. IN ULONG PinId,
  1838. IN OUT PULONG FilterNecessary,
  1839. IN OUT PULONG FilterCurrent,
  1840. IN OUT PULONG FilterPossible,
  1841. IN OUT PULONG GlobalCurrent,
  1842. IN OUT PULONG GlobalPossible
  1843. ) PURE;
  1844. };
  1845. typedef IPinCount *PPINCOUNT;
  1846. #define IMP_IPinCount \
  1847. STDMETHODIMP_(void) PinCount \
  1848. ( IN ULONG PinId, \
  1849. IN OUT PULONG FilterNecessary, \
  1850. IN OUT PULONG FilterCurrent, \
  1851. IN OUT PULONG FilterPossible, \
  1852. IN OUT PULONG GlobalCurrent, \
  1853. IN OUT PULONG GlobalPossible \
  1854. )
  1855. /*****************************************************************************
  1856. * IPortEvents
  1857. *****************************************************************************
  1858. * An interface implemented by ports to provide
  1859. * notification event helpers to miniports.
  1860. */
  1861. DECLARE_INTERFACE_(IPortEvents,IUnknown)
  1862. {
  1863. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1864. STDMETHOD_(void,AddEventToEventList)
  1865. ( THIS_
  1866. IN PKSEVENT_ENTRY EventEntry
  1867. ) PURE;
  1868. STDMETHOD_(void,GenerateEventList)
  1869. ( THIS_
  1870. IN GUID* Set OPTIONAL,
  1871. IN ULONG EventId,
  1872. IN BOOL PinEvent,
  1873. IN ULONG PinId,
  1874. IN BOOL NodeEvent,
  1875. IN ULONG NodeId
  1876. ) PURE;
  1877. };
  1878. typedef IPortEvents *PPORTEVENTS;
  1879. #define IMP_IPortEvents\
  1880. STDMETHODIMP_(void) AddEventToEventList\
  1881. ( IN PKSEVENT_ENTRY EventEntry\
  1882. );\
  1883. STDMETHODIMP_(void) GenerateEventList\
  1884. ( IN GUID* Set OPTIONAL,\
  1885. IN ULONG EventId,\
  1886. IN BOOL PinEvent,\
  1887. IN ULONG PinId,\
  1888. IN BOOL NodeEvent,\
  1889. IN ULONG NodeId\
  1890. )
  1891. /*****************************************************************************
  1892. * IDrmPort
  1893. *****************************************************************************
  1894. * An optional interface implemented by ports
  1895. * to provide DRM functionality to miniports.
  1896. */
  1897. DECLARE_INTERFACE_(IDrmPort,IUnknown)
  1898. {
  1899. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1900. DEFINE_ABSTRACT_DRMPORT() // For IDrmPort
  1901. };
  1902. typedef IDrmPort *PDRMPORT;
  1903. #define IMP_IDrmPort\
  1904. STDMETHODIMP_(NTSTATUS) CreateContentMixed \
  1905. ( IN PULONG paContentId, \
  1906. IN ULONG cContentId, \
  1907. OUT PULONG pMixedContentId \
  1908. ); \
  1909. STDMETHODIMP_(NTSTATUS) DestroyContent \
  1910. ( IN ULONG ContentId \
  1911. ); \
  1912. STDMETHODIMP_(NTSTATUS) ForwardContentToFileObject \
  1913. ( IN ULONG ContentId, \
  1914. IN PFILE_OBJECT FileObject \
  1915. ); \
  1916. STDMETHODIMP_(NTSTATUS) ForwardContentToInterface \
  1917. ( IN ULONG ContentId, \
  1918. IN PUNKNOWN pUnknown, \
  1919. IN ULONG NumMethods \
  1920. ); \
  1921. STDMETHODIMP_(NTSTATUS) GetContentRights \
  1922. ( IN ULONG ContentId, \
  1923. OUT PDRMRIGHTS DrmRights \
  1924. )
  1925. /*****************************************************************************
  1926. * IDrmPort2
  1927. *****************************************************************************
  1928. * An optional interface implemented by ports
  1929. * to provide DRM functionality to miniports.
  1930. * This is identical to IDrmPort with the
  1931. * addition of two new routines.
  1932. */
  1933. DECLARE_INTERFACE_(IDrmPort2,IDrmPort)
  1934. {
  1935. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  1936. DEFINE_ABSTRACT_DRMPORT() // For IDrmPort
  1937. STDMETHOD_(NTSTATUS,AddContentHandlers)
  1938. ( THIS_
  1939. IN ULONG ContentId,
  1940. IN PVOID * paHandlers,
  1941. IN ULONG NumHandlers
  1942. ) PURE;
  1943. STDMETHOD_(NTSTATUS,ForwardContentToDeviceObject)
  1944. ( THIS_
  1945. IN ULONG ContentId,
  1946. IN PVOID Reserved,
  1947. IN PCDRMFORWARD DrmForward
  1948. ) PURE;
  1949. };
  1950. typedef IDrmPort2 *PDRMPORT2;
  1951. #define IMP_IDrmPort2 \
  1952. IMP_IDrmPort; \
  1953. STDMETHODIMP_(NTSTATUS) AddContentHandlers \
  1954. ( IN ULONG ContentId, \
  1955. IN PVOID * paHandlers, \
  1956. IN ULONG NumHandlers \
  1957. ); \
  1958. STDMETHODIMP_(NTSTATUS) ForwardContentToDeviceObject \
  1959. ( IN ULONG ContentId, \
  1960. IN PVOID Reserved, \
  1961. IN PCDRMFORWARD DrmForward \
  1962. )
  1963. /*****************************************************************************
  1964. * IPortClsVersion
  1965. *****************************************************************************
  1966. * What version of PortCls is this?
  1967. */
  1968. DECLARE_INTERFACE_(IPortClsVersion,IUnknown)
  1969. {
  1970. STDMETHOD_(DWORD,GetVersion)
  1971. ( THIS
  1972. ) PURE;
  1973. };
  1974. typedef IPortClsVersion *PPORTCLSVERSION;
  1975. // DO NOT ASSUME THAT EACH SUCCESSIVE ENUM IMPLIES A FEATURE SUPERSET!
  1976. // Example: Win2K has more audio features than Win98SE_QFE2.
  1977. //
  1978. enum
  1979. {
  1980. kVersionInvalid = -1,
  1981. kVersionWin98, // IPortClsVersion is unsupported
  1982. kVersionWin98SE, // IPortClsVersion is unsupported
  1983. kVersionWin2K, // IPortClsVersion is unsupported
  1984. kVersionWin98SE_QFE2, // IPortClsVersion is unsupported
  1985. // QFE Package 269601 (contains 242937 and 247565)
  1986. kVersionWin2K_SP2, // IPortClsVersion is supported
  1987. kVersionWinME, // IPortClsVersion is unsupported
  1988. kVersionWin98SE_QFE3, // IPortClsVersion is supported
  1989. // QFE Package (not yet released, as of 6/15/2001)
  1990. kVersionWinME_QFE1, // IPortClsVersion is supported
  1991. // QFE Package (not yet released, as of 6/15/2001)
  1992. kVersionWinXP, // IPortClsVersion is supported
  1993. kVersionWinXPSP1 // IPortClsVersion is supported
  1994. // Additional enum values will be added here, in
  1995. // *roughly* chronological (not feature set) order.
  1996. };
  1997. /*****************************************************************************
  1998. * IDmaOperations
  1999. *****************************************************************************
  2000. * An interface implemented by the DMA object to provide operations on the
  2001. * "DMA adapter" like HalAllocateCommonBuffer.
  2002. */
  2003. DECLARE_INTERFACE_(IDmaOperations,IUnknown)
  2004. {
  2005. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  2006. STDMETHOD_(PVOID,AllocateCommonBuffer)
  2007. ( THIS_
  2008. IN ULONG Length,
  2009. OUT PPHYSICAL_ADDRESS physAddr,
  2010. IN BOOLEAN bCacheEnabled
  2011. ) PURE;
  2012. };
  2013. typedef IDmaOperations *PDMAOPERATIONS;
  2014. #define IMP_IDmaOperations\
  2015. STDMETHODIMP_(PVOID) AllocateCommonBuffer\
  2016. (\
  2017. IN ULONG Length,\
  2018. OUT PPHYSICAL_ADDRESS physAddr,\
  2019. IN BOOLEAN bCacheEnabled\
  2020. )
  2021. /*****************************************************************************
  2022. * IPreFetchOffset
  2023. *****************************************************************************
  2024. * An interface implemented by the pin to implement prefetch characteristics
  2025. * of bus master hardware - to specify the hardware queue size, determining
  2026. * the pad between play cursor and write cursor.
  2027. */
  2028. DECLARE_INTERFACE_(IPreFetchOffset,IUnknown)
  2029. {
  2030. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  2031. STDMETHOD_(VOID,SetPreFetchOffset)
  2032. ( THIS_
  2033. IN ULONG PreFetchOffset
  2034. ) PURE;
  2035. };
  2036. typedef IPreFetchOffset *PPREFETCHOFFSET;
  2037. #define IMP_IPreFetchOffset\
  2038. STDMETHODIMP_(VOID) SetPreFetchOffset\
  2039. (\
  2040. IN ULONG PreFetchOffset\
  2041. )
  2042. /*****************************************************************************
  2043. * Functions.
  2044. */
  2045. /*****************************************************************************
  2046. * PCPFNSTARTDEVICE
  2047. *****************************************************************************
  2048. * Type for start device callback.
  2049. */
  2050. typedef
  2051. NTSTATUS
  2052. (*PCPFNSTARTDEVICE)
  2053. (
  2054. #ifdef PC_OLD_NAMES
  2055. IN PVOID DeviceObject,
  2056. IN PVOID Irp,
  2057. #else
  2058. IN PDEVICE_OBJECT DeviceObject,
  2059. IN PIRP Irp,
  2060. #endif
  2061. IN PRESOURCELIST ResourceList
  2062. );
  2063. /*****************************************************************************
  2064. * PcInitializeAdapterDriver()
  2065. *****************************************************************************
  2066. * Initializes an adapter driver.
  2067. */
  2068. PORTCLASSAPI
  2069. NTSTATUS
  2070. NTAPI
  2071. PcInitializeAdapterDriver
  2072. (
  2073. IN PDRIVER_OBJECT DriverObject,
  2074. IN PUNICODE_STRING RegistryPathName,
  2075. IN PDRIVER_ADD_DEVICE AddDevice
  2076. );
  2077. /*****************************************************************************
  2078. * PcDispatchIrp()
  2079. *****************************************************************************
  2080. * Dispatch an IRP.
  2081. */
  2082. PORTCLASSAPI
  2083. NTSTATUS
  2084. NTAPI
  2085. PcDispatchIrp
  2086. (
  2087. IN PDEVICE_OBJECT pDeviceObject,
  2088. IN PIRP pIrp
  2089. );
  2090. /*****************************************************************************
  2091. * PcAddAdapterDevice()
  2092. *****************************************************************************
  2093. * Adds an adapter device. DeviceExtensionSize may be zero for default size.
  2094. */
  2095. PORTCLASSAPI
  2096. NTSTATUS
  2097. NTAPI
  2098. PcAddAdapterDevice
  2099. (
  2100. IN PDRIVER_OBJECT DriverObject,
  2101. IN PDEVICE_OBJECT PhysicalDeviceObject,
  2102. IN PCPFNSTARTDEVICE StartDevice,
  2103. IN ULONG MaxObjects,
  2104. IN ULONG DeviceExtensionSize
  2105. );
  2106. /*****************************************************************************
  2107. * PcCompleteIrp()
  2108. *****************************************************************************
  2109. * Complete an IRP unless status is STATUS_PENDING.
  2110. */
  2111. PORTCLASSAPI
  2112. NTSTATUS
  2113. NTAPI
  2114. PcCompleteIrp
  2115. (
  2116. IN PDEVICE_OBJECT pDeviceObject,
  2117. IN PIRP pIrp,
  2118. IN NTSTATUS ntStatus
  2119. );
  2120. /*****************************************************************************
  2121. * PcForwardIrpSynchronous()
  2122. *****************************************************************************
  2123. * Forward a PnP IRP to the PDO. The IRP is not completed at this level,
  2124. * this function does not return until the lower driver has completed the IRP,
  2125. * and DecrementPendingIrpCount() is not called.
  2126. */
  2127. PORTCLASSAPI
  2128. NTSTATUS
  2129. NTAPI
  2130. PcForwardIrpSynchronous
  2131. (
  2132. IN PDEVICE_OBJECT DeviceObject,
  2133. IN PIRP Irp
  2134. );
  2135. /*****************************************************************************
  2136. * PcRegisterSubdevice()
  2137. *****************************************************************************
  2138. * Registers a subdevice.
  2139. */
  2140. PORTCLASSAPI
  2141. NTSTATUS
  2142. NTAPI
  2143. PcRegisterSubdevice
  2144. (
  2145. IN PDEVICE_OBJECT DeviceObject,
  2146. IN PWCHAR Name,
  2147. IN PUNKNOWN Unknown
  2148. );
  2149. /*****************************************************************************
  2150. * PcRegisterPhysicalConnection()
  2151. *****************************************************************************
  2152. * Registers a physical connection between subdevices.
  2153. */
  2154. PORTCLASSAPI
  2155. NTSTATUS
  2156. NTAPI
  2157. PcRegisterPhysicalConnection
  2158. (
  2159. IN PDEVICE_OBJECT DeviceObject,
  2160. IN PUNKNOWN FromUnknown,
  2161. IN ULONG FromPin,
  2162. IN PUNKNOWN ToUnknown,
  2163. IN ULONG ToPin
  2164. );
  2165. /*****************************************************************************
  2166. * PcRegisterPhysicalConnectionToExternal()
  2167. *****************************************************************************
  2168. * Registers a physical connection from a subdevice to an external device.
  2169. */
  2170. PORTCLASSAPI
  2171. NTSTATUS
  2172. NTAPI
  2173. PcRegisterPhysicalConnectionToExternal
  2174. (
  2175. IN PDEVICE_OBJECT DeviceObject,
  2176. IN PUNKNOWN FromUnknown,
  2177. IN ULONG FromPin,
  2178. IN PUNICODE_STRING ToString,
  2179. IN ULONG ToPin
  2180. );
  2181. /*****************************************************************************
  2182. * PcRegisterPhysicalConnectionFromExternal()
  2183. *****************************************************************************
  2184. * Registers a physical connection to a subdevice from an external device.
  2185. */
  2186. PORTCLASSAPI
  2187. NTSTATUS
  2188. NTAPI
  2189. PcRegisterPhysicalConnectionFromExternal
  2190. (
  2191. IN PDEVICE_OBJECT DeviceObject,
  2192. IN PUNICODE_STRING FromString,
  2193. IN ULONG FromPin,
  2194. IN PUNKNOWN ToUnknown,
  2195. IN ULONG ToPin
  2196. );
  2197. /*****************************************************************************
  2198. * PcNewPort()
  2199. *****************************************************************************
  2200. * Creates an instance of a port driver.
  2201. */
  2202. PORTCLASSAPI
  2203. NTSTATUS
  2204. NTAPI
  2205. PcNewPort
  2206. (
  2207. OUT PPORT * OutPort,
  2208. IN REFCLSID ClassID
  2209. );
  2210. /*****************************************************************************
  2211. * PcNewMiniport()
  2212. *****************************************************************************
  2213. * Creates an instance of a system-supplied miniport driver.
  2214. */
  2215. PORTCLASSAPI
  2216. NTSTATUS
  2217. NTAPI
  2218. PcNewMiniport
  2219. (
  2220. OUT PMINIPORT * OutMiniPort,
  2221. IN REFCLSID ClassID
  2222. );
  2223. /*****************************************************************************
  2224. * PcNewDmaChannel()
  2225. *****************************************************************************
  2226. * Creates a DMA channel.
  2227. */
  2228. PORTCLASSAPI
  2229. NTSTATUS
  2230. NTAPI
  2231. PcNewDmaChannel
  2232. (
  2233. OUT PDMACHANNEL * OutDmaChannel,
  2234. IN PUNKNOWN OuterUnknown OPTIONAL,
  2235. IN POOL_TYPE PoolType,
  2236. IN PDEVICE_DESCRIPTION DeviceDescription,
  2237. IN PDEVICE_OBJECT DeviceObject
  2238. );
  2239. /*****************************************************************************
  2240. * PcCompletePendingPropertyRequest()
  2241. *****************************************************************************
  2242. * Completes a pending property request.
  2243. */
  2244. PORTCLASSAPI
  2245. NTSTATUS
  2246. NTAPI
  2247. PcCompletePendingPropertyRequest
  2248. (
  2249. IN PPCPROPERTY_REQUEST PropertyRequest,
  2250. IN NTSTATUS NtStatus
  2251. );
  2252. /*****************************************************************************
  2253. * PcGetTimeInterval
  2254. *****************************************************************************
  2255. * Gets the system time interval
  2256. */
  2257. PORTCLASSAPI
  2258. ULONGLONG
  2259. NTAPI
  2260. PcGetTimeInterval
  2261. (
  2262. IN ULONGLONG Since
  2263. );
  2264. #define GTI_SECONDS(t) (ULONGLONG(t)*10000000)
  2265. #define GTI_MILLISECONDS(t) (ULONGLONG(t)*10000)
  2266. #define GTI_MICROSECONDS(t) (ULONGLONG(t)*10)
  2267. /*****************************************************************************
  2268. * PcNewResourceList()
  2269. *****************************************************************************
  2270. * Creates and initializes a resource list.
  2271. */
  2272. PORTCLASSAPI
  2273. NTSTATUS
  2274. NTAPI
  2275. PcNewResourceList
  2276. (
  2277. OUT PRESOURCELIST * OutResourceList,
  2278. IN PUNKNOWN OuterUnknown OPTIONAL,
  2279. IN POOL_TYPE PoolType,
  2280. IN PCM_RESOURCE_LIST TranslatedResources,
  2281. IN PCM_RESOURCE_LIST UntranslatedResources
  2282. );
  2283. /*****************************************************************************
  2284. * PcNewResourceSublist()
  2285. *****************************************************************************
  2286. * Creates and initializes an empty resource list derived from another
  2287. * resource list.
  2288. */
  2289. PORTCLASSAPI
  2290. NTSTATUS
  2291. NTAPI
  2292. PcNewResourceSublist
  2293. (
  2294. OUT PRESOURCELIST * OutResourceList,
  2295. IN PUNKNOWN OuterUnknown OPTIONAL,
  2296. IN POOL_TYPE PoolType,
  2297. IN PRESOURCELIST ParentList,
  2298. IN ULONG MaximumEntries
  2299. );
  2300. /*****************************************************************************
  2301. * PcNewInterruptSync()
  2302. *****************************************************************************
  2303. * Creates and initializes an interrupt-level synchronization object.
  2304. */
  2305. PORTCLASSAPI
  2306. NTSTATUS
  2307. NTAPI
  2308. PcNewInterruptSync
  2309. (
  2310. OUT PINTERRUPTSYNC * OutInterruptSync,
  2311. IN PUNKNOWN OuterUnknown OPTIONAL,
  2312. IN PRESOURCELIST ResourceList,
  2313. IN ULONG ResourceIndex,
  2314. IN INTERRUPTSYNCMODE Mode
  2315. );
  2316. /*****************************************************************************
  2317. * PcNewServiceGroup()
  2318. *****************************************************************************
  2319. * Creates and initializes a service group object.
  2320. */
  2321. PORTCLASSAPI
  2322. NTSTATUS
  2323. NTAPI
  2324. PcNewServiceGroup
  2325. (
  2326. OUT PSERVICEGROUP * OutServiceGroup,
  2327. IN PUNKNOWN OuterUnknown OPTIONAL
  2328. );
  2329. /*****************************************************************************
  2330. * PcNewRegistryKey()
  2331. *****************************************************************************
  2332. * Creates and initializes a registry key object.
  2333. */
  2334. PORTCLASSAPI
  2335. NTSTATUS
  2336. NTAPI
  2337. PcNewRegistryKey
  2338. (
  2339. OUT PREGISTRYKEY * OutRegistryKey,
  2340. IN PUNKNOWN OuterUnknown OPTIONAL,
  2341. IN ULONG RegistryKeyType,
  2342. IN ACCESS_MASK DesiredAccess,
  2343. IN PVOID DeviceObject OPTIONAL,
  2344. IN PVOID SubDevice OPTIONAL,
  2345. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  2346. IN ULONG CreateOptions OPTIONAL,
  2347. OUT PULONG Disposition OPTIONAL
  2348. );
  2349. /*****************************************************************************
  2350. * RegistryKeyType for NewRegistryKey()
  2351. *****************************************************************************
  2352. * Enumeration of key types.
  2353. */
  2354. enum
  2355. {
  2356. GeneralRegistryKey, // ObjectAttributes and CreateOptions are req'd.
  2357. DeviceRegistryKey, // Device Object is required
  2358. DriverRegistryKey, // Device Object is required
  2359. HwProfileRegistryKey, // Device Object is required
  2360. DeviceInterfaceRegistryKey // Device Object and SubDevice are required
  2361. };
  2362. /*****************************************************************************
  2363. * PcGetDeviceProperty()
  2364. *****************************************************************************
  2365. * This returns the requested device property from the registry.
  2366. */
  2367. PORTCLASSAPI
  2368. NTSTATUS
  2369. NTAPI
  2370. PcGetDeviceProperty
  2371. (
  2372. IN PVOID DeviceObject,
  2373. IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
  2374. IN ULONG BufferLength,
  2375. OUT PVOID PropertyBuffer,
  2376. OUT PULONG ResultLength
  2377. );
  2378. /*****************************************************************************
  2379. * PcRegisterAdapterPowerManagement()
  2380. *****************************************************************************
  2381. * Register the adapter's power management interface with PortCls.
  2382. */
  2383. PORTCLASSAPI
  2384. NTSTATUS
  2385. NTAPI
  2386. PcRegisterAdapterPowerManagement
  2387. (
  2388. IN PUNKNOWN Unknown,
  2389. IN PVOID pvContext1
  2390. );
  2391. /*****************************************************************************
  2392. * PcRequestNewPowerState()
  2393. *****************************************************************************
  2394. * This routine is used to request a new power state for the device. It is
  2395. * normally not needed by adapter drivers but is exported in order to
  2396. * support unusual circumstances.
  2397. */
  2398. PORTCLASSAPI
  2399. NTSTATUS
  2400. NTAPI
  2401. PcRequestNewPowerState
  2402. (
  2403. IN PDEVICE_OBJECT pDeviceObject,
  2404. IN DEVICE_POWER_STATE RequestedNewState
  2405. );
  2406. /*****************************************************************************
  2407. * PcRegisterIoTimeout()
  2408. *****************************************************************************
  2409. * This routine registers a driver-supplied callback associated with a given
  2410. * device object (see IoInitializeTimer in the DDK). This callback that will
  2411. * be called approximately once per second while the device is active (see
  2412. * IoStartTimer, and IoStopTimer in the DDK - these are called upon device
  2413. * START and STOP).
  2414. *
  2415. * This routine must be called at PASSIVE_LEVEL.
  2416. * pTimerRoutine can and will be called at DISPATCH_LEVEL; it must be non-paged.
  2417. *
  2418. */
  2419. PORTCLASSAPI
  2420. NTSTATUS
  2421. NTAPI
  2422. PcRegisterIoTimeout
  2423. (
  2424. IN PDEVICE_OBJECT pDeviceObject,
  2425. IN PIO_TIMER_ROUTINE pTimerRoutine,
  2426. IN PVOID pContext
  2427. );
  2428. /*****************************************************************************
  2429. * PcUnregisterIoTimeout()
  2430. *****************************************************************************
  2431. * This routine unregisters a driver-supplied callback associated with a given
  2432. * device object. This callback must have been previously registered with
  2433. * PcRegisterIoTimeout (with the same device object, timer routine and context).
  2434. *
  2435. * This routine must be called at PASSIVE_LEVEL.
  2436. * pTimerRoutine can and will be called at DISPATCH_LEVEL; it must be non-paged.
  2437. *
  2438. */
  2439. PORTCLASSAPI
  2440. NTSTATUS
  2441. NTAPI
  2442. PcUnregisterIoTimeout
  2443. (
  2444. IN PDEVICE_OBJECT pDeviceObject,
  2445. IN PIO_TIMER_ROUTINE pTimerRoutine,
  2446. IN PVOID pContext
  2447. );
  2448. /*****************************************************************************
  2449. * Pc DRM functions
  2450. *****************************************************************************
  2451. * These functions link directly to the kernel-mode Digital Rights Management
  2452. * module. They all must be called at PASSIVE_LEVEL.
  2453. */
  2454. PORTCLASSAPI
  2455. NTSTATUS
  2456. NTAPI
  2457. PcAddContentHandlers
  2458. (
  2459. IN ULONG ContentId,
  2460. IN PVOID * paHandlers,
  2461. IN ULONG NumHandlers
  2462. );
  2463. PORTCLASSAPI
  2464. NTSTATUS
  2465. NTAPI
  2466. PcCreateContentMixed
  2467. (
  2468. IN PULONG paContentId,
  2469. IN ULONG cContentId,
  2470. OUT PULONG pMixedContentId
  2471. );
  2472. PORTCLASSAPI
  2473. NTSTATUS
  2474. NTAPI
  2475. PcDestroyContent
  2476. (
  2477. IN ULONG ContentId
  2478. );
  2479. PORTCLASSAPI
  2480. NTSTATUS
  2481. NTAPI
  2482. PcForwardContentToDeviceObject
  2483. (
  2484. IN ULONG ContentId,
  2485. IN PVOID Reserved,
  2486. IN PCDRMFORWARD DrmForward
  2487. );
  2488. PORTCLASSAPI
  2489. NTSTATUS
  2490. NTAPI
  2491. PcForwardContentToFileObject
  2492. (
  2493. IN ULONG ContentId,
  2494. IN PFILE_OBJECT FileObject
  2495. );
  2496. PORTCLASSAPI
  2497. NTSTATUS
  2498. NTAPI
  2499. PcForwardContentToInterface
  2500. (
  2501. IN ULONG ContentId,
  2502. IN PUNKNOWN pUnknown,
  2503. IN ULONG NumMethods
  2504. );
  2505. PORTCLASSAPI
  2506. NTSTATUS
  2507. NTAPI
  2508. PcGetContentRights
  2509. (
  2510. IN ULONG ContentId,
  2511. OUT PDRMRIGHTS DrmRights
  2512. );
  2513. #ifdef PC_OLD_NAMES
  2514. #define InitializeAdapterDriver(c1,c2,a) \
  2515. PcInitializeAdapterDriver(PDRIVER_OBJECT(c1),PUNICODE_STRING(c2),PDRIVER_ADD_DEVICE(a))
  2516. #define AddAdapterDevice(c1,c2,s,m) \
  2517. PcAddAdapterDevice(PDRIVER_OBJECT(c1),PDEVICE_OBJECT(c2),s,m,0)
  2518. #define RegisterSubdevice(c1,c2,n,u) \
  2519. PcRegisterSubdevice(PDEVICE_OBJECT(c1),n,u)
  2520. #define RegisterPhysicalConnection(c1,c2,fs,fp,ts,tp) \
  2521. PcRegisterPhysicalConnection(PDEVICE_OBJECT(c1),fs,fp,ts,tp)
  2522. #define RegisterPhysicalConnectionToExternal(c1,c2,fs,fp,ts,tp) \
  2523. PcRegisterPhysicalConnectionToExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp)
  2524. #define RegisterPhysicalConnectionFromExternal(c1,c2,fs,fp,ts,tp) \
  2525. PcRegisterPhysicalConnectionFromExternal(PDEVICE_OBJECT(c1),fs,fp,ts,tp)
  2526. #define NewPort PcNewPort
  2527. #define NewMiniport PcNewMiniport
  2528. #define CompletePendingPropertyRequest PcCompletePendingPropertyRequest
  2529. #define NewResourceList PcNewResourceList
  2530. #define NewResourceSublist PcNewResourceSublist
  2531. #define NewDmaChannel PcNewDmaChannel
  2532. #define NewServiceGroup PcNewServiceGroup
  2533. #define GetTimeInterval PcGetTimeInterval
  2534. #define WIN95COMPAT_ReadPortUChar(Port) READ_PORT_UCHAR(Port)
  2535. #define WIN95COMPAT_WritePortUChar(Port,Value) WRITE_PORT_UCHAR(Port,Value)
  2536. #define WIN95COMPAT_ReadPortUShort(Port) READ_PORT_USHORT(Port)
  2537. #define WIN95COMPAT_WritePortUShort(Port,Value) WRITE_PORT_USHORT(Port,Value)
  2538. #endif //PC_OLD_NAMES
  2539. #endif //_PORTCLS_H_