win32pdh and background processes

David L. Jessup dljessup at ix.netcom.com
Thu Jul 1 12:44:30 EDT 2004


Hi there:

I am trying to write a program to monitor certain processes on a
Windows NT 4.0 box without me needing to be logged in.  I have
successfully created a python program that performs this task by
running as a service on Windows 2000, but it fails on Win NT due to a
missing procedure entry point "RegisterServiceCtrlHandlerExW" in
ADVAPI32.dll; this problem appears to be due to the servicemanager
module, and exists in all versions of the win32 package back to 161,
which is when the servicemanager module first appeared.  I then tried
to run the program in an infinite loop using the "Scheduled Tasks"
service to spawn the program.  If I am logged in when the program is
running, the program runs fine, although it creates a console on my
screen.  However, if I am not logged in when the program kicks off, my
program dies on a call to win32pdh.EnumObjectItems:

    items, instances = win32pdh.EnumObjectItems(None, None, \
      'Process', win32pdh.PERF_DETAIL_WIZARD)

My question:  Why does win32pdh.EnumObjectItems die when I'm not
logged in?

Any help you can give me would be greatly appreciated.

--- David Jessup
(N.B.:  My e-mail address has a fairly obnoxious spam filter running,
due to the large amounts of spam I receive at this address.  If you
choose to e-mail me privately, ignore any e-mails from the spam
filter.)



More information about the Python-list mailing list