- 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

svn path=/trunk/; revision=40672
This commit is contained in:
Johannes Anderwald 2009-04-23 19:06:36 +00:00
parent 61eca830d1
commit 0f406bf6b8
23 changed files with 261 additions and 118 deletions

View file

@ -46,6 +46,7 @@ PcInitializeAdapterDriver(
//ULONG i;
DPRINT1("PcInitializeAdapterDriver\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* Our IRP handlers */
DPRINT1("Setting IRP handlers\n");
@ -94,6 +95,7 @@ PcAddAdapterDevice(
PPCLASS_DEVICE_EXTENSION portcls_ext = NULL;
DPRINT1("PcAddAdapterDevice called\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DriverObject || !PhysicalDeviceObject || !StartDevice)
{
@ -223,6 +225,7 @@ PcRegisterSubdevice(
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)

View file

@ -20,6 +20,7 @@ PcGetDeviceProperty(
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return IoGetDeviceProperty(DeviceObject, DeviceProperty, BufferLength, PropertyBuffer, ResultLength);
}
@ -49,6 +50,7 @@ PcRegisterIoTimeout(
{
NTSTATUS Status;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* FIXME
* check if timer is already used
@ -74,6 +76,8 @@ PcUnregisterIoTimeout(
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
/* FIXME
* check if timer is already used
*/
@ -93,6 +97,7 @@ PcCompletePendingPropertyRequest(
IN NTSTATUS NtStatus)
{
/* sanity checks */
ASSERT_IRQL(DISPATCH_LEVEL);
if (!PropertyRequest)
return STATUS_INVALID_PARAMETER;

View file

@ -114,8 +114,8 @@ PcRegisterPhysicalConnection(
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 @@ PcRegisterPhysicalConnectionFromExternal(
IN PUNKNOWN ToUnknown,
IN ULONG ToPin)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DeviceObject || !FromString || !ToUnknown)
return STATUS_INVALID_PARAMETER;
@ -151,6 +153,8 @@ PcRegisterPhysicalConnectionToExternal(
IN PUNICODE_STRING ToString,
IN ULONG ToPin)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DeviceObject || !FromUnknown || !ToString)
return STATUS_INVALID_PARAMETER;

View file

@ -18,6 +18,7 @@ PcAddContentHandlers(
IN PVOID *paHandlers,
IN ULONG NumHandlers)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
}
@ -31,6 +32,7 @@ PcCreateContentMixed(
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
}
@ -42,6 +44,7 @@ NTAPI
PcDestroyContent(
IN ULONG ContentId)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmDestroyContent(ContentId);
}
@ -55,6 +58,7 @@ PcForwardContentToDeviceObject(
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
}
@ -67,6 +71,7 @@ PcForwardContentToFileObject(
IN ULONG ContentId,
IN PFILE_OBJECT FileObject)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToFileObject(ContentId, FileObject);
}
@ -92,5 +97,6 @@ PcGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmGetContentRights(ContentId, DrmRights);
}

View file

@ -79,6 +79,7 @@ IDrmPort2_fnCreateContentMixed(
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
}
@ -88,6 +89,7 @@ IDrmPort2_fnDestroyContent(
IN IDrmPort2 * iface,
IN ULONG ContentId)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmDestroyContent(ContentId);
}
@ -109,6 +111,7 @@ IDrmPort2_fnForwardContentToInterface(
IN PUNKNOWN pUnknown,
IN ULONG NumMethods)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToInterface(ContentId, pUnknown, NumMethods);
}
@ -119,6 +122,7 @@ IDrmPort2_fnGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmGetContentRights(ContentId, DrmRights);
}
@ -130,6 +134,7 @@ IDrmPort2_fnAddContentHandlers(
IN PVOID * paHandlers,
IN ULONG NumHandlers)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
}
@ -141,6 +146,7 @@ IDrmPort2_fnForwardContentToDeviceObject(
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
}

View file

@ -242,6 +242,7 @@ IInterruptSync_fnConnect(
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 @@ IInterruptSync_fnDisconnect(
IN IInterruptSync * iface)
{
IInterruptSyncImpl * This = (IInterruptSyncImpl*)iface;
DPRINT("IInterruptSync_fnDisconnect\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->Interrupt)
{
@ -297,6 +300,7 @@ IInterruptSync_fnRegisterServiceRoutine(
IInterruptSyncImpl * This = (IInterruptSyncImpl*)iface;
DPRINT("IInterruptSync_fnRegisterServiceRoutine\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
NewEntry = AllocateItem(NonPagedPool, sizeof(SYNC_ENTRY), TAG_PORTCLASS);
if (!NewEntry)

View file

@ -291,6 +291,8 @@ PcForwardIrpSynchronous(
PPCLASS_DEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* initialize the notification event */

View file

@ -13,7 +13,6 @@ typedef struct _IRP_MAPPING_
LIST_ENTRY Entry;
KSSTREAM_HEADER *Header;
PIRP Irp;
KDPC Dpc;
ULONG NumTags;
PVOID * Tag;
@ -48,15 +47,9 @@ typedef struct
VOID
NTAPI
DpcRoutine(
IN struct _KDPC *Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
FreeMappingRoutine(
PIRP_MAPPING CurMapping)
{
PIRP_MAPPING CurMapping;
CurMapping = (PIRP_MAPPING)SystemArgument1;
ASSERT(CurMapping);
if (CurMapping->Irp)
@ -159,8 +152,6 @@ IIrpQueue_fnAddMapping(
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 @@ IIrpQueue_fnUpdateMapping(
IN ULONG BytesWritten)
{
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
PIRP_MAPPING Mapping;
PIRP_MAPPING Mapping, CurMapping;
This->CurrentOffset += BytesWritten;
This->NumDataAvailable -= BytesWritten;
@ -224,11 +215,12 @@ IIrpQueue_fnUpdateMapping(
{
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 @@ NTAPI
IIrpQueue_fnCancelBuffers(
IN IIrpQueue *iface)
{
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
This->StartStream = FALSE;
return TRUE;
}

View file

@ -19,6 +19,7 @@ PcNewMiniport(
NTSTATUS Status = STATUS_INVALID_PARAMETER;
DPRINT("PcNewMiniport entered\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!OutMiniport)
{

View file

@ -21,7 +21,7 @@ typedef struct
/* IUnknown methods */
NTSTATUS
STDMETHODCALLTYPE
NTAPI
IMiniportDMus_fnQueryInterface(
IMiniportDMus* iface,
IN REFIID refiid,
@ -39,7 +39,7 @@ IMiniportDMus_fnQueryInterface(
}
ULONG
STDMETHODCALLTYPE
NTAPI
IMiniportDMus_fnAddRef(
IMiniportDMus* iface)
{
@ -49,7 +49,7 @@ IMiniportDMus_fnAddRef(
}
ULONG
STDMETHODCALLTYPE
NTAPI
IMiniportDMust_fnRelease(
IMiniportDMus* iface)
{

View file

@ -24,7 +24,6 @@ typedef struct
KSSTATE State;
PKSDATAFORMAT Format;
KSPIN_CONNECT * ConnectDetails;
KDPC Dpc;
PVOID CommonBuffer;
ULONG CommonBufferSize;
@ -35,12 +34,19 @@ typedef struct
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
IPortWaveCyclic_fnProcessNewIrp(
@ -194,57 +200,64 @@ UpdateCommonBufferOverlap(
VOID
NTAPI
StopStreamWorkerRoutine(
SetStreamWorkerRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{
IPortPinWaveCyclicImpl * This;
PSTOPSTREAM_CONTEXT Ctx = (PSTOPSTREAM_CONTEXT)Context;
PSETSTREAM_CONTEXT Ctx = (PSETSTREAM_CONTEXT)Context;
KSSTATE State;
This = (IPortPinWaveCyclicImpl*)Ctx->Pin;
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;
/* Set the state */
if (NT_SUCCESS(This->Stream->lpVtbl->SetState(This->Stream, State)))
{
/* Set internal state to stop */
This->State = State;
DPRINT1("Stopping %p %u Irql %u\n", This, This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), KeGetCurrentIrql());
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)
SetStreamState(
IN IPortPinWaveCyclicImpl * This,
IN KSSTATE State)
{
PDEVICE_OBJECT DeviceObject;
IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)DeferredContext;
PIO_WORKITEM WorkItem;
PSTOPSTREAM_CONTEXT Context;
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 @@ StopStreamRoutine(
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 @@ IServiceSink_fnRequestService(
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 @@ IPortPinWaveCyclic_HandleKsProperty(
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 @@ IPortPinWaveCyclic_HandleKsProperty(
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
}
DPRINT1("Failed to set format\n");
Irp->IoStatus.Information = 0;
@ -921,11 +934,9 @@ IPortPinWaveCyclic_fnFastWrite(
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 @@ IPortPinWaveCyclic_fnInit(
This->KsPinDescriptor = KsPinDescriptor;
This->ConnectDetails = ConnectDetails;
This->Miniport = GetWaveCyclicMiniport(Port);
KeInitializeDpc(&This->Dpc, StopStreamRoutine, (PVOID)This);
DeviceObject = GetDeviceObject(Port);

View file

@ -22,6 +22,8 @@ PcNewPort(
DPRINT("PcNewPort entered\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!OutPort)
{
DPRINT("PcNewPort was supplied a NULL OutPort parameter\n");

View file

@ -97,6 +97,8 @@ IPortDMus_fnGetDeviceProperty(
{
IPortDMusImpl * This = (IPortDMusImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortDMus_fnNewRegistryKey called w/o initiazed\n");
@ -120,6 +122,8 @@ IPortDMus_fnInit(
NTSTATUS Status;
IPortDMusImpl * This = (IPortDMusImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
DPRINT("IPortDMus_Init called again\n");
@ -166,6 +170,8 @@ IPortDMus_fnNewRegistryKey(
{
IPortDMusImpl * This = (IPortDMusImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortDMus_fnNewRegistryKey called w/o initialized\n");
@ -174,13 +180,6 @@ IPortDMus_fnNewRegistryKey(
return STATUS_UNSUCCESSFUL;
}
NTSTATUS
NewPortDMus(
OUT PPORT* OutPort)

View file

@ -134,6 +134,8 @@ IPortMidi_fnGetDeviceProperty(
{
IPortMidiImpl * This = (IPortMidiImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortMidi_fnNewRegistryKey called w/o initiazed\n");
@ -160,6 +162,7 @@ IPortMidi_fnInit(
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 @@ IPortMidi_fnNewRegistryKey(
{
IPortMidiImpl * This = (IPortMidiImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortMidi_fnNewRegistryKey called w/o initialized\n");
@ -272,6 +277,7 @@ IPortMidi_fnRegisterServiceGroup(
IN PSERVICEGROUP ServiceGroup)
{
UNIMPLEMENTED
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return STATUS_SUCCESS;
}

View file

@ -153,6 +153,7 @@ IPortTopology_fnGetDeviceProperty(
OUT PULONG ReturnLength)
{
IPortTopologyImpl * This = (IPortTopologyImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@ -179,6 +180,7 @@ IPortTopology_fnInit(
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 @@ IPortTopology_fnNewRegistryKey(
OUT PULONG Disposition OPTIONAL)
{
IPortTopologyImpl * This = (IPortTopologyImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@ -506,7 +509,7 @@ PcCreateItemDispatch(
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 @@ PcCreateItemDispatch(
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 @@ PcCreateItemDispatch(
/* create the dispatch object */
Status = NewDispatchObject(Irp, Filter);
DPRINT("Filter %p\n", Filter);
DPRINT1("Filter %p\n", Filter);
}
else
{

View file

@ -287,6 +287,7 @@ IPortWaveCyclic_fnGetDeviceProperty(
OUT PULONG ReturnLength)
{
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@ -314,6 +315,7 @@ IPortWaveCyclic_fnInit(
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
DPRINT("IPortWaveCyclic_Init entered %p\n", This);
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (This->bInitialized)
{
@ -420,6 +422,8 @@ IPortWaveCyclic_fnNewRegistryKey(
{
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initialized\n");
@ -450,6 +454,8 @@ IPortWaveCyclic_fnNewMasterDmaChannel(
DEVICE_DESCRIPTION DeviceDescription;
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortWaveCyclic_fnNewSlaveDmaChannel called w/o initialized\n");
@ -480,9 +486,10 @@ IPortWaveCyclic_fnNewSlaveDmaChannel(
DEVICE_DESCRIPTION DeviceDescription;
PDMACHANNEL DmaChannel;
NTSTATUS Status;
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
DPRINT("IPortWaveCyclic_fnNewSlaveDmaChannel called w/o initialized\n");

View file

@ -114,6 +114,7 @@ IPortEvents_fnAddEventToEventList(
IN PKSEVENT_ENTRY EventEntry)
{
UNIMPLEMENTED
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
}
@ -348,6 +349,7 @@ IPortWavePci_fnInit(
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 @@ IPortWavePci_fnNewRegistryKey(
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT("IPortWavePci_fnNewRegistryKey entered\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@ -501,6 +504,7 @@ IPortWavePci_fnGetDeviceProperty(
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT("IPortWavePci_fnGetDeviceProperty entered\n");
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!This->bInitialized)
{
@ -533,6 +537,7 @@ IPortWavePci_fnNewMasterDmaChannel(
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))

View file

@ -86,6 +86,8 @@ IPortWavePciStream_fnGetMapping(
{
IPortWavePciStreamImpl * This = (IPortWavePciStreamImpl*)iface;
ASSERT_IRQL(DISPATCH_LEVEL);
return This->Queue->lpVtbl->GetMappingWithTag(This->Queue, Tag, PhysicalAddress, VirtualAddress, ByteCount, Flags);
}
@ -97,6 +99,9 @@ IPortWavePciStream_fnReleaseMapping(
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 @@ IPortWavePciStream_fnTerminatePacket(
IN IPortWavePciStream *iface)
{
UNIMPLEMENTED
ASSERT_IRQL(DISPATCH_LEVEL);
return STATUS_SUCCESS;
}

View file

@ -24,6 +24,7 @@ PcRegisterAdapterPowerManagement(
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 @@ PcRequestNewPowerState(
POWER_STATE PowerState;
PPCLASS_DEVICE_EXTENSION DeviceExt;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!DeviceObject || !RequestedNewState)
return STATUS_INVALID_PARAMETER;

View file

@ -29,6 +29,8 @@
#define DDKAPI
#endif
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
NTSTATUS
NTAPI
PortClsCreate(
@ -182,12 +184,6 @@ typedef struct
PIRP Irp;
}CONTEXT_WRITE, *PCONTEXT_WRITE;
typedef struct
{
PVOID Pin;
PIO_WORKITEM WorkItem;
}STOPSTREAM_CONTEXT, *PSTOPSTREAM_CONTEXT;
typedef struct
{
PVOID Pin;

View file

@ -14,6 +14,7 @@ typedef struct
LONG ref;
HANDLE hKey;
BOOL Deleted;
}IRegistryKeyImpl;
@ -22,7 +23,7 @@ static IRegistryKeyVtbl vt_IRegistryKey;
ULONG
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnAddRef(
IN IRegistryKey* iface)
{
@ -34,7 +35,7 @@ IRegistryKey_fnAddRef(
}
ULONG
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnRelease(
IN IRegistryKey* iface)
{
@ -56,7 +57,7 @@ IRegistryKey_fnRelease(
}
NTSTATUS
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnQueryInterface(
IN IRegistryKey* iface,
IN REFIID refiid,
@ -77,17 +78,29 @@ IRegistryKey_fnQueryInterface(
}
NTSTATUS
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnDeleteKey(
IN IRegistryKey* iface)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT("IRegistryKey_fnDeleteKey entered\n");
return ZwDeleteKey(This->hKey);
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
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnEnumerateKey(
IN IRegistryKey* iface,
IN ULONG Index,
@ -97,12 +110,18 @@ IRegistryKey_fnEnumerateKey(
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 @@ IRegistryKey_fnEnumerateKeyValue(
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,8 +157,15 @@ IRegistryKey_fnNewSubKey(
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);
if (!NT_SUCCESS(Status))
@ -164,7 +196,7 @@ IRegistryKey_fnNewSubKey(
}
NTSTATUS
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnQueryKey(
IN IRegistryKey* iface,
IN KEY_INFORMATION_CLASS KeyInformationClass,
@ -173,25 +205,36 @@ IRegistryKey_fnQueryKey(
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;
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
STDMETHODCALLTYPE
NTAPI
IRegistryKey_fnQueryValueKey(
IN IRegistryKey* iface,
IN PUNICODE_STRING ValueName,
@ -201,12 +244,20 @@ IRegistryKey_fnQueryValueKey(
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 @@ IRegistryKey_fnSetValueKey(
{
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);
}

View file

@ -98,6 +98,8 @@ IResourceList_fnNumberOfEntries(IResourceList* iface)
{
IResourceListImpl * This = (IResourceListImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return This->TranslatedResourceList->List[0].PartialResourceList.Count;
}
@ -107,12 +109,13 @@ IResourceList_fnNumberOfEntriesOfType(
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];
@ -139,6 +142,8 @@ IResourceList_fnFindTranslatedEntry(
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 ++ )
{
PartialDescriptor = &This->TranslatedResourceList->List[0].PartialResourceList.PartialDescriptors[DescIndex];
@ -168,6 +173,8 @@ IResourceList_fnFindUntranslatedEntry(
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 @@ IResourceList_fnAddEntry(
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 @@ IResourceList_fnAddEntryFromParent(
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 @@ IResourceList_fnTranslatedList(
{
IResourceListImpl * This = (IResourceListImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return This->TranslatedResourceList;
}
@ -297,6 +310,8 @@ IResourceList_fnUntranslatedList(
{
IResourceListImpl * This = (IResourceListImpl*)iface;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
return This->UntranslatedResourceList;
}

View file

@ -25,9 +25,7 @@ typedef struct
BOOL Initialized;
BOOL TimerActive;
KTIMER Timer;
KEVENT DpcEvent;
KDPC Dpc;
}IServiceGroupImpl;
@ -38,7 +36,7 @@ typedef struct
NTSTATUS
STDMETHODCALLTYPE
NTAPI
IServiceGroup_fnQueryInterface(
IServiceGroup* iface,
IN REFIID refiid,
@ -66,7 +64,7 @@ IServiceGroup_fnQueryInterface(
}
ULONG
STDMETHODCALLTYPE
NTAPI
IServiceGroup_fnAddRef(
IServiceGroup* iface)
{
@ -76,7 +74,7 @@ IServiceGroup_fnAddRef(
}
ULONG
STDMETHODCALLTYPE
NTAPI
IServiceGroup_fnRelease(
IServiceGroup* iface)
{
@ -95,7 +93,6 @@ IServiceGroup_fnRelease(
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 @@ NTAPI
IServiceGroup_fnRequestService(
IN IServiceGroup * iface)
{
PLIST_ENTRY CurEntry;
PGROUP_ENTRY Entry;
KIRQL OldIrql;
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
CurEntry = This->ServiceSinkHead.Flink;
while (CurEntry != &This->ServiceSinkHead)
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
{
Entry = CONTAINING_RECORD(CurEntry, GROUP_ENTRY, Entry);
Entry->pServiceSink->lpVtbl->RequestService(Entry->pServiceSink);
CurEntry = CurEntry->Flink;
KeInsertQueueDpc(&This->Dpc, NULL, NULL);
return;
}
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
KeInsertQueueDpc(&This->Dpc, NULL, NULL);
KeLowerIrql(OldIrql);
}
//---------------------------------------------------------------
@ -141,6 +139,8 @@ IServiceGroup_fnAddMember(
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 @@ IServiceGroup_fnAddMember(
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 @@ IServiceGroup_fnRemoveMember(
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 @@ IServiceGroupDpc(
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 @@ IServiceGroup_fnSupportDelayedService(
{
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;
}
}
@ -225,6 +228,8 @@ IServiceGroup_fnRequestDelayedService(
LARGE_INTEGER DueTime;
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
ASSERT_IRQL(DISPATCH_LEVEL);
DueTime.QuadPart = ullDelay;
if (This->Initialized)
@ -233,8 +238,6 @@ IServiceGroup_fnRequestDelayedService(
KeSetTimer(&This->Timer, DueTime, &This->Dpc);
else
KeInsertQueueDpc(&This->Dpc, NULL, NULL);
KeClearEvent(&This->DpcEvent);
}
}
@ -245,6 +248,8 @@ IServiceGroup_fnCancelDelayedService(
{
IServiceGroupImpl * This = (IServiceGroupImpl*)iface;
ASSERT_IRQL(DISPATCH_LEVEL);
if (This->Initialized)
{
KeCancelTimer(&This->Timer);
@ -283,6 +288,8 @@ PcNewServiceGroup(
This->lpVtbl = &vt_IServiceGroup;
This->ref = 1;
KeInitializeDpc(&This->Dpc, IServiceGroupDpc, (PVOID)This);
KeSetImportanceDpc(&This->Dpc, HighImportance);
InitializeListHead(&This->ServiceSinkHead);
*OutServiceGroup = (PSERVICEGROUP)&This->lpVtbl;