have a handle to the SCM, open a specific service using the function
, which has the following signature.
handle = win32service.OpenService(
A handle to the SCM, as obtained from
The name of the service to open.
A bitmask of flags defining the desired access.
win32service.SERVICE_ALL_ACCESS provides all
Now that you’re connected to the SCM, you can obtain a handle to the messenger service with the following code:
>>> hs=win32service.OpenService(hscm, "Messenger", ... win32service.SERVICE_ALL_ACCESS) >>> hs 1375960 >>>