[ivshmem] PassiveHandling is incorrect
While this works fine under Windows 10 Creators Edition, earlier
versions fail the call to WdfInterruptCreate with the status
STATUS_INVALID_PARAMETER.
@@ -70,7 +70,7 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
PDEVICE_CONTEXT deviceContext;
deviceContext = DeviceGetContext(Device);
- NTSTATUS status = STATUS_SUCCESS;
+ NTSTATUS result = STATUS_SUCCESS;
int memIndex = 0;
const ULONG resCount = WdfCmResourceListGetCount(ResourcesTranslated);
@@ -119,7 +119,7 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
{
DEBUG_ERROR("Resource size was %u long when %u was expected",
descriptor->u.Memory.Length, sizeof(IVSHMEMDeviceRegisters));
- status = STATUS_DEVICE_HARDWARE_ERROR;
+ result = STATUS_DEVICE_HARDWARE_ERROR;
break;
}
@@ -129,7 +129,7 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
if (!deviceContext->devRegisters)
{
DEBUG_ERROR("%s", "Call to MmMapIoSpace failed");
- status = STATUS_DEVICE_HARDWARE_ERROR;
+ result = STATUS_DEVICE_HARDWARE_ERROR;
break;
}
}
@@ -142,7 +142,7 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
if (!NT_SUCCESS(MmAllocateMdlForIoSpace(&deviceContext->shmemAddr, 1, &deviceContext->shmemMDL)))
{
DEBUG_ERROR("%s", "Call to MmAllocateMdlForIoSpace failed");
- status = STATUS_DEVICE_HARDWARE_ERROR;
+ result = STATUS_DEVICE_HARDWARE_ERROR;
break;
}
}
@@ -156,14 +156,16 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
{
WDF_INTERRUPT_CONFIG irqConfig;
WDF_INTERRUPT_CONFIG_INIT(&irqConfig, IVSHMEMInterruptISR, NULL);
- irqConfig.PassiveHandling = TRUE;
irqConfig.InterruptTranslated = descriptor;
irqConfig.InterruptRaw = WdfCmResourceListGetDescriptor(ResourcesRaw, i);
- if (!NT_SUCCESS(WdfInterruptCreate(Device, &irqConfig, WDF_NO_OBJECT_ATTRIBUTES,
- &deviceContext->interrupts[deviceContext->interruptsUsed])))
+
+ NTSTATUS status = WdfInterruptCreate(Device, &irqConfig, WDF_NO_OBJECT_ATTRIBUTES,
+ &deviceContext->interrupts[deviceContext->interruptsUsed]);
+
+ if (!NT_SUCCESS(status))
{
- DEBUG_ERROR("%s", "Call to WdfInterruptCreate failed");
- status = STATUS_DEVICE_HARDWARE_ERROR;
+ DEBUG_ERROR("Call to WdfInterruptCreate failed: %08x", status);
+ result = status;
break;
}
++deviceContext->interruptsUsed;
@@ -172,15 +174,15 @@ NTSTATUS IVSHMEMEvtDevicePrepareHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIS
}
if (memIndex == 0)
- status = STATUS_DEVICE_HARDWARE_ERROR;
+ result = STATUS_DEVICE_HARDWARE_ERROR;
- if (NT_SUCCESS(status))
+ if (NT_SUCCESS(result))
{
DEBUG_INFO("Shared Memory: %p, %u bytes", deviceContext->shmemAddr.PhysicalAddress, deviceContext->shmemAddr.NumberOfBytes);
DEBUG_INFO("Interrupts : %d", deviceContext->interruptsUsed);
}
- return status;
+ return result;
}
NTSTATUS IVSHMEMEvtDeviceReleaseHardware(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST ResourcesTranslated)
