Most of the Win32 API for working with
services requires a handle to the SCM. This is obtained by the
handle = win32service.OpenSCManager(
The name of the machine on which you wish to open the SCM. This can
None or left empty for the current machine.
The name of the service database or
None for the
default. The default is almost always used.
The desired access on the SCM.
The result is a handle to the SCM. Once you are finished with the
handle, the function
is used. See Appendix B, for a complete description of these
To open the SCM on the current machine, we could use the following code:
>>> import win32service >>> hscm=win32service.OpenSCManager(None, None, win32service.SC_MANAGER_ALL_ACCESS) >>> hscm 1368896 >>>
As you can see, service handles are implemented as integers, although
this may be changed to a variation of a