UPS Minidriver Demo

SUMMARY

The Demo UPS sample provides an example of a UPS minidriver for use by the UPS service.  It contains annotated code to assist in developing a UPS minidriver DLL.  Detailed documentation may be found in the Windows 2000/XP DDK under Battery Devices.

Introduction to UPS Minidrivers

A UPS minidriver provides a means for the standard UPS service to communicate with various UPS devices.  Third parties may provide a minidriver to enable the UPS service to manage their proprietary hardware.  A UPS minidriver is a user-mode DLL called by the UPS service.  A UPS minidriver has the following responsibilities:

Typically, a UPS minidriver communicates with a UPS device through a COM (serial) port by calling CreateFile, ReadFile, and WriteFile.  These functions are described in the Platform SDK documentation.  The minidriver is responsible for implementing whatever communication protocol the UPS unit supports.

Note: This package is intended to demonstrate UPS minidriver concepts for educational purposes. It is not to be used in a production environment in its entirety. 

Introduction to the Demo UPS Sample

This sample package consists of source code and an installation INF file. The sample contains following files:

BUILDING THE SAMPLE

To build the sample drivers, you must first set up the DDK environment on your host machine. The “Installation and Release Notes” in the Windows 2000/XP DDK has a complete description on how to do this. 

  1. Run the build –ceZ command in the DemoUPS directory to build demoups.dll

This will build the sample. Any errors will be displayed in the Output window.

INSTALLING THE SAMPLE

To install the UPS demo minidriver:

  1. Using Windows Explorer, navigate to the directory containing the Demo UPS files.
  2. Right click on demoups.inf and select ‘Install’.

This will copy the demoups.dll file to the %SystemRoom$\system32 directory and make the appropriate registry entries.

RUNNING THE SAMPLE

Once the Demo UPS minidriver is installed, it needs to be configured and started from the Power Options Control Panel applet.

  1. Open the Control Panel and select Power Options.
  2. Select the ‘UPS’ tab and click ‘Select...’ to open the UPS Selection dialog.  This dialog allows the user to select their UPS manufacturer, model, and COM port. 
  3. Select ‘DDK Sample’ for the manufacturer and ‘DDK Demo UPS’ for the model and click ‘Finish’.  The COM port value is ignored by the Demo UPS minidriver.  
  4. Click ‘Apply’ to start the UPS service.  This will take a few seconds and then the display will show the UPS details.

You can uninstall the Demo UPS minidriver by selecting ‘None’ for the manufacturer and clicking ‘Finish’ and ‘Apply’.  This will remove the Demo UPS minidriver configuration and stop the UPS service.

Top of page

 

© Microsoft Corporation 2001