Maxim
Sat Dec 13 03:48:51 CST 2003
WMI is also the way, and the _good_ way BTW.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"Ray Trent" <rat@synaptics.com.spamblock> wrote in message
news:u9XxXf2vDHA.1764@TK2MSFTNGP10.phx.gbl...
> There are numerous ways for a WDM driver to communicate with an app, but
> I can think of 2 in particular that map reasonably well to your existing
> model:
>
> 1) Asynchronous (overlapped) I/O. Issue a read/write/ioctl request in
> overlapped mode, with another thread waiting on the event. The driver
> pends the request when it's received and then completes it when ready.
> This is a more "canonical" way of doing things, but may or may not fit
> your existing model quite as well. This is a bit more complicated than
> the next suggestion, because you have to deal with pended/canceled
> requests correctly, but the advantage is that the driver can return
> information about each request directly.
>
> 2) Roll your own event-based triggering. This is somewhat easier to use
> in the case where the driver just wants to send a stream of
> notifications about something. A separate thread creates an event and
> passes it down to the driver in an IOCtl, which does an
> ObReferenceObjectByHandle on it. The thread then waits on this event in
> a loop. The driver triggers it when it's ready. The thread can do
> whatever it wants when the event triggers, including sending a windows
> message to some window. However, you only get 1 bit of information using
> this mechanism, i.e. the driver wants attention. Further IOCTLs could be
> used to queue notifications, etc., if needed, though option 1 might be
> easier in that case, depending on what you need.
>
> Speaking of canonical, BTW, the suggested way to connect to the driver
> is via a device interface, registered with IoRegisterDeviceInterface,
> rather than just creating a plain symbolic link that apps open (which
> also works, but you might as well do it right if you're starting
> afresh). See the docs for details.
>
> Dave Skok wrote:
>
> > Hi all!
> >
> > How can I send a windows message to an application from a WDM driver?
> >
> > Several years ago I wrote a VxD driver for an ISA device used in our
> > equipment. Through an IOCTL message, our application would pass its handle
> > and the VxD would store it. When the VxD had something ready for us it
> > would use the handle to send the app a windows message at which time we
> > might have to do some sort of IOCTL to the driver or more commonly read a
> > message in dualported memory. Good or bad programming practice it worked
> > quite well. We are migrating to XPe and I'm trying to translate this
> > possibly dubious practice from VxD to WDM. I have all the tools. XP DDK,
> > Walter Oneys book and Compuware Driverworks. I used VtoolsD for the last
> > driver.
> >
> > Thanks in advance,
> >
> > Dave
> >
> > dskok@LOVELYSPAMlehighdim.com take out LOVELY and SPAM
> >
> >
>
> --
> ../ray\..