Author: janderwald
Date: Thu Mar 26 12:59:45 2009
New Revision: 40250
URL:
http://svn.reactos.org/svn/reactos?rev=40250&view=rev
Log:
- Remove dead code
- Silence a few debug prints
- Implement Dispatch_FastRead, Dispatch_fnFastDeviceIoControl
- Change _InterlockedXXX to InterlockedXXX
- Store IPortPinWaveCyclic pins in an array and close pin on a new create request (fixes a
memory leak)
- Complete the close irp when the stream has really been closed
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] Thu Mar 26
12:59:45 2009
@@ -50,15 +50,6 @@
DPRINT1("PcInitializeAdapterDriver\n");
-#if 0
- /* Set default stub - is this a good idea? */
- DPRINT1("Setting IRP stub\n");
- for ( i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i ++ )
- {
- DriverObject->MajorFunction[i] = IrpStub;
- }
-#endif
-
/* Our IRP handlers */
DPRINT1("Setting IRP handlers\n");
DriverObject->MajorFunction[IRP_MJ_CREATE] = PcDispatchIrp;
@@ -195,8 +186,6 @@
return STATUS_UNSUCCESSFUL;
}
-
-
return status;
}
@@ -241,6 +230,17 @@
/* the provided port driver doesnt support ISubdevice */
return STATUS_INVALID_PARAMETER;
}
+
+ /* get the subdevice descriptor */
+ Status = SubDevice->lpVtbl->GetDescriptor(SubDevice,
&SubDeviceDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to get subdevice descriptor %x\n", Status);
+ SubDevice->lpVtbl->Release(SubDevice);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* add an create item to the device header */
Status = KsAddObjectCreateItemToDeviceHeader(DeviceExt->KsDeviceHeader,
PcCreateItemDispatch, (PVOID)SubDevice, Name, NULL);
if (!NT_SUCCESS(Status))
{
@@ -249,17 +249,16 @@
DPRINT1("KsAddObjectCreateItemToDeviceHeader failed with %x\n",
Status);
return Status;
}
+
+ /* increment reference count */
SubDevice->lpVtbl->AddRef(SubDevice);
- Status = SubDevice->lpVtbl->GetDescriptor(SubDevice,
&SubDeviceDescriptor);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to get subdevice descriptor %x\n", Status);
- SubDevice->lpVtbl->Release(SubDevice);
- }
-
for(Index = 0; Index < SubDeviceDescriptor->InterfaceCount; Index++)
{
+ //FIXME
+ // Use a reference string such as Wave0001 / Topology0001
+ //
+
Status = IoRegisterDeviceInterface(DeviceExt->PhysicalDeviceObject,
&SubDeviceDescriptor->Interfaces[Index],
NULL,
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c [iso-8859-1] Thu Mar 26 12:59:45
2009
@@ -49,7 +49,7 @@
Status = IoInitializeTimer(pDeviceObject, pTimerRoutine, pContext);
if (!NT_SUCCESS(Status))
{
- DPRINT("IoInitializeTimer failed with %x\n", Status);
+ DPRINT1("IoInitializeTimer failed with %x\n", Status);
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c [iso-8859-1] Thu Mar 26
12:59:45 2009
@@ -94,8 +94,6 @@
return Status;
}
-
-
/*
* @implemented
*/
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c [iso-8859-1] Thu Mar 26
12:59:45 2009
@@ -6,20 +6,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- //DPRINT1("Dispatch_fnDeviceIoControl called DeviceObject %p Irp %p\n",
DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->DeviceIoControl(IrpTarget, DeviceObject, Irp);
}
@@ -29,20 +23,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnRead called DeviceObject %p Irp %p\n", DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->Read(IrpTarget, DeviceObject, Irp);
}
@@ -52,20 +40,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnWrite called DeviceObject %p Irp %p\n", DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->Write(IrpTarget, DeviceObject, Irp);
}
@@ -75,20 +57,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnFlush called DeviceObject %p Irp %p\n", DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->Flush(IrpTarget, DeviceObject, Irp);
}
@@ -98,24 +74,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnClose called DeviceObject %p Irp %p\n", DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
- ASSERT(CreateItem != NULL);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack != NULL);
- ASSERT(IoStack->FileObject != NULL);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
- //DPRINT1("IrpTarget %p\n", IrpTarget);
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->Close(IrpTarget, DeviceObject, Irp);
}
@@ -125,20 +91,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n",
DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->QuerySecurity(IrpTarget, DeviceObject, Irp);
}
@@ -148,20 +108,14 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- IIrpTarget * IrpTarget;
- PKSOBJECT_CREATE_ITEM CreateItem;
-
- DPRINT1("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n",
DeviceObject);
-
- /* access the create item */
- CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- ASSERT(IoStack->FileObject);
-
- IrpTarget = (IIrpTarget*)CreateItem->Context;
-
+ IIrpTarget * IrpTarget;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+
+ /* access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->SetSecurity(IrpTarget, DeviceObject, Irp);
}
@@ -178,10 +132,13 @@
PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject)
{
- DPRINT1("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n",
DeviceObject);
-
-
- return FALSE;
+ IIrpTarget * IrpTarget;
+
+ /* access IrpTarget */
+ IrpTarget = (IIrpTarget *)FileObject->FsContext2;
+
+ /* let IrpTarget handle request */
+ return IrpTarget->lpVtbl->FastDeviceIoControl(IrpTarget, FileObject, Wait,
InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength, IoControlCode, IoStatus,
DeviceObject);
}
@@ -197,10 +154,13 @@
PIO_STATUS_BLOCK IoStatus,
PDEVICE_OBJECT DeviceObject)
{
- DPRINT1("Dispatch_fnFastRead called DeviceObject %p Irp %p\n",
DeviceObject);
-
- return FALSE;
-
+ IIrpTarget * IrpTarget;
+
+ /* access IrpTarget */
+ IrpTarget = (IIrpTarget *)FileObject->FsContext2;
+
+ /* let IrpTarget handle request */
+ return IrpTarget->lpVtbl->FastRead(IrpTarget, FileObject, FileOffset, Length,
Wait, LockKey, Buffer, IoStatus, DeviceObject);
}
BOOLEAN
@@ -216,10 +176,10 @@
PDEVICE_OBJECT DeviceObject)
{
IIrpTarget * IrpTarget;
- //DPRINT1("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n",
DeviceObject);
-
+
+ /* access IrpTarget */
IrpTarget = (IIrpTarget *)FileObject->FsContext2;
-
+ /* let IrpTarget handle request */
return IrpTarget->lpVtbl->FastWrite(IrpTarget, FileObject, FileOffset, Length,
Wait, LockKey, Buffer, IoStatus, DeviceObject);
}
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] Thu Mar 26
12:59:45 2009
@@ -112,9 +112,6 @@
DPRINT1("IDmaChannelSlave_AllocateBuffer free common buffer first
\n");
return STATUS_UNSUCCESSFUL;
}
-
- //FIXME
- // retry with different size on failure
This->Buffer =
This->pAdapter->DmaOperations->AllocateCommonBuffer(This->pAdapter,
BufferSize, &This->Address, FALSE);
if (!This->Buffer)
@@ -400,7 +397,7 @@
This->DmaStarted = FALSE;
- return 0;
+ return STATUS_SUCCESS;
}
NTSTATUS
@@ -493,7 +490,7 @@
IDmaChannelSlaveImpl * This;
- DPRINT1("OutDmaChannel %p OuterUnknown %p PoolType %p DeviceDescription %p
DeviceObject %p\n",
+ DPRINT("OutDmaChannel %p OuterUnknown %p PoolType %p DeviceDescription %p
DeviceObject %p\n",
OutDmaChannel, OuterUnknown, PoolType, DeviceDescription, DeviceObject);
This = AllocateItem(PoolType, sizeof(IDmaChannelSlaveImpl), TAG_PORTCLASS);
@@ -509,8 +506,6 @@
{
DeviceDescription->InterfaceType = BusType;
}
-
- DPRINT1("Calling IoGetDmaAdapter\n");
Adapter = IoGetDmaAdapter(DeviceExt->PhysicalDeviceObject, DeviceDescription,
&MapRegisters);
if (!Adapter)
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c [iso-8859-1] Thu Mar 26
12:59:45 2009
@@ -15,7 +15,7 @@
DPRINT("IDrmPort2_AddRef: This %p\n", This);
- return _InterlockedIncrement(&This->ref);
+ return InterlockedIncrement(&This->ref);
}
ULONG
@@ -25,7 +25,7 @@
{
IDrmPort2Impl * This = (IDrmPort2Impl*)iface;
- _InterlockedDecrement(&This->ref);
+ InterlockedDecrement(&This->ref);
if (This->ref == 0)
{
@@ -51,13 +51,12 @@
IsEqualGUIDAligned(refiid, &IID_IUnknown))
{
*Output = (PVOID)&This->lpVtbl;
- _InterlockedIncrement(&This->ref);
+ InterlockedIncrement(&This->ref);
return STATUS_SUCCESS;
}
StringFromCLSID(refiid, Buffer);
DPRINT1("IDrmPort2_QueryInterface no interface!!! iface %S\n", Buffer);
- KeBugCheckEx(0, 0, 0, 0, 0);
return STATUS_UNSUCCESSFUL;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Thu
Mar 26 12:59:45 2009
@@ -7,7 +7,8 @@
LONG ref;
IPortWaveCyclic* Port;
- IPortPinWaveCyclic * Pin;
+ IPortPinWaveCyclic ** Pins;
+ SUBDEVICE_DESCRIPTOR * Descriptor;
}IPortFilterWaveCyclicImpl;
@@ -69,7 +70,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
NTAPI
@@ -83,55 +84,58 @@
IN PIRP Irp,
IN KSOBJECT_CREATE *CreateObject)
{
- ISubdevice * ISubDevice;
NTSTATUS Status;
IPortPinWaveCyclic * Pin;
- SUBDEVICE_DESCRIPTOR * Descriptor;
PKSPIN_CONNECT ConnectDetails;
IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface;
ASSERT(This->Port);
+ ASSERT(This->Descriptor);
+ ASSERT(This->Pins);
DPRINT("IPortFilterWaveCyclic_fnNewIrpTarget entered\n");
- Status = This->Port->lpVtbl->QueryInterface(This->Port,
&IID_ISubdevice, (PVOID*)&ISubDevice);
+ /* let's verify the connection request */
+ Status = PcValidateConnectRequest(Irp, &This->Descriptor->Factory,
&ConnectDetails);
if (!NT_SUCCESS(Status))
+ {
return STATUS_UNSUCCESSFUL;
-
- Status = ISubDevice->lpVtbl->GetDescriptor(ISubDevice, &Descriptor);
- if (!NT_SUCCESS(Status))
- return STATUS_UNSUCCESSFUL;
-
- Status = PcValidateConnectRequest(Irp, &Descriptor->Factory,
&ConnectDetails);
- if (!NT_SUCCESS(Status))
- {
- ISubDevice->lpVtbl->Release(ISubDevice);
- return STATUS_UNSUCCESSFUL;
- }
-
- ISubDevice->lpVtbl->Release(ISubDevice);
-
+ }
+
+ if (This->Pins[ConnectDetails->PinId] &&
This->Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount)
+ {
+ /* release existing instance */
+
This->Pins[ConnectDetails->PinId]->lpVtbl->Close(This->Pins[ConnectDetails->PinId],
DeviceObject, NULL);
+ }
+
+ /* now create the pin */
Status = NewPortPinWaveCyclic(&Pin);
if (!NT_SUCCESS(Status))
{
return Status;
}
- Status = Pin->lpVtbl->Init(Pin, This->Port, iface, ConnectDetails,
&Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId]);
+ /* initialize the pin */
+ Status = Pin->lpVtbl->Init(Pin, This->Port, iface, ConnectDetails,
&This->Descriptor->Factory.KsPinDescriptor[ConnectDetails->PinId]);
if (!NT_SUCCESS(Status))
{
Pin->lpVtbl->Release(Pin);
return Status;
}
- /* store pin handle */
- This->Pin = Pin;
+ /* release existing pin */
+ if (This->Pins[ConnectDetails->PinId])
+ {
+
This->Pins[ConnectDetails->PinId]->lpVtbl->Release(This->Pins[ConnectDetails->PinId]);
+ }
+ /* store pin */
+ This->Pins[ConnectDetails->PinId] = Pin;
/* store result */
*OutTarget = (IIrpTarget*)Pin;
/* increment current instance count */
-
Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount++;
+
This->Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount++;
return Status;
}
@@ -207,7 +211,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
NTAPI
@@ -216,10 +220,18 @@
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
- DPRINT1("IPortFilterWaveCyclic_fnClose entered\n");
-
- //FIXME
- //close all pin instances
+ ULONG Index;
+ IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface;
+
+ for(Index = 0; Index < This->Descriptor->Factory.PinDescriptorCount;
Index++)
+ {
+ if (This->Pins[Index])
+ {
+ This->Pins[Index]->lpVtbl->Close(This->Pins[Index], DeviceObject,
NULL);
+ }
+
+ }
+
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
@@ -271,7 +283,7 @@
OUT PIO_STATUS_BLOCK StatusBlock,
IN PDEVICE_OBJECT DeviceObject)
{
-
+ UNIMPLEMENTED
return STATUS_SUCCESS;
}
@@ -291,6 +303,7 @@
OUT PIO_STATUS_BLOCK StatusBlock,
IN PDEVICE_OBJECT DeviceObject)
{
+ UNIMPLEMENTED
return STATUS_SUCCESS;
}
@@ -310,6 +323,7 @@
OUT PIO_STATUS_BLOCK StatusBlock,
IN PDEVICE_OBJECT DeviceObject)
{
+ UNIMPLEMENTED
return STATUS_SUCCESS;
}
@@ -323,12 +337,38 @@
IN IPortFilterWaveCyclic* iface,
IN IPortWaveCyclic* Port)
{
+ ISubdevice * ISubDevice;
+ SUBDEVICE_DESCRIPTOR * Descriptor;
+ NTSTATUS Status;
IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl*)iface;
This->Port = Port;
+ /* get our private interface */
+ Status = This->Port->lpVtbl->QueryInterface(This->Port,
&IID_ISubdevice, (PVOID*)&ISubDevice);
+ if (!NT_SUCCESS(Status))
+ return STATUS_UNSUCCESSFUL;
+
+ /* get the subdevice descriptor */
+ Status = ISubDevice->lpVtbl->GetDescriptor(ISubDevice, &Descriptor);
+
+ /* release subdevice interface */
+ ISubDevice->lpVtbl->Release(ISubDevice);
+
+ if (!NT_SUCCESS(Status))
+ return STATUS_UNSUCCESSFUL;
+
+ /* save descriptor */
+ This->Descriptor = Descriptor;
+
+ /* allocate pin array */
+ This->Pins = AllocateItem(NonPagedPool, Descriptor->Factory.PinDescriptorCount
* sizeof(IPortPinWaveCyclic*), TAG_PORTCLASS);
+
+ if (!This->Pins)
+ return STATUS_UNSUCCESSFUL;
+
/* increment reference count */
- iface->lpVtbl->AddRef(iface);
+ Port->lpVtbl->AddRef(Port);
return STATUS_SUCCESS;
}
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] Thu Mar 26
12:59:45 2009
@@ -178,8 +178,6 @@
ExInterlockedInsertTailList(&This->ListHead, &Mapping->Entry,
&This->Lock);
(void)InterlockedIncrement((volatile long*)&This->NumMappings);
-
-
if (Irp)
{
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] Thu Mar
26 12:59:45 2009
@@ -30,6 +30,7 @@
ULONG DelayedRequestInProgress;
ULONG FrameSize;
BOOL Capture;
+ PIRP CloseIrp;
}IPortPinWaveCyclicImpl;
@@ -242,7 +243,7 @@
Status = This->Stream->lpVtbl->GetPosition(This->Stream, &Position);
- DPRINT1("Position %u Buffer %p BufferSize %u ActiveIrpOffset %u\n",
Position, Buffer, This->CommonBufferSize, BufferSize);
+ DPRINT("Position %u Buffer %p BufferSize %u ActiveIrpOffset %u\n",
Position, Buffer, This->CommonBufferSize, BufferSize);
if (Position < This->CommonBufferOffset)
{
@@ -616,29 +617,25 @@
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{
- PMINIPORTWAVECYCLICSTREAM Stream = (PMINIPORTWAVECYCLICSTREAM)Context;
-
- DPRINT("CloseStreamRoutine %p\n", Stream);
- Stream->lpVtbl->Release(Stream);
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-IPortPinWaveCyclic_fnClose(
- IN IPortPinWaveCyclic* iface,
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
-{
+ PMINIPORTWAVECYCLICSTREAM Stream;
+ NTSTATUS Status;
ISubdevice *ISubDevice;
- NTSTATUS Status;
- SUBDEVICE_DESCRIPTOR * Descriptor;
- PIO_WORKITEM WorkItem;
-
- IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)iface;
- DPRINT1("IPortPinWaveCyclic_fnClose\n");
+ PSUBDEVICE_DESCRIPTOR Descriptor;
+
+ IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)Context;
+
+ if (This->Stream)
+ {
+ if (This->State != KSSTATE_STOP)
+ {
+ This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP);
+ KeStallExecutionProcessor(10);
+ }
+ }
+
+ This->ServiceGroup->lpVtbl->RemoveMember(This->ServiceGroup,
(PSERVICESINK)&This->lpVtblServiceSink);
+ This->ServiceGroup->lpVtbl->Release(This->ServiceGroup);
+ This->DmaChannel->lpVtbl->Release(This->DmaChannel);
Status = This->Port->lpVtbl->QueryInterface(This->Port,
&IID_ISubdevice, (PVOID*)&ISubDevice);
if (NT_SUCCESS(Status))
@@ -648,39 +645,73 @@
{
ISubDevice->lpVtbl->Release(ISubDevice);
Descriptor->Factory.Instances[This->ConnectDetails->PinId].CurrentPinInstanceCount--;
- DPRINT1("InstanceCount %u\n",
Descriptor->Factory.Instances[This->ConnectDetails->PinId].CurrentPinInstanceCount);
}
}
+ if (This->Format)
+ {
+ ExFreePool(This->Format);
+ This->Format = NULL;
+ }
+
+ if (This->IrpQueue)
+ {
+ This->IrpQueue->lpVtbl->Release(This->IrpQueue);
+ }
if (This->Stream)
{
- This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP);
- }
-
- This->ServiceGroup->lpVtbl->RemoveMember(This->ServiceGroup,
(PSERVICESINK)&This->lpVtblServiceSink);
- This->ServiceGroup->lpVtbl->Release(This->ServiceGroup);
- This->DmaChannel->lpVtbl->Release(This->DmaChannel);
-
- if (This->Format)
- ExFreePool(This->Format);
-
- This->IrpQueue->lpVtbl->Release(This->IrpQueue);
-
+ Stream = This->Stream;
+ This->Stream = NULL;
+
+ if (This->CloseIrp)
+ {
+ This->CloseIrp->IoStatus.Information = 0;
+ This->CloseIrp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(This->CloseIrp, IO_NO_INCREMENT);
+ }
+ Stream->lpVtbl->Release(Stream);
+ /* this line is never reached */
+ }
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+IPortPinWaveCyclic_fnClose(
+ IN IPortPinWaveCyclic* iface,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ PIO_WORKITEM WorkItem;
+
+ IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)iface;
if (This->Stream)
{
WorkItem = IoAllocateWorkItem(DeviceObject);
if (WorkItem)
{
- IoQueueWorkItem(WorkItem, CloseStreamRoutine, DelayedWorkQueue,
(PVOID)This->Stream);
+ if (Irp)
+ {
+ This->CloseIrp = Irp;
+ IoMarkIrpPending(Irp);
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_PENDING;
+ }
+ IoQueueWorkItem(WorkItem, CloseStreamRoutine, DelayedWorkQueue,
(PVOID)This);
+ return STATUS_PENDING;
}
}
- Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
+ if (Irp)
+ {
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ }
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] Thu Mar
26 12:59:45 2009
@@ -598,7 +598,7 @@
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_INSUFFICIENT_RESOURCES;
}
- DPRINT1("Queueing IRP %p\n", Irp);
+ DPRINT1("Queueing IRP %p Irql %u\n", Irp, KeGetCurrentIrql());
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_PENDING;
IoMarkIrpPending(Irp);