- Silence a few debug prints

- Fix memory leaks on failure

svn path=/trunk/; revision=40596
This commit is contained in:
Johannes Anderwald 2009-04-19 22:01:57 +00:00
parent ae4881eaf5
commit 39affd9197
5 changed files with 40 additions and 30 deletions

View file

@ -122,7 +122,7 @@ SetMixerInputOutputFormat(
/* set the input format */ /* set the input format */
PinRequest.PinId = 0; PinRequest.PinId = 0;
//DPRINT1("InputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", InputFormat, InputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX)); DPRINT("InputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", InputFormat, InputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY,
(PVOID)&PinRequest, (PVOID)&PinRequest,
sizeof(KSP_PIN), sizeof(KSP_PIN),
@ -134,7 +134,7 @@ SetMixerInputOutputFormat(
/* set the the output format */ /* set the the output format */
PinRequest.PinId = 1; PinRequest.PinId = 1;
//DPRINT1("OutputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", OutputFormat, OutputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX)); DPRINT("OutputFormat %p Size %u WaveFormatSize %u DataFormat %u WaveEx %u\n", OutputFormat, OutputFormat->FormatSize, sizeof(KSDATAFORMAT_WAVEFORMATEX), sizeof(KSDATAFORMAT), sizeof(WAVEFORMATEX));
Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY,
(PVOID)&PinRequest, (PVOID)&PinRequest,
sizeof(KSP_PIN), sizeof(KSP_PIN),

View file

@ -41,12 +41,18 @@ FilterPinWorkerRoutine(
Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PropertyRequest, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned); Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PropertyRequest, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ObDereferenceObject(DeviceEntry->FileObject);
ZwClose(DeviceEntry->Handle);
ExFreePool(DeviceEntry->DeviceName.Buffer);
ExFreePool(DeviceEntry); ExFreePool(DeviceEntry);
return; return;
} }
if (!Count) if (!Count)
{ {
ObDereferenceObject(DeviceEntry->FileObject);
ZwClose(DeviceEntry->Handle);
ExFreePool(DeviceEntry->DeviceName.Buffer);
ExFreePool(DeviceEntry); ExFreePool(DeviceEntry);
return; return;
} }
@ -56,6 +62,9 @@ FilterPinWorkerRoutine(
if (!DeviceEntry->Pins) if (!DeviceEntry->Pins)
{ {
/* no memory */ /* no memory */
ObDereferenceObject(DeviceEntry->FileObject);
ZwClose(DeviceEntry->Handle);
ExFreePool(DeviceEntry->DeviceName.Buffer);
ExFreePool(DeviceEntry); ExFreePool(DeviceEntry);
return; return;
} }
@ -101,7 +110,7 @@ FilterPinWorkerRoutine(
} }
DPRINT1("Num Pins %u Num WaveIn Pins %u Name WaveOut Pins %u\n", DeviceEntry->NumberOfPins, DeviceEntry->NumWaveInPin, DeviceEntry->NumWaveOutPin); DPRINT("Num Pins %u Num WaveIn Pins %u Name WaveOut Pins %u\n", DeviceEntry->NumberOfPins, DeviceEntry->NumWaveInPin, DeviceEntry->NumWaveOutPin);
DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension; DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension;
@ -139,7 +148,7 @@ OpenDevice(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("ZwCreateFile failed with %x\n", Status); DPRINT("ZwCreateFile failed with %x\n", Status);
return Status; return Status;
} }
@ -147,7 +156,7 @@ OpenDevice(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ZwClose(NodeHandle); ZwClose(NodeHandle);
DPRINT1("ObReferenceObjectByHandle failed with %x\n", Status); DPRINT("ObReferenceObjectByHandle failed with %x\n", Status);
return Status; return Status;
} }
@ -210,12 +219,13 @@ DeviceInterfaceChangeCallback(
Status = OpenDevice(&DeviceEntry->DeviceName, &DeviceEntry->Handle, &DeviceEntry->FileObject); Status = OpenDevice(&DeviceEntry->DeviceName, &DeviceEntry->Handle, &DeviceEntry->FileObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("ZwCreateFile failed with %x\n", Status); DPRINT("ZwCreateFile failed with %x\n", Status);
ExFreePool(DeviceEntry->DeviceName.Buffer);
ExFreePool(DeviceEntry); ExFreePool(DeviceEntry);
return Status; return Status;
} }
DPRINT1("Successfully opened audio device %u handle %p file object %p device object %p\n", DeviceExtension->NumberOfKsAudioDevices, DeviceEntry->Handle, DeviceEntry->FileObject, DeviceEntry->FileObject->DeviceObject); DPRINT("Successfully opened audio device %u handle %p file object %p device object %p\n", DeviceExtension->NumberOfKsAudioDevices, DeviceEntry->Handle, DeviceEntry->FileObject, DeviceEntry->FileObject->DeviceObject);
//FIXME //FIXME
// mutal exclusion // mutal exclusion
@ -224,7 +234,7 @@ DeviceInterfaceChangeCallback(
} }
else else
{ {
DPRINT1("Remove interface to audio device!\n"); DPRINT("Remove interface to audio device!\n");
UNIMPLEMENTED UNIMPLEMENTED
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -250,7 +260,7 @@ SysAudioRegisterNotifications(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("IoRegisterPlugPlayNotification failed with %x\n", Status); DPRINT("IoRegisterPlugPlayNotification failed with %x\n", Status);
} }
Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
@ -264,7 +274,7 @@ SysAudioRegisterNotifications(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* ignore failure for now */ /* ignore failure for now */
DPRINT1("IoRegisterPlugPlayNotification failed for DMOCATEGORY_ACOUSTIC_ECHO_CANCEL\n", Status); DPRINT("IoRegisterPlugPlayNotification failed for DMOCATEGORY_ACOUSTIC_ECHO_CANCEL\n", Status);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -287,7 +297,7 @@ SysAudioRegisterDeviceInterfaces(
} }
else else
{ {
DPRINT1("Failed to register KSCATEGORY_PREFERRED_MIDIOUT_DEVICE interface Status %x\n", Status); DPRINT("Failed to register KSCATEGORY_PREFERRED_MIDIOUT_DEVICE interface Status %x\n", Status);
return Status; return Status;
} }
@ -299,7 +309,7 @@ SysAudioRegisterDeviceInterfaces(
} }
else else
{ {
DPRINT1("Failed to register KSCATEGORY_PREFERRED_WAVEIN_DEVICE interface Status %x\n", Status); DPRINT("Failed to register KSCATEGORY_PREFERRED_WAVEIN_DEVICE interface Status %x\n", Status);
return Status; return Status;
} }
@ -311,7 +321,7 @@ SysAudioRegisterDeviceInterfaces(
} }
else else
{ {
DPRINT1("Failed to register KSCATEGORY_PREFERRED_WAVEOUT_DEVICE interface Status %x\n", Status); DPRINT("Failed to register KSCATEGORY_PREFERRED_WAVEOUT_DEVICE interface Status %x\n", Status);
} }
Status = IoRegisterDeviceInterface(DeviceObject, &KSCATEGORY_SYSAUDIO, NULL, &SymbolicLink); Status = IoRegisterDeviceInterface(DeviceObject, &KSCATEGORY_SYSAUDIO, NULL, &SymbolicLink);
@ -322,7 +332,7 @@ SysAudioRegisterDeviceInterfaces(
} }
else else
{ {
DPRINT1("Failed to register KSCATEGORY_SYSAUDIO interface Status %x\n", Status); DPRINT("Failed to register KSCATEGORY_SYSAUDIO interface Status %x\n", Status);
} }
return Status; return Status;

View file

@ -128,7 +128,7 @@ Dispatch_fnClose(
ExFreePool(DispatchContext); ExFreePool(DispatchContext);
//DPRINT1("Index %u DeviceIndex %u Pin %u References %u\n", Index, Client->Devs[Index].DeviceId, SubIndex, Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References); DPRINT("Index %u DeviceIndex %u Pin %u References %u\n", Index, Client->Devs[Index].DeviceId, SubIndex, Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References);
if (!Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References) if (!Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].References)
{ {
DPRINT("Closing pin %p\n", Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].PinHandle); DPRINT("Closing pin %p\n", Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].PinHandle);
@ -159,7 +159,7 @@ Dispatch_fnQuerySecurity(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PIRP Irp) PIRP Irp)
{ {
DPRINT1("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
@ -174,7 +174,7 @@ Dispatch_fnSetSecurity(
PIRP Irp) PIRP Irp)
{ {
DPRINT1("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
@ -195,7 +195,7 @@ Dispatch_fnFastDeviceIoControl(
PIO_STATUS_BLOCK IoStatus, PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
DPRINT1("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
return FALSE; return FALSE;
@ -214,7 +214,7 @@ Dispatch_fnFastRead(
PIO_STATUS_BLOCK IoStatus, PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
DPRINT1("Dispatch_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Dispatch_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
return FALSE; return FALSE;
@ -232,7 +232,7 @@ Dispatch_fnFastWrite(
PIO_STATUS_BLOCK IoStatus, PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
DPRINT1("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
return FALSE; return FALSE;
} }
@ -353,7 +353,7 @@ DispatchCreateSysAudio(
/* allocate object header */ /* allocate object header */
Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable); Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable);
DPRINT1("KsAllocateObjectHeader result %x\n", Status); DPRINT("KsAllocateObjectHeader result %x\n", Status);
/* complete the irp */ /* complete the irp */
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = Status; Irp->IoStatus.Status = Status;

View file

@ -24,7 +24,7 @@ VOID
NTAPI NTAPI
SysAudio_Unload(IN PDRIVER_OBJECT DriverObject) SysAudio_Unload(IN PDRIVER_OBJECT DriverObject)
{ {
DPRINT1("SysAudio_Unload called\n"); DPRINT("SysAudio_Unload called\n");
} }
NTSTATUS NTSTATUS
@ -79,7 +79,7 @@ SysAudio_InstallDevice(
SYSAUDIODEVEXT *DeviceExtension; SYSAUDIODEVEXT *DeviceExtension;
DPRINT1("SysAudio_InstallDevice called\n"); DPRINT("SysAudio_InstallDevice called\n");
/* Create the device */ /* Create the device */
Status = IoCreateDevice(DriverObject, Status = IoCreateDevice(DriverObject,
@ -191,7 +191,7 @@ DriverEntry(
IN PDRIVER_OBJECT DriverObject, IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath) IN PUNICODE_STRING RegistryPath)
{ {
DPRINT1("System audio graph builder (sysaudio) started\n"); DPRINT("System audio graph builder (sysaudio) started\n");
/* Let ks handle these */ /* Let ks handle these */
KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CREATE); KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CREATE);

View file

@ -206,7 +206,7 @@ Pin_fnClose(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PIRP Irp) PIRP Irp)
{ {
DPRINT1("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject);
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
@ -220,7 +220,7 @@ Pin_fnQuerySecurity(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,
PIRP Irp) PIRP Irp)
{ {
DPRINT1("Pin_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
@ -235,7 +235,7 @@ Pin_fnSetSecurity(
PIRP Irp) PIRP Irp)
{ {
DPRINT1("Pin_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
@ -256,7 +256,7 @@ Pin_fnFastDeviceIoControl(
PIO_STATUS_BLOCK IoStatus, PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
DPRINT1("Pin_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject);
return FALSE; return FALSE;
@ -275,7 +275,7 @@ Pin_fnFastRead(
PIO_STATUS_BLOCK IoStatus, PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
DPRINT1("Pin_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject);
return FALSE; return FALSE;
@ -296,7 +296,7 @@ Pin_fnFastWrite(
PDISPATCH_CONTEXT Context; PDISPATCH_CONTEXT Context;
NTSTATUS Status; NTSTATUS Status;
//DPRINT1("Pin_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject); DPRINT("Pin_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
Context = (PDISPATCH_CONTEXT)FileObject->FsContext2; Context = (PDISPATCH_CONTEXT)FileObject->FsContext2;