[HDAUDBUS] Implement HDA_Unload. Stub HDA_Power and HDA_SystemControl.

This commit is contained in:
Thomas Faber 2019-02-24 12:29:34 +01:00
parent 25b22131ca
commit a8414f665b
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -8,7 +8,10 @@
#include "hdaudbus.h" #include "hdaudbus.h"
DRIVER_DISPATCH HDA_Pnp; DRIVER_DISPATCH HDA_Pnp;
DRIVER_DISPATCH HDA_SystemControl;
DRIVER_DISPATCH HDA_Power;
DRIVER_ADD_DEVICE HDA_AddDevice; DRIVER_ADD_DEVICE HDA_AddDevice;
DRIVER_UNLOAD HDA_Unload;
extern "C" DRIVER_INITIALIZE DriverEntry; extern "C" DRIVER_INITIALIZE DriverEntry;
PVOID PVOID
@ -206,6 +209,55 @@ HDA_Pnp(
} }
} }
NTSTATUS
NTAPI
HDA_SystemControl(
_In_ PDEVICE_OBJECT DeviceObject,
_Inout_ PIRP Irp)
{
NTSTATUS Status;
PHDA_FDO_DEVICE_EXTENSION FDODeviceExtension;
FDODeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension);
if (FDODeviceExtension->IsFDO)
{
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FDODeviceExtension->LowerDevice, Irp);
}
else
{
Status = Irp->IoStatus.Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
}
NTSTATUS
NTAPI
HDA_Power(
_In_ PDEVICE_OBJECT DeviceObject,
_Inout_ PIRP Irp)
{
NTSTATUS Status;
PHDA_FDO_DEVICE_EXTENSION FDODeviceExtension;
FDODeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension);
if (FDODeviceExtension->IsFDO)
{
PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocation(Irp);
return PoCallDriver(FDODeviceExtension->LowerDevice, Irp);
}
else
{
Status = Irp->IoStatus.Status;
PoStartNextPowerIrp(Irp);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
}
NTSTATUS NTSTATUS
NTAPI NTAPI
@ -238,6 +290,14 @@ HDA_AddDevice(
return Status; return Status;
} }
VOID
NTAPI
HDA_Unload(
_In_ PDRIVER_OBJECT DriverObject)
{
}
extern "C" extern "C"
{ {
NTSTATUS NTSTATUS
@ -246,7 +306,10 @@ DriverEntry(
_In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPathName) _In_ PUNICODE_STRING RegistryPathName)
{ {
DriverObject->DriverUnload = HDA_Unload;
DriverObject->DriverExtension->AddDevice = HDA_AddDevice; DriverObject->DriverExtension->AddDevice = HDA_AddDevice;
DriverObject->MajorFunction[IRP_MJ_POWER] = HDA_Power;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HDA_SystemControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = HDA_Pnp; DriverObject->MajorFunction[IRP_MJ_PNP] = HDA_Pnp;
return STATUS_SUCCESS; return STATUS_SUCCESS;