[python-win32] ctypes and python dll callbacks

Mark Hammond mhammond at skippinet.com.au
Tue Jan 22 11:25:46 CET 2008


> Sorry but where can I find "RegisterServiceCtrlHandlerEx" ? I could
> only find "servicemanager.RegisterServiceCtrlHandler" which is different
and
> do not catch logon/logoff events.

servicemanager.RegisterServiceCtrlHandler() automatically calls
RegisterServiceCtrlHandlerEx on 2k and later. See PythonService.cpp:

        if (g_RegisterServiceCtrlHandlerEx) {
            // Use 2K/XP extended registration if available
            pe->sshStatusHandle = g_RegisterServiceCtrlHandlerEx(szName,
service_ctrl_ex, pe);
        } else {
            // Otherwise fall back to NT
            pe->sshStatusHandle = RegisterServiceCtrlHandler(szName,
service_ctrl);
        }

This also gives us the theoretical capability of hosting more than 1 service
in a python instance, but I've never tried that.

Cheers,

Mark



More information about the python-win32 mailing list