Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EvtSubscribe_push.py 692B

1 year ago
12345678910111213141516171819202122232425
  1. ## Demonstrates a "push" subscription with a callback function
  2. import win32evtlog
  3. query_text = '*[System[Provider[@Name="Microsoft-Windows-Winlogon"]]]'
  4. def c(reason, context, evt):
  5. if reason == win32evtlog.EvtSubscribeActionError:
  6. print("EvtSubscribeActionError")
  7. elif reason == win32evtlog.EvtSubscribeActionDeliver:
  8. print("EvtSubscribeActionDeliver")
  9. else:
  10. print("??? Unknown action ???", reason)
  11. context.append(win32evtlog.EvtRender(evt, win32evtlog.EvtRenderEventXml))
  12. return 0
  13. evttext = []
  14. s = win32evtlog.EvtSubscribe(
  15. "System",
  16. win32evtlog.EvtSubscribeStartAtOldestRecord,
  17. Query="*",
  18. Callback=c,
  19. Context=evttext,
  20. )