Author: janderwald
Date: Thu Apr 23 23:06:36 2009
New Revision: 40672
URL:
http://svn.reactos.org/svn/reactos?rev=40672&view=rev
Log:
- Add tons of ASSERT_IRQL / ASSERT_IRQL_EQUAL
- Queue a dpc when IServiceGroup::RequestService is called above dispatch level
- As a result writing to common buffer and completing irps can be done at the same time
- Start the stream at PASSIVE_LEVEL
- Check if key has been deleted in IRegistryKey object function
- Implement IRegistryKey::QueryRegistryValues
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/drm.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c
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/miniport.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport_dmus.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.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_wavepcistream.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.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 Apr 23
23:06:36 2009
@@ -46,6 +46,7 @@
//ULONG i;
DPRINT1("PcInitializeAdapterDriver\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* Our IRP handlers */
DPRINT1("Setting IRP handlers\n");
@@ -94,6 +95,7 @@
PPCLASS_DEVICE_EXTENSION portcls_ext = NULL;
DPRINT1("PcAddAdapterDevice called\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DriverObject || !PhysicalDeviceObject || !StartDevice)
{
@@ -223,6 +225,7 @@
ULONG Index;
DPRINT1("PcRegisterSubdevice DeviceObject %p Name %S Unknown %p\n",
DeviceObject, Name, Unknown);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* check if all parameters are valid */
if (!DeviceObject || !Name || !Unknown)
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 Apr 23 23:06:36
2009
@@ -20,6 +20,7 @@
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return IoGetDeviceProperty(DeviceObject, DeviceProperty, BufferLength,
PropertyBuffer, ResultLength);
}
@@ -49,6 +50,7 @@
{
NTSTATUS Status;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* FIXME
* check if timer is already used
@@ -74,6 +76,8 @@
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
/* FIXME
* check if timer is already used
*/
@@ -93,6 +97,7 @@
IN NTSTATUS NtStatus)
{
/* sanity checks */
+ ASSERT_IRQL(DISPATCH_LEVEL);
if (!PropertyRequest)
return STATUS_INVALID_PARAMETER;
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 Apr 23
23:06:36 2009
@@ -114,8 +114,8 @@
IN PUNKNOWN ToUnknown,
IN ULONG ToPin)
{
-
DPRINT("PcRegisterPhysicalConnection\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DeviceObject || !FromUnknown || !ToUnknown)
return STATUS_INVALID_PARAMETER;
@@ -134,6 +134,8 @@
IN PUNKNOWN ToUnknown,
IN ULONG ToPin)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!DeviceObject || !FromString || !ToUnknown)
return STATUS_INVALID_PARAMETER;
@@ -151,6 +153,8 @@
IN PUNICODE_STRING ToString,
IN ULONG ToPin)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!DeviceObject || !FromUnknown || !ToString)
return STATUS_INVALID_PARAMETER;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/drm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/drm.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/drm.c [iso-8859-1] Thu Apr 23 23:06:36
2009
@@ -18,6 +18,7 @@
IN PVOID *paHandlers,
IN ULONG NumHandlers)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
}
@@ -31,6 +32,7 @@
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
}
@@ -42,6 +44,7 @@
PcDestroyContent(
IN ULONG ContentId)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmDestroyContent(ContentId);
}
@@ -55,6 +58,7 @@
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
}
@@ -67,6 +71,7 @@
IN ULONG ContentId,
IN PFILE_OBJECT FileObject)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToFileObject(ContentId, FileObject);
}
@@ -92,5 +97,6 @@
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmGetContentRights(ContentId, DrmRights);
}
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 Apr 23
23:06:36 2009
@@ -79,6 +79,7 @@
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
}
@@ -88,6 +89,7 @@
IN IDrmPort2 * iface,
IN ULONG ContentId)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmDestroyContent(ContentId);
}
@@ -109,6 +111,7 @@
IN PUNKNOWN pUnknown,
IN ULONG NumMethods)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToInterface(ContentId, pUnknown, NumMethods);
}
@@ -119,6 +122,7 @@
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmGetContentRights(ContentId, DrmRights);
}
@@ -130,6 +134,7 @@
IN PVOID * paHandlers,
IN ULONG NumHandlers)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
}
@@ -141,6 +146,7 @@
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -242,6 +242,7 @@
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor;
DPRINT("IInterruptSync_fnConnect\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
Descriptor =
This->ResourceList->lpVtbl->FindTranslatedEntry(This->ResourceList,
CmResourceTypeInterrupt, This->ResourceIndex);
if (!Descriptor)
@@ -273,7 +274,9 @@
IN IInterruptSync * iface)
{
IInterruptSyncImpl * This = (IInterruptSyncImpl*)iface;
+
DPRINT("IInterruptSync_fnDisconnect\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->Interrupt)
{
@@ -297,6 +300,7 @@
IInterruptSyncImpl * This = (IInterruptSyncImpl*)iface;
DPRINT("IInterruptSync_fnRegisterServiceRoutine\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
NewEntry = AllocateItem(NonPagedPool, sizeof(SYNC_ENTRY), TAG_PORTCLASS);
if (!NewEntry)
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] Thu Apr 23 23:06:36
2009
@@ -291,6 +291,8 @@
PPCLASS_DEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* initialize the notification event */
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 Apr 23
23:06:36 2009
@@ -13,7 +13,6 @@
LIST_ENTRY Entry;
KSSTREAM_HEADER *Header;
PIRP Irp;
- KDPC Dpc;
ULONG NumTags;
PVOID * Tag;
@@ -48,15 +47,9 @@
VOID
NTAPI
-DpcRoutine(
- IN struct _KDPC *Dpc,
- IN PVOID DeferredContext,
- IN PVOID SystemArgument1,
- IN PVOID SystemArgument2)
-{
- PIRP_MAPPING CurMapping;
-
- CurMapping = (PIRP_MAPPING)SystemArgument1;
+FreeMappingRoutine(
+ PIRP_MAPPING CurMapping)
+{
ASSERT(CurMapping);
if (CurMapping->Irp)
@@ -159,8 +152,6 @@
Mapping->Header = (KSSTREAM_HEADER*)Buffer;
Mapping->Irp = Irp;
- KeInitializeDpc(&Mapping->Dpc, DpcRoutine, (PVOID)Mapping);
- KeSetImportanceDpc(&Mapping->Dpc, HighImportance);
if (This->MaxFrameSize)
{
@@ -215,7 +206,7 @@
IN ULONG BytesWritten)
{
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
- PIRP_MAPPING Mapping;
+ PIRP_MAPPING Mapping, CurMapping;
This->CurrentOffset += BytesWritten;
This->NumDataAvailable -= BytesWritten;
@@ -224,11 +215,12 @@
{
This->CurrentOffset = 0;
Mapping = (PIRP_MAPPING)ExInterlockedRemoveHeadList(&This->ListHead,
&This->Lock);
-
+ CurMapping = This->FirstMap;
+
+ (void)InterlockedExchangePointer((PVOID volatile*)&This->FirstMap,
(PVOID)Mapping);
InterlockedDecrement(&This->NumMappings);
- KeInsertQueueDpc(&This->FirstMap->Dpc, (PVOID)This->FirstMap,
NULL);
- (void)InterlockedExchangePointer((PVOID volatile*)&This->FirstMap,
(PVOID)Mapping);
+ FreeMappingRoutine(CurMapping);
}
}
@@ -279,6 +271,9 @@
IIrpQueue_fnCancelBuffers(
IN IIrpQueue *iface)
{
+ IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
+
+ This->StartStream = FALSE;
return TRUE;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -19,6 +19,7 @@
NTSTATUS Status = STATUS_INVALID_PARAMETER;
DPRINT("PcNewMiniport entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!OutMiniport)
{
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport_dmus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport_dmus.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/miniport_dmus.c [iso-8859-1] Thu Apr
23 23:06:36 2009
@@ -21,7 +21,7 @@
/* IUnknown methods */
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IMiniportDMus_fnQueryInterface(
IMiniportDMus* iface,
IN REFIID refiid,
@@ -39,7 +39,7 @@
}
ULONG
-STDMETHODCALLTYPE
+NTAPI
IMiniportDMus_fnAddRef(
IMiniportDMus* iface)
{
@@ -49,7 +49,7 @@
}
ULONG
-STDMETHODCALLTYPE
+NTAPI
IMiniportDMust_fnRelease(
IMiniportDMus* iface)
{
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 Apr
23 23:06:36 2009
@@ -24,7 +24,6 @@
KSSTATE State;
PKSDATAFORMAT Format;
KSPIN_CONNECT * ConnectDetails;
- KDPC Dpc;
PVOID CommonBuffer;
ULONG CommonBufferSize;
@@ -35,11 +34,18 @@
PUCHAR ActiveIrpBuffer;
ULONG ActiveIrpBufferSize;
ULONG ActiveIrpOffset;
- ULONG DelayedRequestInProgress;
ULONG FrameSize;
BOOL Capture;
}IPortPinWaveCyclicImpl;
+
+
+typedef struct
+{
+ IPortPinWaveCyclicImpl *Pin;
+ PIO_WORKITEM WorkItem;
+ KSSTATE State;
+}SETSTREAM_CONTEXT, *PSETSTREAM_CONTEXT;
NTSTATUS
NTAPI
@@ -194,57 +200,64 @@
VOID
NTAPI
-StopStreamWorkerRoutine(
+SetStreamWorkerRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{
IPortPinWaveCyclicImpl * This;
- PSTOPSTREAM_CONTEXT Ctx = (PSTOPSTREAM_CONTEXT)Context;
-
- This = (IPortPinWaveCyclicImpl*)Ctx->Pin;
+ PSETSTREAM_CONTEXT Ctx = (PSETSTREAM_CONTEXT)Context;
+ KSSTATE State;
+
+ This = Ctx->Pin;
+ State = Ctx->State;
IoFreeWorkItem(Ctx->WorkItem);
FreeItem(Ctx, TAG_PORTCLASS);
- if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue))
+ /* Has the audio stream resumed? */
+ if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) && State
== KSSTATE_STOP)
return;
- /* Set the state to stop */
- This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP);
- /* Set internal state to stop */
- This->State = KSSTATE_STOP;
-
- DPRINT1("Stopping %p %u Irql %u\n", This,
This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), KeGetCurrentIrql());
+ /* Set the state */
+ if (NT_SUCCESS(This->Stream->lpVtbl->SetState(This->Stream, State)))
+ {
+ /* Set internal state to stop */
+ This->State = State;
+
+ if (This->State == KSSTATE_STOP)
+ {
+ /* reset start stream */
+ This->IrpQueue->lpVtbl->CancelBuffers(This->IrpQueue); //FIX
function name
+ DPRINT1("Stopping %u Irql %u\n", This,
This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), KeGetCurrentIrql());
+ }
+ }
}
VOID
NTAPI
-StopStreamRoutine(
- IN PKDPC Dpc,
- IN PVOID DeferredContext,
- IN PVOID SystemArgument1,
- IN PVOID SystemArgument2)
-{
- PDEVICE_OBJECT DeviceObject;
- IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)DeferredContext;
- PIO_WORKITEM WorkItem;
- PSTOPSTREAM_CONTEXT Context;
+SetStreamState(
+ IN IPortPinWaveCyclicImpl * This,
+ IN KSSTATE State)
+{
+ PDEVICE_OBJECT DeviceObject;
+ PIO_WORKITEM WorkItem;
+ PSETSTREAM_CONTEXT Context;
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
/* Has the audio stream resumed? */
- if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue))
+ if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue) && State
== KSSTATE_STOP)
return;
- /* Has the audio stream already stopped */
- if (This->State == KSSTATE_STOP)
+ /* Has the audio state already been set? */
+ if (This->State == State)
return;
/* Get device object */
DeviceObject = GetDeviceObject(This->Port);
- /* allocate stop context */
- Context = AllocateItem(NonPagedPool, sizeof(STOPSTREAM_CONTEXT), TAG_PORTCLASS);
+ /* allocate set state context */
+ Context = AllocateItem(NonPagedPool, sizeof(SETSTREAM_CONTEXT), TAG_PORTCLASS);
if (!Context)
return;
@@ -260,9 +273,10 @@
Context->Pin = (PVOID)This;
Context->WorkItem = WorkItem;
+ Context->State = State;
/* queue the work item */
- IoQueueWorkItem(WorkItem, StopStreamWorkerRoutine, DelayedWorkQueue,
(PVOID)Context);
+ IoQueueWorkItem(WorkItem, SetStreamWorkerRoutine, DelayedWorkQueue, (PVOID)Context);
}
static
@@ -277,10 +291,12 @@
ULONG BufferSize;
IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortPinWaveCyclicImpl, lpVtblServiceSink);
+ ASSERT_IRQL(DISPATCH_LEVEL);
+
Status = This->IrpQueue->lpVtbl->GetMapping(This->IrpQueue, &Buffer,
&BufferSize);
if (!NT_SUCCESS(Status))
{
- KeInsertQueueDpc(&This->Dpc, NULL, NULL);
+ SetStreamState(This, KSSTATE_STOP);
return;
}
@@ -481,9 +497,7 @@
ASSERT(IsEqualGUIDAligned(&((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->DataFormat.SubFormat,
&KSDATAFORMAT_SUBTYPE_PCM));
ASSERT(IsEqualGUIDAligned(&((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->DataFormat.Specifier,
&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX));
- Status = This->Stream->lpVtbl->SetState(This->Stream,
KSSTATE_STOP);
- ASSERT(Status == STATUS_SUCCESS);
- This->State = KSSTATE_STOP;
+ ASSERT(This->State == KSSTATE_STOP);
DPRINT1("NewDataFormat: Channels %u Bits %u Samples %u\n",
((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
@@ -501,7 +515,6 @@
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
-
}
DPRINT1("Failed to set format\n");
Irp->IoStatus.Information = 0;
@@ -921,11 +934,9 @@
if (This->IrpQueue->lpVtbl->MinimumDataAvailable(This->IrpQueue) == TRUE
&& This->State != KSSTATE_RUN)
{
+ SetStreamState(This, KSSTATE_RUN);
/* some should initiate a state request but didnt do it */
- DPRINT1("Starting stream with %lu\n",
This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue));
-
- This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_RUN);
- This->State = KSSTATE_RUN;
+ DPRINT1("Starting stream with %lu mappings Status %x\n",
This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), Status);
}
return TRUE;
@@ -958,7 +969,6 @@
This->KsPinDescriptor = KsPinDescriptor;
This->ConnectDetails = ConnectDetails;
This->Miniport = GetWaveCyclicMiniport(Port);
- KeInitializeDpc(&This->Dpc, StopStreamRoutine, (PVOID)This);
DeviceObject = GetDeviceObject(Port);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -21,6 +21,8 @@
UNICODE_STRING GuidString;
DPRINT("PcNewPort entered\n");
+
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!OutPort)
{
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -97,6 +97,8 @@
{
IPortDMusImpl * This = (IPortDMusImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortDMus_fnNewRegistryKey called w/o initiazed\n");
@@ -119,6 +121,8 @@
IMiniportDMus * Miniport;
NTSTATUS Status;
IPortDMusImpl * This = (IPortDMusImpl*)iface;
+
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@@ -166,6 +170,8 @@
{
IPortDMusImpl * This = (IPortDMusImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortDMus_fnNewRegistryKey called w/o initialized\n");
@@ -173,13 +179,6 @@
}
return STATUS_UNSUCCESSFUL;
}
-
-
-
-
-
-
-
NTSTATUS
NewPortDMus(
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -134,6 +134,8 @@
{
IPortMidiImpl * This = (IPortMidiImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortMidi_fnNewRegistryKey called w/o initiazed\n");
@@ -160,6 +162,7 @@
DPRINT("IPortMidi_fnInit entered This %p DeviceObject %p Irp %p UnknownMiniport
%p UnknownAdapter %p ResourceList %p\n",
This, DeviceObject, Irp, UnknownMiniport, UnknownAdapter, ResourceList);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@@ -239,6 +242,8 @@
{
IPortMidiImpl * This = (IPortMidiImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortMidi_fnNewRegistryKey called w/o initialized\n");
@@ -272,6 +277,7 @@
IN PSERVICEGROUP ServiceGroup)
{
UNIMPLEMENTED
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
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 Apr
23 23:06:36 2009
@@ -153,6 +153,7 @@
OUT PULONG ReturnLength)
{
IPortTopologyImpl * This = (IPortTopologyImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@@ -179,6 +180,7 @@
DPRINT("IPortTopology_fnInit entered This %p DeviceObject %p Irp %p
UnknownMiniport %p UnknownAdapter %p ResourceList %p\n",
This, DeviceObject, Irp, UnknownMiniport, UnknownAdapter, ResourceList);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@@ -255,6 +257,7 @@
OUT PULONG Disposition OPTIONAL)
{
IPortTopologyImpl * This = (IPortTopologyImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@@ -506,7 +509,7 @@
PKSOBJECT_CREATE_ITEM CreateItem;
PPIN_WORKER_CONTEXT Context;
- DPRINT("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject);
+ DPRINT1("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject);
/* access the create item */
CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
@@ -570,7 +573,7 @@
NULL);
if (!NT_SUCCESS(Status))
{
- DPRINT("Failed to get filter object\n");
+ DPRINT1("Failed to get filter object\n");
return Status;
}
@@ -580,7 +583,7 @@
/* create the dispatch object */
Status = NewDispatchObject(Irp, Filter);
- DPRINT("Filter %p\n", Filter);
+ DPRINT1("Filter %p\n", Filter);
}
else
{
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] Thu Apr
23 23:06:36 2009
@@ -287,6 +287,7 @@
OUT PULONG ReturnLength)
{
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@@ -314,6 +315,7 @@
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
DPRINT("IPortWaveCyclic_Init entered %p\n", This);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@@ -420,6 +422,8 @@
{
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initialized\n");
@@ -450,6 +454,8 @@
DEVICE_DESCRIPTION DeviceDescription;
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!This->bInitialized)
{
DPRINT("IPortWaveCyclic_fnNewSlaveDmaChannel called w/o
initialized\n");
@@ -480,8 +486,9 @@
DEVICE_DESCRIPTION DeviceDescription;
PDMACHANNEL DmaChannel;
NTSTATUS Status;
-
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
+
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
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] Thu Apr 23
23:06:36 2009
@@ -114,6 +114,7 @@
IN PKSEVENT_ENTRY EventEntry)
{
UNIMPLEMENTED
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
}
@@ -348,6 +349,7 @@
DPRINT("IPortWavePci_fnInit entered with This %p, DeviceObject %p Irp %p
UnknownMiniport %p, UnknownAdapter %p ResourceList %p\n",
This, DeviceObject, Irp, UnknownMiniport, UnknownAdapter, ResourceList);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@@ -471,6 +473,7 @@
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT("IPortWavePci_fnNewRegistryKey entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@@ -501,6 +504,7 @@
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT("IPortWavePci_fnGetDeviceProperty entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@@ -533,6 +537,7 @@
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT("IPortWavePci_fnNewMasterDmaChannel This %p entered\n", This);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
Status = PcDmaMasterDescription(ResourceList, ScatterGather, Dma32BitAddresses,
IgnoreCount, Dma64BitAddresses, DmaWidth, DmaSpeed, MaximumLength, DmaPort,
&DeviceDescription);
if (NT_SUCCESS(Status))
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepcistream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepcistream.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepcistream.c [iso-8859-1] Thu
Apr 23 23:06:36 2009
@@ -86,6 +86,8 @@
{
IPortWavePciStreamImpl * This = (IPortWavePciStreamImpl*)iface;
+ ASSERT_IRQL(DISPATCH_LEVEL);
+
return This->Queue->lpVtbl->GetMappingWithTag(This->Queue, Tag,
PhysicalAddress, VirtualAddress, ByteCount, Flags);
}
@@ -97,6 +99,9 @@
IN PVOID Tag)
{
IPortWavePciStreamImpl * This = (IPortWavePciStreamImpl*)iface;
+
+ ASSERT_IRQL(DISPATCH_LEVEL);
+
This->Queue->lpVtbl->ReleaseMappingWithTag(This->Queue, Tag);
return STATUS_SUCCESS;
}
@@ -108,6 +113,7 @@
IN IPortWavePciStream *iface)
{
UNIMPLEMENTED
+ ASSERT_IRQL(DISPATCH_LEVEL);
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -24,6 +24,7 @@
IAdapterPowerManagement * pPower;
DPRINT("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n",
pUnknown, pvContext);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!pUnknown || !pvContext)
return STATUS_INVALID_PARAMETER;
@@ -72,6 +73,8 @@
POWER_STATE PowerState;
PPCLASS_DEVICE_EXTENSION DeviceExt;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
if (!DeviceObject || !RequestedNewState)
return STATUS_INVALID_PARAMETER;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -28,6 +28,8 @@
#define STDCALL
#define DDKAPI
#endif
+
+#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
NTSTATUS
NTAPI
@@ -181,12 +183,6 @@
KSSTREAM_HEADER Header;
PIRP Irp;
}CONTEXT_WRITE, *PCONTEXT_WRITE;
-
-typedef struct
-{
- PVOID Pin;
- PIO_WORKITEM WorkItem;
-}STOPSTREAM_CONTEXT, *PSTOPSTREAM_CONTEXT;
typedef struct
{
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] Thu Apr 23
23:06:36 2009
@@ -14,6 +14,7 @@
LONG ref;
HANDLE hKey;
+ BOOL Deleted;
}IRegistryKeyImpl;
@@ -22,7 +23,7 @@
ULONG
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnAddRef(
IN IRegistryKey* iface)
{
@@ -34,7 +35,7 @@
}
ULONG
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnRelease(
IN IRegistryKey* iface)
{
@@ -56,7 +57,7 @@
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnQueryInterface(
IN IRegistryKey* iface,
IN REFIID refiid,
@@ -77,17 +78,29 @@
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnDeleteKey(
IN IRegistryKey* iface)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- DPRINT("IRegistryKey_fnDeleteKey entered\n");
- return ZwDeleteKey(This->hKey);
-}
-
-NTSTATUS
-STDMETHODCALLTYPE
+ NTSTATUS Status;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
+ Status = ZwDeleteKey(This->hKey);
+ if (NT_SUCCESS(Status))
+ {
+ This->Deleted = TRUE;
+ }
+ return Status;
+}
+
+NTSTATUS
+NTAPI
IRegistryKey_fnEnumerateKey(
IN IRegistryKey* iface,
IN ULONG Index,
@@ -97,12 +110,18 @@
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- DPRINT("IRegistryKey_fnEnumerateKey entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
return ZwEnumerateKey(This->hKey, Index, KeyInformationClass, KeyInformation,
Length, ResultLength);
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnEnumerateKeyValue(
IN IRegistryKey* iface,
IN ULONG Index,
@@ -112,12 +131,18 @@
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- DPRINT("IRegistryKey_fnEnumerateKeyValue entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
return ZwEnumerateValueKey(This->hKey, Index, KeyValueInformationClass,
KeyValueInformation, Length, ResultLength);
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnNewSubKey(
IN IRegistryKey* iface,
OUT PREGISTRYKEY *RegistrySubKey,
@@ -132,7 +157,14 @@
HANDLE hKey;
IRegistryKeyImpl * NewThis, *This = (IRegistryKeyImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
DPRINT("IRegistryKey_fnNewSubKey entered %S\n", SubKeyName);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
InitializeObjectAttributes(&Attributes, SubKeyName, 0, This->hKey, NULL);
Status = ZwCreateKey(&hKey, KEY_READ | KEY_WRITE, &Attributes, 0, NULL, 0,
Disposition);
@@ -164,7 +196,7 @@
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnQueryKey(
IN IRegistryKey* iface,
IN KEY_INFORMATION_CLASS KeyInformationClass,
@@ -173,25 +205,36 @@
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- DPRINT("IRegistryKey_fnQueryKey entered\n");
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
return ZwQueryKey(This->hKey, KeyInformationClass, KeyInformation, Length,
ResultLength);
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnQueryRegistryValues(
IN IRegistryKey* iface,
IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
IN PVOID Context OPTIONAL)
{
- //IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- UNIMPLEMENTED
- DbgBreakPoint();
- return STATUS_UNSUCCESSFUL;
-}
-
-NTSTATUS
-STDMETHODCALLTYPE
+ IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
+ return RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, (PCWSTR)This->hKey, QueryTable,
Context, NULL);
+}
+
+NTSTATUS
+NTAPI
IRegistryKey_fnQueryValueKey(
IN IRegistryKey* iface,
IN PUNICODE_STRING ValueName,
@@ -201,12 +244,20 @@
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
+
DPRINT("IRegistryKey_fnQueryValueKey entered %p value %wZ\n", This,
ValueName);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
return ZwQueryValueKey(This->hKey, ValueName, KeyValueInformationClass,
KeyValueInformation, Length, ResultLength);
}
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IRegistryKey_fnSetValueKey(
IN IRegistryKey* iface,
IN PUNICODE_STRING ValueName OPTIONAL,
@@ -217,6 +268,13 @@
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT("IRegistryKey_fnSetValueKey entered %S\n", ValueName->Buffer);
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ if (This->Deleted)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
return ZwSetValueKey(This->hKey, ValueName, 0, Type, Data, DataSize);
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c [iso-8859-1] Thu Apr 23
23:06:36 2009
@@ -98,6 +98,8 @@
{
IResourceListImpl * This = (IResourceListImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
return This->TranslatedResourceList->List[0].PartialResourceList.Count;
}
@@ -107,12 +109,13 @@
IResourceList* iface,
IN CM_RESOURCE_TYPE Type)
{
- /* I guess the translated and untranslated lists will be same length? */
-
IResourceListImpl * This = (IResourceListImpl*)iface;
ULONG Index, Count = 0;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
+ /* I guess the translated and untranslated lists will be same length? */
for (Index = 0; Index <
This->TranslatedResourceList->List[0].PartialResourceList.Count; Index ++ )
{
PartialDescriptor =
&This->TranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
@@ -138,6 +141,8 @@
IResourceListImpl * This = (IResourceListImpl*)iface;
ULONG DescIndex, Count = 0;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
+
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
for (DescIndex = 0; DescIndex <
This->TranslatedResourceList->List[0].PartialResourceList.Count; DescIndex ++ )
{
@@ -168,6 +173,8 @@
ULONG DescIndex, Count = 0;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
for (DescIndex = 0; DescIndex <
This->UntranslatedResourceList->List[0].PartialResourceList.Count; DescIndex ++ )
{
PartialDescriptor =
&This->UntranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[DescIndex];
@@ -196,6 +203,8 @@
ULONG NewTranslatedSize, NewUntranslatedSize;
IResourceListImpl * This = (IResourceListImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
NewTranslatedSize = sizeof(CM_RESOURCE_LIST) +
This->TranslatedResourceList[0].List->PartialResourceList.Count *
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
NewTranslatedResources = AllocateItem(This->PoolType, NewTranslatedSize,
TAG_PORTCLASS);
if (!NewTranslatedResources)
@@ -254,6 +263,8 @@
ULONG NewTranslatedSize;
IResourceListImpl * This = (IResourceListImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
Translated = Parent->lpVtbl->FindTranslatedEntry(Parent, Type, Index);
if (!Translated)
return STATUS_INVALID_PARAMETER;
@@ -287,6 +298,8 @@
{
IResourceListImpl * This = (IResourceListImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
return This->TranslatedResourceList;
}
@@ -296,6 +309,8 @@
IResourceList* iface)
{
IResourceListImpl * This = (IResourceListImpl*)iface;
+
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return This->UntranslatedResourceList;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c [iso-8859-1] Thu Apr
23 23:06:36 2009
@@ -25,9 +25,7 @@
BOOL Initialized;
BOOL TimerActive;
KTIMER Timer;
- KEVENT DpcEvent;
KDPC Dpc;
-
}IServiceGroupImpl;
@@ -38,7 +36,7 @@
NTSTATUS
-STDMETHODCALLTYPE
+NTAPI
IServiceGroup_fnQueryInterface(
IServiceGroup* iface,
IN REFIID refiid,
@@ -66,7 +64,7 @@
}
ULONG
-STDMETHODCALLTYPE
+NTAPI
IServiceGroup_fnAddRef(
IServiceGroup* iface)
{
@@ -76,7 +74,7 @@
}
ULONG
-STDMETHODCALLTYPE
+NTAPI
IServiceGroup_fnRelease(
IServiceGroup* iface)
{
@@ -95,7 +93,6 @@
Entry->pServiceSink->lpVtbl->Release(Entry->pServiceSink);
FreeItem(Entry, TAG_PORTCLASS);
}
- KeWaitForSingleObject(&This->DpcEvent, Executive, KernelMode, FALSE,
NULL);
KeCancelTimer(&This->Timer);
FreeItem(This, TAG_PORTCLASS);
return 0;
@@ -115,17 +112,18 @@
IServiceGroup_fnRequestService(
IN IServiceGroup * iface)
{
- PLIST_ENTRY CurEntry;
- PGROUP_ENTRY Entry;
- IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
-
- CurEntry = This->ServiceSinkHead.Flink;
- while (CurEntry != &This->ServiceSinkHead)
- {
- Entry = CONTAINING_RECORD(CurEntry, GROUP_ENTRY, Entry);
- Entry->pServiceSink->lpVtbl->RequestService(Entry->pServiceSink);
- CurEntry = CurEntry->Flink;
- }
+ KIRQL OldIrql;
+ IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
+
+ if (KeGetCurrentIrql() > DISPATCH_LEVEL)
+ {
+ KeInsertQueueDpc(&This->Dpc, NULL, NULL);
+ return;
+ }
+
+ KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
+ KeInsertQueueDpc(&This->Dpc, NULL, NULL);
+ KeLowerIrql(OldIrql);
}
//---------------------------------------------------------------
@@ -141,6 +139,8 @@
PGROUP_ENTRY Entry;
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
+
Entry = AllocateItem(NonPagedPool, sizeof(GROUP_ENTRY), TAG_PORTCLASS);
if (!Entry)
return STATUS_INSUFFICIENT_RESOURCES;
@@ -148,8 +148,6 @@
Entry->pServiceSink = pServiceSink;
pServiceSink->lpVtbl->AddRef(pServiceSink);
- //FIXME
- //check if Dpc is active
InsertTailList(&This->ServiceSinkHead, &Entry->Entry);
return STATUS_SUCCESS;
@@ -165,9 +163,7 @@
PGROUP_ENTRY Entry;
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
- //FIXME
- //check if Dpc is active
- //
+ ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
CurEntry = This->ServiceSinkHead.Flink;
while (CurEntry != &This->ServiceSinkHead)
@@ -194,11 +190,18 @@
IN PVOID SystemArgument2
)
{
+ PLIST_ENTRY CurEntry;
+ PGROUP_ENTRY Entry;
IServiceGroupImpl * This = (IServiceGroupImpl*)DeferredContext;
- IServiceGroup_fnRequestService((IServiceGroup*)DeferredContext);
- KeSetEvent(&This->DpcEvent, IO_SOUND_INCREMENT, FALSE);
-}
-
+
+ CurEntry = This->ServiceSinkHead.Flink;
+ while (CurEntry != &This->ServiceSinkHead)
+ {
+ Entry = CONTAINING_RECORD(CurEntry, GROUP_ENTRY, Entry);
+ Entry->pServiceSink->lpVtbl->RequestService(Entry->pServiceSink);
+ CurEntry = CurEntry->Flink;
+ }
+}
VOID
NTAPI
@@ -207,11 +210,11 @@
{
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
+ ASSERT_IRQL(DISPATCH_LEVEL);
+
if (!This->Initialized)
{
- KeInitializeEvent(&This->DpcEvent, SynchronizationEvent, FALSE);
KeInitializeTimerEx(&This->Timer, NotificationTimer);
- KeInitializeDpc(&This->Dpc, IServiceGroupDpc, (PVOID)This);
This->Initialized = TRUE;
}
}
@@ -224,6 +227,8 @@
{
LARGE_INTEGER DueTime;
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
+
+ ASSERT_IRQL(DISPATCH_LEVEL);
DueTime.QuadPart = ullDelay;
@@ -233,8 +238,6 @@
KeSetTimer(&This->Timer, DueTime, &This->Dpc);
else
KeInsertQueueDpc(&This->Dpc, NULL, NULL);
-
- KeClearEvent(&This->DpcEvent);
}
}
@@ -244,6 +247,8 @@
IN IServiceGroup * iface)
{
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
+
+ ASSERT_IRQL(DISPATCH_LEVEL);
if (This->Initialized)
{
@@ -283,6 +288,8 @@
This->lpVtbl = &vt_IServiceGroup;
This->ref = 1;
+ KeInitializeDpc(&This->Dpc, IServiceGroupDpc, (PVOID)This);
+ KeSetImportanceDpc(&This->Dpc, HighImportance);
InitializeListHead(&This->ServiceSinkHead);
*OutServiceGroup = (PSERVICEGROUP)&This->lpVtbl;