1c2c66affSColin Finck /* 2c2c66affSColin Finck PortCls FDO Extension 3c2c66affSColin Finck 4c2c66affSColin Finck by Andrew Greenwood 5c2c66affSColin Finck */ 6c2c66affSColin Finck 7c2c66affSColin Finck #ifndef PORTCLS_PRIVATE_H 8c2c66affSColin Finck #define PORTCLS_PRIVATE_H 9c2c66affSColin Finck 10c2c66affSColin Finck #include <stdio.h> 11c2c66affSColin Finck 12c2c66affSColin Finck //#define _KS_NO_ANONYMOUS_STRUCTURES_ 13c2c66affSColin Finck #define PC_IMPLEMENTATION 14c2c66affSColin Finck #define COM_STDMETHOD_CAN_THROW 15c2c66affSColin Finck #define PC_NO_IMPORTS 16c2c66affSColin Finck 17c2c66affSColin Finck #include <ntddk.h> 18c2c66affSColin Finck #include <portcls.h> 19c2c66affSColin Finck #include <dmusicks.h> 20c2c66affSColin Finck #include <kcom.h> 21c2c66affSColin Finck 22c2c66affSColin Finck #include "interfaces.hpp" 23c2c66affSColin Finck 24c2c66affSColin Finck #define TAG_PORTCLASS 'SLCP' 25c2c66affSColin Finck 26c2c66affSColin Finck #define PC_ASSERT(exp) \ 27c2c66affSColin Finck (VOID)((!(exp)) ? \ 28c2c66affSColin Finck RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE) 29c2c66affSColin Finck 30c2c66affSColin Finck #define PC_ASSERT_IRQL(x) PC_ASSERT(KeGetCurrentIrql() <= (x)) 31c2c66affSColin Finck #define PC_ASSERT_IRQL_EQUAL(x) PC_ASSERT(KeGetCurrentIrql()==(x)) 32c2c66affSColin Finck 3399fa3880STimo Kreuzer PVOID 3499fa3880STimo Kreuzer __cdecl 3599fa3880STimo Kreuzer operator new( 3699fa3880STimo Kreuzer size_t Size, 3799fa3880STimo Kreuzer POOL_TYPE PoolType, 3899fa3880STimo Kreuzer ULONG Tag); 3999fa3880STimo Kreuzer 40c2c66affSColin Finck extern 41c2c66affSColin Finck "C" 42c2c66affSColin Finck NTSTATUS 43c2c66affSColin Finck NTAPI 44c2c66affSColin Finck PortClsCreate( 45c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 46c2c66affSColin Finck IN PIRP Irp); 47c2c66affSColin Finck 48c2c66affSColin Finck extern 49c2c66affSColin Finck "C" 50c2c66affSColin Finck NTSTATUS 51c2c66affSColin Finck NTAPI 52c2c66affSColin Finck PortClsPnp( 53c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 54c2c66affSColin Finck IN PIRP Irp); 55c2c66affSColin Finck 56c2c66affSColin Finck extern 57c2c66affSColin Finck "C" 58c2c66affSColin Finck NTSTATUS 59c2c66affSColin Finck NTAPI 60c2c66affSColin Finck PortClsPower( 61c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 62c2c66affSColin Finck IN PIRP Irp); 63c2c66affSColin Finck 64c2c66affSColin Finck extern 65c2c66affSColin Finck "C" 66c2c66affSColin Finck NTSTATUS 67c2c66affSColin Finck NTAPI 68c2c66affSColin Finck PortClsSysControl( 69c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 70c2c66affSColin Finck IN PIRP Irp); 71c2c66affSColin Finck 72c2c66affSColin Finck NTSTATUS 73c2c66affSColin Finck NewMiniportDMusUART( 74c2c66affSColin Finck OUT PMINIPORT* OutMiniport, 75c2c66affSColin Finck IN REFCLSID ClassId); 76c2c66affSColin Finck 77c2c66affSColin Finck NTSTATUS 78c2c66affSColin Finck NewMiniportFmSynth( 79c2c66affSColin Finck OUT PMINIPORT* OutMiniport, 80c2c66affSColin Finck IN REFCLSID ClassId); 81c2c66affSColin Finck 82c2c66affSColin Finck NTSTATUS 83c2c66affSColin Finck NewPortDMus( 84c2c66affSColin Finck OUT PPORT* OutPort); 85c2c66affSColin Finck 86c2c66affSColin Finck NTSTATUS 87c2c66affSColin Finck NewPortTopology( 88c2c66affSColin Finck OUT PPORT* OutPort); 89c2c66affSColin Finck 90c2c66affSColin Finck NTSTATUS 91c2c66affSColin Finck NewPortWaveCyclic( 92c2c66affSColin Finck OUT PPORT* OutPort); 93c2c66affSColin Finck 94c2c66affSColin Finck NTSTATUS 95c2c66affSColin Finck NewPortWavePci( 96c2c66affSColin Finck OUT PPORT* OutPort); 97c2c66affSColin Finck 98c2c66affSColin Finck NTSTATUS 99c2c66affSColin Finck NewIDrmPort( 100c2c66affSColin Finck OUT PDRMPORT2 *OutPort); 101c2c66affSColin Finck 102c2c66affSColin Finck NTSTATUS 103c2c66affSColin Finck NewPortClsVersion( 104c2c66affSColin Finck OUT PPORTCLSVERSION * OutVersion); 105c2c66affSColin Finck 106c2c66affSColin Finck NTSTATUS 107c2c66affSColin Finck NewPortFilterWaveCyclic( 108c2c66affSColin Finck OUT IPortFilterWaveCyclic ** OutFilter); 109c2c66affSColin Finck 110c2c66affSColin Finck NTSTATUS 111c2c66affSColin Finck NewPortPinWaveCyclic( 112c2c66affSColin Finck OUT IPortPinWaveCyclic ** OutPin); 113c2c66affSColin Finck 114c2c66affSColin Finck NTSTATUS 115c2c66affSColin Finck NewPortFilterWavePci( 116c2c66affSColin Finck OUT IPortFilterWavePci ** OutFilter); 117c2c66affSColin Finck 118c2c66affSColin Finck NTSTATUS 119c2c66affSColin Finck NewPortPinWavePci( 120c2c66affSColin Finck OUT IPortPinWavePci ** OutPin); 121c2c66affSColin Finck 122c2c66affSColin Finck PDEVICE_OBJECT 123c2c66affSColin Finck GetDeviceObjectFromWaveCyclic( 124c2c66affSColin Finck IPortWavePci* iface); 125c2c66affSColin Finck 126c2c66affSColin Finck PDEVICE_OBJECT 127c2c66affSColin Finck GetDeviceObjectFromPortWavePci( 128c2c66affSColin Finck IPortWavePci* iface); 129c2c66affSColin Finck 130c2c66affSColin Finck PMINIPORTWAVEPCI 131c2c66affSColin Finck GetWavePciMiniport( 132c2c66affSColin Finck PPORTWAVEPCI Port); 133c2c66affSColin Finck 134c2c66affSColin Finck 135c2c66affSColin Finck NTSTATUS 136c2c66affSColin Finck NewPortFilterDMus( 137c2c66affSColin Finck OUT PPORTFILTERDMUS * OutFilter); 138c2c66affSColin Finck 139c2c66affSColin Finck 140c2c66affSColin Finck NTSTATUS 141c2c66affSColin Finck NewPortPinDMus( 142c2c66affSColin Finck OUT PPORTPINDMUS * OutPin); 143c2c66affSColin Finck 144c2c66affSColin Finck VOID 145c2c66affSColin Finck GetDMusMiniport( 146c2c66affSColin Finck IN IPortDMus * iface, 147c2c66affSColin Finck IN PMINIPORTDMUS * Miniport, 148c2c66affSColin Finck IN PMINIPORTMIDI * MidiMiniport); 149c2c66affSColin Finck 150c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_VISTA) 151c2c66affSColin Finck 152c2c66affSColin Finck NTSTATUS 153c2c66affSColin Finck NewPortFilterWaveRT( 154c2c66affSColin Finck OUT IPortFilterWaveRT ** OutFilter); 155c2c66affSColin Finck 156c2c66affSColin Finck NTSTATUS 157c2c66affSColin Finck NewPortPinWaveRT( 158c2c66affSColin Finck OUT IPortPinWaveRT ** OutPin); 159c2c66affSColin Finck 160c2c66affSColin Finck PMINIPORTWAVERT 161c2c66affSColin Finck GetWaveRTMiniport( 162c2c66affSColin Finck IN IPortWaveRT* iface); 163c2c66affSColin Finck 164c2c66affSColin Finck PDEVICE_OBJECT 165c2c66affSColin Finck GetDeviceObjectFromPortWaveRT( 166c2c66affSColin Finck IPortWaveRT* iface); 167c2c66affSColin Finck 168c2c66affSColin Finck 169c2c66affSColin Finck NTSTATUS 170c2c66affSColin Finck NewPortWaveRTStream( 171c2c66affSColin Finck PPORTWAVERTSTREAM *OutStream); 172c2c66affSColin Finck 173c2c66affSColin Finck NTSTATUS 174c2c66affSColin Finck NewPortWaveRT( 175c2c66affSColin Finck OUT PPORT* OutPort); 176c2c66affSColin Finck 177c2c66affSColin Finck 178c2c66affSColin Finck #endif 179c2c66affSColin Finck 180c2c66affSColin Finck NTSTATUS 181c2c66affSColin Finck NewPortFilterTopology( 182c2c66affSColin Finck OUT IPortFilterTopology ** OutFilter); 183c2c66affSColin Finck 184c2c66affSColin Finck PMINIPORTTOPOLOGY 185c2c66affSColin Finck GetTopologyMiniport( 186c2c66affSColin Finck PPORTTOPOLOGY Port); 187c2c66affSColin Finck 188c2c66affSColin Finck NTSTATUS 189c2c66affSColin Finck NTAPI 190c2c66affSColin Finck NewDispatchObject( 191c2c66affSColin Finck IN PIRP Irp, 192c2c66affSColin Finck IN IIrpTarget * Target, 193c2c66affSColin Finck IN ULONG ObjectCreateItemCount, 194c2c66affSColin Finck IN PKSOBJECT_CREATE_ITEM ObjectCreateItem); 195c2c66affSColin Finck 196c2c66affSColin Finck PMINIPORTWAVECYCLIC 197c2c66affSColin Finck GetWaveCyclicMiniport( 198c2c66affSColin Finck IN IPortWaveCyclic* iface); 199c2c66affSColin Finck 200c2c66affSColin Finck PVOID 201c2c66affSColin Finck AllocateItem( 202c2c66affSColin Finck IN POOL_TYPE PoolType, 203c2c66affSColin Finck IN SIZE_T NumberOfBytes, 204c2c66affSColin Finck IN ULONG Tag); 205c2c66affSColin Finck 206c2c66affSColin Finck VOID 207c2c66affSColin Finck FreeItem( 208c2c66affSColin Finck IN PVOID Item, 209c2c66affSColin Finck IN ULONG Tag); 210c2c66affSColin Finck 211c2c66affSColin Finck NTSTATUS 212c2c66affSColin Finck NTAPI 213c2c66affSColin Finck NewIrpQueue( 214c2c66affSColin Finck IN IIrpQueue **Queue); 215c2c66affSColin Finck 216c2c66affSColin Finck NTSTATUS 217c2c66affSColin Finck NTAPI 218c2c66affSColin Finck TopologyPropertyHandler( 219c2c66affSColin Finck IN PIRP Irp, 220c2c66affSColin Finck IN PKSIDENTIFIER Request, 221c2c66affSColin Finck IN OUT PVOID Data); 222c2c66affSColin Finck 223c2c66affSColin Finck NTSTATUS 224c2c66affSColin Finck NTAPI 225c2c66affSColin Finck PinPropertyHandler( 226c2c66affSColin Finck IN PIRP Irp, 227c2c66affSColin Finck IN PKSIDENTIFIER Request, 228c2c66affSColin Finck IN OUT PVOID Data); 229c2c66affSColin Finck 230c2c66affSColin Finck extern 231c2c66affSColin Finck "C" 232c2c66affSColin Finck NTSTATUS 233c2c66affSColin Finck NTAPI 234c2c66affSColin Finck PcDmaMasterDescription( 235c2c66affSColin Finck IN PRESOURCELIST ResourceList OPTIONAL, 236c2c66affSColin Finck IN BOOLEAN ScatterGather, 237c2c66affSColin Finck IN BOOLEAN Dma32BitAddresses, 238c2c66affSColin Finck IN BOOLEAN IgnoreCount, 239c2c66affSColin Finck IN BOOLEAN Dma64BitAddresses, 240c2c66affSColin Finck IN DMA_WIDTH DmaWidth, 241c2c66affSColin Finck IN DMA_SPEED DmaSpeed, 242c2c66affSColin Finck IN ULONG MaximumLength, 243c2c66affSColin Finck IN ULONG DmaPort, 244c2c66affSColin Finck OUT PDEVICE_DESCRIPTION DeviceDescription); 245c2c66affSColin Finck 246c2c66affSColin Finck extern 247c2c66affSColin Finck "C" 248c2c66affSColin Finck NTSTATUS 249c2c66affSColin Finck NTAPI 250c2c66affSColin Finck PcDmaSlaveDescription( 251c2c66affSColin Finck IN PRESOURCELIST ResourceList OPTIONAL, 252c2c66affSColin Finck IN ULONG DmaIndex, 253c2c66affSColin Finck IN BOOLEAN DemandMode, 254c2c66affSColin Finck IN BOOLEAN AutoInitialize, 255c2c66affSColin Finck IN DMA_SPEED DmaSpeed, 256c2c66affSColin Finck IN ULONG MaximumLength, 257c2c66affSColin Finck IN ULONG DmaPort, 258c2c66affSColin Finck OUT PDEVICE_DESCRIPTION DeviceDescription); 259c2c66affSColin Finck 260c2c66affSColin Finck extern 261c2c66affSColin Finck "C" 262c2c66affSColin Finck NTSTATUS 263c2c66affSColin Finck NTAPI 264c2c66affSColin Finck PcCreateSubdeviceDescriptor( 265c2c66affSColin Finck OUT SUBDEVICE_DESCRIPTOR ** OutSubdeviceDescriptor, 266c2c66affSColin Finck IN ULONG InterfaceCount, 267c2c66affSColin Finck IN GUID * InterfaceGuids, 268c2c66affSColin Finck IN ULONG IdentifierCount, 269c2c66affSColin Finck IN KSIDENTIFIER *Identifier, 270c2c66affSColin Finck IN ULONG FilterPropertiesCount, 271c2c66affSColin Finck IN KSPROPERTY_SET * FilterProperties, 272c2c66affSColin Finck IN ULONG Unknown1, 273c2c66affSColin Finck IN ULONG Unknown2, 274c2c66affSColin Finck IN ULONG PinPropertiesCount, 275c2c66affSColin Finck IN KSPROPERTY_SET * PinProperties, 276c2c66affSColin Finck IN ULONG EventSetCount, 277c2c66affSColin Finck IN KSEVENT_SET * EventSet, 278c2c66affSColin Finck IN PPCFILTER_DESCRIPTOR FilterDescription); 279c2c66affSColin Finck 280c2c66affSColin Finck extern 281c2c66affSColin Finck "C" 282c2c66affSColin Finck NTSTATUS 283c2c66affSColin Finck NTAPI 284c2c66affSColin Finck PcValidateConnectRequest( 285c2c66affSColin Finck IN PIRP Irp, 286c2c66affSColin Finck IN KSPIN_FACTORY * Descriptor, 287c2c66affSColin Finck OUT PKSPIN_CONNECT* Connect); 288c2c66affSColin Finck 289c2c66affSColin Finck NTSTATUS 290c2c66affSColin Finck NTAPI 291c2c66affSColin Finck PcCreateItemDispatch( 292c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 293c2c66affSColin Finck IN PIRP Irp); 294c2c66affSColin Finck 295c2c66affSColin Finck PDEVICE_OBJECT 296c2c66affSColin Finck GetDeviceObject( 297c2c66affSColin Finck IPortWaveCyclic* iface); 298c2c66affSColin Finck 299c2c66affSColin Finck VOID 300c2c66affSColin Finck NTAPI 301c2c66affSColin Finck PcIoTimerRoutine( 302c2c66affSColin Finck IN PDEVICE_OBJECT DeviceObject, 303c2c66affSColin Finck IN PVOID Context); 304c2c66affSColin Finck 305c2c66affSColin Finck NTSTATUS 306c2c66affSColin Finck NTAPI 307c2c66affSColin Finck NewIUnregisterSubdevice( 308c2c66affSColin Finck OUT PUNREGISTERSUBDEVICE *OutDevice); 309c2c66affSColin Finck 310c2c66affSColin Finck NTSTATUS 311c2c66affSColin Finck NTAPI 312c2c66affSColin Finck NewIUnregisterPhysicalConnection( 313c2c66affSColin Finck OUT PUNREGISTERPHYSICALCONNECTION *OutConnection); 314c2c66affSColin Finck 315c2c66affSColin Finck NTSTATUS 316c2c66affSColin Finck NTAPI 317c2c66affSColin Finck PcHandlePropertyWithTable( 318c2c66affSColin Finck IN PIRP Irp, 319c2c66affSColin Finck IN ULONG PropertySetCount, 320c2c66affSColin Finck IN PKSPROPERTY_SET PropertySet, 321c2c66affSColin Finck IN PSUBDEVICE_DESCRIPTOR Descriptor); 322c2c66affSColin Finck 323c2c66affSColin Finck NTSTATUS 324c2c66affSColin Finck NTAPI 325c2c66affSColin Finck PcHandleEnableEventWithTable( 326c2c66affSColin Finck IN PIRP Irp, 327c2c66affSColin Finck IN PSUBDEVICE_DESCRIPTOR Descriptor); 328c2c66affSColin Finck 329c2c66affSColin Finck NTSTATUS 330c2c66affSColin Finck NTAPI 331c2c66affSColin Finck PcHandleDisableEventWithTable( 332c2c66affSColin Finck IN PIRP Irp, 333c2c66affSColin Finck IN PSUBDEVICE_DESCRIPTOR Descriptor); 334c2c66affSColin Finck 335c2c66affSColin Finck IIrpTarget * 336c2c66affSColin Finck NTAPI 337c2c66affSColin Finck KsoGetIrpTargetFromIrp( 338c2c66affSColin Finck PIRP Irp); 339c2c66affSColin Finck 340c2c66affSColin Finck #define DEFINE_KSPROPERTY_CONNECTIONSET(PinSet,\ 341c2c66affSColin Finck PropStateHandler, PropDataFormatHandler, PropAllocatorFraming)\ 342c2c66affSColin Finck DEFINE_KSPROPERTY_TABLE(PinSet) {\ 343c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(PropStateHandler, PropStateHandler),\ 344c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(PropDataFormatHandler, PropDataFormatHandler),\ 345c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(PropAllocatorFraming)\ 346c2c66affSColin Finck } 347c2c66affSColin Finck 348c2c66affSColin Finck #define DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(GetHandler, SetHandler)\ 349c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM(\ 350c2c66affSColin Finck KSPROPERTY_AUDIO_POSITION,\ 351c2c66affSColin Finck (GetHandler),\ 352c2c66affSColin Finck sizeof(KSPROPERTY),\ 353c2c66affSColin Finck sizeof(KSAUDIO_POSITION),\ 354c2c66affSColin Finck (SetHandler),\ 355c2c66affSColin Finck NULL, 0, NULL, NULL, 0) 356c2c66affSColin Finck 357c2c66affSColin Finck #define DEFINE_KSPROPERTY_AUDIOSET(PinSet,\ 358c2c66affSColin Finck PropPositionHandler)\ 359c2c66affSColin Finck DEFINE_KSPROPERTY_TABLE(PinSet) {\ 360c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\ 361c2c66affSColin Finck } 362c2c66affSColin Finck 363c2c66affSColin Finck 364c2c66affSColin Finck #define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)\ 365c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM(\ 366c2c66affSColin Finck KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,\ 367c2c66affSColin Finck NULL,\ 368c2c66affSColin Finck sizeof(KSPROPERTY),\ 369c2c66affSColin Finck sizeof(ULONG),\ 370c2c66affSColin Finck (SetHandler),\ 371c2c66affSColin Finck NULL, 0, NULL, NULL, 0) 372c2c66affSColin Finck 373c2c66affSColin Finck #define DEFINE_KSPROPERTY_DRMSET(PinSet,\ 374c2c66affSColin Finck PropPositionHandler)\ 375c2c66affSColin Finck DEFINE_KSPROPERTY_TABLE(PinSet) {\ 376c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\ 377c2c66affSColin Finck } 378c2c66affSColin Finck 379c2c66affSColin Finck #define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\ 380c2c66affSColin Finck PropGeneral, PropInstances, PropIntersection)\ 381c2c66affSColin Finck DEFINE_KSPROPERTY_TABLE(PinSet) {\ 382c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\ 383c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\ 384c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\ 385c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\ 386c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\ 387c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\ 388c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\ 389c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\ 390c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(PropGeneral),\ 391c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(PropGeneral),\ 392c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(PropGeneral),\ 393c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\ 394c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\ 395c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral),\ 396c2c66affSColin Finck DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(PropGeneral)\ 397c2c66affSColin Finck } 398c2c66affSColin Finck 399c2c66affSColin Finck typedef struct 400c2c66affSColin Finck { 401c2c66affSColin Finck KSDEVICE_HEADER KsDeviceHeader; 402c2c66affSColin Finck PDEVICE_OBJECT PhysicalDeviceObject; 403c2c66affSColin Finck PDEVICE_OBJECT PrevDeviceObject; 404c2c66affSColin Finck PCPFNSTARTDEVICE StartDevice; 405c2c66affSColin Finck ULONG_PTR Unused[4]; 406c2c66affSColin Finck IAdapterPowerManagement * AdapterPowerManagement; 407c2c66affSColin Finck ULONG MaxSubDevices; 408c2c66affSColin Finck KSOBJECT_CREATE_ITEM * CreateItems; 409c2c66affSColin Finck 410c2c66affSColin Finck IResourceList* resources; 411c2c66affSColin Finck 412c2c66affSColin Finck LIST_ENTRY TimerList; 413c2c66affSColin Finck KSPIN_LOCK TimerListLock; 414c2c66affSColin Finck 415c2c66affSColin Finck DEVICE_POWER_STATE DevicePowerState; 416c2c66affSColin Finck SYSTEM_POWER_STATE SystemPowerState; 417c2c66affSColin Finck 418c2c66affSColin Finck } PCLASS_DEVICE_EXTENSION, *PPCLASS_DEVICE_EXTENSION; 419c2c66affSColin Finck 420c2c66affSColin Finck 421c2c66affSColin Finck typedef struct 422c2c66affSColin Finck { 423c2c66affSColin Finck PVOID Pin; 424c2c66affSColin Finck PIO_WORKITEM WorkItem; 425c2c66affSColin Finck PIRP Irp; 426c2c66affSColin Finck }CLOSESTREAM_CONTEXT, *PCLOSESTREAM_CONTEXT; 427c2c66affSColin Finck 428c2c66affSColin Finck typedef struct 429c2c66affSColin Finck { 430c2c66affSColin Finck LIST_ENTRY Entry; 431c2c66affSColin Finck PIO_TIMER_ROUTINE pTimerRoutine; 432c2c66affSColin Finck PVOID Context; 433c2c66affSColin Finck }TIMER_CONTEXT, *PTIMER_CONTEXT; 434c2c66affSColin Finck 435c2c66affSColin Finck typedef struct 436c2c66affSColin Finck { 437c2c66affSColin Finck KSOBJECT_HEADER ObjectHeader; 438c2c66affSColin Finck IIrpTarget * Target; 439c2c66affSColin Finck PKSOBJECT_CREATE_ITEM CreateItem; 440c2c66affSColin Finck }DISPATCH_CONTEXT, *PDISPATCH_CONTEXT; 441c2c66affSColin Finck 442*6e97b431SVictor Perevertkin template<typename... Interfaces> 443*6e97b431SVictor Perevertkin class CUnknownImpl : public Interfaces... 444*6e97b431SVictor Perevertkin { 445*6e97b431SVictor Perevertkin private: 446*6e97b431SVictor Perevertkin volatile LONG m_Ref; 447*6e97b431SVictor Perevertkin protected: CUnknownImpl()448*6e97b431SVictor Perevertkin CUnknownImpl() : 449*6e97b431SVictor Perevertkin m_Ref(0) 450*6e97b431SVictor Perevertkin { 451*6e97b431SVictor Perevertkin } ~CUnknownImpl()452*6e97b431SVictor Perevertkin virtual ~CUnknownImpl() 453*6e97b431SVictor Perevertkin { 454*6e97b431SVictor Perevertkin } 455*6e97b431SVictor Perevertkin public: AddRef()456*6e97b431SVictor Perevertkin STDMETHODIMP_(ULONG) AddRef() 457*6e97b431SVictor Perevertkin { 458*6e97b431SVictor Perevertkin ULONG Ref = InterlockedIncrement(&m_Ref); 459*6e97b431SVictor Perevertkin ASSERT(Ref < 0x10000); 460*6e97b431SVictor Perevertkin return Ref; 461*6e97b431SVictor Perevertkin } Release()462*6e97b431SVictor Perevertkin STDMETHODIMP_(ULONG) Release() 463*6e97b431SVictor Perevertkin { 464*6e97b431SVictor Perevertkin ULONG Ref = InterlockedDecrement(&m_Ref); 465*6e97b431SVictor Perevertkin ASSERT(Ref < 0x10000); 466*6e97b431SVictor Perevertkin if (!Ref) 467*6e97b431SVictor Perevertkin { 468*6e97b431SVictor Perevertkin delete this; 469*6e97b431SVictor Perevertkin return 0; 470*6e97b431SVictor Perevertkin } 471*6e97b431SVictor Perevertkin return Ref; 472*6e97b431SVictor Perevertkin } 473*6e97b431SVictor Perevertkin }; 474*6e97b431SVictor Perevertkin 475c2c66affSColin Finck #endif /* PORTCLS_PRIVATE_H */ 476