comtypes 1.4.9__zip → 1.4.11__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 (148) hide show
  1. {comtypes-1.4.9 → comtypes-1.4.11}/CHANGES.txt +41 -0
  2. {comtypes-1.4.9/comtypes.egg-info → comtypes-1.4.11}/PKG-INFO +4 -2
  3. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/GUID.py +34 -13
  4. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/__init__.py +25 -16
  5. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_comobject.py +92 -39
  6. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_memberspec.py +112 -78
  7. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_meta.py +2 -1
  8. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/_cominterface_meta_patcher.py +3 -6
  9. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/bstr.py +12 -5
  10. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/instancemethod.py +1 -2
  11. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/misc.py +59 -24
  12. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/unknwn.py +30 -25
  13. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_safearray.py +2 -2
  14. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_vtbl.py +52 -55
  15. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/automation.py +19 -14
  16. comtypes-1.4.11/comtypes/client/__init__.py +42 -0
  17. comtypes-1.4.11/comtypes/client/_activeobj.py +46 -0
  18. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_code_cache.py +15 -24
  19. comtypes-1.4.11/comtypes/client/_create.py +147 -0
  20. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_events.py +140 -57
  21. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_generate.py +3 -5
  22. comtypes-1.4.11/comtypes/client/_managing.py +114 -0
  23. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/dynamic.py +2 -3
  24. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/lazybind.py +10 -11
  25. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/connectionpoints.py +38 -3
  26. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/errorinfo.py +72 -21
  27. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/git.py +4 -3
  28. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/hints.pyi +15 -2
  29. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/hresult.py +16 -6
  30. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/logutil.py +15 -3
  31. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/messageloop.py +15 -13
  32. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/persist.py +3 -5
  33. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/safearray.py +8 -6
  34. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/__init__.py +22 -4
  35. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/automation.py +1 -2
  36. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/connectionpoints.py +71 -70
  37. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/inprocserver.py +14 -8
  38. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/localserver.py +28 -16
  39. comtypes-1.4.11/comtypes/server/register.py +478 -0
  40. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/shelllink.py +13 -7
  41. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/stream.py +7 -4
  42. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.py +6 -7
  43. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.py +4 -2
  44. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/__init__.py +1 -1
  45. comtypes-1.4.11/comtypes/test/find_memleak.py +72 -0
  46. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/runtests.py +1 -0
  47. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/setup.py +2 -1
  48. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_BSTR.py +7 -17
  49. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_GUID.py +7 -7
  50. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_QueryService.py +1 -0
  51. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_agilent.py +4 -3
  52. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_basic.py +18 -9
  53. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_clear_cache.py +1 -1
  54. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client.py +2 -2
  55. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client_dynamic.py +2 -2
  56. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client_regenerate_modules.py +2 -2
  57. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_collections.py +7 -4
  58. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_comobject.py +22 -9
  59. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_comserver.py +56 -3
  60. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dict.py +2 -1
  61. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispifc_records.py +1 -1
  62. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispifc_safearrays.py +1 -1
  63. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dyndispatch.py +5 -2
  64. comtypes-1.4.11/comtypes/test/test_errorinfo.py +115 -0
  65. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_findgendir.py +1 -2
  66. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_getactiveobj.py +4 -4
  67. comtypes-1.4.11/comtypes/test/test_hresult.py +48 -0
  68. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_ie.py +19 -6
  69. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_ienum.py +2 -2
  70. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_imfattributes.py +13 -3
  71. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_inout_args.py +10 -3
  72. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_midl_safearray_create.py +6 -4
  73. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_monikers.py +23 -9
  74. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_msscript.py +2 -1
  75. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_npsupport.py +4 -4
  76. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_outparam.py +22 -6
  77. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_persist.py +2 -4
  78. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_recordinfo.py +1 -1
  79. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_safearray.py +2 -1
  80. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_sapi.py +4 -1
  81. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_server_register.py +114 -125
  82. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_shelllink.py +2 -3
  83. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_storage.py +12 -6
  84. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_stream.py +16 -5
  85. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_subinterface.py +4 -2
  86. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_typeannotator.py +1 -2
  87. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_typeinfo.py +36 -7
  88. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_urlhistory.py +7 -4
  89. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_variant.py +5 -3
  90. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_w_getopt.py +4 -4
  91. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_word.py +1 -1
  92. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/codegenerator.py +167 -435
  93. comtypes-1.4.11/comtypes/tools/codegenerator/comments.py +79 -0
  94. comtypes-1.4.11/comtypes/tools/codegenerator/heads.py +192 -0
  95. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/helpers.py +3 -6
  96. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/namespaces.py +13 -5
  97. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/typeannotator.py +13 -3
  98. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/tlbparser.py +25 -25
  99. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/typedesc.py +3 -2
  100. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/typedesc_base.py +2 -2
  101. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/typeinfo.py +163 -51
  102. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/viewobject.py +2 -4
  103. {comtypes-1.4.9 → comtypes-1.4.11/comtypes.egg-info}/PKG-INFO +4 -2
  104. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/SOURCES.txt +7 -0
  105. {comtypes-1.4.9 → comtypes-1.4.11}/pyproject.toml +10 -23
  106. comtypes-1.4.9/comtypes/client/__init__.py +0 -323
  107. comtypes-1.4.9/comtypes/server/register.py +0 -419
  108. comtypes-1.4.9/comtypes/test/find_memleak.py +0 -76
  109. {comtypes-1.4.9 → comtypes-1.4.11}/LICENSE.txt +0 -0
  110. {comtypes-1.4.9 → comtypes-1.4.11}/MANIFEST.in +0 -0
  111. {comtypes-1.4.9 → comtypes-1.4.11}/README.md +0 -0
  112. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_npsupport.py +0 -0
  113. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/__init__.py +0 -0
  114. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_tlib_version_checker.py +0 -0
  115. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/clear_cache.py +0 -0
  116. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_constants.py +0 -0
  117. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/patcher.py +0 -0
  118. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/w_getopt.py +0 -0
  119. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.idl +0 -0
  120. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.tlb +0 -0
  121. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.idl +0 -0
  122. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.tlb +0 -0
  123. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mylib.idl +0 -0
  124. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mylib.tlb +0 -0
  125. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mytypelib.idl +0 -0
  126. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_DISPPARAMS.py +0 -0
  127. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_avmc.py +0 -0
  128. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_casesensitivity.py +0 -0
  129. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_createwrappers.py +0 -0
  130. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispinterface.py +0 -0
  131. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_excel.py +0 -0
  132. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_jscript.js +0 -0
  133. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_pump_events.py +0 -0
  134. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_server.py +0 -0
  135. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_showevents.py +0 -0
  136. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_win32com_interop.py +0 -0
  137. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_wmi.py +0 -0
  138. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/urlhist.tlb +0 -0
  139. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/__init__.py +0 -0
  140. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/__init__.py +0 -0
  141. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  142. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/packing.py +0 -0
  143. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/util.py +0 -0
  144. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/dependency_links.txt +0 -0
  145. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/entry_points.txt +0 -0
  146. {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/top_level.txt +0 -0
  147. {comtypes-1.4.9 → comtypes-1.4.11}/setup.cfg +0 -0
  148. {comtypes-1.4.9 → comtypes-1.4.11}/setup.py +0 -0
@@ -3,21 +3,70 @@
3
3
  # generated by 'xml2py'
4
4
  # flags '..\tools\windows.xml -m comtypes -m comtypes.automation -w -r .*TypeLibEx -r .*TypeLib -o typeinfo.py'
5
5
  # then hacked manually
6
+ import ctypes
6
7
  import sys
7
- from typing import Any, overload, TypeVar, TYPE_CHECKING
8
- from typing import List, Type, Tuple
9
- from typing import Optional, Union as _UnionT
10
- from typing import Callable, Sequence
11
8
  import weakref
12
-
13
- import ctypes
14
- from ctypes import HRESULT, POINTER, _Pointer, byref, c_int, c_void_p, c_wchar_p
15
- from ctypes.wintypes import DWORD, LONG, UINT, ULONG, WCHAR, WORD, INT, SHORT, USHORT
16
- from comtypes import BSTR, _CData, COMMETHOD, GUID, IID, IUnknown, STDMETHOD
17
- from comtypes.automation import DISPID, LCID, SCODE
18
- from comtypes.automation import DISPPARAMS, EXCEPINFO, VARIANT, VARIANTARG, VARTYPE
9
+ from ctypes import (
10
+ HRESULT,
11
+ POINTER,
12
+ OleDLL,
13
+ WinDLL,
14
+ byref,
15
+ c_int,
16
+ c_void_p,
17
+ c_wchar_p,
18
+ create_unicode_buffer,
19
+ )
20
+ from ctypes.wintypes import (
21
+ DWORD,
22
+ HMODULE,
23
+ INT,
24
+ LONG,
25
+ LPWSTR,
26
+ SHORT,
27
+ UINT,
28
+ ULONG,
29
+ USHORT,
30
+ WCHAR,
31
+ WORD,
32
+ )
33
+ from typing import (
34
+ TYPE_CHECKING,
35
+ Any,
36
+ Callable,
37
+ List,
38
+ Optional,
39
+ Sequence,
40
+ Tuple,
41
+ Type,
42
+ TypeVar,
43
+ overload,
44
+ )
45
+ from typing import Union as _UnionT
46
+
47
+ from comtypes import BSTR, COMMETHOD, GUID, IID, STDMETHOD, IUnknown, _CData
48
+ from comtypes._memberspec import PARAMFLAG_FHASCUSTDATA as PARAMFLAG_FHASCUSTDATA
49
+ from comtypes._memberspec import PARAMFLAG_FHASDEFAULT as PARAMFLAG_FHASDEFAULT
50
+ from comtypes._memberspec import PARAMFLAG_FIN as PARAMFLAG_FIN
51
+ from comtypes._memberspec import PARAMFLAG_FLCID as PARAMFLAG_FLCID
52
+ from comtypes._memberspec import PARAMFLAG_FOPT as PARAMFLAG_FOPT
53
+ from comtypes._memberspec import PARAMFLAG_FOUT as PARAMFLAG_FOUT
54
+ from comtypes._memberspec import PARAMFLAG_FRETVAL as PARAMFLAG_FRETVAL
55
+ from comtypes._memberspec import PARAMFLAG_NONE as PARAMFLAG_NONE
56
+ from comtypes.automation import (
57
+ DISPID,
58
+ DISPPARAMS,
59
+ EXCEPINFO,
60
+ LCID,
61
+ SCODE,
62
+ VARIANT,
63
+ VARIANTARG,
64
+ VARTYPE,
65
+ )
19
66
 
20
67
  if TYPE_CHECKING:
68
+ from ctypes import _Pointer
69
+
21
70
  from comtypes import hints # type: ignore
22
71
 
23
72
 
@@ -35,6 +84,7 @@ PVOID = c_void_p
35
84
  ULONG_PTR = ctypes.c_uint64 if is_64_bit else ctypes.c_ulong
36
85
 
37
86
  LPOLESTR = POINTER(OLECHAR)
87
+ LPCOLESTR = c_wchar_p
38
88
 
39
89
  ################################################################
40
90
  # enums
@@ -163,15 +213,6 @@ VARFLAG_FREPLACEABLE = 2048
163
213
  VARFLAG_FIMMEDIATEBIND = 4096
164
214
  VARFLAGS = tagVARFLAGS
165
215
 
166
- PARAMFLAG_NONE = 0
167
- PARAMFLAG_FIN = 1
168
- PARAMFLAG_FOUT = 2
169
- PARAMFLAG_FLCID = 4
170
- PARAMFLAG_FRETVAL = 8
171
- PARAMFLAG_FOPT = 16
172
- PARAMFLAG_FHASDEFAULT = 32
173
- PARAMFLAG_FHASCUSTDATA = 64
174
-
175
216
  ################################################################
176
217
  # a helper
177
218
 
@@ -238,8 +279,6 @@ class ITypeLib(IUnknown):
238
279
  Returns the name with capitalization found in the type
239
280
  library, or None.
240
281
  """
241
- from ctypes import create_unicode_buffer
242
-
243
282
  namebuf = create_unicode_buffer(name)
244
283
  found = BOOL()
245
284
  self.__com_IsName(namebuf, lHashVal, byref(found)) # type: ignore
@@ -568,13 +607,65 @@ IRecordInfo._methods_ = [
568
607
 
569
608
  ################################################################
570
609
  # functions
571
- _oleaut32 = ctypes.oledll.oleaut32
610
+ _oleaut32 = OleDLL("oleaut32")
611
+
612
+ _GetRecordInfoFromTypeInfo = _oleaut32.GetRecordInfoFromTypeInfo
613
+ _GetRecordInfoFromTypeInfo.argtypes = [
614
+ POINTER(ITypeInfo),
615
+ POINTER(POINTER(IRecordInfo)),
616
+ ]
617
+ _GetRecordInfoFromTypeInfo.restype = HRESULT
618
+
619
+ _GetRecordInfoFromGuids = _oleaut32.GetRecordInfoFromGuids
620
+ _GetRecordInfoFromGuids.argtypes = [
621
+ POINTER(GUID),
622
+ ULONG,
623
+ ULONG,
624
+ LCID,
625
+ POINTER(GUID),
626
+ POINTER(POINTER(IRecordInfo)),
627
+ ]
628
+ _GetRecordInfoFromGuids.restype = HRESULT
629
+
630
+ _LoadRegTypeLib = _oleaut32.LoadRegTypeLib
631
+ _LoadRegTypeLib.argtypes = [POINTER(GUID), WORD, WORD, LCID, POINTER(POINTER(ITypeLib))]
632
+ _LoadRegTypeLib.restype = HRESULT
633
+
634
+ _LoadTypeLibEx = _oleaut32.LoadTypeLibEx
635
+ _LoadTypeLibEx.argtypes = [LPCOLESTR, REGKIND, POINTER(POINTER(ITypeLib))]
636
+ _LoadTypeLibEx.restype = HRESULT
637
+
638
+ _LoadTypeLib = _oleaut32.LoadTypeLib
639
+ _LoadTypeLib.argtypes = [LPCOLESTR, POINTER(POINTER(ITypeLib))]
640
+ _LoadTypeLib.restype = HRESULT
641
+
642
+ _UnRegisterTypeLib = _oleaut32.UnRegisterTypeLib
643
+ _UnRegisterTypeLib.argtypes = [POINTER(GUID), WORD, WORD, LCID, SYSKIND]
644
+ _UnRegisterTypeLib.restype = HRESULT
645
+
646
+ _RegisterTypeLib = _oleaut32.RegisterTypeLib
647
+ _RegisterTypeLib.argtypes = [POINTER(ITypeLib), LPCOLESTR, LPCOLESTR]
648
+ _RegisterTypeLib.restype = HRESULT
649
+
650
+ _CreateTypeLib2 = _oleaut32.CreateTypeLib2
651
+ _CreateTypeLib2.argtypes = [SYSKIND, LPCOLESTR, POINTER(POINTER(ICreateTypeLib2))]
652
+ _CreateTypeLib2.restype = HRESULT
653
+
654
+ _QueryPathOfRegTypeLib = _oleaut32.QueryPathOfRegTypeLib
655
+ _QueryPathOfRegTypeLib.argtypes = [POINTER(GUID), USHORT, USHORT, LCID, POINTER(BSTR)]
656
+ _QueryPathOfRegTypeLib.restype = HRESULT
657
+
658
+ _kernel32 = WinDLL("kernel32")
659
+
660
+ _GetModuleFileNameW = _kernel32.GetModuleFileNameW
661
+ _GetModuleFileNameW.argtypes = [HMODULE, LPWSTR, DWORD]
662
+ _GetModuleFileNameW.restype = DWORD
572
663
 
573
664
 
574
665
  def GetRecordInfoFromTypeInfo(tinfo: ITypeInfo) -> IRecordInfo:
575
666
  """Return an IRecordInfo pointer to the UDT described in tinfo"""
576
667
  ri = POINTER(IRecordInfo)()
577
- _oleaut32.GetRecordInfoFromTypeInfo(tinfo, byref(ri))
668
+ _GetRecordInfoFromTypeInfo(tinfo, byref(ri))
578
669
  return ri # type: ignore
579
670
 
580
671
 
@@ -582,7 +673,7 @@ def GetRecordInfoFromGuids(
582
673
  rGuidTypeLib: str, verMajor: int, verMinor: int, lcid: int, rGuidTypeInfo: str
583
674
  ) -> IRecordInfo:
584
675
  ri = POINTER(IRecordInfo)()
585
- _oleaut32.GetRecordInfoFromGuids(
676
+ _GetRecordInfoFromGuids(
586
677
  byref(GUID(rGuidTypeLib)),
587
678
  verMajor,
588
679
  verMinor,
@@ -598,33 +689,21 @@ def LoadRegTypeLib(
598
689
  ) -> ITypeLib:
599
690
  """Load a registered type library"""
600
691
  tlib = POINTER(ITypeLib)()
601
- _oleaut32.LoadRegTypeLib(
602
- byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib)
603
- )
692
+ _LoadRegTypeLib(byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib))
604
693
  return tlib # type: ignore
605
694
 
606
695
 
607
- if hasattr(_oleaut32, "LoadTypeLibEx"):
608
-
609
- def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
610
- """Load, and optionally register a type library file"""
611
- ptl = POINTER(ITypeLib)()
612
- _oleaut32.LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
613
- return ptl # type: ignore
614
-
615
- else:
616
-
617
- def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
618
- """Load, and optionally register a type library file"""
619
- ptl = POINTER(ITypeLib)()
620
- _oleaut32.LoadTypeLib(c_wchar_p(szFile), byref(ptl))
621
- return ptl # type: ignore
696
+ def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
697
+ """Load, and optionally register a type library file"""
698
+ ptl = POINTER(ITypeLib)()
699
+ _LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
700
+ return ptl # type: ignore
622
701
 
623
702
 
624
703
  def LoadTypeLib(szFile: str) -> ITypeLib:
625
704
  """Load and register a type library file"""
626
705
  tlib = POINTER(ITypeLib)()
627
- _oleaut32.LoadTypeLib(c_wchar_p(szFile), byref(tlib))
706
+ _LoadTypeLib(c_wchar_p(szFile), byref(tlib))
628
707
  return tlib # type: ignore
629
708
 
630
709
 
@@ -636,36 +715,65 @@ def UnRegisterTypeLib(
636
715
  syskind: int = (SYS_WIN64 if is_64_bit else SYS_WIN32),
637
716
  ) -> int:
638
717
  """Unregister a registered type library"""
639
- return _oleaut32.UnRegisterTypeLib(
640
- byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind
641
- )
718
+ return _UnRegisterTypeLib(byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind)
642
719
 
643
720
 
644
721
  def RegisterTypeLib(
645
722
  tlib: ITypeLib, fullpath: str, helpdir: Optional[str] = None
646
723
  ) -> int:
647
724
  """Register a type library in the registry"""
648
- return _oleaut32.RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
725
+ return _RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
649
726
 
650
727
 
651
728
  def CreateTypeLib(filename: str, syskind: int = SYS_WIN32) -> ICreateTypeLib2:
652
729
  """Return a ICreateTypeLib2 pointer"""
653
730
  ctlib = POINTER(ICreateTypeLib2)()
654
- _oleaut32.CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
731
+ _CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
655
732
  return ctlib # type: ignore
656
733
 
657
734
 
658
735
  def QueryPathOfRegTypeLib(
659
736
  libid: str, wVerMajor: int, wVerMinor: int, lcid: int = 0
660
737
  ) -> str:
661
- """Return the path of a registered type library"""
738
+ """
739
+ Retrieve the path of a registered type library.
740
+
741
+ This function interacts with the Windows registry to locate the path of a
742
+ registered type library given its GUID, version, and locale.
743
+
744
+ Args:
745
+ libid (str): The GUID of the type library as a string.
746
+ wVerMajor (int): The major version of the type library.
747
+ wVerMinor (int): The minor version of the type library.
748
+ lcid (int, optional): The locale ID of the type library.
749
+
750
+ Returns:
751
+ str: The path of the registered type library.
752
+
753
+ Raises:
754
+ OSError: If QueryPathOfRegTypeLib fails.
755
+ """
756
+
662
757
  pathname = BSTR()
663
- _oleaut32.QueryPathOfRegTypeLib(
758
+ _QueryPathOfRegTypeLib(
664
759
  byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname)
665
760
  )
666
761
  return pathname.value.split("\0")[0]
667
762
 
668
763
 
764
+ def GetModuleFileName(handle: Optional[int], maxsize: int) -> str:
765
+ """Returns the fullpath of the loaded module specified by the handle.
766
+ If the handle is NULL, returns the executable file path of the current process.
767
+
768
+ https://learn.microsoft.com/ja-jp/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryw
769
+ """
770
+ buf = create_unicode_buffer(maxsize)
771
+ length = _GetModuleFileNameW(handle, buf, maxsize)
772
+ if not length:
773
+ raise ctypes.WinError()
774
+ return buf.value[:length]
775
+
776
+
669
777
  ################################################################
670
778
  # Structures
671
779
 
@@ -1072,6 +1180,10 @@ class IProvideClassInfo(IUnknown):
1072
1180
  ]
1073
1181
 
1074
1182
 
1183
+ # Flags used to specify the kind of information requested from an object.
1184
+ GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1
1185
+
1186
+
1075
1187
  class IProvideClassInfo2(IProvideClassInfo):
1076
1188
  _iid_ = GUID("{A6BC3AC0-DBAA-11CE-9DE3-00AA004BB851}")
1077
1189
  if TYPE_CHECKING:
@@ -1,10 +1,8 @@
1
1
  # XXX need to find out what the share from comtypes.dataobject.
2
2
  from ctypes import *
3
- from ctypes.wintypes import _RECTL, SIZEL, HDC, tagRECT, tagPOINT
3
+ from ctypes.wintypes import _RECTL, HDC, SIZEL, tagPOINT, tagRECT
4
4
 
5
- from comtypes import COMMETHOD
6
- from comtypes import GUID
7
- from comtypes import IUnknown
5
+ from comtypes import COMMETHOD, GUID, IUnknown
8
6
 
9
7
 
10
8
  class tagPALETTEENTRY(Structure):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: comtypes
3
- Version: 1.4.9
3
+ Version: 1.4.11
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,8 @@ 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
20
+ Dynamic: license-file
19
21
 
20
22
  # comtypes
21
23
 
@@ -43,10 +43,13 @@ comtypes/_post_coinit/instancemethod.py
43
43
  comtypes/_post_coinit/misc.py
44
44
  comtypes/_post_coinit/unknwn.py
45
45
  comtypes/client/__init__.py
46
+ comtypes/client/_activeobj.py
46
47
  comtypes/client/_code_cache.py
47
48
  comtypes/client/_constants.py
49
+ comtypes/client/_create.py
48
50
  comtypes/client/_events.py
49
51
  comtypes/client/_generate.py
52
+ comtypes/client/_managing.py
50
53
  comtypes/client/dynamic.py
51
54
  comtypes/client/lazybind.py
52
55
  comtypes/server/__init__.py
@@ -90,9 +93,11 @@ comtypes/test/test_dispifc_records.py
90
93
  comtypes/test/test_dispifc_safearrays.py
91
94
  comtypes/test/test_dispinterface.py
92
95
  comtypes/test/test_dyndispatch.py
96
+ comtypes/test/test_errorinfo.py
93
97
  comtypes/test/test_excel.py
94
98
  comtypes/test/test_findgendir.py
95
99
  comtypes/test/test_getactiveobj.py
100
+ comtypes/test/test_hresult.py
96
101
  comtypes/test/test_ie.py
97
102
  comtypes/test/test_ienum.py
98
103
  comtypes/test/test_imfattributes.py
@@ -130,6 +135,8 @@ comtypes/tools/typedesc.py
130
135
  comtypes/tools/typedesc_base.py
131
136
  comtypes/tools/codegenerator/__init__.py
132
137
  comtypes/tools/codegenerator/codegenerator.py
138
+ comtypes/tools/codegenerator/comments.py
139
+ comtypes/tools/codegenerator/heads.py
133
140
  comtypes/tools/codegenerator/helpers.py
134
141
  comtypes/tools/codegenerator/modulenamer.py
135
142
  comtypes/tools/codegenerator/namespaces.py
@@ -3,53 +3,40 @@ requires = ["setuptools>=61.2"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [tool.ruff.lint]
6
+ extend-select = ["I"]
6
7
  ignore = ["E402"]
7
8
 
8
9
  [tool.ruff.lint.per-file-ignores]
9
10
  # production
10
- "comtypes/_comobject.py" = ["E713", "E722", "F401"]
11
11
  "comtypes/_npsupport.py" = ["F401"]
12
12
  "comtypes/_vtbl.py" = ["E722"]
13
- "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
14
13
  "comtypes/automation.py" = ["F401", "F403", "F405"]
15
- "comtypes/errorinfo.py" = ["F403", "F405"]
16
14
  "comtypes/git.py" = ["F401", "F403", "F405"]
17
- "comtypes/logutil.py" = ["E401"]
18
- "comtypes/shelllink.py" = ["F401"]
19
15
  "comtypes/util.py" = ["F403", "F405"]
20
16
  "comtypes/viewobject.py" = ["F403", "F405"]
21
- "comtypes/_post_coinit/unknwn.py" = ["F821"]
22
- "comtypes/client/__init__.py" = ["F401", "F403"]
23
- "comtypes/client/_code_cache.py" = ["E401", "E711"]
24
17
  "comtypes/client/_constants.py" = ["F401"]
25
- "comtypes/client/_events.py" = ["F841"]
26
- "comtypes/client/lazybind.py" = ["F821"]
27
- "comtypes/server/__init__.py" = ["E401"]
28
18
  "comtypes/server/automation.py" = ["F403", "F405"]
29
19
  "comtypes/server/connectionpoints.py" = ["F401", "F403", "F405"]
30
- "comtypes/server/inprocserver.py" = ["E713", "E722", "F403", "F405", "F841"]
31
- "comtypes/server/localserver.py" = ["F401", "F403", "F405"]
32
- "comtypes/server/register.py" = ["F403", "F405", "E713", "E731"]
33
- "comtypes/tools/codegenerator/codegenerator.py" = ["E713", "E721"]
34
- "comtypes/tools/codegenerator/helpers.py" = ["F401"]
20
+ "comtypes/server/inprocserver.py" = ["E722"]
21
+ "comtypes/server/register.py" = ["E713"]
35
22
  "comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
36
- "comtypes/tools/tlbparser.py" = ["F401"]
37
23
  "comtypes/tools/typedesc.py" = ["F403", "F405"]
38
24
  "comtypes/tools/typedesc_base.py" = ["F401"]
25
+ # gen directory
26
+ "comtypes/gen/*" = ["E", "F", "I"]
27
+ # stub
28
+ "comtypes/hints.pyi" = ["I"]
39
29
  # tests
40
- "comtypes/test/TestComServer.py" = ["E401", "F401", "F403", "F405"]
41
30
  "comtypes/test/TestDispServer.py" = ["E401"]
42
31
  "comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
43
32
  "comtypes/test/setup.py" = ["F401"]
44
- "comtypes/test/test_BSTR.py" = ["E401", "F401", "F403", "F405"]
45
33
  "comtypes/test/test_agilent.py" = ["F401", "F841"]
46
34
  "comtypes/test/test_client.py" = ["F401"]
47
35
  "comtypes/test/test_dict.py" = ["F841"]
48
- "comtypes/test/test_ie.py" = ["F403", "F405", "F841"]
49
- "comtypes/test/test_outparam.py" = ["F403", "F405", "F841"]
36
+ "comtypes/test/test_ie.py" = ["F841"]
37
+ "comtypes/test/test_outparam.py" = ["F841"]
50
38
  "comtypes/test/test_sapi.py" = ["E401"]
51
- "comtypes/test/test_server.py" = ["E401", "E722", "F401", "F841"]
39
+ "comtypes/test/test_server.py" = ["F401", "F841"]
52
40
  "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
53
- "comtypes/test/test_typeinfo.py" = ["F401"]
54
41
  "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
55
42
  "comtypes/test/test_variant.py" = ["F401", "F821", "F841"]