Hello,
I'm trying to use RegisterServiceCtrlHandlerEx. Since it isn't available 
in pywin32, I have to call it from advapi32.dll using ctypes.
RegisterServiceCtrlHandlerEx is useful to replace winlogon notification 
package to get informations about login/logoff events. I could use SENS 
in a com server but I have already an NT service running a twisted 
PerspectiveBroker server.
A handler to a callback function must be passed to 
RegisterServiceCtrlHandlerEx. How can a python callback function handler 
be created to be passed to a ctypes DLL function ?


advapi32 = ctypes.oledll.LoadLibrary('Advapi32.dll')
RegisterServiceCtrlHandlerEx = advapi32.RegisterServiceCtrlHandlerExW
RegisterServiceCtrlHandlerEx(svc_name, myPyFunc, svc_name)

returns :
<class 'ctypes.ArgumentError'>: argument 2: <type 
'exceptions.TypeError'>: Don't know how to convert parameter 2

Any idea ?


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

Reply via email to