Communication from WDM driver to user mode application

Hi,

I have a requirement where my current WDM driver needs to send the data to my user mode application. Data patterns are such that the driver needs to send small buffers of data immediately whenever it has and the driver can’t wait to accumulate the data to send large buffers.

The filesystem filter manager provides a mechanism for communication between user mode application and minifilter driver, which is pretty good. This can be achieved between a WDM driver and a user mode application by

  1. Associating the file handle with an IO completion port
  2. Sending the Asynchronous IO to the driver
  3. And receiving the responses with GetQueuedCompletionStatus.

I can increase the number of threads in user application to send and receive the IOs based on the load. And WDM driver completes the simultaneous IOs asynchronously by queuing the IRPs and completing them later when it has data to complete the requests. However, I do need to handle the cancellation of IRPs and the context data is high for this.

My question is:

Is there any alternate mechanism which can achieve the above in a WDM driver similar to
Communication port in Min filter drivers?

-Arjun

Nothing equivalent exists in WDM. Communication Ports are just a convenient
wrapper around using IRPs as you have described below. It’s unfortunate that
they require a filter handle to create a communication port because it would
be a generically useful thing to have.

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

Hi,

I have a requirement where my current WDM driver needs to send the data to
my user mode application. Data patterns are such that the driver needs to
send small buffers of data immediately whenever it has and the driver can’t
wait to accumulate the data to send large buffers.

The filesystem filter manager provides a mechanism for communication between
user mode application and minifilter driver, which is pretty good. This can
be achieved between a WDM driver and a user mode application by

  1. Associating the file handle with an IO completion port
  2. Sending the Asynchronous IO to the driver
  3. And receiving the responses with GetQueuedCompletionStatus.

I can increase the number of threads in user application to send and receive
the IOs based on the load. And WDM driver completes the simultaneous IOs
asynchronously by queuing the IRPs and completing them later when it has
data to complete the requests. However, I do need to handle the cancellation
of IRPs and the context data is high for this.

My question is:

Is there any alternate mechanism which can achieve the above in a WDM driver
similar to
Communication port in Min filter drivers?

-Arjun

On Oct 3, 2016, at 9:59 AM, xxxxx@gmail.com wrote:

The filesystem filter manager provides a mechanism for communication between user mode application and minifilter driver, which is pretty good. This can be achieved between a WDM driver and a user mode application by

  1. Associating the file handle with an IO completion port
  2. Sending the Asynchronous IO to the driver
  3. And receiving the responses with GetQueuedCompletionStatus.

I/O completion ports are not a file system thing. It’s a user-mode technique that can be used with ANY kernel-mode driver.

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On Oct 3, 2016, at 9:50 PM, Tim Roberts wrote:
>
> On Oct 3, 2016, at 9:59 AM, xxxxx@gmail.com wrote:
>>
>> The filesystem filter manager provides a mechanism for communication between user mode application and minifilter driver, which is pretty good. This can be achieved between a WDM driver and a user mode application by
>>
>> 1) Associating the file handle with an IO completion port
>> 2) Sending the Asynchronous IO to the driver
>> 3) And receiving the responses with GetQueuedCompletionStatus.
>
> I/O completion ports are not a file system thing. It’s a user-mode technique that can be used with ANY kernel-mode driver.

Or so I thought.

Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Two different things being discussed here, right?

I/O Completion Ports: A standard mechanism for receiving I/O completion notifications in user-mode.

Communication Ports: A file system mini-filter specific mechanism (that wraps IOCTLs, like Mr. Noone described) for user-FS Filter communication.

Peter
OSR
@OSRDrivers

Peter,
Right, I had mentioned about both I/O Completion ports and FS Filter Communication Ports to provide the context of my requirement.

My query is on FS Filter Communication ports. I wanted to get the inputs on ways to achieve the functionality of Communication ports in a WDM driver.

Don?t increase the number of threads in UM. Except in special circumstances, use the thread pool APIs and pend several overlapped reads (IRPs). The number of UM threads should approximate the number of CPUs and tune the number of pending reads (IOCTL) based on your data rate and reliability requirments

Sent from Mailhttps: for Windows 10

From: xxxxx@gmail.commailto:xxxxx
Sent: October 3, 2016 1:00 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Communication from WDM driver to user mode application

Hi,

I have a requirement where my current WDM driver needs to send the data to my user mode application. Data patterns are such that the driver needs to send small buffers of data immediately whenever it has and the driver can’t wait to accumulate the data to send large buffers.

The filesystem filter manager provides a mechanism for communication between user mode application and minifilter driver, which is pretty good. This can be achieved between a WDM driver and a user mode application by

1) Associating the file handle with an IO completion port
2) Sending the Asynchronous IO to the driver
3) And receiving the responses with GetQueuedCompletionStatus.

I can increase the number of threads in user application to send and receive the IOs based on the load. And WDM driver completes the simultaneous IOs asynchronously by queuing the IRPs and completing them later when it has data to complete the requests. However, I do need to handle the cancellation of IRPs and the context data is high for this.

My question is:

Is there any alternate mechanism which can achieve the above in a WDM driver similar to
Communication port in Min filter drivers?

-Arjun


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></mailto:xxxxx></mailto:xxxxx></https:>

Exactly this. You can send multiple io requests on the same thread. You might not even need a thread pool, especially in the case where order matters. If it matters, you need to include a sequence number in the output buffer.

Get Outlook for Androidhttps:

________________________________
From: xxxxx@lists.osr.com on behalf of Marion Bond
Sent: Tuesday, October 4, 2016 4:13:41 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Communication from WDM driver to user mode application

Don?t increase the number of threads in UM. Except in special circumstances, use the thread pool APIs and pend several overlapped reads (IRPs). The number of UM threads should approximate the number of CPUs and tune the number of pending reads (IOCTL) based on your data rate and reliability requirments

Sent from Mailhttps: for Windows 10

From: xxxxx@gmail.commailto:xxxxx
Sent: October 3, 2016 1:00 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Communication from WDM driver to user mode application

Hi,

I have a requirement where my current WDM driver needs to send the data to my user mode application. Data patterns are such that the driver needs to send small buffers of data immediately whenever it has and the driver can’t wait to accumulate the data to send large buffers.

The filesystem filter manager provides a mechanism for communication between user mode application and minifilter driver, which is pretty good. This can be achieved between a WDM driver and a user mode application by

1) Associating the file handle with an IO completion port
2) Sending the Asynchronous IO to the driver
3) And receiving the responses with GetQueuedCompletionStatus.

I can increase the number of threads in user application to send and receive the IOs based on the load. And WDM driver completes the simultaneous IOs asynchronously by queuing the IRPs and completing them later when it has data to complete the requests. However, I do need to handle the cancellation of IRPs and the context data is high for this.

My question is:

Is there any alternate mechanism which can achieve the above in a WDM driver similar to
Communication port in Min filter drivers?

-Arjun


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></http:></http:></http:></mailto:xxxxx></mailto:xxxxx></https:></https:>