comtypes 1.4.8__zip → 1.4.10__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. {comtypes-1.4.8 → comtypes-1.4.10}/CHANGES.txt +40 -0
  2. {comtypes-1.4.8/comtypes.egg-info → comtypes-1.4.10}/PKG-INFO +4 -3
  3. {comtypes-1.4.8 → comtypes-1.4.10}/README.md +1 -1
  4. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/GUID.py +38 -16
  5. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/__init__.py +36 -16
  6. comtypes-1.4.10/comtypes/_comobject.py +562 -0
  7. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_memberspec.py +93 -13
  8. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_meta.py +1 -0
  9. comtypes-1.4.10/comtypes/_post_coinit/_cominterface_meta_patcher.py +152 -0
  10. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_post_coinit/bstr.py +12 -5
  11. comtypes-1.4.8/comtypes/_py_instance_method.py → comtypes-1.4.10/comtypes/_post_coinit/instancemethod.py +1 -2
  12. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_post_coinit/misc.py +60 -25
  13. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_post_coinit/unknwn.py +26 -176
  14. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_safearray.py +3 -4
  15. comtypes-1.4.10/comtypes/_vtbl.py +448 -0
  16. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/automation.py +46 -49
  17. comtypes-1.4.10/comtypes/client/__init__.py +42 -0
  18. comtypes-1.4.10/comtypes/client/_activeobj.py +46 -0
  19. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/_code_cache.py +10 -5
  20. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/_constants.py +1 -1
  21. comtypes-1.4.10/comtypes/client/_create.py +147 -0
  22. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/_events.py +58 -13
  23. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/_generate.py +7 -11
  24. comtypes-1.4.10/comtypes/client/_managing.py +114 -0
  25. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/dynamic.py +2 -3
  26. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/client/lazybind.py +12 -13
  27. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/connectionpoints.py +2 -1
  28. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/errorinfo.py +22 -9
  29. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/git.py +5 -5
  30. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/hints.pyi +7 -15
  31. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/logutil.py +15 -3
  32. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/messageloop.py +1 -1
  33. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/persist.py +3 -5
  34. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/safearray.py +17 -5
  35. comtypes-1.4.10/comtypes/server/__init__.py +104 -0
  36. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/server/automation.py +1 -2
  37. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/server/connectionpoints.py +5 -5
  38. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/server/inprocserver.py +25 -17
  39. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/server/localserver.py +49 -19
  40. comtypes-1.4.10/comtypes/server/register.py +478 -0
  41. comtypes-1.4.10/comtypes/server/w_getopt.py +48 -0
  42. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/shelllink.py +16 -33
  43. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/stream.py +7 -4
  44. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestComServer.py +6 -7
  45. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestDispServer.py +4 -2
  46. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/__init__.py +10 -12
  47. comtypes-1.4.10/comtypes/test/find_memleak.py +72 -0
  48. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/runtests.py +1 -0
  49. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/setup.py +2 -1
  50. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_BSTR.py +10 -23
  51. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_GUID.py +1 -0
  52. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_QueryService.py +1 -0
  53. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_agilent.py +4 -3
  54. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_avmc.py +1 -1
  55. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_basic.py +12 -6
  56. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_casesensitivity.py +3 -5
  57. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_clear_cache.py +1 -1
  58. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_client.py +2 -2
  59. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_client_dynamic.py +2 -2
  60. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_client_regenerate_modules.py +2 -2
  61. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_collections.py +4 -4
  62. comtypes-1.4.10/comtypes/test/test_comobject.py +146 -0
  63. comtypes-1.4.10/comtypes/test/test_comserver.py +349 -0
  64. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_createwrappers.py +2 -4
  65. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_dispifc_records.py +1 -1
  66. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_dispifc_safearrays.py +1 -1
  67. comtypes-1.4.10/comtypes/test/test_dispinterface.py +153 -0
  68. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_dyndispatch.py +1 -0
  69. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_excel.py +22 -12
  70. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_findgendir.py +1 -2
  71. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_getactiveobj.py +4 -4
  72. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_ie.py +19 -9
  73. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_ienum.py +2 -2
  74. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_imfattributes.py +13 -3
  75. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_inout_args.py +8 -5
  76. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_midl_safearray_create.py +14 -4
  77. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_monikers.py +23 -9
  78. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_msscript.py +2 -1
  79. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_npsupport.py +4 -4
  80. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_outparam.py +37 -14
  81. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_persist.py +2 -4
  82. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_recordinfo.py +1 -1
  83. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_safearray.py +1 -90
  84. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_sapi.py +4 -1
  85. comtypes-1.4.10/comtypes/test/test_server.py +350 -0
  86. comtypes-1.4.10/comtypes/test/test_server_register.py +524 -0
  87. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_shelllink.py +2 -3
  88. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_showevents.py +7 -17
  89. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_storage.py +12 -6
  90. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_stream.py +16 -5
  91. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_subinterface.py +4 -2
  92. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_typeannotator.py +1 -2
  93. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_typeinfo.py +19 -7
  94. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_urlhistory.py +7 -4
  95. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_variant.py +3 -19
  96. comtypes-1.4.10/comtypes/test/test_w_getopt.py +29 -0
  97. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_win32com_interop.py +80 -36
  98. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_wmi.py +0 -3
  99. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_word.py +1 -1
  100. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/codegenerator.py +166 -440
  101. comtypes-1.4.10/comtypes/tools/codegenerator/comments.py +79 -0
  102. comtypes-1.4.10/comtypes/tools/codegenerator/heads.py +192 -0
  103. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/helpers.py +11 -14
  104. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/namespaces.py +13 -5
  105. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/packing.py +4 -4
  106. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/typeannotator.py +19 -9
  107. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/tlbparser.py +22 -23
  108. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/typedesc.py +4 -8
  109. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/typedesc_base.py +2 -2
  110. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/typeinfo.py +159 -63
  111. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/viewobject.py +3 -9
  112. {comtypes-1.4.8 → comtypes-1.4.10/comtypes.egg-info}/PKG-INFO +4 -3
  113. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes.egg-info/SOURCES.txt +11 -3
  114. {comtypes-1.4.8 → comtypes-1.4.10}/pyproject.toml +12 -19
  115. comtypes-1.4.8/comtypes/_comobject.py +0 -833
  116. comtypes-1.4.8/comtypes/_idl_stuff.py +0 -67
  117. comtypes-1.4.8/comtypes/client/__init__.py +0 -323
  118. comtypes-1.4.8/comtypes/server/__init__.py +0 -70
  119. comtypes-1.4.8/comtypes/server/register.py +0 -431
  120. comtypes-1.4.8/comtypes/server/w_getopt.py +0 -75
  121. comtypes-1.4.8/comtypes/test/find_memleak.py +0 -76
  122. comtypes-1.4.8/comtypes/test/test_comserver.py +0 -239
  123. comtypes-1.4.8/comtypes/test/test_dispinterface.py +0 -137
  124. comtypes-1.4.8/comtypes/test/test_propputref.py +0 -40
  125. comtypes-1.4.8/comtypes/test/test_server.py +0 -354
  126. {comtypes-1.4.8 → comtypes-1.4.10}/LICENSE.txt +0 -0
  127. {comtypes-1.4.8 → comtypes-1.4.10}/MANIFEST.in +0 -0
  128. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_npsupport.py +0 -0
  129. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_post_coinit/__init__.py +0 -0
  130. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/_tlib_version_checker.py +0 -0
  131. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/clear_cache.py +0 -0
  132. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/hresult.py +0 -0
  133. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/patcher.py +0 -0
  134. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestComServer.idl +0 -0
  135. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestComServer.tlb +0 -0
  136. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestDispServer.idl +0 -0
  137. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/TestDispServer.tlb +0 -0
  138. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/mylib.idl +0 -0
  139. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/mylib.tlb +0 -0
  140. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/mytypelib.idl +0 -0
  141. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_DISPPARAMS.py +0 -0
  142. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_dict.py +0 -0
  143. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_jscript.js +0 -0
  144. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/test_pump_events.py +0 -0
  145. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/test/urlhist.tlb +0 -0
  146. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/__init__.py +0 -0
  147. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/__init__.py +0 -0
  148. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  149. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes/util.py +0 -0
  150. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes.egg-info/dependency_links.txt +0 -0
  151. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes.egg-info/entry_points.txt +0 -0
  152. {comtypes-1.4.8 → comtypes-1.4.10}/comtypes.egg-info/top_level.txt +0 -0
  153. {comtypes-1.4.8 → comtypes-1.4.10}/setup.cfg +0 -0
  154. {comtypes-1.4.8 → comtypes-1.4.10}/setup.py +0 -0
@@ -1,6 +1,46 @@
1
1
  Comtypes CHANGELOG
2
2
  ==================
3
3
 
4
+ Release 1.4.10
5
+ --------------
6
+ * Replace ``GetModuleFileNameA`` with ``GetModuleFileNameW`` to prevent a ``TypeError``. By @junkmd.
7
+ * Refactor ``server.register``. By @junkmd.
8
+ * ``PythonClass`` and ``PythonPath`` are no longer registered in the registry for a frozen server. By @junkmd.
9
+ * Use ``WinDLL``/``OleDLL`` instead of ``windll``/``oledll``. By @moi15moi.
10
+ * In ``tools.tlbparser``, replace ``windll.oleaut32.QueryPathOfRegTypeLib`` with ``typeinfo.QueryPathOfRegTypeLib``. By @moi15moi.
11
+ * Adjust ``QueryPathOfRegTypeLib`` docstring. By @moi15moi.
12
+ * Reserve blank lines in the generated modules. By @junkmd.
13
+ * Refactor ``tools`` subpackage. By @junkmd.
14
+ * Add ``ActiveObjTest`` to ``test_comserver``. By @junkmd.
15
+ * Replace deprecated install command in CI pipelines. By @moi15moi.
16
+ * Remove unused parameters in ``_shutdown``. By @moi15moi.
17
+ * Delete ``preview.bat``. By @moi15moi.
18
+ * Remove unnecessary ``ruff`` lint rules from ``pyproject.toml``. By @moi15moi.
19
+ * Refactor some code from ``client/__init__.py`` into modules. By @junkmd.
20
+ * Remove workarounds for Windows CE in ``find_memleak``. By @junkmd.
21
+ * Format import blocks and add ``extend-select = ["I"]`` to ``[tool.ruff.lint]``. By @junkmd.
22
+
23
+ Release 1.4.9
24
+ --------------
25
+ * Separate patch processing within ``_com_interface_meta`` into a module. By @junkmd.
26
+ * Replace ``Literal`` and ``Protocol`` with runtime-referable symbols. By @junkmd.
27
+ * Refactor from ``%`` string formatting to f-strings in many modules. By @newwingbird.
28
+ * Refactor from ``%`` string formatting to f-strings in ``_post_coinit.unknwn``. By @junkmd.
29
+ * Remove the script entry point in ``comtypes.shelllink``. By @cosmastech.
30
+ * Move the modules that define IDL stuff and ``instancemethod``. By @junkmd.
31
+ * Allow the definition of the ``_midlSAFEARRAY(HRESULT)`` type. By @davidschranz.
32
+ * Split ``server/w_getopt.py`` into production code and test code. By @junkmd.
33
+ * Add docstrings to the module defining the ``GUID`` symbol. By @junkmd.
34
+ * Fix broken unregistration of 64bit type libraries. By @forderud.
35
+ * Replace alias definitions with ``ctypes.wintypes`` imports. By @fmtabler.
36
+ * Revive ``pywin32`` related tests. By @junkmd.
37
+ * Revive comserver related tests. By @junkmd.
38
+ * Separate the part that creates entries from ``server.register.Registrar`` and refactor it. By @junkmd.
39
+ * Add ``Test_Registrar_...``. By @junkmd.
40
+ * Many typing improvements. By @junkmd.
41
+ * Separate ``vtbl`` creation within ``_comobject`` into a module. By @junkmd.
42
+ * Migrate the documentation from PythonHosted to ReadTheDocs. By @junkmd.
43
+
4
44
  Release 1.4.8
5
45
  --------------
6
46
  * Remove Python 3.7 and add Python 3.13 to the CI pipelines. By @junkmd.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: comtypes
3
- Version: 1.4.8
3
+ Version: 1.4.10
4
4
  Summary: Pure Python COM package
5
5
  Home-page: https://github.com/enthought/comtypes
6
6
  Download-URL: https://github.com/enthought/comtypes/releases
@@ -16,6 +16,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
16
  Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE.txt
19
+ Dynamic: download-url
19
20
 
20
21
  # comtypes
21
22
 
@@ -99,4 +100,4 @@ However, if the script implementation does not use `comtypes.client.GetModule` o
99
100
 
100
101
  ## Documentation
101
102
 
102
- The documentation is currently hosted [here](https://pythonhosted.org/comtypes) on PythonHosted.
103
+ The documentation is currently hosted [here](https://comtypes.readthedocs.io/) on ReadTheDocs.
@@ -80,4 +80,4 @@ However, if the script implementation does not use `comtypes.client.GetModule` o
80
80
 
81
81
  ## Documentation
82
82
 
83
- The documentation is currently hosted [here](https://pythonhosted.org/comtypes) on PythonHosted.
83
+ The documentation is currently hosted [here](https://comtypes.readthedocs.io/) on ReadTheDocs.
@@ -1,6 +1,8 @@
1
- from ctypes import oledll, windll
2
- from ctypes import byref, c_byte, c_ushort, c_ulong, c_wchar_p, Structure
3
- from typing import Any, TYPE_CHECKING
1
+ """comtypes.GUID module"""
2
+
3
+ from ctypes import HRESULT, POINTER, OleDLL, Structure, WinDLL, byref, c_wchar_p
4
+ from ctypes.wintypes import BYTE, DWORD, LPVOID, WORD
5
+ from typing import TYPE_CHECKING, Any
4
6
 
5
7
  if TYPE_CHECKING:
6
8
  from comtypes import hints # type: ignore
@@ -10,24 +12,13 @@ def binary(obj: "GUID") -> bytes:
10
12
  return bytes(obj)
11
13
 
12
14
 
13
- BYTE = c_byte
14
- WORD = c_ushort
15
- DWORD = c_ulong
16
-
17
- _ole32 = oledll.ole32
18
-
19
- _StringFromCLSID = _ole32.StringFromCLSID
20
- _CoTaskMemFree = windll.ole32.CoTaskMemFree
21
- _ProgIDFromCLSID = _ole32.ProgIDFromCLSID
22
- _CLSIDFromString = _ole32.CLSIDFromString
23
- _CLSIDFromProgID = _ole32.CLSIDFromProgID
24
- _CoCreateGuid = _ole32.CoCreateGuid
25
-
26
15
  # Note: Comparing GUID instances by comparing their buffers
27
16
  # is slightly faster than using ole32.IsEqualGUID.
28
17
 
29
18
 
30
19
  class GUID(Structure):
20
+ """Globally unique identifier structure."""
21
+
31
22
  _fields_ = [("Data1", DWORD), ("Data2", WORD), ("Data3", WORD), ("Data4", BYTE * 8)]
32
23
 
33
24
  def __init__(self, name=None):
@@ -92,6 +83,37 @@ class GUID(Structure):
92
83
  return guid
93
84
 
94
85
 
86
+ REFCLSID = POINTER(GUID)
87
+ LPOLESTR = LPCOLESTR = c_wchar_p
88
+ LPCLSID = POINTER(GUID)
89
+
90
+ _ole32_nohresult = WinDLL("ole32")
91
+ _ole32 = OleDLL("ole32")
92
+
93
+ _StringFromCLSID = _ole32.StringFromCLSID
94
+ _StringFromCLSID.argtypes = [REFCLSID, POINTER(LPOLESTR)]
95
+ _StringFromCLSID.restype = HRESULT
96
+
97
+ _CoTaskMemFree = _ole32_nohresult.CoTaskMemFree
98
+ _CoTaskMemFree.argtypes = [LPVOID]
99
+ _CoTaskMemFree.restype = None
100
+
101
+ _ProgIDFromCLSID = _ole32.ProgIDFromCLSID
102
+ _ProgIDFromCLSID.argtypes = [REFCLSID, POINTER(LPOLESTR)]
103
+ _ProgIDFromCLSID.restype = HRESULT
104
+
105
+ _CLSIDFromString = _ole32.CLSIDFromString
106
+ _CLSIDFromString.argtypes = [LPCOLESTR, LPCLSID]
107
+ _CLSIDFromString.restype = HRESULT
108
+
109
+ _CLSIDFromProgID = _ole32.CLSIDFromProgID
110
+ _CLSIDFromProgID.argtypes = [LPCOLESTR, LPCLSID]
111
+ _CLSIDFromProgID.restype = HRESULT
112
+
113
+ _CoCreateGuid = _ole32.CoCreateGuid
114
+ _CoCreateGuid.argtypes = [POINTER(GUID)]
115
+ _CoCreateGuid.restype = HRESULT
116
+
95
117
  GUID_null = GUID()
96
118
 
97
119
  __all__ = ["GUID"]
@@ -1,5 +1,5 @@
1
1
  # comtypes version numbers follow semver (http://semver.org/) and PEP 440
2
- __version__ = "1.4.8"
2
+ __version__ = "1.4.10"
3
3
 
4
4
  try:
5
5
  from _ctypes import COMError # noqa
@@ -15,33 +15,30 @@ except ImportError as e:
15
15
  raise ImportError(msg) from e
16
16
 
17
17
  import atexit
18
+ import logging
19
+ import sys
18
20
 
19
21
  # HACK: Workaround for projects that depend on this package
20
22
  # There should be several projects around the world that depend on this package
21
23
  # and indirectly reference the symbols of `ctypes` from `comtypes`.
22
24
  # If we remove the wildcard import from `ctypes`, they might break. So it is
23
25
  # left in the following line.
24
- from ctypes import * # noqa
25
- from ctypes import HRESULT # noqa
26
- from ctypes import _Pointer, _SimpleCData # noqa
27
- from ctypes import c_int, c_ulong, oledll, windll
28
- import logging
29
- import sys
26
+ from ctypes import * # noqa # type: ignore
27
+ from ctypes import HRESULT, OleDLL, WinDLL, _SimpleCData, c_int, c_ulong
28
+ from ctypes.wintypes import DWORD, LPVOID
30
29
  from typing import TYPE_CHECKING
31
30
 
32
31
  if TYPE_CHECKING:
33
32
  from ctypes import _CData # only in `typeshed`, private in runtime
33
+
34
34
  from comtypes import hints as hints # noqa # type: ignore
35
35
  else:
36
36
  _CData = _SimpleCData.__mro__[:-1][-1]
37
37
 
38
- from comtypes.GUID import GUID
39
38
  from comtypes import patcher # noqa
40
39
  from comtypes._npsupport import interop as npsupport # noqa
41
40
  from comtypes._tlib_version_checker import _check_version # noqa
42
- from comtypes._py_instance_method import instancemethod # noqa
43
- from comtypes._idl_stuff import defaultvalue, helpstring, dispid # noqa
44
- from comtypes._idl_stuff import STDMETHOD, DISPMETHOD, DISPPROPERTY, COMMETHOD # noqa
41
+ from comtypes.GUID import GUID
45
42
 
46
43
  _all_slice = slice(None, None, None)
47
44
 
@@ -75,7 +72,6 @@ class ReturnHRESULT(Exception):
75
72
 
76
73
  _GUID = GUID
77
74
  IID = GUID
78
- DWORD = c_ulong
79
75
 
80
76
  wireHWND = c_ulong
81
77
 
@@ -124,8 +120,18 @@ EOAC_NONE = 0
124
120
 
125
121
  ################################################################
126
122
  # Initialization and shutdown
127
- _ole32 = oledll.ole32
128
- _ole32_nohresult = windll.ole32 # use this for functions that don't return a HRESULT
123
+ _ole32 = OleDLL("ole32")
124
+
125
+ _CoInitializeEx = _ole32.CoInitializeEx
126
+ _CoInitializeEx.argtypes = [LPVOID, DWORD]
127
+ _CoInitializeEx.restype = HRESULT
128
+
129
+ _ole32_nohresult = WinDLL("ole32") # use this for functions that don't return a HRESULT
130
+
131
+ _CoUninitialize = _ole32_nohresult.CoUninitialize
132
+ _CoUninitialize.argtypes = []
133
+ _CoUninitialize.restype = None
134
+
129
135
 
130
136
  COINIT_MULTITHREADED = 0x0
131
137
  COINIT_APARTMENTTHREADED = 0x2
@@ -141,7 +147,7 @@ def CoInitializeEx(flags=None):
141
147
  if flags is None:
142
148
  flags = getattr(sys, "coinit_flags", COINIT_APARTMENTTHREADED)
143
149
  logger.debug("CoInitializeEx(None, %s)", flags)
144
- _ole32.CoInitializeEx(None, flags)
150
+ _CoInitializeEx(None, flags)
145
151
 
146
152
 
147
153
  # COM is initialized automatically for the thread that imports this
@@ -159,7 +165,7 @@ CoInitializeEx()
159
165
  # in which we are using COM
160
166
  def CoUninitialize():
161
167
  logger.debug("CoUninitialize()")
162
- _ole32_nohresult.CoUninitialize()
168
+ _CoUninitialize()
163
169
 
164
170
 
165
171
  ################################################################
@@ -172,6 +178,19 @@ com_interface_registry = {}
172
178
  com_coclass_registry = {}
173
179
 
174
180
 
181
+ ################################################################
182
+ # IDL stuff
183
+
184
+ from comtypes._memberspec import ( # noqa
185
+ COMMETHOD,
186
+ DISPMETHOD,
187
+ DISPPROPERTY,
188
+ STDMETHOD,
189
+ defaultvalue,
190
+ dispid,
191
+ helpstring,
192
+ )
193
+
175
194
  ################################################################
176
195
  # IUnknown, the root of all evil...
177
196
  from comtypes._post_coinit import _shutdown
@@ -193,6 +212,7 @@ from comtypes._post_coinit.misc import IPersist, IServiceProvider # noqa
193
212
  ################################################################
194
213
 
195
214
 
215
+ from comtypes._post_coinit.instancemethod import instancemethod # noqa
196
216
  from comtypes._post_coinit.misc import ( # noqa
197
217
  _is_object,
198
218
  CoGetObject,