comtypes 1.4.9__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 (146) hide show
  1. {comtypes-1.4.9 → comtypes-1.4.10}/CHANGES.txt +19 -0
  2. {comtypes-1.4.9/comtypes.egg-info → comtypes-1.4.10}/PKG-INFO +3 -2
  3. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/GUID.py +34 -13
  4. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/__init__.py +22 -13
  5. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_comobject.py +69 -14
  6. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_memberspec.py +14 -6
  7. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_meta.py +1 -0
  8. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/_cominterface_meta_patcher.py +0 -1
  9. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/bstr.py +12 -5
  10. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/instancemethod.py +1 -2
  11. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/misc.py +59 -24
  12. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/unknwn.py +2 -6
  13. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_safearray.py +2 -2
  14. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/automation.py +10 -4
  15. comtypes-1.4.10/comtypes/client/__init__.py +42 -0
  16. comtypes-1.4.10/comtypes/client/_activeobj.py +46 -0
  17. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/_code_cache.py +6 -1
  18. comtypes-1.4.10/comtypes/client/_create.py +147 -0
  19. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/_events.py +57 -12
  20. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/_generate.py +3 -3
  21. comtypes-1.4.10/comtypes/client/_managing.py +114 -0
  22. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/dynamic.py +2 -3
  23. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/lazybind.py +10 -11
  24. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/connectionpoints.py +2 -1
  25. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/errorinfo.py +20 -7
  26. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/git.py +4 -3
  27. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/logutil.py +15 -3
  28. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/messageloop.py +1 -1
  29. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/persist.py +3 -5
  30. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/safearray.py +8 -6
  31. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/__init__.py +22 -4
  32. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/automation.py +1 -2
  33. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/connectionpoints.py +5 -5
  34. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/inprocserver.py +6 -3
  35. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/localserver.py +23 -5
  36. comtypes-1.4.10/comtypes/server/register.py +478 -0
  37. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/shelllink.py +13 -7
  38. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/stream.py +7 -4
  39. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestComServer.py +6 -7
  40. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestDispServer.py +4 -2
  41. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/__init__.py +1 -1
  42. comtypes-1.4.10/comtypes/test/find_memleak.py +72 -0
  43. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/runtests.py +1 -0
  44. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/setup.py +2 -1
  45. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_BSTR.py +7 -17
  46. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_GUID.py +1 -0
  47. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_QueryService.py +1 -0
  48. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_agilent.py +4 -3
  49. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_basic.py +12 -6
  50. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_clear_cache.py +1 -1
  51. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_client.py +2 -2
  52. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_client_dynamic.py +2 -2
  53. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_client_regenerate_modules.py +2 -2
  54. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_collections.py +1 -1
  55. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_comobject.py +4 -4
  56. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_comserver.py +31 -1
  57. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_dispifc_records.py +1 -1
  58. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_dispifc_safearrays.py +1 -1
  59. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_dyndispatch.py +1 -0
  60. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_findgendir.py +1 -2
  61. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_getactiveobj.py +4 -4
  62. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_ie.py +19 -6
  63. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_ienum.py +2 -2
  64. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_imfattributes.py +13 -3
  65. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_inout_args.py +1 -1
  66. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_midl_safearray_create.py +6 -4
  67. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_monikers.py +23 -9
  68. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_msscript.py +2 -1
  69. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_npsupport.py +4 -4
  70. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_outparam.py +22 -6
  71. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_persist.py +2 -4
  72. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_recordinfo.py +1 -1
  73. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_sapi.py +4 -1
  74. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_server_register.py +113 -125
  75. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_shelllink.py +2 -3
  76. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_storage.py +12 -6
  77. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_stream.py +16 -5
  78. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_subinterface.py +4 -2
  79. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_typeannotator.py +1 -2
  80. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_typeinfo.py +19 -7
  81. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_urlhistory.py +7 -4
  82. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_variant.py +3 -2
  83. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_word.py +1 -1
  84. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/codegenerator.py +167 -435
  85. comtypes-1.4.10/comtypes/tools/codegenerator/comments.py +79 -0
  86. comtypes-1.4.10/comtypes/tools/codegenerator/heads.py +192 -0
  87. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/helpers.py +3 -6
  88. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/namespaces.py +13 -5
  89. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/typeannotator.py +13 -3
  90. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/tlbparser.py +22 -23
  91. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/typedesc.py +3 -2
  92. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/typedesc_base.py +2 -2
  93. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/typeinfo.py +149 -42
  94. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/viewobject.py +2 -4
  95. {comtypes-1.4.9 → comtypes-1.4.10/comtypes.egg-info}/PKG-INFO +3 -2
  96. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes.egg-info/SOURCES.txt +5 -0
  97. {comtypes-1.4.9 → comtypes-1.4.10}/pyproject.toml +11 -19
  98. comtypes-1.4.9/comtypes/client/__init__.py +0 -323
  99. comtypes-1.4.9/comtypes/server/register.py +0 -419
  100. comtypes-1.4.9/comtypes/test/find_memleak.py +0 -76
  101. {comtypes-1.4.9 → comtypes-1.4.10}/LICENSE.txt +0 -0
  102. {comtypes-1.4.9 → comtypes-1.4.10}/MANIFEST.in +0 -0
  103. {comtypes-1.4.9 → comtypes-1.4.10}/README.md +0 -0
  104. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_npsupport.py +0 -0
  105. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_post_coinit/__init__.py +0 -0
  106. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_tlib_version_checker.py +0 -0
  107. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/_vtbl.py +0 -0
  108. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/clear_cache.py +0 -0
  109. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/client/_constants.py +0 -0
  110. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/hints.pyi +0 -0
  111. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/hresult.py +0 -0
  112. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/patcher.py +0 -0
  113. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/server/w_getopt.py +0 -0
  114. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestComServer.idl +0 -0
  115. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestComServer.tlb +0 -0
  116. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestDispServer.idl +0 -0
  117. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/TestDispServer.tlb +0 -0
  118. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/mylib.idl +0 -0
  119. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/mylib.tlb +0 -0
  120. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/mytypelib.idl +0 -0
  121. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_DISPPARAMS.py +0 -0
  122. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_avmc.py +0 -0
  123. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_casesensitivity.py +0 -0
  124. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_createwrappers.py +0 -0
  125. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_dict.py +0 -0
  126. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_dispinterface.py +0 -0
  127. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_excel.py +0 -0
  128. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_jscript.js +0 -0
  129. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_pump_events.py +0 -0
  130. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_safearray.py +0 -0
  131. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_server.py +0 -0
  132. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_showevents.py +0 -0
  133. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_w_getopt.py +0 -0
  134. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_win32com_interop.py +0 -0
  135. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/test_wmi.py +0 -0
  136. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/test/urlhist.tlb +0 -0
  137. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/__init__.py +0 -0
  138. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/__init__.py +0 -0
  139. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  140. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/tools/codegenerator/packing.py +0 -0
  141. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes/util.py +0 -0
  142. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes.egg-info/dependency_links.txt +0 -0
  143. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes.egg-info/entry_points.txt +0 -0
  144. {comtypes-1.4.9 → comtypes-1.4.10}/comtypes.egg-info/top_level.txt +0 -0
  145. {comtypes-1.4.9 → comtypes-1.4.10}/setup.cfg +0 -0
  146. {comtypes-1.4.9 → 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, 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.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
 
@@ -35,6 +76,7 @@ PVOID = c_void_p
35
76
  ULONG_PTR = ctypes.c_uint64 if is_64_bit else ctypes.c_ulong
36
77
 
37
78
  LPOLESTR = POINTER(OLECHAR)
79
+ LPCOLESTR = c_wchar_p
38
80
 
39
81
  ################################################################
40
82
  # enums
@@ -238,8 +280,6 @@ class ITypeLib(IUnknown):
238
280
  Returns the name with capitalization found in the type
239
281
  library, or None.
240
282
  """
241
- from ctypes import create_unicode_buffer
242
-
243
283
  namebuf = create_unicode_buffer(name)
244
284
  found = BOOL()
245
285
  self.__com_IsName(namebuf, lHashVal, byref(found)) # type: ignore
@@ -568,13 +608,65 @@ IRecordInfo._methods_ = [
568
608
 
569
609
  ################################################################
570
610
  # functions
571
- _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
572
664
 
573
665
 
574
666
  def GetRecordInfoFromTypeInfo(tinfo: ITypeInfo) -> IRecordInfo:
575
667
  """Return an IRecordInfo pointer to the UDT described in tinfo"""
576
668
  ri = POINTER(IRecordInfo)()
577
- _oleaut32.GetRecordInfoFromTypeInfo(tinfo, byref(ri))
669
+ _GetRecordInfoFromTypeInfo(tinfo, byref(ri))
578
670
  return ri # type: ignore
579
671
 
580
672
 
@@ -582,7 +674,7 @@ def GetRecordInfoFromGuids(
582
674
  rGuidTypeLib: str, verMajor: int, verMinor: int, lcid: int, rGuidTypeInfo: str
583
675
  ) -> IRecordInfo:
584
676
  ri = POINTER(IRecordInfo)()
585
- _oleaut32.GetRecordInfoFromGuids(
677
+ _GetRecordInfoFromGuids(
586
678
  byref(GUID(rGuidTypeLib)),
587
679
  verMajor,
588
680
  verMinor,
@@ -598,33 +690,21 @@ def LoadRegTypeLib(
598
690
  ) -> ITypeLib:
599
691
  """Load a registered type library"""
600
692
  tlib = POINTER(ITypeLib)()
601
- _oleaut32.LoadRegTypeLib(
602
- byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib)
603
- )
693
+ _LoadRegTypeLib(byref(GUID(guid)), wMajorVerNum, wMinorVerNum, lcid, byref(tlib))
604
694
  return tlib # type: ignore
605
695
 
606
696
 
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
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
622
702
 
623
703
 
624
704
  def LoadTypeLib(szFile: str) -> ITypeLib:
625
705
  """Load and register a type library file"""
626
706
  tlib = POINTER(ITypeLib)()
627
- _oleaut32.LoadTypeLib(c_wchar_p(szFile), byref(tlib))
707
+ _LoadTypeLib(c_wchar_p(szFile), byref(tlib))
628
708
  return tlib # type: ignore
629
709
 
630
710
 
@@ -636,36 +716,63 @@ def UnRegisterTypeLib(
636
716
  syskind: int = (SYS_WIN64 if is_64_bit else SYS_WIN32),
637
717
  ) -> int:
638
718
  """Unregister a registered type library"""
639
- return _oleaut32.UnRegisterTypeLib(
640
- byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind
641
- )
719
+ return _UnRegisterTypeLib(byref(GUID(libID)), wVerMajor, wVerMinor, lcid, syskind)
642
720
 
643
721
 
644
722
  def RegisterTypeLib(
645
723
  tlib: ITypeLib, fullpath: str, helpdir: Optional[str] = None
646
724
  ) -> int:
647
725
  """Register a type library in the registry"""
648
- return _oleaut32.RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
726
+ return _RegisterTypeLib(tlib, c_wchar_p(fullpath), c_wchar_p(helpdir))
649
727
 
650
728
 
651
729
  def CreateTypeLib(filename: str, syskind: int = SYS_WIN32) -> ICreateTypeLib2:
652
730
  """Return a ICreateTypeLib2 pointer"""
653
731
  ctlib = POINTER(ICreateTypeLib2)()
654
- _oleaut32.CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
732
+ _CreateTypeLib2(syskind, c_wchar_p(filename), byref(ctlib))
655
733
  return ctlib # type: ignore
656
734
 
657
735
 
658
736
  def QueryPathOfRegTypeLib(
659
737
  libid: str, wVerMajor: int, wVerMinor: int, lcid: int = 0
660
738
  ) -> str:
661
- """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
+
662
758
  pathname = BSTR()
663
- _oleaut32.QueryPathOfRegTypeLib(
759
+ _QueryPathOfRegTypeLib(
664
760
  byref(GUID(libid)), wVerMajor, wVerMinor, lcid, byref(pathname)
665
761
  )
666
762
  return pathname.value.split("\0")[0]
667
763
 
668
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
+
669
776
  ################################################################
670
777
  # Structures
671
778
 
@@ -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.2
2
2
  Name: comtypes
3
- Version: 1.4.9
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
 
@@ -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
@@ -130,6 +133,8 @@ comtypes/tools/typedesc.py
130
133
  comtypes/tools/typedesc_base.py
131
134
  comtypes/tools/codegenerator/__init__.py
132
135
  comtypes/tools/codegenerator/codegenerator.py
136
+ comtypes/tools/codegenerator/comments.py
137
+ comtypes/tools/codegenerator/heads.py
133
138
  comtypes/tools/codegenerator/helpers.py
134
139
  comtypes/tools/codegenerator/modulenamer.py
135
140
  comtypes/tools/codegenerator/namespaces.py
@@ -3,53 +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
12
  "comtypes/_vtbl.py" = ["E722"]
13
- "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
14
13
  "comtypes/automation.py" = ["F401", "F403", "F405"]
14
+ "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
15
15
  "comtypes/errorinfo.py" = ["F403", "F405"]
16
16
  "comtypes/git.py" = ["F401", "F403", "F405"]
17
- "comtypes/logutil.py" = ["E401"]
18
- "comtypes/shelllink.py" = ["F401"]
19
17
  "comtypes/util.py" = ["F403", "F405"]
20
18
  "comtypes/viewobject.py" = ["F403", "F405"]
21
- "comtypes/_post_coinit/unknwn.py" = ["F821"]
22
- "comtypes/client/__init__.py" = ["F401", "F403"]
23
19
  "comtypes/client/_code_cache.py" = ["E401", "E711"]
24
20
  "comtypes/client/_constants.py" = ["F401"]
25
21
  "comtypes/client/_events.py" = ["F841"]
26
- "comtypes/client/lazybind.py" = ["F821"]
27
- "comtypes/server/__init__.py" = ["E401"]
28
22
  "comtypes/server/automation.py" = ["F403", "F405"]
29
23
  "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"]
24
+ "comtypes/server/inprocserver.py" = ["E713", "E722", "F841"]
25
+ "comtypes/server/register.py" = ["E713"]
35
26
  "comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
36
27
  "comtypes/tools/tlbparser.py" = ["F401"]
37
28
  "comtypes/tools/typedesc.py" = ["F403", "F405"]
38
29
  "comtypes/tools/typedesc_base.py" = ["F401"]
30
+ # gen directory
31
+ "comtypes/gen/*" = ["E", "F", "I"]
32
+ # stub
33
+ "comtypes/hints.pyi" = ["I"]
39
34
  # tests
40
- "comtypes/test/TestComServer.py" = ["E401", "F401", "F403", "F405"]
41
35
  "comtypes/test/TestDispServer.py" = ["E401"]
42
36
  "comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
43
37
  "comtypes/test/setup.py" = ["F401"]
44
- "comtypes/test/test_BSTR.py" = ["E401", "F401", "F403", "F405"]
45
38
  "comtypes/test/test_agilent.py" = ["F401", "F841"]
46
39
  "comtypes/test/test_client.py" = ["F401"]
47
40
  "comtypes/test/test_dict.py" = ["F841"]
48
- "comtypes/test/test_ie.py" = ["F403", "F405", "F841"]
49
- "comtypes/test/test_outparam.py" = ["F403", "F405", "F841"]
41
+ "comtypes/test/test_ie.py" = ["F841"]
42
+ "comtypes/test/test_outparam.py" = ["F841"]
50
43
  "comtypes/test/test_sapi.py" = ["E401"]
51
- "comtypes/test/test_server.py" = ["E401", "E722", "F401", "F841"]
44
+ "comtypes/test/test_server.py" = ["F401", "F841"]
52
45
  "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
53
- "comtypes/test/test_typeinfo.py" = ["F401"]
54
46
  "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
55
47
  "comtypes/test/test_variant.py" = ["F401", "F821", "F841"]