Using Wmimofck.exe

Included with the Windows Driver Kit (WDK) is the Wmimofck.exe utility. This application takes as input a binary MOF file (a .bmf file), which was generated by the MOF compiler (mofcomp.exe). Wmimofck.exe will check that the classes, properties, methods and events specified in the .bmf file are valid for WMI use. Wmimofck.exe is also capable of generating the following files:

  • C language header file (.h file) that can then be used to keep header file in sync with MOF definitions.

  • C language source file which contains stubs for WMI driver code.

  • Hex version of .bmf data which can be included in the driver source for supplying dynamic MOF data at runtime.

  • Test application templates in VBScript or HTML.

To run the wmimofck utility, use the following syntax:

wmimofck [-hfilename [-m] [-u]] [-cfilename] [-xfilename] [-tfilename] [-wdirectory] [-yfilename] [-zfilename]

If the -h parameter is specified, a C language header file is created that defines the GUIDs, data structures, and method indices specified in the MOF file. If the caller specifies the -m flag as well, then the header file will include structure definitions for the input and output of each WMI method. By default, wmimofck does not generate member definitions for WMI classes that contain variable length properties. If the caller specifies -u, then wmimofck will generate member definitions for every property that has a fixed size, including string properties that specify a MaxLen qualifier. If the -t parameter is specified, a VBScript program is created that will query all data blocks and properties specified in the MOF file.

If the -x parameter is specified a text file is created that contains the text representation of the binary MOF data. This can be included in the source of the driver if the driver supports reporting the binary MOF via a WMI query rather than a resource on the driver image file.

If the -c parameter is specified, a C language source file is generated that contains a template for implementing WMI code in a device driver.

If the -w parameter is specified, a set of HTML files are generated that create a rudimentary UI that can be used to access the WMI data blocks.

The -y and -z flags can only be used together. The -y specifies a file containing language-independent WMI class declarations, and -z specifies the class amendments for a particular language. The command wmimofck localizedfile -ymof -zmfl merges the mof and mfl files to form the complete localized version of MOF file. See Building and Deploying the Localized MOF File for details.