__init__.py 786 B

1234567891011121314151617181920212223242526272829303132
  1. from . import oleaut32, ws2_32, wsock32
  2. """
  3. A small module containing a database of ordinal to symbol mappings for DLLs
  4. which frequently get linked without symbolic information.
  5. """
  6. ords = {
  7. b"oleaut32.dll": oleaut32.ord_names,
  8. b"ws2_32.dll": ws2_32.ord_names,
  9. b"wsock32.dll": wsock32.ord_names,
  10. }
  11. def formatOrdString(ord_val):
  12. return "ord{}".format(ord_val).encode()
  13. def ordLookup(libname, ord_val, make_name=False):
  14. """
  15. Lookup a name for the given ordinal if it's in our
  16. database.
  17. """
  18. names = ords.get(libname.lower())
  19. if names is None:
  20. if make_name is True:
  21. return formatOrdString(ord_val)
  22. return None
  23. name = names.get(ord_val)
  24. if name is None:
  25. return formatOrdString(ord_val)
  26. return name