2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2009-01-26 10:08:17 +00:00
|
|
|
|
2009-04-03 17:06:16 +00:00
|
|
|
#include <ntifs.h>
|
|
|
|
#include <ntddk.h>
|
|
|
|
#include <portcls.h>
|
|
|
|
#include <ks.h>
|
|
|
|
#include <ksmedia.h>
|
|
|
|
#include <math.h>
|
2009-06-07 18:24:50 +00:00
|
|
|
#define NDEBUG
|
2009-04-03 17:06:16 +00:00
|
|
|
#include <debug.h>
|
2009-06-07 18:22:24 +00:00
|
|
|
#include <stdio.h>
|
2009-04-03 17:06:16 +00:00
|
|
|
|
2009-02-22 18:58:51 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-03-25 19:14:04 +00:00
|
|
|
HANDLE PinHandle; // handle to audio irp pin
|
|
|
|
ULONG References; // number of clients having a reference to this audio irp pin
|
2009-02-22 18:58:51 +00:00
|
|
|
}PIN_INFO;
|
|
|
|
|
2009-06-07 18:22:24 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-07-10 15:14:56 +00:00
|
|
|
LIST_ENTRY Entry; // device entry for KsAudioDeviceList
|
|
|
|
UNICODE_STRING DeviceName; // symbolic link of audio device
|
2009-06-07 18:22:24 +00:00
|
|
|
|
2009-09-12 14:35:27 +00:00
|
|
|
HANDLE Handle; // handle to audio device
|
|
|
|
PFILE_OBJECT FileObject; // file objecto to audio device
|
2009-06-07 18:22:24 +00:00
|
|
|
|
2010-05-15 19:05:58 +00:00
|
|
|
//PIN_INFO * Pins; // array of PIN_INFO
|
2009-02-10 16:28:24 +00:00
|
|
|
}KSAUDIO_DEVICE_ENTRY, *PKSAUDIO_DEVICE_ENTRY;
|
2009-01-26 10:08:17 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-03-25 19:14:04 +00:00
|
|
|
KSDEVICE_HEADER KsDeviceHeader; // ks streaming header - must always be first item in device extension
|
|
|
|
PDEVICE_OBJECT PhysicalDeviceObject; // pdo
|
|
|
|
PDEVICE_OBJECT NextDeviceObject; // lower device object
|
|
|
|
ULONG NumberOfKsAudioDevices; // number of audio devices
|
2009-02-20 17:52:47 +00:00
|
|
|
|
2009-03-25 19:14:04 +00:00
|
|
|
LIST_ENTRY KsAudioDeviceList; // audio device list
|
|
|
|
PVOID KsAudioNotificationEntry; // ks audio notification hook
|
|
|
|
PVOID EchoCancelNotificationEntry; // ks echo cancel notification hook
|
2009-04-22 10:57:28 +00:00
|
|
|
KSPIN_LOCK Lock; // audio device list mutex
|
2009-03-11 09:30:33 +00:00
|
|
|
|
2009-03-25 19:14:04 +00:00
|
|
|
PFILE_OBJECT KMixerFileObject; // mixer file object
|
|
|
|
HANDLE KMixerHandle; // mixer file handle
|
2009-03-11 09:30:33 +00:00
|
|
|
|
2009-02-20 17:52:47 +00:00
|
|
|
}SYSAUDIODEVEXT, *PSYSAUDIODEVEXT;
|
|
|
|
|
2009-03-25 19:14:04 +00:00
|
|
|
// struct DISPATCH_CONTEXT
|
|
|
|
//
|
|
|
|
// This structure is used to dispatch read / write / device io requests
|
|
|
|
// It is stored in the file object FsContext2 member
|
|
|
|
// Note: FsContext member is reserved for ks object header
|
|
|
|
|
2009-02-21 20:18:44 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-09-12 14:35:27 +00:00
|
|
|
KSOBJECT_HEADER ObjectHeader; // pin object header
|
2009-03-25 19:14:04 +00:00
|
|
|
HANDLE Handle; // audio irp pin handle
|
|
|
|
ULONG PinId; // pin id of device
|
2009-07-10 15:14:56 +00:00
|
|
|
PKSAUDIO_DEVICE_ENTRY AudioEntry; // pointer to audio device entry
|
2009-02-21 20:18:44 +00:00
|
|
|
|
2009-03-25 19:14:04 +00:00
|
|
|
HANDLE hMixerPin; // handle to mixer pin
|
2009-02-22 18:58:51 +00:00
|
|
|
}DISPATCH_CONTEXT, *PDISPATCH_CONTEXT;
|
2009-02-21 20:18:44 +00:00
|
|
|
|
2009-02-20 17:52:47 +00:00
|
|
|
NTSTATUS
|
|
|
|
SysAudioAllocateDeviceHeader(
|
|
|
|
IN SYSAUDIODEVEXT *DeviceExtension);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
SysAudioRegisterDeviceInterfaces(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
SysAudioRegisterNotifications(
|
2009-02-27 11:22:16 +00:00
|
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
|
|
IN PDEVICE_OBJECT DeviceObject);
|
2009-02-20 17:52:47 +00:00
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
SysAudioHandleProperty(
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PIRP Irp);
|
2009-01-26 10:08:17 +00:00
|
|
|
|
2009-03-11 09:30:33 +00:00
|
|
|
NTSTATUS
|
|
|
|
SysAudioOpenKMixer(
|
|
|
|
IN SYSAUDIODEVEXT *DeviceExtension);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
OpenDevice(
|
|
|
|
IN PUNICODE_STRING DeviceName,
|
|
|
|
IN PHANDLE HandleOut,
|
|
|
|
IN PFILE_OBJECT * FileObjectOut);
|
|
|
|
|
2009-07-10 15:14:56 +00:00
|
|
|
PKSAUDIO_DEVICE_ENTRY
|
2009-02-21 20:18:44 +00:00
|
|
|
GetListEntry(
|
|
|
|
IN PLIST_ENTRY Head,
|
|
|
|
IN ULONG Index);
|
|
|
|
|
|
|
|
NTSTATUS
|
2009-08-10 07:14:04 +00:00
|
|
|
NTAPI
|
|
|
|
DispatchCreateSysAudioPin(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
2009-02-21 20:18:44 +00:00
|
|
|
|
2009-02-27 11:22:16 +00:00
|
|
|
ULONG
|
|
|
|
GetDeviceCount(
|
|
|
|
PSYSAUDIODEVEXT DeviceExtension,
|
|
|
|
BOOL WaveIn);
|
|
|
|
|
2009-08-10 07:14:04 +00:00
|
|
|
NTSTATUS
|
|
|
|
GetPinInstanceCount(
|
|
|
|
PKSAUDIO_DEVICE_ENTRY Entry,
|
|
|
|
PKSPIN_CINSTANCES PinInstances,
|
|
|
|
PKSPIN_CONNECT PinConnect);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
ComputeCompatibleFormat(
|
|
|
|
IN PKSAUDIO_DEVICE_ENTRY Entry,
|
|
|
|
IN ULONG PinId,
|
|
|
|
IN PKSDATAFORMAT_WAVEFORMATEX ClientFormat,
|
|
|
|
OUT PKSDATAFORMAT_WAVEFORMATEX MixerFormat);
|
2010-06-19 07:26:20 +00:00
|
|
|
|
|
|
|
PVOID
|
|
|
|
AllocateItem(
|
|
|
|
IN POOL_TYPE PoolType,
|
|
|
|
IN SIZE_T NumberOfBytes);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FreeItem(
|
|
|
|
IN PVOID Item);
|
|
|
|
|