DiagFilt

[This is preliminary documentation and subject to change.]

SUMMARY

This is a sample Plug and Play filter driver that provides WMI data blocks and methods to the CDM provider. This allows the CDM provider to expose diagnostic tests via the Common Diagnostic Model. Typically, driver writers will copy the sample code into their own driver and make any minor modifications so that the WMI data blocks are always available when the driver is loaded. Alternatively, WmiSamp can be left as a filter driver if WMI data blocks should only be made available when the filter driver is loaded. Or it can be included in a different driver.

BUILDING THE SAMPLE

Follow these steps to WMI-enable a driver with the sample code.

1. Determine what diagnostics needs to be provided.

2. Write one or more Managed Object Format (.mof) files that describe the WDM data blocks and methods for those diagnostics. In doing this, the driver writer will need to run the GUIDgen tool to create globally unique GUIDs that are assigned to the data blocks. GUIDgen must be run so that no two data block formats have the same GUID. Compile the .mof files into .bmf files by using the Mofcomp tool. The resulting .bmf files are platform-independent binaries, and can be reported as resources attached to the .sys file or as one or more instances of a data block queried by WMI. Note that one of the byproducts of generating the binary .mof file is a header file that contains GUID and structure definitions for the data blocks. Use this header because it will always be up to date with the .mof.

3. Write the Managed Object Format (.mof) file containing the CDM classes that refererence the WDM shadow classes described by the MOF written in step 1.

4. Build the WMIGUIDREGINFO structure with the GUIDs for the data blocks defined in the WDM .mof file. If the device should be notified when to start and stop collection of a data block, the WMIREG_FLAG_EXPENSIVE flag should be set for the data block in the WMIGUIDREGINFO structure.

5. Implement the six WMI function callback routines and reference them in a WMILIB_CONTEXT structure. Note that some of them are optional.

6. Modify the sources and makefile.inc files so that the .mof file is compiled into the .bmf, .x, .vbs and .h file.

RUNNING THE SAMPLE

1.      Build and install the CDMProv DDK sample on target machine

2.      On target machine change the value Provider class qualifier from CdmProv to the name of your provider. Next run mofcomp sample.mof. This will include the CDM mof into the WMI schema.

3.      Install the DiagFilt sample driver as a filter driver on your device stack

4.      Modify listem.vbs to contain the correct CIM RelPath that your device maps to. Run start /wait listem.vbs to invoke your driver

RESOURCES

Please see the DDK CDM Provider sample and the Kernel-Mode driver section of DDK documentation for more information on WMI.

CODE TOUR

File Manifest

File           Description
 
Filter.c       NULL filter driver (boilerplate code)
Filter.h       Header file for the filter driver
Filter.mof     Managed Object Format file that contains descriptions of the data blocks events and methods implemented by the driver
Filter.rc      Resource file containing version information
Inf.txt        Sections of the .inf file to change
Makefile       Standard Windows NT makefile
Pnp.c          Plug and Play routines
Power.c        Power Management routines
Sources        Sources for build
Util.c         NULL filter driver—boilerplate code
Wmisamp.c      Sample device driver that shows various mechanisms for using WMI in a kernel-mode driver 
Sample.Mof     MOF for CDM classes associated with this driver
Listem.Vbs     VBS script that is useful for testing CDM provider and driver implementation

 

Top of page

 

 

 
 

© 2000 Microsoft Corporation