I have a Win32 service, that needs to run a .NET executable on service stop (for cleanup reasons). I recently discovered that the cleanup never happens on shutdown, because the process creation gets blocked by OS. Does anyone know a way to override this? Process, I am spawning is not invasive and should only run a fraction of a second.
Run process during windows shutdown
Asked Answered
Take a look on the following link: #849118. It describes how you can subscribe to process events. –
Fierce
@Klinger: I have absolutely no idea how is subscribing to process events going to help me –
Phagocyte
I missed that you meant OS shutdown. The following link describes how to run scripts on startup/shutdown, not sure if this will help but you never know. tutorial5.com/content/view/157/47 –
Fierce
Also, the following SO question, that has no accepted answer, is similar to your question. #5217746 –
Fierce
He says it's "impossible" and sugests the policy route, what is what that tutorial is about. There is also a policy to disable automatic closing of console and GUI apps. Follow link with instructions: technospot.net/blogs/… –
Fierce
The only way I could find to do it was: pre-create a child process suspended, and them un-suspend it on shutdown.
© 2022 - 2024 — McMap. All rights reserved.