How can I test my LPHANDLE_EX callback function

Thomas Chiantia 0 Reputation points
2023-10-26T13:12:57.0133333+00:00

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 for business | Windows Client for IT Pros | Devices and deployment | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.