comtypes 1.4.9__zip → 1.4.11__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {comtypes-1.4.9 → comtypes-1.4.11}/CHANGES.txt +41 -0
- {comtypes-1.4.9/comtypes.egg-info → comtypes-1.4.11}/PKG-INFO +4 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/GUID.py +34 -13
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/__init__.py +25 -16
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_comobject.py +92 -39
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_memberspec.py +112 -78
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_meta.py +2 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/_cominterface_meta_patcher.py +3 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/bstr.py +12 -5
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/instancemethod.py +1 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/misc.py +59 -24
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/unknwn.py +30 -25
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_safearray.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_vtbl.py +52 -55
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/automation.py +19 -14
- comtypes-1.4.11/comtypes/client/__init__.py +42 -0
- comtypes-1.4.11/comtypes/client/_activeobj.py +46 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_code_cache.py +15 -24
- comtypes-1.4.11/comtypes/client/_create.py +147 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_events.py +140 -57
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_generate.py +3 -5
- comtypes-1.4.11/comtypes/client/_managing.py +114 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/dynamic.py +2 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/lazybind.py +10 -11
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/connectionpoints.py +38 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/errorinfo.py +72 -21
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/git.py +4 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/hints.pyi +15 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/hresult.py +16 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/logutil.py +15 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/messageloop.py +15 -13
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/persist.py +3 -5
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/safearray.py +8 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/__init__.py +22 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/automation.py +1 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/connectionpoints.py +71 -70
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/inprocserver.py +14 -8
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/localserver.py +28 -16
- comtypes-1.4.11/comtypes/server/register.py +478 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/shelllink.py +13 -7
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/stream.py +7 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.py +6 -7
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.py +4 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/__init__.py +1 -1
- comtypes-1.4.11/comtypes/test/find_memleak.py +72 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/runtests.py +1 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/setup.py +2 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_BSTR.py +7 -17
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_GUID.py +7 -7
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_QueryService.py +1 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_agilent.py +4 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_basic.py +18 -9
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_clear_cache.py +1 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client_dynamic.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_client_regenerate_modules.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_collections.py +7 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_comobject.py +22 -9
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_comserver.py +56 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dict.py +2 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispifc_records.py +1 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispifc_safearrays.py +1 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dyndispatch.py +5 -2
- comtypes-1.4.11/comtypes/test/test_errorinfo.py +115 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_findgendir.py +1 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_getactiveobj.py +4 -4
- comtypes-1.4.11/comtypes/test/test_hresult.py +48 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_ie.py +19 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_ienum.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_imfattributes.py +13 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_inout_args.py +10 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_midl_safearray_create.py +6 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_monikers.py +23 -9
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_msscript.py +2 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_npsupport.py +4 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_outparam.py +22 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_persist.py +2 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_recordinfo.py +1 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_safearray.py +2 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_sapi.py +4 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_server_register.py +114 -125
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_shelllink.py +2 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_storage.py +12 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_stream.py +16 -5
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_subinterface.py +4 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_typeannotator.py +1 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_typeinfo.py +36 -7
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_urlhistory.py +7 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_variant.py +5 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_w_getopt.py +4 -4
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_word.py +1 -1
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/codegenerator.py +167 -435
- comtypes-1.4.11/comtypes/tools/codegenerator/comments.py +79 -0
- comtypes-1.4.11/comtypes/tools/codegenerator/heads.py +192 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/helpers.py +3 -6
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/namespaces.py +13 -5
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/typeannotator.py +13 -3
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/tlbparser.py +25 -25
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/typedesc.py +3 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/typedesc_base.py +2 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/typeinfo.py +163 -51
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/viewobject.py +2 -4
- {comtypes-1.4.9 → comtypes-1.4.11/comtypes.egg-info}/PKG-INFO +4 -2
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/SOURCES.txt +7 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/pyproject.toml +10 -23
- comtypes-1.4.9/comtypes/client/__init__.py +0 -323
- comtypes-1.4.9/comtypes/server/register.py +0 -419
- comtypes-1.4.9/comtypes/test/find_memleak.py +0 -76
- {comtypes-1.4.9 → comtypes-1.4.11}/LICENSE.txt +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/MANIFEST.in +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/README.md +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_npsupport.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_post_coinit/__init__.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/patcher.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_casesensitivity.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_createwrappers.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_dispinterface.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_excel.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_server.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_showevents.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/test_wmi.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/modulenamer.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/tools/codegenerator/packing.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes/util.py +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/setup.cfg +0 -0
- {comtypes-1.4.9 → comtypes-1.4.11}/setup.py +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import unittest as ut
|
|
2
|
-
from ctypes import Structure, c_long, c_uint, c_ulong
|
|
2
|
+
from ctypes import POINTER, Structure, WinDLL, byref, c_long, c_uint, c_ulong
|
|
3
|
+
from ctypes.wintypes import BOOL, HWND, LPLONG, UINT
|
|
3
4
|
|
|
4
5
|
from comtypes.client import CreateObject, GetEvents
|
|
5
6
|
|
|
@@ -58,14 +59,26 @@ class MSG(Structure):
|
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
def PumpWaitingMessages():
|
|
61
|
-
|
|
62
|
+
_user32 = WinDLL("user32")
|
|
63
|
+
|
|
64
|
+
_PeekMessageA = _user32.PeekMessageA
|
|
65
|
+
_PeekMessageA.argtypes = [POINTER(MSG), HWND, UINT, UINT, UINT]
|
|
66
|
+
_PeekMessageA.restype = BOOL
|
|
67
|
+
|
|
68
|
+
_TranslateMessage = _user32.TranslateMessage
|
|
69
|
+
_TranslateMessage.argtypes = [POINTER(MSG)]
|
|
70
|
+
_TranslateMessage.restype = BOOL
|
|
71
|
+
|
|
72
|
+
LRESULT = LPLONG
|
|
73
|
+
_DispatchMessageA = _user32.DispatchMessageA
|
|
74
|
+
_DispatchMessageA.argtypes = [POINTER(MSG)]
|
|
75
|
+
_DispatchMessageA.restype = LRESULT
|
|
62
76
|
|
|
63
|
-
user32 = windll.user32
|
|
64
77
|
msg = MSG()
|
|
65
78
|
PM_REMOVE = 0x0001
|
|
66
|
-
while
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
while _PeekMessageA(byref(msg), 0, 0, 0, PM_REMOVE):
|
|
80
|
+
_TranslateMessage(byref(msg))
|
|
81
|
+
_DispatchMessageA(byref(msg))
|
|
69
82
|
|
|
70
83
|
|
|
71
84
|
class Test(ut.TestCase):
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import contextlib
|
|
2
2
|
import unittest as ut
|
|
3
|
+
from ctypes import HRESULT, POINTER, WinDLL, c_uint32, pointer
|
|
3
4
|
|
|
4
|
-
from ctypes import POINTER, pointer, windll
|
|
5
|
-
from comtypes import GUID
|
|
6
5
|
import comtypes.client
|
|
6
|
+
from comtypes import GUID
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Test_IMFAttributes(ut.TestCase):
|
|
@@ -12,8 +12,18 @@ class Test_IMFAttributes(ut.TestCase):
|
|
|
12
12
|
comtypes.client.GetModule("msvidctl.dll")
|
|
13
13
|
from comtypes.gen import MSVidCtlLib
|
|
14
14
|
|
|
15
|
+
_mfplat = WinDLL("mfplat")
|
|
16
|
+
|
|
17
|
+
UINT32 = c_uint32
|
|
18
|
+
_MFCreateAttributes = _mfplat.MFCreateAttributes
|
|
19
|
+
_MFCreateAttributes.argtypes = [
|
|
20
|
+
POINTER(POINTER(MSVidCtlLib.IMFAttributes)),
|
|
21
|
+
UINT32,
|
|
22
|
+
]
|
|
23
|
+
_MFCreateAttributes.restype = HRESULT
|
|
24
|
+
|
|
15
25
|
imf_attrs = POINTER(MSVidCtlLib.IMFAttributes)()
|
|
16
|
-
hres =
|
|
26
|
+
hres = _MFCreateAttributes(pointer(imf_attrs), 2)
|
|
17
27
|
self.assertEqual(hres, 0)
|
|
18
28
|
|
|
19
29
|
MF_TRANSCODE_ADJUST_PROFILE = GUID("{9c37c21b-060f-487c-a690-80d7f50d1c72}")
|
|
@@ -4,11 +4,18 @@ from typing import TYPE_CHECKING, Any, Callable, List, NamedTuple, Tuple, Type
|
|
|
4
4
|
from unittest.mock import MagicMock
|
|
5
5
|
|
|
6
6
|
import comtypes
|
|
7
|
+
from comtypes import IUnknown
|
|
7
8
|
from comtypes._memberspec import _fix_inout_args
|
|
8
|
-
from comtypes.client import IUnknown
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
|
-
from comtypes
|
|
11
|
+
from comtypes import hints # type: ignore
|
|
12
|
+
|
|
13
|
+
_ArgSpecType = Tuple[
|
|
14
|
+
hints.ArgSpecElmType,
|
|
15
|
+
hints.ArgSpecElmType,
|
|
16
|
+
hints.ArgSpecElmType,
|
|
17
|
+
hints.ArgSpecElmType,
|
|
18
|
+
]
|
|
12
19
|
|
|
13
20
|
WSTRING = c_wchar_p
|
|
14
21
|
|
|
@@ -259,7 +266,7 @@ class Test_ArgsKwargsCombinations(ut.TestCase):
|
|
|
259
266
|
|
|
260
267
|
|
|
261
268
|
class PermutedArgspecTestingParams(NamedTuple):
|
|
262
|
-
argspec: "
|
|
269
|
+
argspec: "_ArgSpecType"
|
|
263
270
|
args: Tuple[Any, Any, Any]
|
|
264
271
|
orig_ret_val: Tuple[Any, Any, Any]
|
|
265
272
|
fixed_ret_val: List[Any]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
|
|
3
|
-
from ctypes import c_int, pointer, HRESULT, POINTER
|
|
4
3
|
import unittest
|
|
4
|
+
from ctypes import HRESULT, POINTER, c_int, pointer
|
|
5
5
|
|
|
6
6
|
import comtypes
|
|
7
7
|
import comtypes.safearray
|
|
8
|
+
import comtypes.typeinfo
|
|
8
9
|
from comtypes import CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER
|
|
9
10
|
from comtypes.client import CreateObject, GetModule
|
|
10
|
-
import comtypes.typeinfo
|
|
11
11
|
|
|
12
12
|
GetModule("UIAutomationCore.dll")
|
|
13
13
|
from comtypes.gen.UIAutomationClient import CUIAutomation, IUIAutomation
|
|
@@ -16,8 +16,10 @@ ComtypesCppTestSrvLib_GUID = "{07D2AEE5-1DF8-4D2C-953A-554ADFD25F99}"
|
|
|
16
16
|
|
|
17
17
|
try:
|
|
18
18
|
GetModule((ComtypesCppTestSrvLib_GUID, 1, 0, 0))
|
|
19
|
-
from comtypes.gen.ComtypesCppTestSrvLib import
|
|
20
|
-
|
|
19
|
+
from comtypes.gen.ComtypesCppTestSrvLib import (
|
|
20
|
+
IDispSafearrayParamTest,
|
|
21
|
+
StructRecordParamTest,
|
|
22
|
+
)
|
|
21
23
|
|
|
22
24
|
IMPORT_FAILED = False
|
|
23
25
|
except (ImportError, OSError):
|
|
@@ -1,39 +1,53 @@
|
|
|
1
|
-
from _ctypes import COMError
|
|
2
|
-
from ctypes import byref, POINTER
|
|
3
1
|
import contextlib
|
|
4
2
|
import unittest
|
|
3
|
+
from _ctypes import COMError
|
|
4
|
+
from ctypes import HRESULT, POINTER, OleDLL, byref, c_wchar_p
|
|
5
|
+
from ctypes.wintypes import DWORD
|
|
5
6
|
|
|
6
|
-
import
|
|
7
|
-
from comtypes.client import
|
|
8
|
-
from comtypes import hresult, GUID
|
|
7
|
+
from comtypes import GUID, hresult
|
|
8
|
+
from comtypes.client import CreateObject, GetModule
|
|
9
9
|
|
|
10
10
|
with contextlib.redirect_stdout(None): # supress warnings
|
|
11
11
|
GetModule("msvidctl.dll")
|
|
12
12
|
from comtypes.gen import MSVidCtlLib as msvidctl
|
|
13
13
|
from comtypes.gen.MSVidCtlLib import IBindCtx, IMoniker, IRunningObjectTable
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
MKSYS_ITEMMONIKER = 4
|
|
17
16
|
ROTFLAGS_ALLOWANYCLIENT = 1
|
|
17
|
+
LPOLESTR = LPCOLESTR = c_wchar_p
|
|
18
|
+
|
|
19
|
+
_ole32 = OleDLL("ole32")
|
|
20
|
+
|
|
21
|
+
_CreateItemMoniker = _ole32.CreateItemMoniker
|
|
22
|
+
_CreateItemMoniker.argtypes = [LPCOLESTR, LPCOLESTR, POINTER(POINTER(IMoniker))]
|
|
23
|
+
_CreateItemMoniker.restype = HRESULT
|
|
24
|
+
|
|
25
|
+
_CreateBindCtx = _ole32.CreateBindCtx
|
|
26
|
+
_CreateBindCtx.argtypes = [DWORD, POINTER(POINTER(IBindCtx))]
|
|
27
|
+
_CreateBindCtx.restype = HRESULT
|
|
28
|
+
|
|
29
|
+
_GetRunningObjectTable = _ole32.GetRunningObjectTable
|
|
30
|
+
_GetRunningObjectTable.argtypes = [DWORD, POINTER(POINTER(IRunningObjectTable))]
|
|
31
|
+
_GetRunningObjectTable.restype = HRESULT
|
|
18
32
|
|
|
19
33
|
|
|
20
34
|
def _create_item_moniker(delim: str, item: str) -> IMoniker:
|
|
21
35
|
mon = POINTER(IMoniker)()
|
|
22
|
-
|
|
36
|
+
_CreateItemMoniker(delim, item, byref(mon))
|
|
23
37
|
return mon # type: ignore
|
|
24
38
|
|
|
25
39
|
|
|
26
40
|
def _create_bctx() -> IBindCtx:
|
|
27
41
|
bctx = POINTER(IBindCtx)()
|
|
28
42
|
# The first parameter is reserved and must be 0.
|
|
29
|
-
|
|
43
|
+
_CreateBindCtx(0, byref(bctx))
|
|
30
44
|
return bctx # type: ignore
|
|
31
45
|
|
|
32
46
|
|
|
33
47
|
def _create_rot() -> IRunningObjectTable:
|
|
34
48
|
rot = POINTER(IRunningObjectTable)()
|
|
35
49
|
# The first parameter is reserved and must be 0.
|
|
36
|
-
|
|
50
|
+
_GetRunningObjectTable(0, byref(rot))
|
|
37
51
|
return rot # type: ignore
|
|
38
52
|
|
|
39
53
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
from ctypes import POINTER
|
|
3
|
+
|
|
4
|
+
from comtypes import GUID
|
|
3
5
|
from comtypes.automation import IDispatch
|
|
4
6
|
from comtypes.client import CreateObject
|
|
5
|
-
from comtypes import GUID
|
|
6
7
|
|
|
7
8
|
##from test import test_support
|
|
8
9
|
##from comtypes.unittests import support
|
|
@@ -3,7 +3,7 @@ import functools
|
|
|
3
3
|
import importlib
|
|
4
4
|
import inspect
|
|
5
5
|
import unittest
|
|
6
|
-
from ctypes import
|
|
6
|
+
from ctypes import POINTER, c_double, c_long, pointer
|
|
7
7
|
from decimal import Decimal
|
|
8
8
|
|
|
9
9
|
import comtypes._npsupport
|
|
@@ -11,13 +11,13 @@ from comtypes import IUnknown
|
|
|
11
11
|
from comtypes._safearray import SafeArrayGetVartype
|
|
12
12
|
from comtypes.automation import (
|
|
13
13
|
BSTR,
|
|
14
|
+
VARIANT,
|
|
15
|
+
VARIANT_BOOL,
|
|
14
16
|
VT_BSTR,
|
|
15
17
|
VT_DATE,
|
|
16
18
|
VT_I4,
|
|
17
|
-
_midlSAFEARRAY,
|
|
18
|
-
VARIANT,
|
|
19
19
|
VT_VARIANT,
|
|
20
|
-
|
|
20
|
+
_midlSAFEARRAY,
|
|
21
21
|
)
|
|
22
22
|
from comtypes.safearray import safearray_as_ndarray
|
|
23
23
|
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
from ctypes import (
|
|
3
|
+
HRESULT,
|
|
3
4
|
POINTER,
|
|
5
|
+
OleDLL,
|
|
6
|
+
WinDLL,
|
|
4
7
|
byref,
|
|
5
8
|
c_int,
|
|
9
|
+
c_size_t,
|
|
6
10
|
c_ulong,
|
|
7
11
|
c_void_p,
|
|
8
12
|
c_wchar,
|
|
9
13
|
c_wchar_p,
|
|
10
14
|
cast,
|
|
11
15
|
memmove,
|
|
12
|
-
oledll,
|
|
13
16
|
sizeof,
|
|
14
|
-
windll,
|
|
15
17
|
wstring_at,
|
|
16
18
|
)
|
|
19
|
+
from ctypes.wintypes import DWORD, LPVOID
|
|
17
20
|
from unittest.mock import patch
|
|
18
21
|
|
|
19
22
|
from comtypes import COMMETHOD, GUID, IUnknown
|
|
20
|
-
|
|
23
|
+
from comtypes.GUID import _CoTaskMemFree
|
|
21
24
|
|
|
22
25
|
text_type = str
|
|
23
26
|
|
|
@@ -34,8 +37,21 @@ class IMalloc(IUnknown):
|
|
|
34
37
|
]
|
|
35
38
|
|
|
36
39
|
|
|
40
|
+
_ole32 = OleDLL("ole32")
|
|
41
|
+
|
|
42
|
+
_CoGetMalloc = _ole32.CoGetMalloc
|
|
43
|
+
_CoGetMalloc.argtypes = [DWORD, POINTER(POINTER(IMalloc))]
|
|
44
|
+
_CoGetMalloc.restype = HRESULT
|
|
45
|
+
|
|
46
|
+
_ole32_nohresult = WinDLL("ole32")
|
|
47
|
+
|
|
48
|
+
SIZE_T = c_size_t
|
|
49
|
+
_CoTaskMemAlloc = _ole32_nohresult.CoTaskMemAlloc
|
|
50
|
+
_CoTaskMemAlloc.argtypes = [SIZE_T]
|
|
51
|
+
_CoTaskMemAlloc.restype = LPVOID
|
|
52
|
+
|
|
37
53
|
malloc = POINTER(IMalloc)()
|
|
38
|
-
|
|
54
|
+
_CoGetMalloc(1, byref(malloc))
|
|
39
55
|
assert bool(malloc)
|
|
40
56
|
|
|
41
57
|
|
|
@@ -45,14 +61,14 @@ def from_outparm(self):
|
|
|
45
61
|
result = wstring_at(self)
|
|
46
62
|
if not malloc.DidAlloc(self):
|
|
47
63
|
raise ValueError("memory was NOT allocated by CoTaskMemAlloc")
|
|
48
|
-
|
|
64
|
+
_CoTaskMemFree(self)
|
|
49
65
|
return result
|
|
50
66
|
|
|
51
67
|
|
|
52
68
|
def comstring(text, typ=c_wchar_p):
|
|
53
69
|
text = text_type(text)
|
|
54
70
|
size = (len(text) + 1) * sizeof(c_wchar)
|
|
55
|
-
mem =
|
|
71
|
+
mem = _CoTaskMemAlloc(size)
|
|
56
72
|
print("malloc'd 0x%x, %d bytes" % (mem, size))
|
|
57
73
|
ptr = cast(mem, typ)
|
|
58
74
|
memmove(mem, text, size)
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
1
|
import tempfile
|
|
3
2
|
import unittest as ut
|
|
3
|
+
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from comtypes import CoCreateInstance,
|
|
6
|
-
from comtypes import persist
|
|
7
|
-
|
|
5
|
+
from comtypes import GUID, CoCreateInstance, IPersist, persist
|
|
8
6
|
|
|
9
7
|
CLSID_ShellLink = GUID("{00021401-0000-0000-C000-000000000046}")
|
|
10
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
+
from ctypes import byref, pointer, sizeof
|
|
4
5
|
|
|
5
6
|
from comtypes import typeinfo
|
|
6
7
|
from comtypes.client import GetModule
|
|
7
|
-
from ctypes import byref, pointer, sizeof
|
|
8
8
|
|
|
9
9
|
ComtypesCppTestSrvLib_GUID = "{07D2AEE5-1DF8-4D2C-953A-554ADFD25F99}"
|
|
10
10
|
|
|
@@ -129,7 +129,8 @@ class SafeArrayTestCase(unittest.TestCase):
|
|
|
129
129
|
self.assertEqual(SafeArrayGetVartype(sa), VT_I4)
|
|
130
130
|
|
|
131
131
|
# TypeError: len() of unsized object
|
|
132
|
-
self.assertRaises(TypeError
|
|
132
|
+
with self.assertRaises(TypeError):
|
|
133
|
+
t.from_param(object())
|
|
133
134
|
|
|
134
135
|
def test_VT_VARIANT(self):
|
|
135
136
|
t = _midlSAFEARRAY(VARIANT)
|