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.

pydumper.py 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # pydumper.py
  2. #
  3. # This is being worked on - it does not yet work at all, in ay way
  4. # shape or form :-)
  5. #
  6. # A new script engine, derived from the standard scripting engine,
  7. # which dumps information.
  8. # This generally can be used to grab all sorts of useful details about
  9. # an engine - expose bugs in it or Python, dump the object model, etc.
  10. # As it is derived from the standard engine, it fully supports Python
  11. # as a scripting language - meaning the dumps produced can be quite dynamic,
  12. # and based on the script code you execute.
  13. from win32com.axscript import axscript
  14. from . import pyscript
  15. from .pyscript import SCRIPTTEXT_FORCEEXECUTION, Exception, RaiseAssert, trace
  16. PyDump_CLSID = "{ac527e60-c693-11d0-9c25-00aa00125a98}"
  17. class AXScriptAttribute(pyscript.AXScriptAttribute):
  18. pass
  19. class NamedScriptAttribute(pyscript.NamedScriptAttribute):
  20. pass
  21. class PyScript(pyscript.PyScript):
  22. pass
  23. def Register():
  24. import sys
  25. if "-d" in sys.argv:
  26. dispatcher = "DispatcherWin32trace"
  27. debug_desc = " (" + dispatcher + ")"
  28. debug_option = "Yes"
  29. else:
  30. dispatcher = None
  31. debug_desc = ""
  32. debug_option = ""
  33. categories = [axscript.CATID_ActiveScript, axscript.CATID_ActiveScriptParse]
  34. clsid = PyDump_CLSID
  35. lcid = 0x0409 # // english
  36. policy = None # "win32com.axscript.client.axspolicy.AXScriptPolicy"
  37. print("Registering COM server%s..." % debug_desc)
  38. from win32com.server.register import RegisterServer
  39. languageName = "PyDump"
  40. verProgId = "Python.Dumper.1"
  41. RegisterServer(
  42. clsid=clsid,
  43. pythonInstString="win32com.axscript.client.pyscript.PyDumper",
  44. className="Python Debugging/Dumping ActiveX Scripting Engine",
  45. progID=languageName,
  46. verProgID=verProgId,
  47. catids=categories,
  48. policy=policy,
  49. dispatcher=dispatcher,
  50. )
  51. CreateRegKey(languageName + "\\OLEScript")
  52. # Basic Registration for wsh.
  53. win32com.server.register._set_string(".pysDump", "pysDumpFile")
  54. win32com.server.register._set_string("pysDumpFile\\ScriptEngine", languageName)
  55. print("Dumping Server registered.")
  56. if __name__ == "__main__":
  57. Register()