[python-win32] Re: Windows service features and Python

Mark Hammond mhammond at skippinet.com.au
Mon Aug 16 14:50:12 CEST 2004


> win32evtlogutil.py deals with EventMessageFile and TypesSupported reg
> keys only. For categories two additional keys should be used,
> CategoryMessageFile and CategoryCount. These two keys I did not find
> throughout all the source. Should I log the need for category support
> as an RFE?

Yes, but unfortunately not much will happen.  If you can provide a patch, I
will be happy to look at it and get it in, but I doubt I will find the time
to firstly research it, then implement it.

> Maybe we could add this to the registering method like:
> def AddSourceToRegistry(appName, msgDLL = None, eventLogType =
> "Application", eventLogFlags = None, catDLL = None, catCount = 0):

Sounds great! :)  Just make a patch or if necessary, send me a the complete
modified source.

> >> Now I'm trying to figure out how can I make these IDs visible by
> >> symbolic name in my Python source, like pipeTestService uses
> >> servicemanager.pyd. I don't want to define these twice, and
> >> keep in sync all the time...
>
> > Check out "h2py" in the Python "Tools\scripts" directory
> for one option.
>
> Yes, that would be fine for some sort of automatic translation of IDs
> into Python source, provided I modified it for handling .mc syntax
> instead of .h, but I'd like to see these IDs in only one source.
> I'm trying to create a .cpp with these constants. Since I didnt
> find a minimal Windows .dll example that can be used for Python,
> I will try to deduce one from servicemanager.cpp.

You should find an 'example_nt' directory somewhere (maybe only in the
Python sources).  This will create a .pyd - but a .pyd is just a .dll with a
funky extension :)

> >> I found this out only by looking at the source, as its help does
> >> not mention this switch. It would also be nice if this would
> >> support pause and continue functions.
...
> Should I log the need for cmd line pause and continue as an RFE?

As above - I've no shortage on nice things to do :)

> May I suggest adding the following usage information:
> --perfmonini file: .ini file to use for registering
> performance monitor data
> --perfmondll file: .dll file to use when querying the service for
>  performance data, default = perfmondata.dll

Thanks - I've checked that in.

> There are some services which give a console window when this flag
> is set. I thought pythonservice.exe is such a console app. I suppose
> with some modifications it would be suitable to compile it as a
> console app.

I believe this flag will simply allow these services to *create* a console.
Eg, a service with this flag can call CreateProcess, and you will see the
new process' console.  When the parent service does not have it set, you
don't see the console.  The win32 console API could also be used by a
service to create a console, but I'm not aware of how you can get a console
for the service itself.

Mark.



More information about the Python-win32 mailing list