testwmi – WMI Test Application

SUMMARY

testwmi is a Win32 application that allows one to query and set properties of WMI GUIDs exported by the E100BEX sample. ExampleSetUINT_OID, a property of E100BExampleSetUINT_OID, is the only one that can be set. If you want to use this application to test custom GUIDs exported by your driver then, simply add the class names of the GUIDs to the following array and recompile the program. The array is defined at the beginning in testwmi.cpp file as follows.

LpszClasses

By default, the application connects to root\wmi namespace. You can redefine the macro DEFAULT_NAMESPACE that is defined in testwmi.h header file to connect to a different namespace.

The code is 64-bit compliant. The application is for Windows 2000 or higher and Window 98SE or higher operating systems.

BUILDING THE SAMPLE

The sample builds properly with Microsoft® Visual C® 6.0 using the build utility in Windows 2000 or higher DDK build environment. Run the build command from this directory to build the sample. This creates a binary testwmi.exe. If you are building the sample for Windows 98SE or higher operating systems then, make sure to comment out the following line in the Sources file to build an ANSI version.

C_DEFINES= $(C_DEFINES) -DUNICODE -D_UNICODE

USING THE SAMPLE

When you run the program, it may take up to 10 seconds before the main dialog box appears. In the main dialog box, when you select a class from the combo list box, its instances, if any, are listed in the left pane. By default, the first instance is selected and its properties are listed in the right pane. As you select another instance, the right pane is updated with the properties of the selected instance. You can view/modify a property by double-clicking on the property name. You can only modify a scalar property of string or numeric type using this sample.

CODE TOUR

File Manifest

Files         Description
readme.htm    The documentation for this sample (this file)
Sources       The generic file for building the code sample
testwmi.rc    The resource file for the code sample
testwmi.h     Header file containing data structures, defines and function prototypes.
testwmi.cpp   File containing winmain, dialog procedures and other non-wmi functions.
Wmicode.cpp   File containing code for wmi operation.

 

 

Top of page

 

 

 
 

© 1999 Microsoft Corporation