How can I test my LPHANDLE_EX callback function

Thomas Chiantia 0 Reputation points

Hello, I am developing a Windows service that will process extended service control requests from Windows.

For example, if the system battery drops, the windows kernel will send a POWER_EVENT with event type of POWERSETTING_CHANGE and a GUID_BATTERY_PERCENTAGE_REMAINING containing a DWORD value between 0 - 100.

For another example, When a user plugs in a COM device, the windows kernel will send a service that has setup RegisterDeviceNotification a SERVICE_CONTROL_DEVICEEVENT message with a DEV_BROADCAST_HDR describing the device that was connected.

I would like to be able to test my service with out having to manually plug and unplug USB devices or wait for battery to drop (my development system does not even have a battery!)

I would like to know if there is some data I can use as a mock that I can pass to my HANDLER_EX function. Or perhaps a tool (similar to sc.exe) that can send mock messages to the service.

Thanks for reading!

Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,460 questions
0 comments No comments
{count} votes