comtypes 1.4.14__tar.gz → 1.4.16__tar.gz
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.
- {comtypes-1.4.14 → comtypes-1.4.16}/CHANGES.txt +43 -0
- {comtypes-1.4.14/comtypes.egg-info → comtypes-1.4.16}/PKG-INFO +7 -1
- {comtypes-1.4.14 → comtypes-1.4.16}/README.md +6 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/__init__.py +17 -1
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/misc.py +20 -20
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_create.py +20 -20
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/lazybind.py +1 -5
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/hints.pyi +32 -26
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/hresult.py +1 -1
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/logutil.py +16 -5
- comtypes-1.4.16/comtypes/malloc.py +53 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/__init__.py +19 -2
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/shelllink.py +24 -7
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/__init__.py +0 -28
- comtypes-1.4.16/comtypes/test/gdi_helper.py +202 -0
- comtypes-1.4.16/comtypes/test/monikers_helper.py +73 -0
- comtypes-1.4.16/comtypes/test/test_QueryService.py +61 -0
- comtypes-1.4.16/comtypes/test/test_bctx.py +143 -0
- comtypes-1.4.16/comtypes/test/test_casesensitivity.py +32 -0
- comtypes-1.4.16/comtypes/test/test_classfactory.py +64 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_client.py +77 -7
- comtypes-1.4.16/comtypes/test/test_client_dynamic.py +138 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_comobject.py +57 -2
- comtypes-1.4.16/comtypes/test/test_connectionpoints.py +128 -0
- comtypes-1.4.16/comtypes/test/test_dict.py +141 -0
- comtypes-1.4.14/comtypes/test/test_ie.py → comtypes-1.4.16/comtypes/test/test_eventinterface.py +13 -6
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_getactiveobj.py +10 -0
- comtypes-1.4.16/comtypes/test/test_git.py +177 -0
- comtypes-1.4.16/comtypes/test/test_logutil.py +257 -0
- comtypes-1.4.16/comtypes/test/test_malloc.py +61 -0
- comtypes-1.4.16/comtypes/test/test_moniker.py +583 -0
- comtypes-1.4.16/comtypes/test/test_outparam.py +77 -0
- comtypes-1.4.16/comtypes/test/test_puredispatch.py +98 -0
- comtypes-1.4.16/comtypes/test/test_rot.py +94 -0
- comtypes-1.4.16/comtypes/test/test_server_automation.py +135 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_shelllink.py +79 -0
- comtypes-1.4.16/comtypes/test/test_storage.py +329 -0
- comtypes-1.4.16/comtypes/test/test_stream.py +607 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_subinterface.py +2 -9
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_typeannotator.py +50 -11
- comtypes-1.4.16/comtypes/test/test_typeinfo.py +251 -0
- comtypes-1.4.16/comtypes/test/test_typeinfo_create.py +449 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_urlhistory.py +1 -1
- comtypes-1.4.14/comtypes/test/test_wmi.py → comtypes-1.4.16/comtypes/test/test_variant_outparam.py +21 -4
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_viewobject.py +39 -0
- comtypes-1.4.16/comtypes/test/time_structs_helper.py +39 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/typeannotator.py +40 -8
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/tlbparser.py +1 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/typeinfo.py +19 -15
- {comtypes-1.4.14 → comtypes-1.4.16/comtypes.egg-info}/PKG-INFO +7 -1
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes.egg-info/SOURCES.txt +17 -3
- {comtypes-1.4.14 → comtypes-1.4.16}/pyproject.toml +1 -1
- comtypes-1.4.14/comtypes/test/test_QueryService.py +0 -31
- comtypes-1.4.14/comtypes/test/test_casesensitivity.py +0 -42
- comtypes-1.4.14/comtypes/test/test_client_dynamic.py +0 -67
- comtypes-1.4.14/comtypes/test/test_dict.py +0 -105
- comtypes-1.4.14/comtypes/test/test_monikers.py +0 -84
- comtypes-1.4.14/comtypes/test/test_outparam.py +0 -103
- comtypes-1.4.14/comtypes/test/test_storage.py +0 -133
- comtypes-1.4.14/comtypes/test/test_stream.py +0 -162
- comtypes-1.4.14/comtypes/test/test_typeinfo.py +0 -138
- {comtypes-1.4.14 → comtypes-1.4.16}/LICENSE.txt +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/MANIFEST.in +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/GUID.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_comobject.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_memberspec.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_meta.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_npsupport.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/__init__.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/_cominterface_meta_patcher.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/activeobj.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/bstr.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/instancemethod.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_post_coinit/unknwn.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_safearray.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/_vtbl.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/automation.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/__init__.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_activeobj.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_code_cache.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_events.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_generate.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/_managing.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/client/dynamic.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/connectionpoints.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/errorinfo.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/git.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/messageloop.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/patcher.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/persist.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/safearray.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/automation.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/connectionpoints.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/inprocserver.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/localserver.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/register.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/stream.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestComServer.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestDispServer.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/find_memleak.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/runtests.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/setup.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_BSTR.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_GUID.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_agilent.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_basic.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_clear_cache.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_client_regenerate_modules.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_collections.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_comserver.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_createwrappers.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_dispifc_records.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_dispifc_safearrays.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_dispinterface.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_dyndispatch.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_errorinfo.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_excel.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_findgendir.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_hresult.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_ienum.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_imfattributes.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_inout_args.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_messageloop.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_midl_safearray_create.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_msscript.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_npsupport.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_persist.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_recordinfo.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_safearray.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_sapi.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_server.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_server_register.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_showevents.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_util.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_variant.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_w_getopt.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/test_word.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/codegenerator.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/comments.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/heads.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/helpers.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/modulenamer.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/namespaces.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/codegenerator/packing.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/typedesc.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/tools/typedesc_base.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/util.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes/viewobject.py +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.14 → comtypes-1.4.16}/setup.cfg +0 -0
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
Comtypes CHANGELOG
|
|
2
2
|
==================
|
|
3
3
|
|
|
4
|
+
Release 1.4.16
|
|
5
|
+
--------------
|
|
6
|
+
* Decompose ``IStorage`` tests and enhance coverage. By @junkmd.
|
|
7
|
+
* Enhance tests verifying custom ``COMObject``s raise errors. By @junkmd.
|
|
8
|
+
* Refactor ``shelllink.py`` for ``ITEMIDLIST`` structure. By @junkmd.
|
|
9
|
+
* Fix a code path in ``logutil.NTDebugHandler``. By @junkmd.
|
|
10
|
+
* Add a deprecation decorator to ``logutil.setup_logging``. By @junkmd.
|
|
11
|
+
* Add tests for connection point interfaces. By @junkmd.
|
|
12
|
+
* Add tests for ``IGlobalInterfaceTable`` marshaling. By @junkmd.
|
|
13
|
+
* Remove outdated Python 2.3 compatibility. By @junkmd.
|
|
14
|
+
* Remove unused test utilities. By @junkmd.
|
|
15
|
+
* Extract time utility test helpers. By @junkmd.
|
|
16
|
+
* Add ``CreateTypeLib`` and ``ICreateTypeInfo`` tests. By @junkmd.
|
|
17
|
+
* Add tests for ``VARIANTEnumerator``. By @junkmd.
|
|
18
|
+
* Enhance tests for moniker, bind context and running object table. By @junkmd.
|
|
19
|
+
* Introduce GDI test helper module and tests for ``IViewObject.Draw``. By @junkmd.
|
|
20
|
+
* Unify COM descriptor release logic in ``ITypeComp.Bind``. By @junkmd.
|
|
21
|
+
* Enhance dynamic dispatch and ``client`` testing. By @junkmd.
|
|
22
|
+
|
|
23
|
+
Release 1.4.15
|
|
24
|
+
--------------
|
|
25
|
+
* Fix ``TYPE_E_ELEMENTNOTFOUND`` HRESULT constant value. By @junkmd.
|
|
26
|
+
* Enhance ``ITypeInfo`` testing in ``test_typeinfo.py``. By @junkmd.
|
|
27
|
+
* Improve type hints for for generated dispmethods and properties. By @junkmd.
|
|
28
|
+
* Enhance tests for generated type hints. By @junkmd.
|
|
29
|
+
* Remove Internet Explorer dependency from ``test_QueryService.py`` and ``test_casesensitivity.py``. By @junkmd.
|
|
30
|
+
* Rename ``test_ie.py`` to ``test_eventinterface.py``. By @junkmd.
|
|
31
|
+
* Fix ``SyntaxError`` in ``DispMethodAnnotator`` signature generation. By @junkmd.
|
|
32
|
+
* Rename ``test_msi.py`` to ``test_puredispatch.py``. By @junkmd.
|
|
33
|
+
* Rename ``test_wmi.py`` to ``test_variant_outparam.py``. By @junkmd.
|
|
34
|
+
* Replace the module-level skip with individual ``@skip`` decorators on the test methods in ``test_eventinterface.py``. By @junkmd.
|
|
35
|
+
* Add tests for ``stdole.IPicture`` creation through ``IStream``. By @junkmd.
|
|
36
|
+
* Improve enum testing in ``test_client.py``. By @junkmd.
|
|
37
|
+
* Revive and enhance ``test_outparam``. By @junkmd.
|
|
38
|
+
* Enhance ``test_stream``. By @junkmd.
|
|
39
|
+
* Enhance ``test_storage``. By @junkmd.
|
|
40
|
+
* Add ``malloc`` module. By @junkmd.
|
|
41
|
+
* Enhance and refactor COM moniker tests. By @junkmd.
|
|
42
|
+
* Refine type hints and enhance tests for ``client.GetClassObject``, ``CoGetClassObject`` and ``IClassFactory``. By @junkmd.
|
|
43
|
+
* Implement ``ITypeInfo.AddressOfMember`` with tests and clarifications. By @junkmd.
|
|
44
|
+
* Enhance ``ITypeComp.Bind`` tests and type hints. By @junkmd.
|
|
45
|
+
* Introduce warnings for Python 3.15 enum compatibility. By @junkmd.
|
|
46
|
+
|
|
4
47
|
Release 1.4.14
|
|
5
48
|
--------------
|
|
6
49
|
* Replace ``setup.py`` with ``pyproject.toml``. By @moi15moi.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: comtypes
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.16
|
|
4
4
|
Summary: Pure Python COM package
|
|
5
5
|
Author-email: Thomas Heller <theller@python.net>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -32,6 +32,12 @@ Dynamic: license-file
|
|
|
32
32
|
`comtypes` allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.
|
|
33
33
|
|
|
34
34
|
`comtypes` requires Windows and Python 3.9 or later.
|
|
35
|
+
|
|
36
|
+
- **Note about Python 3.15 and `enum` behavior**
|
|
37
|
+
Starting with Python 3.15, the internal handling of `IntFlag`(`Flag`) values is planned to change:
|
|
38
|
+
**Negative `IntFlag` members will be reinterpreted by masking them to the defined positive bit domain, instead of keeping their original negative literal values**.
|
|
39
|
+
This can affect enumeration types generated by `comtypes` from COM type libraries. Action is needed to maintain literal evaluation.
|
|
40
|
+
For details and ongoing discussion, see: [GH-894](https://github.com/enthought/comtypes/issues/894).
|
|
35
41
|
- Version [1.4.12](https://pypi.org/project/comtypes/1.4.12/) is the last version to support Python 3.8.
|
|
36
42
|
- Version <= [1.4.7](https://pypi.org/project/comtypes/1.4.7/) does not work with Python 3.13 as reported in [GH-618](https://github.com/enthought/comtypes/issues/618). Version [1.4.8](https://pypi.org/project/comtypes/1.4.8/) can work with Python 3.13.
|
|
37
43
|
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
`comtypes` allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.
|
|
13
13
|
|
|
14
14
|
`comtypes` requires Windows and Python 3.9 or later.
|
|
15
|
+
|
|
16
|
+
- **Note about Python 3.15 and `enum` behavior**
|
|
17
|
+
Starting with Python 3.15, the internal handling of `IntFlag`(`Flag`) values is planned to change:
|
|
18
|
+
**Negative `IntFlag` members will be reinterpreted by masking them to the defined positive bit domain, instead of keeping their original negative literal values**.
|
|
19
|
+
This can affect enumeration types generated by `comtypes` from COM type libraries. Action is needed to maintain literal evaluation.
|
|
20
|
+
For details and ongoing discussion, see: [GH-894](https://github.com/enthought/comtypes/issues/894).
|
|
15
21
|
- Version [1.4.12](https://pypi.org/project/comtypes/1.4.12/) is the last version to support Python 3.8.
|
|
16
22
|
- Version <= [1.4.7](https://pypi.org/project/comtypes/1.4.7/) does not work with Python 3.13 as reported in [GH-618](https://github.com/enthought/comtypes/issues/618). Version [1.4.8](https://pypi.org/project/comtypes/1.4.8/) can work with Python 3.13.
|
|
17
23
|
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# comtypes version numbers follow semver (http://semver.org/) and PEP 440
|
|
2
|
-
__version__ = "1.4.
|
|
2
|
+
__version__ = "1.4.16"
|
|
3
3
|
|
|
4
4
|
try:
|
|
5
5
|
from _ctypes import COMError # noqa
|
|
@@ -18,6 +18,22 @@ import atexit
|
|
|
18
18
|
import logging
|
|
19
19
|
import sys
|
|
20
20
|
|
|
21
|
+
if sys.version_info >= (3, 15):
|
|
22
|
+
import warnings
|
|
23
|
+
|
|
24
|
+
_PYVER = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
25
|
+
warnings.warn(
|
|
26
|
+
(
|
|
27
|
+
f"You are running 'comtypes' on Python {_PYVER}, where the behavior of "
|
|
28
|
+
"enum types (such as IntFlag) may differ from Python <= 3.14.\n"
|
|
29
|
+
f"It is recommended to use a version compatible with Python {_PYVER}.\n"
|
|
30
|
+
"See: https://github.com/enthought/comtypes/issues/894"
|
|
31
|
+
),
|
|
32
|
+
FutureWarning,
|
|
33
|
+
stacklevel=2,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
21
37
|
# HACK: Workaround for projects that depend on this package
|
|
22
38
|
# There should be several projects around the world that depend on this package
|
|
23
39
|
# and indirectly reference the symbols of `ctypes` from `comtypes`.
|
|
@@ -142,26 +142,26 @@ def CoCreateInstance(
|
|
|
142
142
|
return p # type: ignore
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
145
|
+
@overload
|
|
146
|
+
def CoGetClassObject(
|
|
147
|
+
clsid: GUID,
|
|
148
|
+
clsctx: Optional[int] = None,
|
|
149
|
+
pServerInfo: "Optional[COSERVERINFO]" = None,
|
|
150
|
+
interface: None = None,
|
|
151
|
+
) -> "hints.IClassFactory": ...
|
|
152
|
+
@overload
|
|
153
|
+
def CoGetClassObject(
|
|
154
|
+
clsid: GUID,
|
|
155
|
+
clsctx: Optional[int] = None,
|
|
156
|
+
pServerInfo: "Optional[COSERVERINFO]" = None,
|
|
157
|
+
interface: type[_T_IUnknown] = IUnknown,
|
|
158
|
+
) -> _T_IUnknown: ...
|
|
159
|
+
def CoGetClassObject(
|
|
160
|
+
clsid: GUID,
|
|
161
|
+
clsctx: Optional[int] = None,
|
|
162
|
+
pServerInfo: "Optional[COSERVERINFO]" = None,
|
|
163
|
+
interface: Optional[type[IUnknown]] = None,
|
|
164
|
+
) -> IUnknown:
|
|
165
165
|
if clsctx is None:
|
|
166
166
|
clsctx = CLSCTX_SERVER
|
|
167
167
|
if interface is None:
|
|
@@ -19,26 +19,26 @@ logger = logging.getLogger(__name__)
|
|
|
19
19
|
#
|
|
20
20
|
# Object creation
|
|
21
21
|
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
@overload
|
|
23
|
+
def GetClassObject(
|
|
24
|
+
progid: _UnionT[str, type[CoClass], GUID],
|
|
25
|
+
clsctx: Optional[int] = None,
|
|
26
|
+
pServerInfo: Optional[COSERVERINFO] = None,
|
|
27
|
+
interface: None = None,
|
|
28
|
+
) -> "hints.IClassFactory": ...
|
|
29
|
+
@overload
|
|
30
|
+
def GetClassObject(
|
|
31
|
+
progid: _UnionT[str, type[CoClass], GUID],
|
|
32
|
+
clsctx: Optional[int] = None,
|
|
33
|
+
pServerInfo: Optional[COSERVERINFO] = None,
|
|
34
|
+
interface: type[_T_IUnknown] = IUnknown,
|
|
35
|
+
) -> _T_IUnknown: ...
|
|
36
|
+
def GetClassObject(
|
|
37
|
+
progid: _UnionT[str, type[CoClass], GUID],
|
|
38
|
+
clsctx: Optional[int] = None,
|
|
39
|
+
pServerInfo: Optional[COSERVERINFO] = None,
|
|
40
|
+
interface: Optional[type[IUnknown]] = None,
|
|
41
|
+
) -> IUnknown:
|
|
42
42
|
"""Create and return the class factory for a COM object.
|
|
43
43
|
|
|
44
44
|
'clsctx' specifies how to create the object, use the CLSCTX_... constants.
|
|
@@ -159,11 +159,7 @@ class Dispatch:
|
|
|
159
159
|
def caller(*args):
|
|
160
160
|
return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
caller.__name__ = name
|
|
164
|
-
except TypeError:
|
|
165
|
-
# In Python 2.3, __name__ is readonly
|
|
166
|
-
pass
|
|
162
|
+
caller.__name__ = name
|
|
167
163
|
return caller
|
|
168
164
|
|
|
169
165
|
def __setattr__(self, name, value):
|
|
@@ -105,31 +105,35 @@ class _GetSetNormalProperty(Generic[_T_Inst, _R_Get, _T_SetVal]):
|
|
|
105
105
|
fset: Callable[[_T_Inst, _T_SetVal], Any]
|
|
106
106
|
|
|
107
107
|
@overload
|
|
108
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
108
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
109
109
|
@overload
|
|
110
|
-
def __get__(
|
|
111
|
-
|
|
110
|
+
def __get__(
|
|
111
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
112
|
+
) -> _R_Get: ...
|
|
113
|
+
def __set__(self, instance: _T_Inst, value: _T_SetVal, /) -> None: ...
|
|
112
114
|
|
|
113
115
|
class _GetOnlyNormalProperty(Generic[_T_Inst, _R_Get]):
|
|
114
116
|
fget: Callable[[_T_Inst], Any]
|
|
115
117
|
|
|
116
118
|
@overload
|
|
117
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
119
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
118
120
|
@overload
|
|
119
|
-
def __get__(
|
|
120
|
-
|
|
121
|
+
def __get__(
|
|
122
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
123
|
+
) -> _R_Get: ...
|
|
124
|
+
def __set__(self, instance: _T_Inst, value: Any, /) -> NoReturn: ...
|
|
121
125
|
|
|
122
126
|
class _SetOnlyNormalProperty(Generic[_T_Inst, _T_SetVal]):
|
|
123
127
|
fget: Callable[[_T_Inst], Any]
|
|
124
128
|
fset: Callable[[_T_Inst, _T_SetVal], Any]
|
|
125
129
|
|
|
126
130
|
@overload
|
|
127
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
131
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
128
132
|
@overload
|
|
129
133
|
def __get__(
|
|
130
|
-
self, instance: _T_Inst, owner: Optional[type[_T_Inst]]
|
|
134
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
131
135
|
) -> NoReturn: ...
|
|
132
|
-
def __set__(self, instance: _T_Inst, value: _T_SetVal) -> None: ...
|
|
136
|
+
def __set__(self, instance: _T_Inst, value: _T_SetVal, /) -> None: ...
|
|
133
137
|
|
|
134
138
|
@overload
|
|
135
139
|
def normal_property(
|
|
@@ -149,9 +153,9 @@ class _GetSetBoundNamedProperty(Generic[_T_Inst, _P_Get, _R_Get, _P_Set]):
|
|
|
149
153
|
fget: Callable[Concatenate[_T_Inst, _P_Get], _R_Get]
|
|
150
154
|
fset: Callable[Concatenate[_T_Inst, _P_Set], Any]
|
|
151
155
|
__doc__: Optional[str]
|
|
152
|
-
def __getitem__(self, index: Any) -> _R_Get: ...
|
|
156
|
+
def __getitem__(self, index: Any, /) -> _R_Get: ...
|
|
153
157
|
def __call__(self, *args: _P_Get.args, **kwargs: _P_Get.kwargs) -> _R_Get: ...
|
|
154
|
-
def __setitem__(self, index: Any, value: Any) -> None: ...
|
|
158
|
+
def __setitem__(self, index: Any, value: Any, /) -> None: ...
|
|
155
159
|
def __iter__(self) -> NoReturn: ...
|
|
156
160
|
|
|
157
161
|
class _GetSetNamedProperty(Generic[_T_Inst, _P_Get, _R_Get, _P_Set]):
|
|
@@ -161,20 +165,20 @@ class _GetSetNamedProperty(Generic[_T_Inst, _P_Get, _R_Get, _P_Set]):
|
|
|
161
165
|
__doc__: Optional[str]
|
|
162
166
|
|
|
163
167
|
@overload
|
|
164
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
168
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
165
169
|
@overload
|
|
166
170
|
def __get__(
|
|
167
|
-
self, instance: _T_Inst, owner: Optional[type[_T_Inst]]
|
|
171
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
168
172
|
) -> _GetSetBoundNamedProperty[_T_Inst, _P_Get, _R_Get, _P_Set]: ...
|
|
169
|
-
def __set__(self, instance: _T_Inst, value: Any) -> NoReturn: ...
|
|
173
|
+
def __set__(self, instance: _T_Inst, value: Any, /) -> NoReturn: ...
|
|
170
174
|
|
|
171
175
|
class _GetOnlyBoundNamedProperty(Generic[_T_Inst, _P_Get, _R_Get]):
|
|
172
176
|
name: str
|
|
173
177
|
fget: Callable[Concatenate[_T_Inst, _P_Get], _R_Get]
|
|
174
178
|
__doc__: Optional[str]
|
|
175
|
-
def __getitem__(self, index: Any) -> _R_Get: ...
|
|
179
|
+
def __getitem__(self, index: Any, /) -> _R_Get: ...
|
|
176
180
|
def __call__(self, *args: _P_Get.args, **kwargs: _P_Get.kwargs) -> _R_Get: ...
|
|
177
|
-
def __setitem__(self, index: Any, value: Any) -> NoReturn: ...
|
|
181
|
+
def __setitem__(self, index: Any, value: Any, /) -> NoReturn: ...
|
|
178
182
|
def __iter__(self) -> NoReturn: ...
|
|
179
183
|
|
|
180
184
|
class _GetOnlyNamedProperty(Generic[_T_Inst, _P_Get, _R_Get]):
|
|
@@ -183,20 +187,20 @@ class _GetOnlyNamedProperty(Generic[_T_Inst, _P_Get, _R_Get]):
|
|
|
183
187
|
__doc__: Optional[str]
|
|
184
188
|
|
|
185
189
|
@overload
|
|
186
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
190
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
187
191
|
@overload
|
|
188
192
|
def __get__(
|
|
189
|
-
self, instance: _T_Inst, owner: Optional[type[_T_Inst]]
|
|
193
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
190
194
|
) -> _GetOnlyBoundNamedProperty[_T_Inst, _P_Get, _R_Get]: ...
|
|
191
|
-
def __set__(self, instance: _T_Inst, value: Any) -> NoReturn: ...
|
|
195
|
+
def __set__(self, instance: _T_Inst, value: Any, /) -> NoReturn: ...
|
|
192
196
|
|
|
193
197
|
class _SetOnlyBoundNamedProperty(Generic[_T_Inst, _P_Set]):
|
|
194
198
|
name: str
|
|
195
199
|
fset: Callable[Concatenate[_T_Inst, _P_Set], Any]
|
|
196
200
|
__doc__: Optional[str]
|
|
197
|
-
def __getitem__(self, index: Any) -> NoReturn: ...
|
|
201
|
+
def __getitem__(self, index: Any, /) -> NoReturn: ...
|
|
198
202
|
def __call__(self, *args: Any, **kwargs: Any) -> NoReturn: ...
|
|
199
|
-
def __setitem__(self, index: Any, value: Any) -> None: ...
|
|
203
|
+
def __setitem__(self, index: Any, value: Any, /) -> None: ...
|
|
200
204
|
def __iter__(self) -> NoReturn: ...
|
|
201
205
|
|
|
202
206
|
class _SetOnlyNamedProperty(Generic[_T_Inst, _P_Set]):
|
|
@@ -205,12 +209,12 @@ class _SetOnlyNamedProperty(Generic[_T_Inst, _P_Set]):
|
|
|
205
209
|
__doc__: Optional[str]
|
|
206
210
|
|
|
207
211
|
@overload
|
|
208
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
212
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
209
213
|
@overload
|
|
210
214
|
def __get__(
|
|
211
|
-
self, instance: _T_Inst, owner: Optional[type[_T_Inst]]
|
|
215
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
212
216
|
) -> _SetOnlyBoundNamedProperty[_T_Inst, _P_Set]: ...
|
|
213
|
-
def __set__(self, instance: _T_Inst, value: Any) -> NoReturn: ...
|
|
217
|
+
def __set__(self, instance: _T_Inst, value: Any, /) -> NoReturn: ...
|
|
214
218
|
|
|
215
219
|
@overload
|
|
216
220
|
def named_property(
|
|
@@ -231,9 +235,11 @@ def named_property(
|
|
|
231
235
|
|
|
232
236
|
class _Descriptor(Protocol[_T_Inst, _R_Get]):
|
|
233
237
|
@overload
|
|
234
|
-
def __get__(self, instance: None, owner: type[_T_Inst]) -> Self: ...
|
|
238
|
+
def __get__(self, instance: None, owner: type[_T_Inst], /) -> Self: ...
|
|
235
239
|
@overload
|
|
236
|
-
def __get__(
|
|
240
|
+
def __get__(
|
|
241
|
+
self, instance: _T_Inst, owner: Optional[type[_T_Inst]], /
|
|
242
|
+
) -> _R_Get: ...
|
|
237
243
|
|
|
238
244
|
# `__len__` for objects with `Count`
|
|
239
245
|
@overload
|
|
@@ -27,7 +27,7 @@ CONNECT_E_CANNOTCONNECT = -2147220990
|
|
|
27
27
|
CONNECT_E_ADVISELIMIT = -2147220991
|
|
28
28
|
CONNECT_E_NOCONNECTION = -2147220992
|
|
29
29
|
|
|
30
|
-
TYPE_E_ELEMENTNOTFOUND = -
|
|
30
|
+
TYPE_E_ELEMENTNOTFOUND = -2147319765 # 0x8002802B
|
|
31
31
|
|
|
32
32
|
TYPE_E_REGISTRYACCESS = -2147319780 # 0x8002801CL
|
|
33
33
|
TYPE_E_CANTLOADLIBRARY = -2147312566 # 0x80029C4AL
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# logutil.py
|
|
2
|
+
import functools
|
|
2
3
|
import logging
|
|
4
|
+
import warnings
|
|
3
5
|
from ctypes import WinDLL
|
|
4
6
|
from ctypes.wintypes import LPCSTR, LPCWSTR
|
|
5
7
|
|
|
@@ -18,19 +20,28 @@ class NTDebugHandler(logging.Handler):
|
|
|
18
20
|
def emit(
|
|
19
21
|
self,
|
|
20
22
|
record,
|
|
21
|
-
writeA=_OutputDebugStringA,
|
|
22
23
|
writeW=_OutputDebugStringW,
|
|
23
24
|
):
|
|
24
25
|
text = self.format(record)
|
|
25
|
-
|
|
26
|
-
writeA(text + "\n")
|
|
27
|
-
else:
|
|
28
|
-
writeW(text + "\n")
|
|
26
|
+
writeW(text + "\n")
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
logging.NTDebugHandler = NTDebugHandler
|
|
32
30
|
|
|
33
31
|
|
|
32
|
+
def deprecated(reason: str):
|
|
33
|
+
def decorator(func):
|
|
34
|
+
@functools.wraps(func)
|
|
35
|
+
def wrapper(*args, **kwargs):
|
|
36
|
+
warnings.warn(reason, category=DeprecationWarning, stacklevel=2)
|
|
37
|
+
return func(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
return wrapper
|
|
40
|
+
|
|
41
|
+
return decorator
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@deprecated("Deprecated. See https://github.com/enthought/comtypes/issues/920.")
|
|
34
45
|
def setup_logging(*pathnames):
|
|
35
46
|
import configparser
|
|
36
47
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from ctypes import HRESULT, POINTER, OleDLL, WinDLL, byref, c_int, c_ulong, c_void_p
|
|
2
|
+
from ctypes import c_size_t as SIZE_T
|
|
3
|
+
from ctypes.wintypes import DWORD, LPVOID
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Optional
|
|
5
|
+
|
|
6
|
+
from comtypes import COMMETHOD, GUID, IUnknown
|
|
7
|
+
from comtypes.GUID import _CoTaskMemFree as _CoTaskMemFree
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class IMalloc(IUnknown):
|
|
11
|
+
_iid_ = GUID("{00000002-0000-0000-C000-000000000046}")
|
|
12
|
+
_methods_ = [
|
|
13
|
+
COMMETHOD([], c_void_p, "Alloc", ([], c_ulong, "cb")),
|
|
14
|
+
COMMETHOD([], c_void_p, "Realloc", ([], c_void_p, "pv"), ([], c_ulong, "cb")),
|
|
15
|
+
COMMETHOD([], None, "Free", ([], c_void_p, "py")),
|
|
16
|
+
COMMETHOD([], c_ulong, "GetSize", ([], c_void_p, "pv")),
|
|
17
|
+
COMMETHOD([], c_int, "DidAlloc", ([], c_void_p, "pv")),
|
|
18
|
+
COMMETHOD([], None, "HeapMinimize"), # 25
|
|
19
|
+
]
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
|
|
22
|
+
def Alloc(self, cb: int) -> Optional[int]: ...
|
|
23
|
+
def Realloc(self, pv: Any, cb: int) -> Optional[int]: ...
|
|
24
|
+
def Free(self, py: Any) -> None: ...
|
|
25
|
+
def GetSize(self, pv: Any) -> int: ...
|
|
26
|
+
def DidAlloc(self, pv: Any) -> int: ...
|
|
27
|
+
def HeapMinimize(self) -> None: ...
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_ole32 = OleDLL("ole32")
|
|
31
|
+
|
|
32
|
+
_CoGetMalloc = _ole32.CoGetMalloc
|
|
33
|
+
_CoGetMalloc.argtypes = [DWORD, POINTER(POINTER(IMalloc))]
|
|
34
|
+
_CoGetMalloc.restype = HRESULT
|
|
35
|
+
|
|
36
|
+
_ole32_nohresult = WinDLL("ole32")
|
|
37
|
+
|
|
38
|
+
_CoTaskMemAlloc = _ole32_nohresult.CoTaskMemAlloc
|
|
39
|
+
_CoTaskMemAlloc.argtypes = [SIZE_T]
|
|
40
|
+
_CoTaskMemAlloc.restype = LPVOID
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def CoGetMalloc(dwMemContext: int = 1) -> IMalloc:
|
|
44
|
+
"""Retrieves a pointer to the default OLE task memory allocator.
|
|
45
|
+
|
|
46
|
+
https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cogetmalloc
|
|
47
|
+
"""
|
|
48
|
+
malloc = POINTER(IMalloc)()
|
|
49
|
+
_CoGetMalloc(
|
|
50
|
+
dwMemContext, # This parameter must be 1.
|
|
51
|
+
byref(malloc),
|
|
52
|
+
)
|
|
53
|
+
return malloc # type: ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ctypes
|
|
2
2
|
from ctypes import HRESULT, POINTER, byref
|
|
3
|
-
from typing import TYPE_CHECKING, Any, Optional
|
|
3
|
+
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, overload
|
|
4
4
|
|
|
5
5
|
import comtypes
|
|
6
6
|
import comtypes.client
|
|
@@ -15,6 +15,9 @@ if TYPE_CHECKING:
|
|
|
15
15
|
from comtypes import hints # type: ignore
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
_T_IUnknown = TypeVar("_T_IUnknown", bound=IUnknown)
|
|
19
|
+
|
|
20
|
+
|
|
18
21
|
################################################################
|
|
19
22
|
# Interfaces
|
|
20
23
|
class IClassFactory(IUnknown):
|
|
@@ -28,9 +31,23 @@ class IClassFactory(IUnknown):
|
|
|
28
31
|
STDMETHOD(HRESULT, "LockServer", [ctypes.c_int]),
|
|
29
32
|
]
|
|
30
33
|
|
|
34
|
+
@overload
|
|
35
|
+
def CreateInstance(
|
|
36
|
+
self,
|
|
37
|
+
punkouter: Optional["_Pointer[IUnknown]"] = None,
|
|
38
|
+
interface: type[_T_IUnknown] = IUnknown,
|
|
39
|
+
dynamic: Literal[False] = False,
|
|
40
|
+
) -> _T_IUnknown: ...
|
|
41
|
+
@overload
|
|
42
|
+
def CreateInstance(
|
|
43
|
+
self,
|
|
44
|
+
punkouter: Optional["_Pointer[IUnknown]"] = None,
|
|
45
|
+
interface: None = None,
|
|
46
|
+
dynamic: Literal[True] = True,
|
|
47
|
+
) -> Any: ...
|
|
31
48
|
def CreateInstance(
|
|
32
49
|
self,
|
|
33
|
-
punkouter: Optional[
|
|
50
|
+
punkouter: Optional["_Pointer[IUnknown]"] = None,
|
|
34
51
|
interface: Optional[type[IUnknown]] = None,
|
|
35
52
|
dynamic: bool = False,
|
|
36
53
|
) -> Any:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from ctypes import (
|
|
2
2
|
POINTER,
|
|
3
|
+
Structure,
|
|
3
4
|
byref,
|
|
4
5
|
c_char_p,
|
|
5
6
|
c_int,
|
|
@@ -8,12 +9,21 @@ from ctypes import (
|
|
|
8
9
|
create_string_buffer,
|
|
9
10
|
create_unicode_buffer,
|
|
10
11
|
)
|
|
11
|
-
from ctypes.wintypes import
|
|
12
|
+
from ctypes.wintypes import (
|
|
13
|
+
BYTE,
|
|
14
|
+
DWORD,
|
|
15
|
+
MAX_PATH,
|
|
16
|
+
USHORT,
|
|
17
|
+
WIN32_FIND_DATAA,
|
|
18
|
+
WIN32_FIND_DATAW,
|
|
19
|
+
)
|
|
12
20
|
from typing import TYPE_CHECKING, Literal
|
|
13
21
|
|
|
14
22
|
from comtypes import COMMETHOD, GUID, HRESULT, CoClass, IUnknown
|
|
15
23
|
|
|
16
24
|
if TYPE_CHECKING:
|
|
25
|
+
from ctypes import _Pointer
|
|
26
|
+
|
|
17
27
|
from comtypes import hints # type: ignore
|
|
18
28
|
|
|
19
29
|
|
|
@@ -42,8 +52,15 @@ HOTKEYF_CONTROL = 0x02
|
|
|
42
52
|
HOTKEYF_EXT = 0x08
|
|
43
53
|
HOTKEYF_SHIFT = 0x01
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
|
|
56
|
+
class SHITEMID(Structure):
|
|
57
|
+
_fields_ = [("cb", USHORT), ("abID", BYTE * 1)]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ITEMIDLIST(Structure):
|
|
61
|
+
_fields_ = [("mkid", SHITEMID)]
|
|
62
|
+
|
|
63
|
+
|
|
47
64
|
LPITEMIDLIST = LPCITEMIDLIST = POINTER(ITEMIDLIST)
|
|
48
65
|
|
|
49
66
|
|
|
@@ -134,8 +151,8 @@ class IShellLinkA(IUnknown):
|
|
|
134
151
|
|
|
135
152
|
if TYPE_CHECKING:
|
|
136
153
|
|
|
137
|
-
def GetIDList(self) ->
|
|
138
|
-
def SetIDList(self, pidl:
|
|
154
|
+
def GetIDList(self) -> _Pointer[ITEMIDLIST]: ...
|
|
155
|
+
def SetIDList(self, pidl: _Pointer[ITEMIDLIST]) -> hints.Hresult: ...
|
|
139
156
|
def SetDescription(self, pszName: bytes) -> hints.Incomplete: ...
|
|
140
157
|
def SetWorkingDirectory(self, pszDir: bytes) -> hints.Hresult: ...
|
|
141
158
|
def SetArguments(self, pszArgs: bytes) -> hints.Hresult: ...
|
|
@@ -269,8 +286,8 @@ class IShellLinkW(IUnknown):
|
|
|
269
286
|
|
|
270
287
|
if TYPE_CHECKING:
|
|
271
288
|
|
|
272
|
-
def GetIDList(self) ->
|
|
273
|
-
def SetIDList(self, pidl:
|
|
289
|
+
def GetIDList(self) -> _Pointer[ITEMIDLIST]: ...
|
|
290
|
+
def SetIDList(self, pidl: _Pointer[ITEMIDLIST]) -> hints.Hresult: ...
|
|
274
291
|
def SetDescription(self, pszName: str) -> hints.Incomplete: ...
|
|
275
292
|
def SetWorkingDirectory(self, pszDir: str) -> hints.Hresult: ...
|
|
276
293
|
def SetArguments(self, pszArgs: str) -> hints.Hresult: ...
|
|
@@ -37,37 +37,9 @@ class ResourceDenied(Exception):
|
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def is_resource_enabled(resource):
|
|
41
|
-
"""Test whether a resource is enabled.
|
|
42
|
-
|
|
43
|
-
If the caller's module is __main__ then automatically return True."""
|
|
44
|
-
if sys._getframe().f_back.f_globals.get("__name__") == "__main__":
|
|
45
|
-
return True
|
|
46
|
-
result = use_resources is not None and (
|
|
47
|
-
resource in use_resources or "*" in use_resources
|
|
48
|
-
)
|
|
49
|
-
if not result:
|
|
50
|
-
_unavail[resource] = None
|
|
51
|
-
return result
|
|
52
|
-
|
|
53
|
-
|
|
54
40
|
_unavail = {}
|
|
55
41
|
|
|
56
42
|
|
|
57
|
-
def requires(resource, msg=None):
|
|
58
|
-
"""Raise ResourceDenied if the specified resource is not available.
|
|
59
|
-
|
|
60
|
-
If the caller's module is __main__ then automatically return True."""
|
|
61
|
-
# see if the caller's module is __main__ - if so, treat as if
|
|
62
|
-
# the resource was set
|
|
63
|
-
if sys._getframe().f_back.f_globals.get("__name__") == "__main__":
|
|
64
|
-
return
|
|
65
|
-
if not is_resource_enabled(resource):
|
|
66
|
-
if msg is None:
|
|
67
|
-
msg = f"Use of the `{resource}` resource not enabled"
|
|
68
|
-
raise ResourceDenied(msg)
|
|
69
|
-
|
|
70
|
-
|
|
71
43
|
def find_package_modules(package, mask):
|
|
72
44
|
import fnmatch
|
|
73
45
|
|