comtypes 1.4.7__zip → 1.4.8__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.7 → comtypes-1.4.8}/CHANGES.txt +18 -0
- {comtypes-1.4.7/comtypes.egg-info → comtypes-1.4.8}/PKG-INFO +5 -3
- {comtypes-1.4.7 → comtypes-1.4.8}/README.md +4 -2
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/__init__.py +1 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_comobject.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_memberspec.py +1 -1
- comtypes-1.4.8/comtypes/_meta.py +95 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_npsupport.py +2 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_post_coinit/__init__.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_post_coinit/misc.py +20 -39
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_post_coinit/unknwn.py +94 -69
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/__init__.py +21 -31
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/_code_cache.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/_events.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/_generate.py +5 -5
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/lazybind.py +0 -5
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/git.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/hints.pyi +4 -4
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/persist.py +7 -7
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/safearray.py +2 -6
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/__init__.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/register.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/shelllink.py +48 -43
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestComServer.py +1 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestDispServer.py +1 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/__init__.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/find_memleak.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_agilent.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_clear_cache.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_createwrappers.py +0 -2
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_dispinterface.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_excel.py +0 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_inout_args.py +1 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_server.py +6 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_shelllink.py +10 -14
- comtypes-1.4.8/comtypes/test/test_stream.py +131 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_typeannotator.py +1 -1
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_urlhistory.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_variant.py +0 -2
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/namespaces.py +97 -27
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/typeannotator.py +2 -4
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/tlbparser.py +33 -32
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/typedesc.py +2 -2
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/typeinfo.py +21 -25
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/util.py +1 -0
- {comtypes-1.4.7 → comtypes-1.4.8/comtypes.egg-info}/PKG-INFO +5 -3
- comtypes-1.4.8/pyproject.toml +54 -0
- comtypes-1.4.7/comtypes/_meta.py +0 -70
- comtypes-1.4.7/comtypes/test/test_stream.py +0 -53
- comtypes-1.4.7/pyproject.toml +0 -3
- {comtypes-1.4.7 → comtypes-1.4.8}/LICENSE.txt +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/MANIFEST.in +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/GUID.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_idl_stuff.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_post_coinit/bstr.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_py_instance_method.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_safearray.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/automation.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/client/dynamic.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/connectionpoints.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/errorinfo.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/hresult.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/logutil.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/messageloop.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/patcher.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/automation.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/connectionpoints.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/inprocserver.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/localserver.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/stream.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/runtests.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/setup.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_BSTR.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_GUID.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_QueryService.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_basic.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_casesensitivity.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_client.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_client_dynamic.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_client_regenerate_modules.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_collections.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_comserver.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_dict.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_dispifc_records.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_dispifc_safearrays.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_dyndispatch.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_findgendir.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_getactiveobj.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_ie.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_ienum.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_imfattributes.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_midl_safearray_create.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_monikers.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_msscript.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_npsupport.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_outparam.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_persist.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_propputref.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_recordinfo.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_safearray.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_sapi.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_showevents.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_storage.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_subinterface.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_typeinfo.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_wmi.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/test_word.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/codegenerator.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/helpers.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/modulenamer.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/codegenerator/packing.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/tools/typedesc_base.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes/viewobject.py +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes.egg-info/SOURCES.txt +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/setup.cfg +0 -0
- {comtypes-1.4.7 → comtypes-1.4.8}/setup.py +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from __future__ import print_function
|
|
2
1
|
import ctypes
|
|
3
2
|
import importlib
|
|
4
3
|
import inspect
|
|
@@ -106,7 +105,8 @@ def GetModule(tlib: _UnionT[Any, typeinfo.ITypeLib]) -> types.ModuleType:
|
|
|
106
105
|
frame = sys._getframe(1)
|
|
107
106
|
_file_: Optional[str] = frame.f_globals.get("__file__", None)
|
|
108
107
|
pathname, is_abs = _resolve_filename(
|
|
109
|
-
tlib_string,
|
|
108
|
+
tlib_string,
|
|
109
|
+
_file_ and os.path.dirname(_file_), # type: ignore
|
|
110
110
|
)
|
|
111
111
|
logger.debug("GetModule(%s), resolved: %s", pathname, is_abs)
|
|
112
112
|
tlib = _load_tlib(pathname) # don't register
|
|
@@ -251,9 +251,9 @@ _ItfName = str
|
|
|
251
251
|
_ItfIid = str
|
|
252
252
|
|
|
253
253
|
|
|
254
|
-
def _get_known_namespaces() ->
|
|
255
|
-
Mapping[_SymbolName, _ModuleName], Mapping[_ItfName, _ItfIid]
|
|
256
|
-
|
|
254
|
+
def _get_known_namespaces() -> (
|
|
255
|
+
Tuple[Mapping[_SymbolName, _ModuleName], Mapping[_ItfName, _ItfIid]]
|
|
256
|
+
):
|
|
257
257
|
"""Returns symbols and interfaces that are already statically defined in `ctypes`
|
|
258
258
|
and `comtypes`.
|
|
259
259
|
From `ctypes`, all the names are obtained.
|
|
@@ -126,11 +126,6 @@ class Dispatch(object):
|
|
|
126
126
|
"QueryInterface is forwarded to the real com object."
|
|
127
127
|
return self._comobj.QueryInterface(*args)
|
|
128
128
|
|
|
129
|
-
def __cmp__(self, other):
|
|
130
|
-
if not isinstance(other, Dispatch):
|
|
131
|
-
return 1
|
|
132
|
-
return cmp(self._comobj, other._comobj)
|
|
133
|
-
|
|
134
129
|
def __eq__(self, other):
|
|
135
130
|
return isinstance(other, Dispatch) and self._comobj == other._comobj
|
|
136
131
|
|
|
@@ -253,7 +253,7 @@ _T_E = TypeVar("_T_E")
|
|
|
253
253
|
def to_dunder_iter(
|
|
254
254
|
newenum: _UnionT[
|
|
255
255
|
_Descriptor[_T_Inst, Iterator[_T_E]], Callable[[_T_Inst], Iterator[_T_E]]
|
|
256
|
-
]
|
|
256
|
+
],
|
|
257
257
|
) -> Callable[[_T_Inst], Iterator[_T_E]]: ...
|
|
258
258
|
@overload
|
|
259
259
|
def to_dunder_iter(newenum: Any) -> Callable[..., NoReturn]: ...
|
|
@@ -266,7 +266,7 @@ def to_dunder_call(
|
|
|
266
266
|
_GetSetNamedProperty[_T_Inst, _P_Get, _R_Get, ...],
|
|
267
267
|
_GetOnlyNamedProperty[_T_Inst, _P_Get, _R_Get],
|
|
268
268
|
Callable[Concatenate[_T_Inst, _P_Get], _R_Get],
|
|
269
|
-
]
|
|
269
|
+
],
|
|
270
270
|
) -> Callable[Concatenate[_T_Inst, _P_Get], _R_Get]: ...
|
|
271
271
|
@overload
|
|
272
272
|
def to_dunder_call(item: Any) -> Callable[..., NoReturn]: ...
|
|
@@ -278,7 +278,7 @@ def to_dunder_getitem(
|
|
|
278
278
|
_GetSetNamedProperty[_T_Inst, _P_Get, _R_Get, ...],
|
|
279
279
|
_GetOnlyNamedProperty[_T_Inst, _P_Get, _R_Get],
|
|
280
280
|
Callable[Concatenate[_T_Inst, _P_Get], _R_Get],
|
|
281
|
-
]
|
|
281
|
+
],
|
|
282
282
|
) -> Callable[Concatenate[_T_Inst, _P_Get], _R_Get]: ...
|
|
283
283
|
@overload
|
|
284
284
|
def to_dunder_getitem(item: Any) -> Callable[..., NoReturn]: ...
|
|
@@ -289,7 +289,7 @@ def to_dunder_setitem(
|
|
|
289
289
|
item: _UnionT[
|
|
290
290
|
_GetSetNamedProperty[_T_Inst, ..., Any, _P_Set],
|
|
291
291
|
_SetOnlyNamedProperty[_T_Inst, _P_Set],
|
|
292
|
-
]
|
|
292
|
+
],
|
|
293
293
|
) -> Callable[Concatenate[_T_Inst, _P_Set], Any]: ...
|
|
294
294
|
@overload
|
|
295
295
|
def to_dunder_setitem(item: Any) -> Callable[..., NoReturn]: ...
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
The 'DictPropertyBag' class is a class implementing the IPropertyBag
|
|
10
10
|
interface, useful in client code.
|
|
11
11
|
"""
|
|
12
|
+
|
|
12
13
|
from ctypes import c_int, c_ulong, c_ushort, c_wchar_p
|
|
13
14
|
from ctypes import POINTER, Structure
|
|
14
15
|
from ctypes.wintypes import WORD, DWORD, BOOL
|
|
@@ -244,13 +245,12 @@ class IPersistFile(IPersist):
|
|
|
244
245
|
]
|
|
245
246
|
|
|
246
247
|
if TYPE_CHECKING:
|
|
247
|
-
|
|
248
|
-
def IsDirty(self) -> hints.Hresult: ...
|
|
249
|
-
def Load(self, pszFileName: str, dwMode: int) -> hints.Hresult: ...
|
|
250
|
-
def Save(self, pszFileName: str, fRemember: bool) -> hints.Hresult: ...
|
|
251
|
-
def SaveCompleted(self, pszFileName: str) -> hints.Hresult: ...
|
|
252
|
-
def GetCurFile(self) -> str: ...
|
|
253
|
-
# fmt: on
|
|
248
|
+
|
|
249
|
+
def IsDirty(self) -> hints.Hresult: ...
|
|
250
|
+
def Load(self, pszFileName: str, dwMode: int) -> hints.Hresult: ...
|
|
251
|
+
def Save(self, pszFileName: str, fRemember: bool) -> hints.Hresult: ...
|
|
252
|
+
def SaveCompleted(self, pszFileName: str) -> hints.Hresult: ...
|
|
253
|
+
def GetCurFile(self) -> str: ...
|
|
254
254
|
|
|
255
255
|
|
|
256
256
|
from comtypes import COMObject
|
|
@@ -81,9 +81,7 @@ def _make_safearray_type(itemtype):
|
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
meta = type(_safearray.tagSAFEARRAY)
|
|
84
|
-
sa_type = meta.
|
|
85
|
-
meta, "SAFEARRAY_%s" % itemtype.__name__, (_safearray.tagSAFEARRAY,), {}
|
|
86
|
-
)
|
|
84
|
+
sa_type = meta(f"SAFEARRAY_{itemtype.__name__}", (_safearray.tagSAFEARRAY,), {})
|
|
87
85
|
|
|
88
86
|
try:
|
|
89
87
|
vartype = _ctype_to_vartype[itemtype]
|
|
@@ -192,9 +190,7 @@ def _make_safearray_type(itemtype):
|
|
|
192
190
|
nitems *= d
|
|
193
191
|
rgsa[i].cElements = d
|
|
194
192
|
rgsa[i].lBound = lBound
|
|
195
|
-
pa = _safearray.SafeArrayCreateEx(
|
|
196
|
-
cls._vartype_, value.ndim, rgsa, extra # cDims # rgsaBound
|
|
197
|
-
) # pvExtra
|
|
193
|
+
pa = _safearray.SafeArrayCreateEx(cls._vartype_, value.ndim, rgsa, extra)
|
|
198
194
|
if not pa:
|
|
199
195
|
if cls._vartype_ == VT_RECORD and extra is None:
|
|
200
196
|
raise TypeError(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from __future__ import print_function
|
|
2
1
|
from ctypes import c_char_p, c_int, c_short, c_wchar_p
|
|
3
2
|
from ctypes import POINTER
|
|
4
3
|
from ctypes import byref, create_string_buffer, create_unicode_buffer
|
|
@@ -18,19 +17,24 @@ SLGP_UNCPRIORITY = 0x2
|
|
|
18
17
|
SLGP_RAWPATH = 0x4
|
|
19
18
|
|
|
20
19
|
# for SetShowCmd, GetShowCmd
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
SW_SHOWNORMAL = 0x01
|
|
21
|
+
SW_SHOWMAXIMIZED = 0x03
|
|
22
|
+
SW_SHOWMINNOACTIVE = 0x07
|
|
25
23
|
|
|
26
24
|
# for Resolve
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
SLR_INVOKE_MSI = 0x0080
|
|
26
|
+
SLR_NOLINKINFO = 0x0040
|
|
27
|
+
SLR_NO_UI = 0x0001
|
|
28
|
+
SLR_NOUPDATE = 0x0008
|
|
29
|
+
SLR_NOSEARCH = 0x0010
|
|
30
|
+
SLR_NOTRACK = 0x0020
|
|
31
|
+
SLR_UPDATE = 0x0004
|
|
32
|
+
|
|
33
|
+
# for Hotkey
|
|
34
|
+
HOTKEYF_ALT = 0x04
|
|
35
|
+
HOTKEYF_CONTROL = 0x02
|
|
36
|
+
HOTKEYF_EXT = 0x08
|
|
37
|
+
HOTKEYF_SHIFT = 0x01
|
|
34
38
|
|
|
35
39
|
# fake these...
|
|
36
40
|
ITEMIDLIST = c_int
|
|
@@ -123,25 +127,26 @@ class IShellLinkA(IUnknown):
|
|
|
123
127
|
]
|
|
124
128
|
|
|
125
129
|
if TYPE_CHECKING:
|
|
126
|
-
|
|
127
|
-
def GetIDList(self) -> hints.Incomplete: ...
|
|
128
|
-
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ...
|
|
129
|
-
def SetDescription(self, pszName: bytes) -> hints.Incomplete: ...
|
|
130
|
-
def SetWorkingDirectory(self, pszDir: bytes) -> hints.Hresult: ...
|
|
131
|
-
def SetArguments(self, pszArgs: bytes) -> hints.Hresult: ...
|
|
130
|
+
|
|
131
|
+
def GetIDList(self) -> hints.Incomplete: ...
|
|
132
|
+
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ...
|
|
133
|
+
def SetDescription(self, pszName: bytes) -> hints.Incomplete: ...
|
|
134
|
+
def SetWorkingDirectory(self, pszDir: bytes) -> hints.Hresult: ...
|
|
135
|
+
def SetArguments(self, pszArgs: bytes) -> hints.Hresult: ...
|
|
132
136
|
@property
|
|
133
|
-
def Hotkey(self) -> int: ...
|
|
137
|
+
def Hotkey(self) -> int: ...
|
|
134
138
|
@Hotkey.setter
|
|
135
|
-
def Hotkey(self, pwHotkey: int) -> None: ...
|
|
139
|
+
def Hotkey(self, pwHotkey: int) -> None: ...
|
|
136
140
|
@property
|
|
137
|
-
def ShowCmd(self) -> int: ...
|
|
141
|
+
def ShowCmd(self) -> int: ...
|
|
138
142
|
@ShowCmd.setter
|
|
139
|
-
def ShowCmd(self, piShowCmd: int) -> None: ...
|
|
140
|
-
def SetIconLocation(self, pszIconPath: bytes, iIcon: int) -> hints.Hresult: ...
|
|
141
|
-
def SetRelativePath(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
def ShowCmd(self, piShowCmd: int) -> None: ...
|
|
144
|
+
def SetIconLocation(self, pszIconPath: bytes, iIcon: int) -> hints.Hresult: ...
|
|
145
|
+
def SetRelativePath(
|
|
146
|
+
self, pszPathRel: bytes, dwReserved: hints.Literal[0]
|
|
147
|
+
) -> hints.Hresult: ...
|
|
148
|
+
def Resolve(self, hwnd: int, fFlags: int) -> hints.Hresult: ...
|
|
149
|
+
def SetPath(self, pszFile: bytes) -> hints.Hresult: ...
|
|
145
150
|
|
|
146
151
|
def GetPath(self, flags: int = SLGP_SHORTPATH) -> bytes:
|
|
147
152
|
buf = create_string_buffer(MAX_PATH)
|
|
@@ -257,25 +262,26 @@ class IShellLinkW(IUnknown):
|
|
|
257
262
|
]
|
|
258
263
|
|
|
259
264
|
if TYPE_CHECKING:
|
|
260
|
-
|
|
261
|
-
def GetIDList(self) -> hints.Incomplete: ...
|
|
262
|
-
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ...
|
|
263
|
-
def SetDescription(self, pszName: str) -> hints.Incomplete: ...
|
|
264
|
-
def SetWorkingDirectory(self, pszDir: str) -> hints.Hresult: ...
|
|
265
|
-
def SetArguments(self, pszArgs: str) -> hints.Hresult: ...
|
|
265
|
+
|
|
266
|
+
def GetIDList(self) -> hints.Incomplete: ...
|
|
267
|
+
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ...
|
|
268
|
+
def SetDescription(self, pszName: str) -> hints.Incomplete: ...
|
|
269
|
+
def SetWorkingDirectory(self, pszDir: str) -> hints.Hresult: ...
|
|
270
|
+
def SetArguments(self, pszArgs: str) -> hints.Hresult: ...
|
|
266
271
|
@property
|
|
267
|
-
def Hotkey(self) -> int: ...
|
|
272
|
+
def Hotkey(self) -> int: ...
|
|
268
273
|
@Hotkey.setter
|
|
269
|
-
def Hotkey(self, pwHotkey: int) -> None: ...
|
|
274
|
+
def Hotkey(self, pwHotkey: int) -> None: ...
|
|
270
275
|
@property
|
|
271
|
-
def ShowCmd(self) -> int: ...
|
|
276
|
+
def ShowCmd(self) -> int: ...
|
|
272
277
|
@ShowCmd.setter
|
|
273
|
-
def ShowCmd(self, piShowCmd: int) -> None: ...
|
|
274
|
-
def SetIconLocation(self, pszIconPath: str, iIcon: int) -> hints.Hresult: ...
|
|
275
|
-
def SetRelativePath(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
def ShowCmd(self, piShowCmd: int) -> None: ...
|
|
279
|
+
def SetIconLocation(self, pszIconPath: str, iIcon: int) -> hints.Hresult: ...
|
|
280
|
+
def SetRelativePath(
|
|
281
|
+
self, pszPathRel: str, dwReserved: hints.Literal[0]
|
|
282
|
+
) -> hints.Hresult: ...
|
|
283
|
+
def Resolve(self, hwnd: int, fFlags: int) -> hints.Hresult: ...
|
|
284
|
+
def SetPath(self, pszFile: str) -> hints.Hresult: ...
|
|
279
285
|
|
|
280
286
|
def GetPath(self, flags: int = SLGP_SHORTPATH) -> str:
|
|
281
287
|
buf = create_unicode_buffer(MAX_PATH)
|
|
@@ -314,7 +320,6 @@ class ShellLink(CoClass):
|
|
|
314
320
|
|
|
315
321
|
|
|
316
322
|
if __name__ == "__main__":
|
|
317
|
-
|
|
318
323
|
import sys
|
|
319
324
|
import comtypes
|
|
320
325
|
from comtypes.client import CreateObject
|
|
@@ -33,6 +33,7 @@ from comtypes.gen import TestComServerLib
|
|
|
33
33
|
|
|
34
34
|
################################################################
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
# Implement the CoClass. Use the coclass from the wrapper as base
|
|
37
38
|
# class, and use DualDispMixin as base class which provides default
|
|
38
39
|
# implementations of IDispatch, IProvideClassInfo, IProvideClassInfo2
|
|
@@ -42,7 +43,6 @@ class TestComServer(
|
|
|
42
43
|
TestComServerLib.TestComServer, # the coclass from the typelib wrapper
|
|
43
44
|
comtypes.server.connectionpoints.ConnectableObjectMixin,
|
|
44
45
|
):
|
|
45
|
-
|
|
46
46
|
# The default interface from the typelib MUST be the first
|
|
47
47
|
# interface, other interfaces can follow
|
|
48
48
|
|
|
@@ -31,6 +31,7 @@ from comtypes.gen import TestDispServerLib
|
|
|
31
31
|
|
|
32
32
|
################################################################
|
|
33
33
|
|
|
34
|
+
|
|
34
35
|
# Implement the CoClass by defining a subclass of the
|
|
35
36
|
# TestDispServerLib.TestDispServer class in the wrapper file. The
|
|
36
37
|
# COMObject base class provides default implementations of the
|
|
@@ -42,7 +43,6 @@ class TestDispServer(
|
|
|
42
43
|
TestDispServerLib.TestDispServer, # the coclass from the typelib wrapper
|
|
43
44
|
comtypes.server.connectionpoints.ConnectableObjectMixin,
|
|
44
45
|
):
|
|
45
|
-
|
|
46
46
|
# The default interface from the typelib MUST be the first
|
|
47
47
|
# interface, other interfaces can follow
|
|
48
48
|
|
|
@@ -278,7 +278,7 @@ class Test_ArgspecPermutations(ut.TestCase):
|
|
|
278
278
|
(orig_0th, *orig_call_args), orig_kw = orig.call_args
|
|
279
279
|
self.assertEqual(orig_kw, {})
|
|
280
280
|
self.assertIs(orig_0th, self_)
|
|
281
|
-
for (
|
|
281
|
+
for (typ, f, val), orig in zip(
|
|
282
282
|
testing_params.call_args_validators, orig_call_args
|
|
283
283
|
):
|
|
284
284
|
self.assertIsInstance(orig, typ)
|
|
@@ -125,6 +125,7 @@ try:
|
|
|
125
125
|
)
|
|
126
126
|
# implementation
|
|
127
127
|
Name = "foo"
|
|
128
|
+
|
|
128
129
|
# test
|
|
129
130
|
def test_Name(self):
|
|
130
131
|
p = wrap(self.create())
|
|
@@ -137,6 +138,7 @@ try:
|
|
|
137
138
|
itf.add(
|
|
138
139
|
"[id(101)] HRESULT MixedInOut([in] int a, [out] int *b, [in] int c, [out] int *d);"
|
|
139
140
|
)
|
|
141
|
+
|
|
140
142
|
# implementation
|
|
141
143
|
def MixedInOut(self, a, c):
|
|
142
144
|
return a + 1, c + 1
|
|
@@ -151,6 +153,7 @@ try:
|
|
|
151
153
|
itf.add(
|
|
152
154
|
"[id(102)] HRESULT MultiInOutArgs([in, out] int *pa, [in, out] int *pb);"
|
|
153
155
|
)
|
|
156
|
+
|
|
154
157
|
# implementation
|
|
155
158
|
def MultiInOutArgs(self, pa, pb):
|
|
156
159
|
return pa[0] * 3, pb[0] * 4
|
|
@@ -174,6 +177,7 @@ try:
|
|
|
174
177
|
################
|
|
175
178
|
# definition
|
|
176
179
|
itf.add("HRESULT MultiInOutArgs3([out] int *pa, [out] int *pb);")
|
|
180
|
+
|
|
177
181
|
# implementation
|
|
178
182
|
def MultiInOutArgs3(self):
|
|
179
183
|
return 42, 43
|
|
@@ -186,6 +190,7 @@ try:
|
|
|
186
190
|
################
|
|
187
191
|
# definition
|
|
188
192
|
itf.add("HRESULT MultiInOutArgs4([out] int *pa, [in, out] int *pb);")
|
|
193
|
+
|
|
189
194
|
# implementation
|
|
190
195
|
def MultiInOutArgs4(self, pb):
|
|
191
196
|
return pb[0] + 3, pb[0] + 4
|
|
@@ -238,6 +243,7 @@ try:
|
|
|
238
243
|
# Test events.
|
|
239
244
|
itf.add("""HRESULT DoSomething();""")
|
|
240
245
|
outgoing.add("""[id(103)] HRESULT OnSomething();""")
|
|
246
|
+
|
|
241
247
|
# implementation
|
|
242
248
|
def DoSomething(self):
|
|
243
249
|
"Implement the DoSomething method"
|
|
@@ -50,17 +50,15 @@ class Test_IShellLinkA(ut.TestCase):
|
|
|
50
50
|
self.assertEqual(shortcut.GetArguments(), b"-f")
|
|
51
51
|
|
|
52
52
|
def test_set_and_get_hotkey(self):
|
|
53
|
-
|
|
54
|
-
HOTKEYF_CONTROL = 0x02
|
|
53
|
+
hotkey = shelllink.HOTKEYF_ALT | shelllink.HOTKEYF_CONTROL
|
|
55
54
|
shortcut = self._create_shortcut()
|
|
56
|
-
shortcut.Hotkey =
|
|
57
|
-
self.assertEqual(shortcut.Hotkey,
|
|
55
|
+
shortcut.Hotkey = hotkey
|
|
56
|
+
self.assertEqual(shortcut.Hotkey, hotkey)
|
|
58
57
|
|
|
59
58
|
def test_set_and_get_showcmd(self):
|
|
60
|
-
SW_SHOWMAXIMIZED = 0x03
|
|
61
59
|
shortcut = self._create_shortcut()
|
|
62
|
-
shortcut.ShowCmd = SW_SHOWMAXIMIZED
|
|
63
|
-
self.assertEqual(shortcut.ShowCmd, SW_SHOWMAXIMIZED)
|
|
60
|
+
shortcut.ShowCmd = shelllink.SW_SHOWMAXIMIZED
|
|
61
|
+
self.assertEqual(shortcut.ShowCmd, shelllink.SW_SHOWMAXIMIZED)
|
|
64
62
|
|
|
65
63
|
def test_set_and_get_icon_location(self):
|
|
66
64
|
shortcut = self._create_shortcut()
|
|
@@ -113,17 +111,15 @@ class Test_IShellLinkW(ut.TestCase):
|
|
|
113
111
|
self.assertEqual(shortcut.GetArguments(), "-f")
|
|
114
112
|
|
|
115
113
|
def test_set_and_get_hotkey(self):
|
|
116
|
-
|
|
117
|
-
HOTKEYF_CONTROL = 0x02
|
|
114
|
+
hotkey = shelllink.HOTKEYF_ALT | shelllink.HOTKEYF_CONTROL
|
|
118
115
|
shortcut = self._create_shortcut()
|
|
119
|
-
shortcut.Hotkey =
|
|
120
|
-
self.assertEqual(shortcut.Hotkey,
|
|
116
|
+
shortcut.Hotkey = hotkey
|
|
117
|
+
self.assertEqual(shortcut.Hotkey, hotkey)
|
|
121
118
|
|
|
122
119
|
def test_set_and_get_showcmd(self):
|
|
123
|
-
SW_SHOWMAXIMIZED = 0x03
|
|
124
120
|
shortcut = self._create_shortcut()
|
|
125
|
-
shortcut.ShowCmd = SW_SHOWMAXIMIZED
|
|
126
|
-
self.assertEqual(shortcut.ShowCmd, SW_SHOWMAXIMIZED)
|
|
121
|
+
shortcut.ShowCmd = shelllink.SW_SHOWMAXIMIZED
|
|
122
|
+
self.assertEqual(shortcut.ShowCmd, shelllink.SW_SHOWMAXIMIZED)
|
|
127
123
|
|
|
128
124
|
def test_set_and_get_icon_location(self):
|
|
129
125
|
shortcut = self._create_shortcut()
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import unittest as ut
|
|
2
|
+
|
|
3
|
+
from ctypes import POINTER, byref, c_bool, c_ubyte, c_ulonglong, oledll, pointer
|
|
4
|
+
import comtypes
|
|
5
|
+
import comtypes.client
|
|
6
|
+
|
|
7
|
+
comtypes.client.GetModule("portabledeviceapi.dll")
|
|
8
|
+
from comtypes.gen.PortableDeviceApiLib import IStream
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
STGC_DEFAULT = 0
|
|
12
|
+
STREAM_SEEK_SET = 0
|
|
13
|
+
STREAM_SEEK_CUR = 1
|
|
14
|
+
STREAM_SEEK_END = 2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _create_stream() -> IStream:
|
|
18
|
+
# Create an IStream
|
|
19
|
+
stream = POINTER(IStream)() # type: ignore
|
|
20
|
+
comtypes._ole32.CreateStreamOnHGlobal(None, c_bool(True), byref(stream))
|
|
21
|
+
return stream # type: ignore
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Test_RemoteWrite(ut.TestCase):
|
|
25
|
+
def test_RemoteWrite(self):
|
|
26
|
+
stream = _create_stream()
|
|
27
|
+
test_data = "Some data".encode("utf-8")
|
|
28
|
+
pv = (c_ubyte * len(test_data)).from_buffer(bytearray(test_data))
|
|
29
|
+
|
|
30
|
+
written = stream.RemoteWrite(pv, len(test_data))
|
|
31
|
+
|
|
32
|
+
# Verification
|
|
33
|
+
self.assertEqual(written, len(test_data))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Test_RemoteRead(ut.TestCase):
|
|
37
|
+
def test_RemoteRead(self):
|
|
38
|
+
stream = _create_stream()
|
|
39
|
+
test_data = "Some data".encode("utf-8")
|
|
40
|
+
pv = (c_ubyte * len(test_data)).from_buffer(bytearray(test_data))
|
|
41
|
+
stream.RemoteWrite(pv, len(test_data))
|
|
42
|
+
|
|
43
|
+
# Make sure the data actually gets written before trying to read back
|
|
44
|
+
stream.Commit(STGC_DEFAULT)
|
|
45
|
+
# Move the stream back to the beginning
|
|
46
|
+
stream.RemoteSeek(0, STREAM_SEEK_SET)
|
|
47
|
+
|
|
48
|
+
buffer_size = 1024
|
|
49
|
+
|
|
50
|
+
read_buffer, data_read = stream.RemoteRead(buffer_size)
|
|
51
|
+
|
|
52
|
+
# Verification
|
|
53
|
+
self.assertEqual(data_read, len(test_data))
|
|
54
|
+
self.assertEqual(bytearray(read_buffer)[0:data_read], test_data)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Test_RemoteSeek(ut.TestCase):
|
|
58
|
+
def _create_sample_stream(self) -> IStream:
|
|
59
|
+
stream = _create_stream()
|
|
60
|
+
test_data = b"spam egg bacon ham"
|
|
61
|
+
pv = (c_ubyte * len(test_data)).from_buffer(bytearray(test_data))
|
|
62
|
+
stream.RemoteWrite(pv, len(test_data))
|
|
63
|
+
stream.Commit(STGC_DEFAULT)
|
|
64
|
+
return stream
|
|
65
|
+
|
|
66
|
+
def test_takes_STREAM_SEEK_SET_as_origin(self):
|
|
67
|
+
stream = self._create_sample_stream()
|
|
68
|
+
newpos = stream.RemoteSeek(9, STREAM_SEEK_SET)
|
|
69
|
+
self.assertEqual(newpos, 9)
|
|
70
|
+
buf, read = stream.RemoteRead(1024)
|
|
71
|
+
self.assertEqual(bytearray(buf)[0:read], b"bacon ham")
|
|
72
|
+
|
|
73
|
+
def test_takes_STREAM_SEEK_CUR_as_origin(self):
|
|
74
|
+
stream = self._create_sample_stream()
|
|
75
|
+
stream.RemoteSeek(8, STREAM_SEEK_SET)
|
|
76
|
+
newpos = stream.RemoteSeek(7, STREAM_SEEK_CUR)
|
|
77
|
+
self.assertEqual(newpos, 15)
|
|
78
|
+
buf, read = stream.RemoteRead(1024)
|
|
79
|
+
self.assertEqual(bytearray(buf)[0:read], b"ham")
|
|
80
|
+
|
|
81
|
+
def test_takes_STREAM_SEEK_END_as_origin(self):
|
|
82
|
+
stream = self._create_sample_stream()
|
|
83
|
+
stream.RemoteSeek(8, STREAM_SEEK_SET)
|
|
84
|
+
newpos = stream.RemoteSeek(-13, STREAM_SEEK_END)
|
|
85
|
+
self.assertEqual(newpos, 5)
|
|
86
|
+
buf, read = stream.RemoteRead(1024)
|
|
87
|
+
self.assertEqual(bytearray(buf)[0:read], b"egg bacon ham")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Test_SetSize(ut.TestCase):
|
|
91
|
+
def test_SetSize(self):
|
|
92
|
+
stream = _create_stream()
|
|
93
|
+
stream.SetSize(42)
|
|
94
|
+
pui = pointer(c_ulonglong())
|
|
95
|
+
oledll.shlwapi.IStream_Size(stream, pui)
|
|
96
|
+
self.assertEqual(pui.contents.value, 42)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Test_RemoteCopyTo(ut.TestCase):
|
|
100
|
+
def test_RemoteCopyTo(self):
|
|
101
|
+
src = _create_stream()
|
|
102
|
+
dst = _create_stream()
|
|
103
|
+
test_data = b"parrot"
|
|
104
|
+
pv = (c_ubyte * len(test_data)).from_buffer(bytearray(test_data))
|
|
105
|
+
src_written = src.RemoteWrite(pv, len(test_data))
|
|
106
|
+
src.Commit(STGC_DEFAULT)
|
|
107
|
+
src.RemoteSeek(0, STREAM_SEEK_SET)
|
|
108
|
+
cpy_read, cpy_written = src.RemoteCopyTo(dst, src_written)
|
|
109
|
+
self.assertEqual(cpy_read, len(test_data))
|
|
110
|
+
self.assertEqual(cpy_written, len(test_data))
|
|
111
|
+
dst.Commit(STGC_DEFAULT)
|
|
112
|
+
dst.RemoteSeek(0, STREAM_SEEK_SET)
|
|
113
|
+
dst_buf, dst_read = dst.RemoteRead(1024)
|
|
114
|
+
self.assertEqual(bytearray(dst_buf)[0:dst_read], test_data)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class Test_Clone(ut.TestCase):
|
|
118
|
+
def test_Clone(self):
|
|
119
|
+
orig = _create_stream()
|
|
120
|
+
test_data = b"spam egg bacon ham"
|
|
121
|
+
pv = (c_ubyte * len(test_data)).from_buffer(bytearray(test_data))
|
|
122
|
+
orig.RemoteWrite(pv, len(test_data))
|
|
123
|
+
orig.Commit(STGC_DEFAULT)
|
|
124
|
+
orig.RemoteSeek(0, STREAM_SEEK_SET)
|
|
125
|
+
new_stm = orig.Clone()
|
|
126
|
+
buf, read = new_stm.RemoteRead(1024)
|
|
127
|
+
self.assertEqual(bytearray(buf)[0:read], test_data)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
ut.main()
|
|
@@ -7,6 +7,7 @@ from comtypes.tools.tlbparser import (
|
|
|
7
7
|
HRESULT_type,
|
|
8
8
|
VARIANT_type,
|
|
9
9
|
VARIANT_BOOL_type,
|
|
10
|
+
void_type,
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
|
|
@@ -20,7 +21,6 @@ idispatch_type = typedesc.ComInterface(
|
|
|
20
21
|
["restricted"],
|
|
21
22
|
None,
|
|
22
23
|
)
|
|
23
|
-
void_type = typedesc.FundamentalType("void", 0, 0)
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class Test_AvoidUsingKeywords(unittest.TestCase):
|
|
@@ -9,6 +9,7 @@ from comtypes.patcher import Patch
|
|
|
9
9
|
GetModule(os.path.join(os.path.dirname(__file__), "urlhist.tlb"))
|
|
10
10
|
from comtypes.gen import urlhistLib
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
# The pwcsTitle and pwcsUrl fields of the _STATURL structure must be
|
|
13
14
|
# freed by the caller. The only way to do this without patching the
|
|
14
15
|
# generated code directly is to monkey-patch the
|