## Building the WMI Mapper

To build Pegasus and the WMI Mapper, you must do the following preliminary steps:

#### Environment Variables

Set the following environment variables, modifying appropriately for your own system.

set PEGASUS_HOME=d:\PegasusRun
set PEGASUS_ROOT=d:\Pegasus
set path=%path%;%PEGASUS_ROOT%
set path=%path%;%PEGASUS_HOME%\bin
set PEGASUS_PLATFORM=WIN32_IX86_MSVC
set PEGASUS_DEBUG=%1 (Set equal to 1 for a debug build)
set PEGASUS_CONCURRENT=1 (I'm not sure this is needed...)
set PEGASUS_TRACE=1 (I'm not sure this is needed...)

The above is in the pegpath.bat file.

Make sure that the appropriate environment variables are set to allow command line builds. The v32.bat file sets them for my system.

#### Build commands

The binary files will be placed in the %PEGASUS_HOME%\bin directory.

To build:

1) First build Pegasus. The gnu-make command is:

make rebuild - from the Pegasus directory.

This sets the appropriate library and binary files in place.

2) Build the mapper using the command

make -f src/WMIMapper/buildmapper mapper

from the Pegasus directory. This will copy the files from the Pegasus pegserver.dll source that are also used in pegwmiserver.dll into the WMIMapper\PegServer subdirectory and then build the mapper components.

If you want a file output append ><file> 2>&1 to the build commands. (You probably know this already...)

Caveat: This version does not build a Pegasus repository. However, the mapper does not seem to need one.

The “dsw” and “dsp” files for the mapper are also included for use with Visual Studio.

## WMI Mapper Components

The WMI Mapper has three components. Additionally, it uses several Pegasus libraries. Following is a brief description of the components.

1. WMIServer.exe is the executable. It may be run either as an NT service or a console application. After checking command-line options, it creates an instance of CIMServer and starts it executing.

2. pegwmiserver.dll is the mapper equivalent of pegserver.dll. The cimOperationRequestDispatcher module has been rewritten to eliminate the provider service and to access the WMI interfaces directly.

3. WMIProvider.dll is the interface dll to WMI. Its methods are called from the cimOperationRequestDispatcher module, and it handles all WMI calls.