1 #ifndef _SYSAUDIO_PCH_ 2 #define _SYSAUDIO_PCH_ 3 4 #include <portcls.h> 5 6 typedef struct 7 { 8 HANDLE PinHandle; // handle to audio irp pin 9 ULONG References; // number of clients having a reference to this audio irp pin 10 }PIN_INFO; 11 12 typedef struct 13 { 14 LIST_ENTRY Entry; // device entry for KsAudioDeviceList 15 UNICODE_STRING DeviceName; // symbolic link of audio device 16 17 HANDLE Handle; // handle to audio device 18 PFILE_OBJECT FileObject; // file objecto to audio device 19 20 //PIN_INFO * Pins; // array of PIN_INFO 21 }KSAUDIO_DEVICE_ENTRY, *PKSAUDIO_DEVICE_ENTRY; 22 23 typedef struct 24 { 25 KSDEVICE_HEADER KsDeviceHeader; // ks streaming header - must always be first item in device extension 26 PDEVICE_OBJECT PhysicalDeviceObject; // pdo 27 PDEVICE_OBJECT NextDeviceObject; // lower device object 28 ULONG NumberOfKsAudioDevices; // number of audio devices 29 30 LIST_ENTRY KsAudioDeviceList; // audio device list 31 PVOID KsAudioNotificationEntry; // ks audio notification hook 32 PVOID EchoCancelNotificationEntry; // ks echo cancel notification hook 33 KSPIN_LOCK Lock; // audio device list mutex 34 35 PFILE_OBJECT KMixerFileObject; // mixer file object 36 HANDLE KMixerHandle; // mixer file handle 37 38 }SYSAUDIODEVEXT, *PSYSAUDIODEVEXT; 39 40 // struct DISPATCH_CONTEXT 41 // 42 // This structure is used to dispatch read / write / device io requests 43 // It is stored in the file object FsContext2 member 44 // Note: FsContext member is reserved for ks object header 45 46 typedef struct 47 { 48 KSOBJECT_HEADER ObjectHeader; // pin object header 49 HANDLE Handle; // audio irp pin handle 50 ULONG PinId; // pin id of device 51 PKSAUDIO_DEVICE_ENTRY AudioEntry; // pointer to audio device entry 52 53 HANDLE hMixerPin; // handle to mixer pin 54 }DISPATCH_CONTEXT, *PDISPATCH_CONTEXT; 55 56 NTSTATUS 57 SysAudioAllocateDeviceHeader( 58 IN SYSAUDIODEVEXT *DeviceExtension); 59 60 NTSTATUS 61 SysAudioRegisterDeviceInterfaces( 62 IN PDEVICE_OBJECT DeviceObject); 63 64 NTSTATUS 65 SysAudioRegisterNotifications( 66 IN PDRIVER_OBJECT DriverObject, 67 IN PDEVICE_OBJECT DeviceObject); 68 69 NTSTATUS 70 SysAudioHandleProperty( 71 PDEVICE_OBJECT DeviceObject, 72 PIRP Irp); 73 74 NTSTATUS 75 SysAudioOpenKMixer( 76 IN SYSAUDIODEVEXT *DeviceExtension); 77 78 NTSTATUS 79 OpenDevice( 80 IN PUNICODE_STRING DeviceName, 81 IN PHANDLE HandleOut, 82 IN PFILE_OBJECT * FileObjectOut); 83 84 PKSAUDIO_DEVICE_ENTRY 85 GetListEntry( 86 IN PLIST_ENTRY Head, 87 IN ULONG Index); 88 89 NTSTATUS 90 NTAPI 91 DispatchCreateSysAudioPin( 92 IN PDEVICE_OBJECT DeviceObject, 93 IN PIRP Irp); 94 95 ULONG 96 GetDeviceCount( 97 PSYSAUDIODEVEXT DeviceExtension, 98 BOOL WaveIn); 99 100 NTSTATUS 101 GetPinInstanceCount( 102 PKSAUDIO_DEVICE_ENTRY Entry, 103 PKSPIN_CINSTANCES PinInstances, 104 PKSPIN_CONNECT PinConnect); 105 106 NTSTATUS 107 ComputeCompatibleFormat( 108 IN PKSAUDIO_DEVICE_ENTRY Entry, 109 IN ULONG PinId, 110 IN PKSDATAFORMAT_WAVEFORMATEX ClientFormat, 111 OUT PKSDATAFORMAT_WAVEFORMATEX MixerFormat); 112 113 PVOID 114 AllocateItem( 115 IN POOL_TYPE PoolType, 116 IN SIZE_T NumberOfBytes); 117 118 VOID 119 FreeItem( 120 IN PVOID Item); 121 122 #endif /* _SYSAUDIO_PCH_ */ 123