Re: when does I use the WMI extensions to WDM ? by 440gtx
440gtx
Sun Oct 10 23:21:47 CDT 2004
> what is the advantage of use the WMI extensions to WDM?
1. bi-directional communication. IOCTL's are sent from app to driver,
not the other way around. a WMI driver can send any info it wants up
to the app asynchronously anytime.
2. remote access; it's just as easy to access your driver running on a
remote system as it is on the local system.
3. the api is documented in the binary. You can actually use things
like the built in wbemtest.exe tool as a test harness for the entire
API of a WMI driver because it is able to dynamically determine every
aspect of the API directly from the binary. No longer required to
define IOCTL codes and in/out buffer layouts in order for a client to
know how to use a function.
4. can access WMI from most languages like VB fairly easily, but *NOT*
C/C++. It takes way over 100 lines of strange C++ code to call just
one WMI function correctly! You'll be connecting to servers,
initializing security, setting proxy blankets, enumerating instances,
manipulating class objects, and performing a mountain of error
handling and cleanup. Compared to IOCTL which an APP can call in just
about 5 lines of code including the CreateFile/Close.
The driver code size to implement WMI is also gargantuam compared to
IOCTL's, even if you are able to use the wmilib helper functions. For
IOCTL, you just implement one dispatch point and you are done. For
WMI, you've got to implement an entire set of complex functions and
callbacks before you can even get the smallest thing to work. I find
it very difficult to debug WMI because it's such an abstract model
that it makes hard to know what failed and why because a lot of things
error out somewhere in windows code for no apparent reason. WMI is
also pretty squirrelly in dealing with things like 64-bit data types
and binary arrays because of historic automation limitations.
Well, that is all my experience. It's pretty daunting to implement,
but has some useful benefits that might be worth it.