Das solltest du lieber nicht tun denn:
Zitat von
MSDN:
Note that certain functions in the Windows
API, including NotifyServiceStatusChange and other SCM functions, use remote procedure calls (RPC); these functions might perform an alertable wait operation, so they are not safe to call from within the callback function
Die Lösung ist:
Zitat von
MSDN:
Instead, the callback function should save the notification parameters and perform any additional work outside the callback.