Author: janderwald
Date: Mon Apr 20 02:01:57 2009
New Revision: 40596

URL: http://svn.reactos.org/svn/reactos?rev=40596&view=rev
Log:
- Silence a few debug prints
- Fix memory leaks on failure

Modified:
    trunk/reactos/drivers/wdm/audio/sysaudio/control.c
    trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c
    trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c
    trunk/reactos/drivers/wdm/audio/sysaudio/main.c
    trunk/reactos/drivers/wdm/audio/sysaudio/pin.c

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/control.c?rev=40596&r1=40595&r2=40596&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Mon Apr 20 
02:01:57 2009
@@ -122,7 +122,7 @@
 
     /* set the input format */
     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,
                                           (PVOID)&PinRequest,
                                            sizeof(KSP_PIN),
@@ -134,7 +134,7 @@
 
     /* set the the output format */
     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,
                                           (PVOID)&PinRequest,
                                            sizeof(KSP_PIN),

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c?rev=40596&r1=40595&r2=40596&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/deviface.c [iso-8859-1] Mon Apr 20 
02:01:57 2009
@@ -41,12 +41,18 @@
     Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, 
IOCTL_KS_PROPERTY, (PVOID)&PropertyRequest, sizeof(KSPROPERTY), (PVOID)&Count, 
sizeof(ULONG), &BytesReturned);
     if (!NT_SUCCESS(Status))
     {
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
 
     if (!Count)
     {
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
@@ -56,6 +62,9 @@
     if (!DeviceEntry->Pins)
     {
         /* no memory */
+        ObDereferenceObject(DeviceEntry->FileObject);
+        ZwClose(DeviceEntry->Handle);
+        ExFreePool(DeviceEntry->DeviceName.Buffer);
         ExFreePool(DeviceEntry);
         return;
     }
@@ -101,7 +110,7 @@
 
     }
 
-    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;
 
@@ -139,7 +148,7 @@
 
     if (!NT_SUCCESS(Status))
     {
-        DPRINT1("ZwCreateFile failed with %x\n", Status);
+        DPRINT("ZwCreateFile failed with %x\n", Status);
         return Status;
     }
 
@@ -147,7 +156,7 @@
     if (!NT_SUCCESS(Status))
     {
         ZwClose(NodeHandle);
-        DPRINT1("ObReferenceObjectByHandle failed with %x\n", Status);
+        DPRINT("ObReferenceObjectByHandle failed with %x\n", Status);
         return Status;
     }
 
@@ -210,12 +219,13 @@
         Status = OpenDevice(&DeviceEntry->DeviceName, &DeviceEntry->Handle, 
&DeviceEntry->FileObject);
         if (!NT_SUCCESS(Status))
         {
-            DPRINT1("ZwCreateFile failed with %x\n", Status);
+            DPRINT("ZwCreateFile failed with %x\n", Status);
+            ExFreePool(DeviceEntry->DeviceName.Buffer);
             ExFreePool(DeviceEntry);
             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
         // mutal exclusion
@@ -224,7 +234,7 @@
     }
     else
     {
-        DPRINT1("Remove interface to audio device!\n");
+        DPRINT("Remove interface to audio device!\n");
         UNIMPLEMENTED
         return STATUS_SUCCESS;
     }
@@ -250,7 +260,7 @@
 
     if (!NT_SUCCESS(Status))
     {
-        DPRINT1("IoRegisterPlugPlayNotification failed with %x\n", Status);
+        DPRINT("IoRegisterPlugPlayNotification failed with %x\n", Status);
     }
 
     Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange,
@@ -264,7 +274,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* 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;
@@ -287,7 +297,7 @@
     }
     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;
     }
 
@@ -299,7 +309,7 @@
     }
     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;
     }
 
@@ -311,7 +321,7 @@
     }
     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);
@@ -322,7 +332,7 @@
     }
     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;

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c?rev=40596&r1=40595&r2=40596&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] 
(original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] Mon Apr 
20 02:01:57 2009
@@ -128,7 +128,7 @@
 
                     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)
                     {
                         DPRINT("Closing pin %p\n", 
Entry->Pins[Client->Devs[Index].ClientHandles[SubIndex].PinId].PinHandle);
@@ -159,7 +159,7 @@
     PDEVICE_OBJECT DeviceObject,
     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.Information = 0;
@@ -174,7 +174,7 @@
     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.Information = 0;
@@ -195,7 +195,7 @@
     PIO_STATUS_BLOCK IoStatus,
     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;
@@ -214,7 +214,7 @@
     PIO_STATUS_BLOCK IoStatus,
     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;
 
@@ -232,7 +232,7 @@
     PIO_STATUS_BLOCK IoStatus,
     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;
 }
@@ -353,7 +353,7 @@
     /* allocate object header */
     Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, 
&DispatchTable);
 
-    DPRINT1("KsAllocateObjectHeader result %x\n", Status);
+    DPRINT("KsAllocateObjectHeader result %x\n", Status);
     /* complete the irp */
     Irp->IoStatus.Information = 0;
     Irp->IoStatus.Status = Status;

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/main.c?rev=40596&r1=40595&r2=40596&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/main.c [iso-8859-1] Mon Apr 20 
02:01:57 2009
@@ -24,7 +24,7 @@
 NTAPI
 SysAudio_Unload(IN PDRIVER_OBJECT DriverObject)
 {
-    DPRINT1("SysAudio_Unload called\n");
+    DPRINT("SysAudio_Unload called\n");
 }
 
 NTSTATUS
@@ -79,7 +79,7 @@
     SYSAUDIODEVEXT *DeviceExtension;
 
 
-    DPRINT1("SysAudio_InstallDevice called\n");
+    DPRINT("SysAudio_InstallDevice called\n");
 
     /* Create the device */
     Status = IoCreateDevice(DriverObject,
@@ -191,7 +191,7 @@
     IN  PDRIVER_OBJECT DriverObject,
     IN  PUNICODE_STRING RegistryPath)
 {
-    DPRINT1("System audio graph builder (sysaudio) started\n");
+    DPRINT("System audio graph builder (sysaudio) started\n");
 
     /* Let ks handle these */
     KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CREATE);

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/pin.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/pin.c?rev=40596&r1=40595&r2=40596&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/pin.c [iso-8859-1] Mon Apr 20 
02:01:57 2009
@@ -206,7 +206,7 @@
     PDEVICE_OBJECT DeviceObject,
     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.Information = 0;
@@ -220,7 +220,7 @@
     PDEVICE_OBJECT DeviceObject,
     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.Information = 0;
@@ -235,7 +235,7 @@
     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.Information = 0;
@@ -256,7 +256,7 @@
     PIO_STATUS_BLOCK IoStatus,
     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;
@@ -275,7 +275,7 @@
     PIO_STATUS_BLOCK IoStatus,
     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;
 
@@ -296,7 +296,7 @@
     PDISPATCH_CONTEXT Context;
     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;
 

Reply via email to