mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
- Implement initializing routines for wdmaud
- Register plug&play notification routines for guid KSCATEGORY_SYSAUDIO svn path=/trunk/; revision=39158
This commit is contained in:
parent
a565c5b364
commit
04a9e81b9e
3 changed files with 204 additions and 35 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE group SYSTEM "../../../../tools/rbuild/project.dtd">
|
<!DOCTYPE group SYSTEM "../../../../tools/rbuild/project.dtd">
|
||||||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<!--directory name="wdmaud">
|
<directory name="wdmaud">
|
||||||
<xi:include href="wdmaud/wdmaud.rbuild" />
|
<xi:include href="wdmaud/wdmaud.rbuild" />
|
||||||
</directory-->
|
</directory>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -1,59 +1,228 @@
|
||||||
/*
|
/*
|
||||||
This doesn't do much yet...
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
*/
|
* PROJECT: ReactOS Kernel Streaming
|
||||||
|
* FILE: drivers/wdm/audio/legacy/wdmaud/main.c
|
||||||
|
* PURPOSE: System Audio graph builder
|
||||||
|
* PROGRAMMER: Andrew Greenwood
|
||||||
|
* Johannes Anderwald
|
||||||
|
*/
|
||||||
|
#include "wdmaud.h"
|
||||||
|
|
||||||
#include <debug.h>
|
const GUID KSCATEGORY_SYSAUDIO = {0xA7C7A5B1L, 0x5AF3, 0x11D1, {0x9C, 0xED, 0x00, 0xA0, 0x24, 0xBF, 0x04, 0x07}};
|
||||||
|
|
||||||
#define InPassiveIrql() \
|
NTSTATUS
|
||||||
(KeGetCurrentIrql() == IRQL_PASSIVE_LEVEL)
|
NTAPI
|
||||||
|
WdmAudAddDevice(
|
||||||
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
NTSTATUS AudioDeviceControl(
|
IN PDEVICE_OBJECT PhysicalDeviceObject)
|
||||||
IN PDEVICE_OBJECT device,
|
|
||||||
IN PIRP irp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return STATUS_SUCCESS;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
}
|
PDEVICE_OBJECT NextDeviceObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DPRINT("WdmAudAddDevice called\n");
|
||||||
|
|
||||||
NTSTATUS AudioAddDevice(
|
Status = IoCreateDevice(DriverObject,
|
||||||
IN PDRIVER_OBJECT driver,
|
sizeof(WDMAUD_DEVICE_EXTENSION),
|
||||||
IN PDEVICE_OBJECT device
|
NULL,
|
||||||
)
|
FILE_DEVICE_KS,
|
||||||
{
|
0,
|
||||||
DPRINT("AudioAddDevice called\n");
|
FALSE,
|
||||||
|
&DeviceObject);
|
||||||
|
|
||||||
if ( ! IsPassiveIrql() )
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* What do we do?! */
|
DPRINT1("IoCreateDevice failed with %x\n", Status);
|
||||||
/* RtlAssert("FAIL", __FILE__, __LINE__, "?" */
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
RtlZeroMemory(DeviceExtension, sizeof(WDMAUD_DEVICE_EXTENSION));
|
||||||
|
|
||||||
|
Status = KsAllocateDeviceHeader(&DeviceExtension->DeviceHeader, 0, NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("KsAllocateDeviceHeader failed with %x\n", Status);
|
||||||
|
IoDeleteDevice(DeviceObject);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject, PhysicalDeviceObject);
|
||||||
|
if (NextDeviceObject)
|
||||||
|
{
|
||||||
|
/// FIXME
|
||||||
|
/// KsSetDevicePnpAndBaseObject((KSDEVICE_HEADER)DeviceObject->DeviceExtension, NextDeviceObject, DeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE;
|
||||||
|
DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID AudioUnload(
|
VOID
|
||||||
IN PDRIVER_OBJECT driver
|
NTAPI
|
||||||
)
|
WdmAudUnload(
|
||||||
|
IN PDRIVER_OBJECT driver)
|
||||||
{
|
{
|
||||||
DPRINT("AudioUnload called\n");
|
DPRINT("WdmAudUnload called\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
WdmAudPnp(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
PIO_STACK_LOCATION IrpStack;
|
||||||
|
|
||||||
|
DPRINT("WdmAudPnp called\n");
|
||||||
|
|
||||||
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
if (IrpStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE)
|
||||||
|
{
|
||||||
|
Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
|
||||||
|
return KsDefaultDispatchPnp(DeviceObject, Irp);
|
||||||
|
}
|
||||||
|
return KsDefaultDispatchPnp(DeviceObject, Irp);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
DeviceInterfaceChangeCallback(
|
||||||
|
IN PVOID NotificationStructure,
|
||||||
|
IN PVOID Context)
|
||||||
|
{
|
||||||
|
DEVICE_INTERFACE_CHANGE_NOTIFICATION * Event = (DEVICE_INTERFACE_CHANGE_NOTIFICATION*)NotificationStructure;
|
||||||
|
|
||||||
|
DPRINT1("DeviceInterfaceChangeCallback called %p\n", Event);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
WdmAudCreate(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DPRINT1("WdmAudCreate\n");
|
||||||
|
|
||||||
|
|
||||||
|
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
Status = KsReferenceSoftwareBusObject((KSDEVICE_HEADER)DeviceObject->DeviceExtension);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("KsReferenceSoftwareBusObject failed with %x\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
|
||||||
|
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,
|
||||||
|
(PVOID)&KSCATEGORY_SYSAUDIO,
|
||||||
|
DeviceObject->DriverObject,
|
||||||
|
DeviceInterfaceChangeCallback,
|
||||||
|
(PVOID)DeviceExtension,
|
||||||
|
&DeviceExtension->SysAudioNotification);
|
||||||
|
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
WdmAudClose(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DPRINT1("WdmAudClose\n");
|
||||||
|
|
||||||
|
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
Status = KsDereferenceSoftwareBusObject(DeviceExtension->DeviceHeader);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
Status = IoUnregisterPlugPlayNotification(DeviceExtension->SysAudioNotification);
|
||||||
|
}
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
WdmAudDeviceControl(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
WdmAudCleanup(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
DriverEntry(
|
DriverEntry(
|
||||||
IN PDRIVER_OBJECT driver,
|
IN PDRIVER_OBJECT Driver,
|
||||||
IN PUNICODE_STRING registry_path
|
IN PUNICODE_STRING Registry_path
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DPRINT("Wdmaud.sys loaded\n");
|
DPRINT("Wdmaud.sys loaded\n");
|
||||||
|
|
||||||
driver->DriverExtension->AddDevice = AudioAddDevice;
|
Driver->DriverExtension->AddDevice = WdmAudAddDevice;
|
||||||
driver->DriverUnload = AudioUnload;
|
Driver->DriverUnload = WdmAudUnload;
|
||||||
|
|
||||||
|
|
||||||
|
Driver->MajorFunction[IRP_MJ_CREATE] = WdmAudCreate;
|
||||||
|
Driver->MajorFunction[IRP_MJ_CLOSE] = WdmAudClose;
|
||||||
|
Driver->MajorFunction[IRP_MJ_PNP] = WdmAudPnp;
|
||||||
|
Driver->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = KsDefaultForwardIrp;
|
||||||
|
Driver->MajorFunction[IRP_MJ_CLEANUP] = WdmAudCleanup;
|
||||||
|
Driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = WdmAudDeviceControl;
|
||||||
|
Driver->MajorFunction[IRP_MJ_POWER] = KsDefaultDispatchPower;
|
||||||
|
|
||||||
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AudioDeviceControl;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../../../tools/rbuild/project.dtd">
|
||||||
<module name="wdmaud_kernel" type="kernelmodedriver" installbase="system32/drivers" installname="wdmaud.sys">
|
<module name="wdmaud_kernel" type="kernelmodedriver" installbase="system32/drivers" installname="wdmaud.sys">
|
||||||
<include base="wdmaud">.</include>
|
<include base="wdmaud_kernel">.</include>
|
||||||
<include base="wdmaud">..</include>
|
|
||||||
<library>ntoskrnl</library>
|
<library>ntoskrnl</library>
|
||||||
|
<library>ks</library>
|
||||||
<file>entry.c</file>
|
<file>entry.c</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
Loading…
Reference in a new issue