What is happening to windows services after putting the computer in sleep mode and then resume it again?

Viewed 134

I have a program in C++ that runs as a service and when I put the computer to sleep and then resume it again, the service crashes because I must reinitialize some pointer to specific hardware.

My question is that what happens exactly when I put my computer into sleep mode and is there any Windows callback that I can call it after resuming my computer?

I know that I can define some call back for starting and pausing a service (As described in the following reference) but not anyone after resuming from sleep mode.

https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nc-winsvc-lphandler_function_ex

0 Answers
Related