def AddSourceToRegistry(appName, msgDLL=None, eventLogType='Application', eventLogFlags=None):
 if (msgDLL is None):
  msgDLL = win32evtlog.__file__
 hkey = win32api.RegCreateKey(win32con.HKEY_LOCAL_MACHINE, ('SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s' % (eventLogType, appName)))
 win32api.RegSetValueEx(hkey, 'EventMessageFile', 0, win32con.REG_EXPAND_SZ, msgDLL)
 if (eventLogFlags is None):
  eventLogFlags = ((win32evtlog.EVENTLOG_ERROR_TYPE | win32evtlog.EVENTLOG_WARNING_TYPE) | win32evtlog.EVENTLOG_INFORMATION_TYPE)
 win32api.RegSetValueEx(hkey, 'TypesSupported', 0, win32con.REG_DWORD, eventLogFlags)
 win32api.RegCloseKey(hkey)

def AddSourceToRegistry ( appName , msgDLL = None , eventLogType = 'Application' , eventLogFlags = None ) : if ( msgDLL is None ) : msgDLL = win32evtlog . __file__ hkey = win32api . RegCreateKey ( win32con . HKEY_LOCAL_MACHINE , ( 'SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s' % ( eventLogType , appName ) ) ) win32api . RegSetValueEx ( hkey , 'EventMessageFile' , 0 , win32con . REG_EXPAND_SZ , msgDLL ) if ( eventLogFlags is None ) : eventLogFlags = ( ( win32evtlog . EVENTLOG_ERROR_TYPE | win32evtlog . EVENTLOG_WARNING_TYPE ) | win32evtlog . EVENTLOG_INFORMATION_TYPE ) win32api . RegSetValueEx ( hkey , 'TypesSupported' , 0 , win32con . REG_DWORD , eventLogFlags ) win32api . RegCloseKey ( hkey )
add a source of messages to the event log .