UsbDk: Make filter devices receive IoInCallerContext event
Signed-off-by: Pavel Gurvich <pavel@daynix.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
parent
d3686076c1
commit
1fef4eee3c
3 changed files with 15 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ public:
|
|||
CUsbDkFilterDeviceInit(const CUsbDkFilterDeviceInit&) = delete;
|
||||
CUsbDkFilterDeviceInit& operator= (const CUsbDkFilterDeviceInit&) = delete;
|
||||
private:
|
||||
static CUsbDkFilterDevice::CStrategist &Strategy(WDFDEVICE Device) const
|
||||
static CUsbDkFilterDevice::CStrategist &Strategy(WDFDEVICE Device)
|
||||
{ return UsbDkFilterGetContext(Device)->UsbDkFilter->m_Strategy; }
|
||||
};
|
||||
|
||||
|
|
@ -35,6 +35,9 @@ NTSTATUS CUsbDkFilterDeviceInit::Configure()
|
|||
SetPowerCallbacks([](_In_ WDFDEVICE Device)
|
||||
{ return Strategy(Device)->MakeAvailable(); });
|
||||
|
||||
SetIoInCallerContextCallback([](_In_ WDFDEVICE Device, WDFREQUEST Request)
|
||||
{ return Strategy(Device)->IoInCallerContext(Device, Request); });
|
||||
|
||||
auto status = SetPreprocessCallback([](_In_ WDFDEVICE Device, _Inout_ PIRP Irp)
|
||||
{ return Strategy(Device)->PNPPreProcess(Irp); },
|
||||
IRP_MJ_PNP);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,15 @@ NTSTATUS CUsbDkFilterStrategy::PNPPreProcess(PIRP Irp)
|
|||
return WdfDeviceWdmDispatchPreprocessedIrp(m_Owner->WdfObject(), Irp);
|
||||
}
|
||||
|
||||
void CUsbDkFilterStrategy::IoInCallerContext(WDFDEVICE Device, WDFREQUEST Request)
|
||||
{
|
||||
auto status = WdfDeviceEnqueueRequest(Device, Request);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
WdfRequestComplete(Request, status);
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS CUsbDkFilterStrategy::Create(CUsbDkFilterDevice *Owner)
|
||||
{
|
||||
m_Owner = Owner;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "ntddk.h"
|
||||
#include "wdf.h"
|
||||
#include "Alloc.h"
|
||||
#include "UsbDkUtil.h"
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ public:
|
|||
virtual NTSTATUS Create(CUsbDkFilterDevice *Owner);
|
||||
virtual void Delete();
|
||||
virtual NTSTATUS PNPPreProcess(PIRP Irp);
|
||||
virtual void IoInCallerContext(WDFDEVICE Device, WDFREQUEST Request);
|
||||
|
||||
virtual NTSTATUS MakeAvailable() = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue