From e57f479b22fcdfe350fe349c15f6872c81bb5ed9 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Wed, 27 May 2009 18:42:56 +0000 Subject: [PATCH] - return error code when there is a timeout - improve error check in PcNewInterruptSync - write an error log entry when a device fails to start svn path=/trunk/; revision=41149 --- .../wdm/audio/backpln/portcls/dma_slave.c | 7 +++--- .../wdm/audio/backpln/portcls/interrupt.c | 2 +- .../drivers/wdm/audio/backpln/portcls/irp.c | 22 +++++++++++++++++-- .../wdm/audio/backpln/portcls/registry.c | 12 +++++----- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c b/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c index 70d4408069e..2ae9ed669e3 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c @@ -455,9 +455,10 @@ IDmaChannelInit_fnWaitForTC( }while(RetryCount-- >= 1); - //FIXME - // return error code on timeout - // + if (BytesRemaining) + { + return STATUS_UNSUCCESSFUL; + } return STATUS_SUCCESS; diff --git a/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c b/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c index 59cbeb202da..6d916fccecf 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c @@ -347,7 +347,7 @@ PcNewInterruptSync( DPRINT("PcNewInterruptSync entered OutInterruptSync %p OuterUnknown %p ResourceList %p ResourceIndex %u Mode %d\n", OutInterruptSync, OuterUnknown, ResourceList, ResourceIndex, Mode); - if (!OutInterruptSync || !ResourceList || Mode > InterruptSyncModeRepeat || Mode < 0) + if (!OutInterruptSync || !ResourceList || Mode > InterruptSyncModeRepeat || Mode < InterruptSyncModeNormal || Mode > InterruptSyncModeRepeat) return STATUS_INVALID_PARAMETER; if (ResourceIndex > ResourceList->lpVtbl->NumberOfEntriesOfType(ResourceList, CmResourceTypeInterrupt)) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/irp.c b/reactos/drivers/wdm/audio/backpln/portcls/irp.c index 7f5f6042ac4..3a61c56be68 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/irp.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/irp.c @@ -43,6 +43,9 @@ PortClsPnp( PPCLASS_DEVICE_EXTENSION DeviceExt; PIO_STACK_LOCATION IoStack; IResourceList* resource_list = NULL; + ULONG Length; + WCHAR szMsg[100]; + PIO_ERROR_LOG_PACKET EventEntry; DPRINT("PortClsPnp called\n"); @@ -97,7 +100,22 @@ PortClsPnp( if (!NT_SUCCESS(Status)) { DPRINT("StartDevice returned a failure code [0x%8x]\n", Status); - + swprintf(szMsg, L"%%1 failed to start with %x", Status); + Length = (wcslen(szMsg) + 1) * sizeof(WCHAR) + sizeof(IO_ERROR_LOG_PACKET); + if (Length < ERROR_LOG_MAXIMUM_SIZE) + { + EventEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(DeviceExt->PhysicalDeviceObject, Length); + if (EventEntry) + { + RtlZeroMemory(EventEntry, Length); + EventEntry->MajorFunctionCode = IRP_MJ_PNP; + EventEntry->NumberOfStrings = 1; + EventEntry->StringOffset = sizeof(IO_ERROR_LOG_PACKET); + EventEntry->ErrorCode = Status; + wcscpy((LPWSTR)(EventEntry + 1), szMsg); + IoWriteErrorLogEntry(EventEntry); + } + } Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; @@ -133,7 +151,7 @@ PortClsPnp( IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_NOT_SUPPORTED; case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: - DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); + DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS Status %x Information %p\n", Irp->IoStatus.Status, Irp->IoStatus.Information); Status = Irp->IoStatus.Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; diff --git a/reactos/drivers/wdm/audio/backpln/portcls/registry.c b/reactos/drivers/wdm/audio/backpln/portcls/registry.c index 7f33acd5ff9..e7eaf5f71e5 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/registry.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/registry.c @@ -18,10 +18,6 @@ typedef struct }IRegistryKeyImpl; - -static IRegistryKeyVtbl vt_IRegistryKey; - - ULONG NTAPI IRegistryKey_fnAddRef( @@ -187,7 +183,7 @@ IRegistryKey_fnNewSubKey( NewThis->hKey = hKey; NewThis->ref = 1; - NewThis->lpVtbl = &vt_IRegistryKey; + NewThis->lpVtbl = This->lpVtbl; *RegistrySubKey = (PREGISTRYKEY)&NewThis->lpVtbl; DPRINT("IRegistryKey_fnNewSubKey RESULT %p\n", *RegistrySubKey ); @@ -243,9 +239,9 @@ IRegistryKey_fnQueryValueKey( IN ULONG Length, OUT PULONG ResultLength) { + NTSTATUS Status; IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface; - DPRINT("IRegistryKey_fnQueryValueKey entered %p value %wZ\n", This, ValueName); ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); if (This->Deleted) @@ -253,7 +249,9 @@ IRegistryKey_fnQueryValueKey( return STATUS_INVALID_HANDLE; } - return ZwQueryValueKey(This->hKey, ValueName, KeyValueInformationClass, KeyValueInformation, Length, ResultLength); + Status = ZwQueryValueKey(This->hKey, ValueName, KeyValueInformationClass, KeyValueInformation, Length, ResultLength); + DPRINT("IRegistryKey_fnQueryValueKey entered %p value %wZ Status %x\n", This, ValueName, Status); + return Status; } NTSTATUS