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_pull.py 792B

1 year ago
12345678910111213141516171819202122232425262728
  1. ## Demonstrates how to create a "pull" subscription
  2. import win32con
  3. import win32event
  4. import win32evtlog
  5. query_text = '*[System[Provider[@Name="Microsoft-Windows-Winlogon"]]]'
  6. h = win32event.CreateEvent(None, 0, 0, None)
  7. s = win32evtlog.EvtSubscribe(
  8. "System",
  9. win32evtlog.EvtSubscribeStartAtOldestRecord,
  10. SignalEvent=h,
  11. Query=query_text,
  12. )
  13. while 1:
  14. while 1:
  15. events = win32evtlog.EvtNext(s, 10)
  16. if len(events) == 0:
  17. break
  18. ##for event in events:
  19. ## print(win32evtlog.EvtRender(event, win32evtlog.EvtRenderEventXml))
  20. print("retrieved %s events" % len(events))
  21. while 1:
  22. print("waiting...")
  23. w = win32event.WaitForSingleObjectEx(h, 2000, True)
  24. if w == win32con.WAIT_OBJECT_0:
  25. break