Description Field in WinXP Services

rbt rbt at athop1.ath.vt.edu
Sat Jan 29 21:03:49 EST 2005


rbt wrote:
> Roger Upole wrote:
> 
>> ChangeServiceConfig2 is the api functions that sets the description,
>> but it's not in the win32service module (yet).
>>
>>          Roger
> 
> 
> OK, I can use _winreg to add the 'Description' field under the 
> appropriate registry key.

Here's an example of it... kludgey but it works ;)

from _winreg import *
import time

def Svc_Description():
     try:
         key_location = r"SYSTEM\CurrentControlSet\Services\test_py_service"
         svc_key = OpenKey(HKEY_LOCAL_MACHINE, key_location, 0, KEY_ALL_ACCESS)
         SetValueEx(svc_key,'Description',0,REG_SZ,u"Brad's Test Python Service")
         CloseKey(svc_key)
     except Exception, e:
         print e

Svc_Description()
time.sleep(10)



More information about the Python-list mailing list