How do I support GetSystemPowerStatusEx?

We have a custom board with an ADC to measure battery voltage. I do not want to create a custom platform build for the VF61 but would like to implement a driver/service to support the CE GetSystemPowerStatusEx functionality–not just in our application, but for the CE 6 OS so it can support automatic sleep/shutdown based on the battery level. What is the easiest path to accomplish this? I noticed that there is a battery.dll (documented as a “dummy” module) in the Windows folder, but not BuiltIn\Battery entries in the registry. Is it as simple as adding the registry entries?


To do this you will need to create battery driver. We include dummy driver but it only reports that system is powered by AC.

To add extra functionality you will have to add your driver. Maybe it would be easier to create a function that measures your battery and reports it back to your program?

Thank you. I was afraid of that answer but my understanding is that my driver could be loaded at startup via the battery driver registry entries and wouldn’t need to be incorporated in a custom build. Is this correct?

You can create a driver and load it at the boot if you want.

Just follow this registry settings here → Battery Driver Registry Settings (Windows CE 5.0) | Microsoft Learn
This will only load your driver and not our dummy ones.

I added implementation of read battery driver to our roadmap. Do you have any target date when you need this?

I will need it within the next month.


You can download battery driver from here → Driver
And save to if Flashdisk\System
All you have to do is add this registry settings →

    "SYSTEM/BatteryAPIsReady"="Battery Interface APIs"

   "Flags"=dword:8                      ; DEVFLAGS_NAKEDENTRIES

After that the driver will load on boot. To communicate with driver you can use memory mapped file. You can download a sample how to use it here →

This sample shows how to update battery state to critical. You can use Microsoft documentation to find out other valid states.