I am working on a Windows Service written in C code.
In the service initialization code I have registered to a SERVICE_ACCEPT_PRESHUTDOWN event like this