Author: janderwald
Date: Fri May 15 19:24:29 2009
New Revision: 40930
URL:
http://svn.reactos.org/svn/reactos?rev=40930&view=rev
Log:
- Remove unused WdmAudWriteCompleted
- check for a valid object header in KsSynchronousIoControlDevice
- Apply alignment restrictions to all allocated buffers
- Fix handling IRP_MN_QUERY_INTERFACE, IRP_MN_QUERY_DEVICE_RELATIONS,
IRP_MN_FILTER_RESOURCE_REQUIREMENTS
- IMiniportWaveCyclic::NewStream && IMiniportWavePci::NewStream take first the pin
id and THEN the parameter capture. Fixes playback for ES1371 (VmWare) driver and many
others
- Store IPortFilterWavePci, IPortFilterWaveRT, IPortFilterWaveCyclic in their
corresponding port
Modified:
trunk/reactos/drivers/ksfilter/ks/misc.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
Modified: trunk/reactos/drivers/ksfilter/ks/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/misc.c…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] Fri May 15 19:24:29 2009
@@ -284,12 +284,22 @@
/* get object header */
ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+ if (!ObjectHeader)
+ {
+ DPRINT("Expected object header\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
/* check if there is fast device io function */
if (ObjectHeader->DispatchTable.FastDeviceIoControl)
{
+ IoStatusBlock.Status = STATUS_UNSUCCESSFUL;
+ IoStatusBlock.Information = 0;
+
/* it is send the request */
Status = ObjectHeader->DispatchTable.FastDeviceIoControl(FileObject, TRUE,
InBuffer, InSize, OutBuffer, OutSize, IoControl, &IoStatusBlock, DeviceObject);
/* check if the request was handled */
+ DPRINT("Handled %u Status %x Length %u\n", Status,
IoStatusBlock.Status, IoStatusBlock.Information);
if (Status)
{
/* store bytes returned */
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -524,11 +524,12 @@
IDmaChannelInit_fnGetAdapterObject,
IDmaChannelInit_fnCopyTo,
IDmaChannelInit_fnCopyFrom,
- /* IDmaChannelInit methods */
+ /* IDmaChannelSlave methods */
IDmaChannelInit_fnStart,
IDmaChannelInit_fnStop,
IDmaChannelInit_fnReadCounter,
IDmaChannelInit_fnWaitForTC,
+ /* IDmaChannelInit methods */
IDmaChannelInit_fnInit
};
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Fri May 15
19:24:29 2009
@@ -195,7 +195,8 @@
IN KSPIN_CONNECT *ConnectDetails,
IN PKSDATAFORMAT DataFormat,
IN PDEVICE_OBJECT DeviceObject,
- IN ULONG FrameSize);
+ IN ULONG FrameSize,
+ IN ULONG Alignment);
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
IN PUCHAR Buffer,
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] Fri May 15 19:24:29
2009
@@ -126,23 +126,21 @@
case IRP_MN_QUERY_INTERFACE:
DPRINT("IRP_MN_QUERY_INTERFACE\n");
Status = PcForwardIrpSynchronous(DeviceObject, Irp);
- Irp->IoStatus.Status = Status;
+ return Status;
+
+ case IRP_MN_QUERY_DEVICE_RELATIONS:
+ DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS\n");
+ Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_NOT_SUPPORTED;
+ case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
+ DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
+ Status = Irp->IoStatus.Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
-
- case IRP_MN_QUERY_DEVICE_RELATIONS:
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_UNSUCCESSFUL;
- case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
Status = PcForwardIrpSynchronous(DeviceObject, Irp);
- Irp->IoStatus.Status = Status;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -39,6 +39,7 @@
ULONG OutOfMapping;
ULONG MaxFrameSize;
+ ULONG Alignment;
}IIrpQueueImpl;
@@ -118,13 +119,15 @@
IN KSPIN_CONNECT *ConnectDetails,
IN PKSDATAFORMAT DataFormat,
IN PDEVICE_OBJECT DeviceObject,
- IN ULONG FrameSize)
+ IN ULONG FrameSize,
+ IN ULONG Alignment)
{
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
This->ConnectDetails = ConnectDetails;
This->DataFormat = (PKSDATAFORMAT_WAVEFORMATEX)DataFormat;
This->MaxFrameSize = FrameSize;
+ This->Alignment = Alignment;
InitializeListHead(&This->ListHead);
InitializeListHead(&This->FreeHead);
@@ -185,7 +188,7 @@
else
Offset = 0;
- Mapping->Buffer = (PVOID)UlongToPtr(PtrToUlong(Header->Data) + Offset);
+ Mapping->Buffer = (PVOID)UlongToPtr((PtrToUlong(Header->Data) + Offset + 3)
& ~(0x3));
if (This->MaxFrameSize)
Mapping->BufferSize = min(Header->DataUsed - Offset,
This->MaxFrameSize);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -1137,7 +1137,7 @@
This->ServiceGroup->lpVtbl->SupportDelayedService(This->ServiceGroup);
}
- Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
This->Format, DeviceObject, 0);
+ Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
This->Format, DeviceObject, 0, 0);
if (!NT_SUCCESS(Status))
{
DPRINT1("IrpQueue_Init failed with %x\n", Status);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Fri May
15 19:24:29 2009
@@ -993,7 +993,7 @@
if (!NT_SUCCESS(Status))
return Status;
- Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
DataFormat, DeviceObject, 0);
+ Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
DataFormat, DeviceObject, 0, 0);
if (!NT_SUCCESS(Status))
{
This->IrpQueue->lpVtbl->Release(This->IrpQueue);
@@ -1018,8 +1018,8 @@
&This->Stream,
NULL,
NonPagedPool,
+ ConnectDetails->PinId,
Capture,
- ConnectDetails->PinId,
This->Format,
&This->DmaChannel,
&This->ServiceGroup);
@@ -1062,7 +1062,10 @@
Status = This->Stream->lpVtbl->SetNotificationFreq(This->Stream, 10,
&This->FrameSize);
- This->Stream->lpVtbl->SetFormat(This->Stream,
(PKSDATAFORMAT)This->Format);
+ //This->Stream->lpVtbl->SetFormat(This->Stream,
(PKSDATAFORMAT)This->Format);
+ DPRINT1("Setting state to acquire %x\n",
This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_ACQUIRE));
+ DPRINT1("Setting state to run %x\n",
This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_PAUSE));
+ This->State = KSSTATE_PAUSE;
return STATUS_SUCCESS;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -201,8 +201,20 @@
ASSERT_IRQL(DISPATCH_LEVEL);
+ if (This->IrpQueue->lpVtbl->HasLastMappingFailed(This->IrpQueue))
+ {
+ This->IrpQueue->lpVtbl->PrintQueueStatus(This->IrpQueue);
+ if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) == 0)
+ {
+ DPRINT("Stopping stream...\n");
+ SetStreamState(This, KSSTATE_STOP);
+ }
+ }
+
Status = This->Stream->lpVtbl->GetPosition(This->Stream, &Position);
DPRINT("Position %lu Status %x\n", Position, Status);
+
+ This->Stream->lpVtbl->Service(This->Stream);
}
static IServiceSinkVtbl vt_IServiceSink =
@@ -598,9 +610,9 @@
PIRP Irp;
IPortPinWavePciImpl * This = (IPortPinWavePciImpl*)iface;
+ DPRINT("IPortPinWavePci_fnFastWrite entered Total %u Pre %u Post %u\n",
This->TotalPackets, This->PreCompleted, This->PostCompleted);
+
InterlockedIncrement((PLONG)&This->TotalPackets);
-
- DPRINT("IPortPinWavePci_fnFastWrite entered Total %u Pre %u Post %u\n",
This->TotalPackets, This->PreCompleted, This->PostCompleted);
Packet = (PCONTEXT_WRITE)Buffer;
@@ -710,8 +722,8 @@
NULL,
NonPagedPool,
This->WaveStream,
+ ConnectDetails->PinId,
Capture,
- ConnectDetails->PinId,
This->Format,
&This->DmaChannel,
&This->ServiceGroup);
@@ -742,7 +754,11 @@
return Status;
}
- Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
This->Format, DeviceObject, AllocatorFraming.FrameSize);
+ DPRINT("OptionFlags %x RequirementsFlag %x PoolType %x Frames %lu FrameSize %lu
FileAlignment %lu\n",
+ AllocatorFraming.OptionsFlags, AllocatorFraming.RequirementsFlags,
AllocatorFraming.PoolType, AllocatorFraming.Frames, AllocatorFraming.FrameSize,
AllocatorFraming.FileAlignment);
+
+
+ Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
This->Format, DeviceObject, AllocatorFraming.FrameSize,
AllocatorFraming.FileAlignment);
if (!NT_SUCCESS(Status))
{
DPRINT1("IrpQueue_Init failed with %x\n", Status);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavert.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -912,7 +912,7 @@
goto cleanup;
}
- Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
DataFormat, DeviceObject, 0);
+ Status = This->IrpQueue->lpVtbl->Init(This->IrpQueue, ConnectDetails,
DataFormat, DeviceObject, 0, 0);
if (!NT_SUCCESS(Status))
{
goto cleanup;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Fri May
15 19:24:29 2009
@@ -617,6 +617,7 @@
}
*OutTarget = (IIrpTarget*)Filter;
+ This->Filter = Filter;
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -679,6 +679,7 @@
}
*OutTarget = (IIrpTarget*)Filter;
+ This->Filter = Filter;
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -519,6 +519,7 @@
}
*OutTarget = (IIrpTarget*)Filter;
+ This->Filter = Filter;
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -159,7 +159,7 @@
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
- DPRINT("IRegistryKey_fnNewSubKey entered %S\n", SubKeyName);
+ DPRINT("IRegistryKey_fnNewSubKey entered %S\n", SubKeyName->Buffer);
if (This->Deleted)
{
@@ -381,7 +381,7 @@
This->hKey = hHandle;
This->lpVtbl = &vt_IRegistryKey;
- This->ref = 2;
+ This->ref = 1;
*OutRegistryKey = (PREGISTRYKEY)&This->lpVtbl;
DPRINT("PcNewRegistryKey result %p\n", *OutRegistryKey);
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Fri May 15
19:24:29 2009
@@ -390,23 +390,6 @@
return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
}
-NTSTATUS
-NTAPI
-WdmAudWriteCompleted(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp,
- IN PVOID Ctx)
-{
- PWRITE_CONTEXT Context = (PWRITE_CONTEXT)Ctx;
-
- Context->Irp->IoStatus.Information = Context->Length;
- Context->Irp->IoStatus.Status = Irp->IoStatus.Status;
- IoCompleteRequest(Context->Irp, IO_SOUND_INCREMENT);
-
- ExFreePool(Context);
- return STATUS_SUCCESS;
-}
-
ULONG
CheckFormatSupport(
IN PKSDATARANGE_AUDIO DataRangeAudio,
@@ -684,6 +667,7 @@
{
/* invalid parameter */
DPRINT1("Error: device type not set\n");
+ ObDereferenceObject(FileObject);
return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0);
}
@@ -691,6 +675,7 @@
{
/* file object parameter */
DPRINT1("Error: file object is not attached\n");
+ ObDereferenceObject(FileObject);
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0);
}
ClientInfo = (PWDMAUD_CLIENT)IoStack->FileObject->FsContext;
@@ -716,6 +701,7 @@
{
/* no memory */
ExFreePool(Packet);
+ ObDereferenceObject(FileObject);
return SetIrpIoStatus(Irp, STATUS_NO_MEMORY, 0);
}
Packet->Header.Data = Buffer;
@@ -737,12 +723,12 @@
DPRINT1("Invalid buffer supplied\n");
ExFreePool(Buffer);
ExFreePool(Packet);
+ ObDereferenceObject(FileObject);
return SetIrpIoStatus(Irp, Status, 0);
}
KsStreamIo(FileObject, NULL, NULL, NULL, NULL, 0, &IoStatusBlock, Packet,
sizeof(CONTEXT_WRITE), KSSTREAM_WRITE, KernelMode);
-
-
+ ObDereferenceObject(FileObject);
return IoStatusBlock.Status;
}