I have a Windows service in which I need to detect the Windows shutdown event and, depending on what kind of processing I am doing at the time, delay the shutdown for a few seconds until my processing is complete. Can that be done?

Any help appreciated.