On 7/02/2012 5:18 PM, Lincoln Yeoh wrote:
Hi,

Is it easy to create a python windows service that registers for the
preshutdown event[1]?

It sounds like it should be easy, although you will need to define your own new constants which have been introduced. It would be great if you do get it working you contribute a working sample which I can add to pywin32.

Cheers,

Mark


Basically I would like a window service that will help shutdown .Net
(and possibly other) services in the right order.

Because:
http://connect.microsoft.com/VisualStudio/feedback/details/641737/add-windows-service-preshutdown

"A Windows service in C# cannot be registered to preshutdown
notifications. It is possible in C++ but not in C# with the current .net
framework"

http://support.microsoft.com/kb/203878

"When a service is dependendent on other services, the Service Control
Manager (SCM) will automatically start the dependencies before starting
the dependent service itself. However, during system shutdown, the SCM
does not take dependencies into consideration when stopping services. It
simply enumerates the list of running services and sends a
SERVICE_CONTROL_SHUTDOWN command to all of them. Thus, a service may
stop responding or fail because another service it depends upon has
already stopped."

(yeah weird right?)

And, since I'm a crappy and lazy programmer I think it'll be easier for
me to write such a thing in Python than C++, reasonably quickly, with
the features I want and with not too many bugs.

Regards,

Link.

[1] http://msdn.microsoft.com/en-us/magazine/cc164252.aspx#S2

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to