You cannot accept either shutdown or pre-shutdown if your service is correctly encoded. The documentation explicitly states this.
From http://msdn.microsoft.com/en-us/library/windows/desktop/ms683241(v=vs.85).aspx :
Referring to SERVICE_CONTROL_PRESHUTDOWN : "The service that processes this notification blocks the system from shutting down until the service shuts down or the wait interval specified by SERVICE_PRESHUTDOWN_INFO expires."
On the same page, the SERVICE_CONTROL_SHUTDOWN section adds: "Please note that services that register for SERVICE_CONTROL_PRESHUTDOWN notifications cannot receive this notification because they have already stopped."
So the correct way is to set dwControlsAccepted to enable SERVICE_ACCEPT_SHUTDOWN or SERVICE_ACCEPT_PRESHUTDOWN, depending on your needs, but not both at the same time.
But note that you probably want to accept more controls. You should always allow at least SERVICE_CONTROL_INTERROGATE and almost certainly allow SERVICE_CONTROL_STOP , since without the latter the service cannot be stopped (for example, to remove software), and the process must be forcibly terminated (i.e. killed).
source share