Search code examples
driverkernel-modewdfminifilter

how to : do 2 way communication between user mode and kernel mode


I have written a driver, that extracts a value from IRP buffer. Now based on this keyword I have to pass or discard the IRP. So I need to communicate with the database which is not easy from kernel mode driver. So I am using an application or exe for doing this which will result in true or false based on which I will pass or discard the IRP.

I want to link the driver with the application that I get the data in the client application.

I thought about using temp file that can act as a pipe.

Please suggest something.


Solution

  • I would go with IOCTLs.

    The application communicating with database starts with sending one or more IOCTLs to the driver. Let's call IOCTLs of this type IOCTL-1.

    The completion of IOCTL-1 idicates a request from driver to the database. The request details can be passed in IOCTL output buffer.

    The application detects IOCTL-1 completion, retrieves the request details, runs the query and passes results to the driver using a different IOCTL (IOCTL-2). Then it re-sends IOCTL-1 so that the driver can issue another request.