Generating events from kernel mode driver to user mode application

Hello All,
I need to develop a kernel mode driver which will capture a chunk of data
from the device & store it in a temporary buffer(fixed size) allocated in
the kernel space.Once the buffer is full I need to generate an event, to
signal the user mode application to read the data.When the data has been
read by the application,the next chunk of data needs to be copied in the
same buffer.Some information which can help me, get started would be useful.

Thanks in advance.
Sachin Anvekar.

Hi Sachin,

Application can use CreateEvent( ) api to create the user mode event and
can wait for the event to get signalled in the application thread. While
pass the application event’s handle ( what CreateEvent( ) returned ) to the
driver using say an IOCTL and in the kernel mode driver, translate the so
obtained user mode
event handle to kernel mode event using as ObReferenceObjectByHandle( ) and
subsequently use the translated kernel event to signal the application about
the buffer usage and so on …

Cheers,

  • Jay

----- Original Message -----
From: “Sachin”
To: “NT Developers Interest List”
Sent: Saturday, July 13, 2002 3:45 PM
Subject: [ntdev] Generating events from kernel mode driver to user mode
application

> Hello All,
> I need to develop a kernel mode driver which will capture a chunk of data
> from the device & store it in a temporary buffer(fixed size) allocated in
> the kernel space.Once the buffer is full I need to generate an event, to
> signal the user mode application to read the data.When the data has been
> read by the application,the next chunk of data needs to be copied in the
> same buffer.Some information which can help me, get started would be
useful.
>
> Thanks in advance.
> Sachin Anvekar.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@vsnl.net
> To unsubscribe send a blank email to %%email.unsub%%
>

You can do that … but by far the simplest way is to simply do a
Read/WriteFile. The request is pended until it is completed. In this case it
would not be completed until the byte count has been satisfied, an error
occurs, or it is cancelled.

If simply hanging a transfer request is not sufficient for the task then
begin exploring using events. A simple means of doing that is by combining a
kernel mode event with a high water mark on the data buffer. You trigger
that event when the HMW is reached. When the application posts a request it
is either completed immediately because an event has already been triggered
or it pends waiting for a trigger.


Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net

“Jayadev” wrote in message news:xxxxx@ntdev…
>
> Hi Sachin,
>
> Application can use CreateEvent( ) api to create the user mode event
and
> can wait for the event to get signalled in the application thread. While
> pass the application event’s handle ( what CreateEvent( ) returned ) to
the
> driver using say an IOCTL and in the kernel mode driver, translate the so
> obtained user mode
> event handle to kernel mode event using as ObReferenceObjectByHandle( )
and
> subsequently use the translated kernel event to signal the application
about
> the buffer usage and so on …
>
> Cheers,
> - Jay
>
> ----- Original Message -----
> From: “Sachin”
> To: “NT Developers Interest List”
> Sent: Saturday, July 13, 2002 3:45 PM
> Subject: [ntdev] Generating events from kernel mode driver to user mode
> application
>
>
> > Hello All,
> > I need to develop a kernel mode driver which will capture a chunk of
data
> > from the device & store it in a temporary buffer(fixed size) allocated
in
> > the kernel space.Once the buffer is full I need to generate an event, to
> > signal the user mode application to read the data.When the data has been
> > read by the application,the next chunk of data needs to be copied in the
> > same buffer.Some information which can help me, get started would be
> useful.
> >
> > Thanks in advance.
> > Sachin Anvekar.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@vsnl.net
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
>
>