Hello all,

From time to time I want to send some data from NDIS driver to user-mode
application.
How can I do it?

The first thing that comes up to my mind is to create a device with
NdisMRegisterDevice and query it in a loop from user-mode program. But this
will take some processor resources...

Are there any other ways to receive notifications from driver?
What I need is a two-way pipe between driver and user-mode application.

Thanks.

Best regards,
Serge.

Re: how to notify? by Benoît

Benoît
Tue Oct 12 13:41:55 CDT 2004

Share an event between user and kernel modes. Kernel mode sets the event
when information is available, and user mode sends a custom DeviceIoControl
request to the driver when it sees the event as signaled.

I believe I saw a nice article on www.osronline.com regarding this trick,
and I'm pretty sure there are other equally good articles floating around.

-BB

"serge" <pserge77@ukr.net> wrote in message
news:ckh8ak$2rq1$1@news.dg.net.ua...
> Hello all,
>
> From time to time I want to send some data from NDIS driver to user-mode
> application.
> How can I do it?
>
> The first thing that comes up to my mind is to create a device with
> NdisMRegisterDevice and query it in a loop from user-mode program. But
this
> will take some processor resources...
>
> Are there any other ways to receive notifications from driver?
> What I need is a two-way pipe between driver and user-mode application.
>
> Thanks.
>
> Best regards,
> Serge.
>
>



Re: how to notify? by Don

Don
Tue Oct 12 13:51:26 CDT 2004

Except why add all the complexity of an event shared between user mode and
kernel. Use the inverted call model, of call down with an IRP that pends
waiting for data, when the data is available fill in buffer of the IRP and
complete it. With overlapped I/O this will provide the event without all
the pain of doing it yourself in the driver.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Benoît Bousquet" <benoit.bousquet@nospam.zzz> wrote in message
news:u7uX$tIsEHA.2904@TK2MSFTNGP15.phx.gbl...
> Share an event between user and kernel modes. Kernel mode sets the event
> when information is available, and user mode sends a custom
DeviceIoControl
> request to the driver when it sees the event as signaled.
>
> I believe I saw a nice article on www.osronline.com regarding this trick,
> and I'm pretty sure there are other equally good articles floating around.
>
> -BB
>
> "serge" <pserge77@ukr.net> wrote in message
> news:ckh8ak$2rq1$1@news.dg.net.ua...
> > Hello all,
> >
> > From time to time I want to send some data from NDIS driver to user-mode
> > application.
> > How can I do it?
> >
> > The first thing that comes up to my mind is to create a device with
> > NdisMRegisterDevice and query it in a loop from user-mode program. But
> this
> > will take some processor resources...
> >
> > Are there any other ways to receive notifications from driver?
> > What I need is a two-way pipe between driver and user-mode application.
> >
> > Thanks.
> >
> > Best regards,
> > Serge.
> >
> >
>
>



Re: how to notify? by Maxim

Maxim
Tue Oct 12 17:17:06 CDT 2004

WMI events are one solution.

Pending a query custom OID via IOCTL_NDIS_QUERY_GLOBAL_STATS till it will
be filled with data and completed by NDIS driver is another solution.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"serge" <pserge77@ukr.net> wrote in message
news:ckh8ak$2rq1$1@news.dg.net.ua...
> Hello all,
>
> From time to time I want to send some data from NDIS driver to user-mode
> application.
> How can I do it?
>
> The first thing that comes up to my mind is to create a device with
> NdisMRegisterDevice and query it in a loop from user-mode program. But this
> will take some processor resources...
>
> Are there any other ways to receive notifications from driver?
> What I need is a two-way pipe between driver and user-mode application.
>
> Thanks.
>
> Best regards,
> Serge.
>
>



Re: how to notify? by serge

serge
Wed Oct 13 18:59:18 CDT 2004

Hello, Don and Benoît!

I managed to notify my application and send/receive data.
Many thanks for your help.

Another problem I faced is I get blue screen when I try to execute
NdisMSleep or NdisStallExecution... I thought I can triger an event, wait
until user-mode application requests some data, then wait until user-mode
replies to driver, and then continue driver execution. Some commercial
firewalls do not have such a problem...

Ok, I managed do not use wait functions, but I still need to pause driver
from time to time. I want to limit traffic speed for certain port numbers.

Could you please advise how this can be done?

Thanks.

Best regards,

Serge.



Re: how to notify? by Pavel

Pavel
Wed Oct 13 19:15:08 CDT 2004

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message news:e54#JjKsEHA.2196@TK2MSFTNGP14.phx.gbl...
> Pending a query custom OID via IOCTL_NDIS_QUERY_GLOBAL_STATS till it will
> be filled with data and completed by NDIS driver is another solution.

NDIS OIDs should be completed quickly ( in less than ~ 2 sec ), so WMI is the way to go.

--PA