mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
- Register shutdown notification
- Close file objects / handles on shutdown svn path=/trunk/; revision=41157
This commit is contained in:
@@ -59,7 +59,7 @@ FilterPinWorkerRoutine(
|
||||
if (!DeviceEntry->Pins)
|
||||
{
|
||||
/* no memory */
|
||||
DPRINT1("Failed to allocate memory Block %x\n", Count * sizeof(PIN_INFO));
|
||||
DPRINT1("Failed to allocate memory Pins %u Block %x\n", Count, Count * sizeof(PIN_INFO));
|
||||
goto cleanup;
|
||||
}
|
||||
/* clear array */
|
||||
|
||||
@@ -27,6 +27,40 @@ SysAudio_Unload(IN PDRIVER_OBJECT DriverObject)
|
||||
DPRINT("SysAudio_Unload called\n");
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
SysAudio_Shutdown(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PKSAUDIO_DEVICE_ENTRY DeviceEntry;
|
||||
PSYSAUDIODEVEXT DeviceExtension;
|
||||
PLIST_ENTRY Entry;
|
||||
|
||||
DPRINT1("SysAudio_Shutdown called\n");
|
||||
|
||||
DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension;
|
||||
|
||||
while(!IsListEmpty(&DeviceExtension->KsAudioDeviceList))
|
||||
{
|
||||
Entry = RemoveHeadList(&DeviceExtension->KsAudioDeviceList);
|
||||
DeviceEntry = (PKSAUDIO_DEVICE_ENTRY)CONTAINING_RECORD(Entry, KSAUDIO_DEVICE_ENTRY, Entry);
|
||||
|
||||
DPRINT1("Freeing item %wZ\n", &DeviceEntry->DeviceName);
|
||||
RtlFreeUnicodeString(&DeviceEntry->DeviceName);
|
||||
ZwClose(DeviceEntry->Handle);
|
||||
ObDereferenceObject(DeviceEntry->FileObject);
|
||||
ExFreePool(DeviceEntry->Pins);
|
||||
ExFreePool(DeviceEntry);
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
SysAudio_Pnp(
|
||||
@@ -153,6 +187,10 @@ SysAudio_InstallDevice(
|
||||
/* clear initializing flag */
|
||||
DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;
|
||||
|
||||
/* register shutdown notfication */
|
||||
IoRegisterShutdownNotification(DeviceObject);
|
||||
|
||||
|
||||
/* Done */
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
@@ -192,6 +230,7 @@ DriverEntry(
|
||||
|
||||
/* Sysaudio needs to do work on pnp, so handle it */
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = SysAudio_Pnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = SysAudio_Shutdown;
|
||||
|
||||
/* Call our initialization function */
|
||||
return SysAudio_InstallDevice(DriverObject);
|
||||
|
||||
Reference in New Issue
Block a user