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
@@ -3,21 +3,62 @@
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
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.automation import (
49
+ DISPID,
50
+ DISPPARAMS,
51
+ EXCEPINFO,
52
+ LCID,
53
+ SCODE,
54
+ VARIANT,
55
+ VARIANTARG,
56
+ VARTYPE,
57
+ )
19
58
 
20
59
  if TYPE_CHECKING:
60
+ from ctypes import _Pointer
61
+
21
62
  from comtypes import hints # type: ignore
22
63
 
23
64
 
@@ -28,16 +69,14 @@ is_64_bit = sys.maxsize > 2**32
28
69
 
29
70
  BOOL = c_int
30
71
  HREFTYPE = DWORD
31
- INT = c_int
32
72
  MEMBERID = DISPID
33
73
  OLECHAR = WCHAR
34
74
  PVOID = c_void_p
35
- SHORT = ctypes.c_short
36
75
  # See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#ULONG_PTR # noqa
37
76
  ULONG_PTR = ctypes.c_uint64 if is_64_bit else ctypes.c_ulong
38
77
 
39
- USHORT = ctypes.c_ushort
40
78
  LPOLESTR = POINTER(OLECHAR)
79
+ LPCOLESTR = c_wchar_p
41
80
 
42
81
  ################################################################
43
82
  # enums
@@ -241,8 +280,6 @@ class ITypeLib(IUnknown):
241
280
  Returns the name with capitalization found in the type
242
281
  library, or None.
243
282
  """
244
- from ctypes import create_unicode_buffer
245
-
246
283
  namebuf = create_unicode_buffer(name)
247
284
  found = BOOL()
248
285
  self.__com_IsName(namebuf, lHashVal, byref(found)) # type: ignore
@@ -571,13 +608,65 @@ IRecordInfo._methods_ = [
571
608
 
572
609
  ################################################################
573
610
  # functions
574
- _oleaut32 = ctypes.oledll.oleaut32
611
+ _oleaut32 = OleDLL("oleaut32")
612
+
613
+ _GetRecordInfoFromTypeInfo = _oleaut32.GetRecordInfoFromTypeInfo
614
+ _GetRecordInfoFromTypeInfo.argtypes = [
615
+ POINTER(ITypeInfo),
616
+ POINTER(POINTER(IRecordInfo)),
617
+ ]
618
+ _GetRecordInfoFromTypeInfo.restype = HRESULT
619
+
620
+ _GetRecordInfoFromGuids = _oleaut32.GetRecordInfoFromGuids
621
+ _GetRecordInfoFromGuids.argtypes = [
622
+ POINTER(GUID),
623
+ ULONG,
624
+ ULONG,
625
+ LCID,
626
+ POINTER(GUID),
627
+ POINTER(POINTER(IRecordInfo)),
628
+ ]
629
+ _GetRecordInfoFromGuids.restype = HRESULT
630
+
631
+ _LoadRegTypeLib = _oleaut32.LoadRegTypeLib
632
+ _LoadRegTypeLib.argtypes = [POINTER(GUID), WORD, WORD, LCID, POINTER(POINTER(ITypeLib))]
633
+ _LoadRegTypeLib.restype = HRESULT
634
+
635
+ _LoadTypeLibEx = _oleaut32.LoadTypeLibEx
636
+ _LoadTypeLibEx.argtypes = [LPCOLESTR, REGKIND, POINTER(POINTER(ITypeLib))]
637
+ _LoadTypeLibEx.restype = HRESULT
638
+
639
+ _LoadTypeLib = _oleaut32.LoadTypeLib
640
+ _LoadTypeLib.argtypes = [LPCOLESTR, POINTER(POINTER(ITypeLib))]
641
+ _LoadTypeLib.restype = HRESULT
642
+
643
+ _UnRegisterTypeLib = _oleaut32.UnRegisterTypeLib
644
+ _UnRegisterTypeLib.argtypes = [POINTER(GUID), WORD, WORD, LCID, SYSKIND]
645
+ _UnRegisterTypeLib.restype = HRESULT
646
+
647
+ _RegisterTypeLib = _oleaut32.RegisterTypeLib
648
+ _RegisterTypeLib.argtypes = [POINTER(ITypeLib), LPCOLESTR, LPCOLESTR]
649
+ _RegisterTypeLib.restype = HRESULT
650
+
651
+ _CreateTypeLib2 = _oleaut32.CreateTypeLib2
652
+ _CreateTypeLib2.argtypes = [SYSKIND, LPCOLESTR, POINTER(POINTER(ICreateTypeLib2))]
653
+ _CreateTypeLib2.restype = HRESULT
654
+
655
+ _QueryPathOfRegTypeLib = _oleaut32.QueryPathOfRegTypeLib
656
+ _QueryPathOfRegTypeLib.argtypes = [POINTER(GUID), USHORT, USHORT, LCID, POINTER(BSTR)]
657
+ _QueryPathOfRegTypeLib.restype = HRESULT
658
+
659
+ _kernel32 = WinDLL("kernel32")
660
+
661
+ _GetModuleFileNameW = _kernel32.GetModuleFileNameW
662
+ _GetModuleFileNameW.argtypes = [HMODULE, LPWSTR, DWORD]
663
+ _GetModuleFileNameW.restype = DWORD
575
664
 
576
665
 
577
666
  def GetRecordInfoFromTypeInfo(tinfo: ITypeInfo) -> IRecordInfo:
578
667
  """Return an IRecordInfo pointer to the UDT described in tinfo"""
579
668
  ri = POINTER(IRecordInfo)()
580
- _oleaut32.GetRecordInfoFromTypeInfo(tinfo, byref(ri))
669
+ _GetRecordInfoFromTypeInfo(tinfo, byref(ri))
581
670
  return ri # type: ignore
582
671
 
583
672
 
@@ -585,7 +674,7 @@ def GetRecordInfoFromGuids(
585
674
  rGuidTypeLib: str, verMajor: int, verMinor: int, lcid: int, rGuidTypeInfo: str
586
675
  ) -> IRecordInfo:
587
676
  ri = POINTER(IRecordInfo)()
588
- _oleaut32.GetRecordInfoFromGuids(
677
+ _GetRecordInfoFromGuids(
589
678
  byref(GUID(rGuidTypeLib)),
590
679
  verMajor,
591
680
  verMinor,
@@ -601,70 +690,89 @@ def LoadRegTypeLib(
601
690
  ) -> ITypeLib:
602
691
  """Load a registered type library"""
603
692
  tlib = POINTER(ITypeLib)()
604
- _oleaut32.LoadRegTypeLib(
605
- byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib)
606
- )
693
+ _LoadRegTypeLib(byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib))
607
694
  return tlib # type: ignore
608
695
 
609
696
 
610
- if hasattr(_oleaut32, "LoadTypeLibEx"):
611
-
612
- def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
613
- """Load, and optionally register a type library file"""
614
- ptl = POINTER(ITypeLib)()
615
- _oleaut32.LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
616
- return ptl # type: ignore
617
-
618
- else:
619
-
620
- def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
621
- """Load, and optionally register a type library file"""
622
- ptl = POINTER(ITypeLib)()
623
- _oleaut32.LoadTypeLib(c_wchar_p(szFile), byref(ptl))
624
- return ptl # type: ignore
697
+ def LoadTypeLibEx(szFile: str, regkind: int = REGKIND_NONE) -> ITypeLib:
698
+ """Load, and optionally register a type library file"""
699
+ ptl = POINTER(ITypeLib)()
700
+ _LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
701
+ return ptl # type: ignore
625
702
 
626
703
 
627
704
  def LoadTypeLib(szFile: str) -> ITypeLib:
628
705
  """Load and register a type library file"""
629
706
  tlib = POINTER(ITypeLib)()
630
- _oleaut32.LoadTypeLib(c_wchar_p(szFile), byref(tlib))
707
+ _LoadTypeLib(c_wchar_p(szFile), byref(tlib))
631
708
  return tlib # type: ignore
632
709
 
633
710
 
634
711
  def UnRegisterTypeLib(
635
- libID: str, wVerMajor: int, wVerMinor: int, lcid: int = 0, syskind: int = SYS_WIN32
712
+ libID: str,
713
+ wVerMajor: int,
714
+ wVerMinor: int,
715
+ lcid: int = 0,
716
+ syskind: int = (SYS_WIN64 if is_64_bit else SYS_WIN32),
636
717
  ) -> int:
637
718
  """Unregister a registered type library"""
638
- return _oleaut32.UnRegisterTypeLib(
639
- byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind
640
- )
719
+ return _UnRegisterTypeLib(byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind)
641
720
 
642
721
 
643
722
  def RegisterTypeLib(
644
723
  tlib: ITypeLib, fullpath: str, helpdir: Optional[str] = None
645
724
  ) -> int:
646
725
  """Register a type library in the registry"""
647
- return _oleaut32.RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
726
+ return _RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
648
727
 
649
728
 
650
729
  def CreateTypeLib(filename: str, syskind: int = SYS_WIN32) -> ICreateTypeLib2:
651
730
  """Return a ICreateTypeLib2 pointer"""
652
731
  ctlib = POINTER(ICreateTypeLib2)()
653
- _oleaut32.CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
732
+ _CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
654
733
  return ctlib # type: ignore
655
734
 
656
735
 
657
736
  def QueryPathOfRegTypeLib(
658
737
  libid: str, wVerMajor: int, wVerMinor: int, lcid: int = 0
659
738
  ) -> str:
660
- """Return the path of a registered type library"""
739
+ """
740
+ Retrieve the path of a registered type library.
741
+
742
+ This function interacts with the Windows registry to locate the path of a
743
+ registered type library given its GUID, version, and locale.
744
+
745
+ Args:
746
+ libid (str): The GUID of the type library as a string.
747
+ wVerMajor (int): The major version of the type library.
748
+ wVerMinor (int): The minor version of the type library.
749
+ lcid (int, optional): The locale ID of the type library.
750
+
751
+ Returns:
752
+ str: The path of the registered type library.
753
+
754
+ Raises:
755
+ OSError: If QueryPathOfRegTypeLib fails.
756
+ """
757
+
661
758
  pathname = BSTR()
662
- _oleaut32.QueryPathOfRegTypeLib(
759
+ _QueryPathOfRegTypeLib(
663
760
  byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname)
664
761
  )
665
762
  return pathname.value.split("\0")[0]
666
763
 
667
764
 
765
+ def GetModuleFileName(handle: Optional[int], maxsize: int) -> str:
766
+ """Returns the fullpath of the loaded module specified by the handle.
767
+ If the handle is NULL, returns the executable file path of the current process.
768
+
769
+ https://learn.microsoft.com/ja-jp/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryw
770
+ """
771
+ buf = create_unicode_buffer(maxsize)
772
+ length = _GetModuleFileNameW(handle, buf, maxsize)
773
+ return buf.value[:length]
774
+
775
+
668
776
  ################################################################
669
777
  # Structures
670
778
 
@@ -680,13 +788,7 @@ class tagTLIBATTR(ctypes.Structure):
680
788
  wLibFlags: int
681
789
 
682
790
  def __repr__(self):
683
- return "TLIBATTR(GUID=%s, Version=%s.%s, LCID=%s, FLags=0x%x)" % (
684
- self.guid,
685
- self.wMajorVerNum,
686
- self.wMinorVerNum,
687
- self.lcid,
688
- self.wLibFlags,
689
- )
791
+ return f"TLIBATTR(GUID={self.guid}, Version={self.wMajorVerNum}.{self.wMinorVerNum}, LCID={self.lcid}, FLags=0x{self.wLibFlags:x})"
690
792
 
691
793
 
692
794
  TLIBATTR = tagTLIBATTR
@@ -715,13 +817,7 @@ class tagTYPEATTR(ctypes.Structure):
715
817
  idldescType: "IDLDESC"
716
818
 
717
819
  def __repr__(self):
718
- return "TYPEATTR(GUID=%s, typekind=%s, funcs=%s, vars=%s, impltypes=%s)" % (
719
- self.guid,
720
- self.typekind,
721
- self.cFuncs,
722
- self.cVars,
723
- self.cImplTypes,
724
- )
820
+ return f"TYPEATTR(GUID={self.guid}, typekind={self.typekind}, funcs={self.cFuncs}, vars={self.cVars}, impltypes={self.cImplTypes})"
725
821
 
726
822
 
727
823
  TYPEATTR = tagTYPEATTR
@@ -745,14 +841,14 @@ class tagFUNCDESC(ctypes.Structure):
745
841
 
746
842
  def __repr__(self):
747
843
  return (
748
- "FUNCDESC("
844
+ f"FUNCDESC("
749
845
  f"memid={self.memid}, "
750
846
  f"cParams={self.cParams}, "
751
847
  f"cParamsOpt={self.cParamsOpt}, "
752
848
  f"callconv={self.callconv}, "
753
- f"invkind={self.invkind,}, "
849
+ f"invkind={self.invkind}, "
754
850
  f"funckind={self.funckind}"
755
- ")"
851
+ f")"
756
852
  )
757
853
 
758
854
 
@@ -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):
@@ -61,11 +59,7 @@ class tagExtentInfo(Structure):
61
59
 
62
60
  def __repr__(self):
63
61
  size = (self.sizelProposed.cx, self.sizelProposed.cy)
64
- return "<ExtentInfo(mode=%s, size=%s) at %x>" % (
65
- self.dwExtentMode,
66
- size,
67
- id(self),
68
- )
62
+ return f"<ExtentInfo(mode={self.dwExtentMode}, size={size}) at {id(self):x}>"
69
63
 
70
64
 
71
65
  assert sizeof(tagExtentInfo) == 16, sizeof(tagExtentInfo)
@@ -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.
@@ -8,13 +8,12 @@ setup.py
8
8
  comtypes/GUID.py
9
9
  comtypes/__init__.py
10
10
  comtypes/_comobject.py
11
- comtypes/_idl_stuff.py
12
11
  comtypes/_memberspec.py
13
12
  comtypes/_meta.py
14
13
  comtypes/_npsupport.py
15
- comtypes/_py_instance_method.py
16
14
  comtypes/_safearray.py
17
15
  comtypes/_tlib_version_checker.py
16
+ comtypes/_vtbl.py
18
17
  comtypes/automation.py
19
18
  comtypes/clear_cache.py
20
19
  comtypes/connectionpoints.py
@@ -38,14 +37,19 @@ comtypes.egg-info/dependency_links.txt
38
37
  comtypes.egg-info/entry_points.txt
39
38
  comtypes.egg-info/top_level.txt
40
39
  comtypes/_post_coinit/__init__.py
40
+ comtypes/_post_coinit/_cominterface_meta_patcher.py
41
41
  comtypes/_post_coinit/bstr.py
42
+ comtypes/_post_coinit/instancemethod.py
42
43
  comtypes/_post_coinit/misc.py
43
44
  comtypes/_post_coinit/unknwn.py
44
45
  comtypes/client/__init__.py
46
+ comtypes/client/_activeobj.py
45
47
  comtypes/client/_code_cache.py
46
48
  comtypes/client/_constants.py
49
+ comtypes/client/_create.py
47
50
  comtypes/client/_events.py
48
51
  comtypes/client/_generate.py
52
+ comtypes/client/_managing.py
49
53
  comtypes/client/dynamic.py
50
54
  comtypes/client/lazybind.py
51
55
  comtypes/server/__init__.py
@@ -81,6 +85,7 @@ comtypes/test/test_client.py
81
85
  comtypes/test/test_client_dynamic.py
82
86
  comtypes/test/test_client_regenerate_modules.py
83
87
  comtypes/test/test_collections.py
88
+ comtypes/test/test_comobject.py
84
89
  comtypes/test/test_comserver.py
85
90
  comtypes/test/test_createwrappers.py
86
91
  comtypes/test/test_dict.py
@@ -102,12 +107,12 @@ comtypes/test/test_msscript.py
102
107
  comtypes/test/test_npsupport.py
103
108
  comtypes/test/test_outparam.py
104
109
  comtypes/test/test_persist.py
105
- comtypes/test/test_propputref.py
106
110
  comtypes/test/test_pump_events.py
107
111
  comtypes/test/test_recordinfo.py
108
112
  comtypes/test/test_safearray.py
109
113
  comtypes/test/test_sapi.py
110
114
  comtypes/test/test_server.py
115
+ comtypes/test/test_server_register.py
111
116
  comtypes/test/test_shelllink.py
112
117
  comtypes/test/test_showevents.py
113
118
  comtypes/test/test_storage.py
@@ -117,6 +122,7 @@ comtypes/test/test_typeannotator.py
117
122
  comtypes/test/test_typeinfo.py
118
123
  comtypes/test/test_urlhistory.py
119
124
  comtypes/test/test_variant.py
125
+ comtypes/test/test_w_getopt.py
120
126
  comtypes/test/test_win32com_interop.py
121
127
  comtypes/test/test_wmi.py
122
128
  comtypes/test/test_word.py
@@ -127,6 +133,8 @@ comtypes/tools/typedesc.py
127
133
  comtypes/tools/typedesc_base.py
128
134
  comtypes/tools/codegenerator/__init__.py
129
135
  comtypes/tools/codegenerator/codegenerator.py
136
+ comtypes/tools/codegenerator/comments.py
137
+ comtypes/tools/codegenerator/heads.py
130
138
  comtypes/tools/codegenerator/helpers.py
131
139
  comtypes/tools/codegenerator/modulenamer.py
132
140
  comtypes/tools/codegenerator/namespaces.py
@@ -3,52 +3,45 @@ 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
- "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
12
+ "comtypes/_vtbl.py" = ["E722"]
13
13
  "comtypes/automation.py" = ["F401", "F403", "F405"]
14
+ "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
14
15
  "comtypes/errorinfo.py" = ["F403", "F405"]
15
16
  "comtypes/git.py" = ["F401", "F403", "F405"]
16
- "comtypes/logutil.py" = ["E401"]
17
- "comtypes/shelllink.py" = ["F401"]
18
17
  "comtypes/util.py" = ["F403", "F405"]
19
18
  "comtypes/viewobject.py" = ["F403", "F405"]
20
- "comtypes/_post_coinit/unknwn.py" = ["F821"]
21
- "comtypes/client/__init__.py" = ["F401", "F403"]
22
19
  "comtypes/client/_code_cache.py" = ["E401", "E711"]
23
20
  "comtypes/client/_constants.py" = ["F401"]
24
21
  "comtypes/client/_events.py" = ["F841"]
25
- "comtypes/client/lazybind.py" = ["F821"]
26
- "comtypes/server/__init__.py" = ["E401"]
27
22
  "comtypes/server/automation.py" = ["F403", "F405"]
28
23
  "comtypes/server/connectionpoints.py" = ["F401", "F403", "F405"]
29
- "comtypes/server/inprocserver.py" = ["E713", "E722", "F403", "F405", "F841"]
30
- "comtypes/server/localserver.py" = ["F401", "F403", "F405"]
31
- "comtypes/server/register.py" = ["F403", "F405", "E713", "E731"]
32
- "comtypes/tools/codegenerator/codegenerator.py" = ["E713", "E721"]
33
- "comtypes/tools/codegenerator/helpers.py" = ["F401"]
24
+ "comtypes/server/inprocserver.py" = ["E713", "E722", "F841"]
25
+ "comtypes/server/register.py" = ["E713"]
34
26
  "comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
35
27
  "comtypes/tools/tlbparser.py" = ["F401"]
36
28
  "comtypes/tools/typedesc.py" = ["F403", "F405"]
37
29
  "comtypes/tools/typedesc_base.py" = ["F401"]
30
+ # gen directory
31
+ "comtypes/gen/*" = ["E", "F", "I"]
32
+ # stub
33
+ "comtypes/hints.pyi" = ["I"]
38
34
  # tests
39
- "comtypes/test/TestComServer.py" = ["E401", "F401", "F403", "F405"]
40
35
  "comtypes/test/TestDispServer.py" = ["E401"]
41
36
  "comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
42
37
  "comtypes/test/setup.py" = ["F401"]
43
- "comtypes/test/test_BSTR.py" = ["E401", "F401", "F403", "F405"]
44
38
  "comtypes/test/test_agilent.py" = ["F401", "F841"]
45
39
  "comtypes/test/test_client.py" = ["F401"]
46
40
  "comtypes/test/test_dict.py" = ["F841"]
47
- "comtypes/test/test_ie.py" = ["F403", "F405", "F841"]
48
- "comtypes/test/test_outparam.py" = ["F403", "F405", "F841"]
41
+ "comtypes/test/test_ie.py" = ["F841"]
42
+ "comtypes/test/test_outparam.py" = ["F841"]
49
43
  "comtypes/test/test_sapi.py" = ["E401"]
50
- "comtypes/test/test_server.py" = ["E401", "E722", "F401", "F841"]
44
+ "comtypes/test/test_server.py" = ["F401", "F841"]
51
45
  "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
52
- "comtypes/test/test_typeinfo.py" = ["F401"]
53
46
  "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
54
47
  "comtypes/test/test_variant.py" = ["F401", "F821", "F841"]