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