ctypes-commit Mailing List for ctypes (Page 71)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Thomas H. <th...@us...> - 2005-03-07 09:22:24
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3258 Modified Files: setup.py Log Message: Also run comtypes tests, if comtypes directory is found. Index: setup.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/setup.py,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** setup.py 12 Dec 2004 03:13:47 -0000 1.112 --- setup.py 7 Mar 2005 09:22:12 -0000 1.113 *************** *** 58,62 **** self.verbosity = 1 if sys.platform == "win32": ! self.test_dirs = r"unittests,unittests\com" else: self.test_dirs = "unittests" --- 58,65 ---- self.verbosity = 1 if sys.platform == "win32": ! if os.path.isdir(r"comtypes\unittests"): ! self.test_dirs = r"unittests,unittests\com,comtypes\unittests" ! else: ! self.test_dirs = r"unittests,unittests\com" else: self.test_dirs = "unittests" |
From: Thomas H. <th...@us...> - 2005-03-04 20:52:59
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11948 Modified Files: custom.py Log Message: Update comments. Index: custom.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/custom.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** custom.py 4 Mar 2005 20:41:05 -0000 1.4 --- custom.py 4 Mar 2005 20:52:49 -0000 1.5 *************** *** 47,60 **** def get_custom_interface(comobj, typeinfo=None): ! # Hm, IDispatch? or IUnknown? or what? if typeinfo is None: typeinfo = comobj.GetTypeInfo() ta = typeinfo.GetTypeAttr() if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: # correct typeinfo, still need to QI for this interface ! ta = typeinfo.GetTypeAttr() ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, ta.guid) ! return comobj, typeinfo ! if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: # try to get the dual interface portion from a dispatch interface href = typeinfo.GetRefTypeOfImplType(-1) --- 47,62 ---- def get_custom_interface(comobj, typeinfo=None): ! # return comobj, typeinfo where typeinfo describes a custom ! # interface, and comobj implements it if typeinfo is None: + # If the caller didn't specify typeinfo, and comobj doesn't + # provide any, we're stumped - and the caller should handle + # whatever exception this raises. typeinfo = comobj.GetTypeInfo() ta = typeinfo.GetTypeAttr() if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: # correct typeinfo, still need to QI for this interface ! iid = ta.guid ! elif ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: # try to get the dual interface portion from a dispatch interface href = typeinfo.GetRefTypeOfImplType(-1) *************** *** 64,72 **** # it didn't work raise TypeError, "could not get custom interface" - # we must QI for this interface, but using IDispatch iid = ta.guid ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, iid) ! return comobj, typeinfo ! raise TypeError, "could not get custom interface" PDisp = ctypes.POINTER(comtypes.automation.IDispatch) --- 66,78 ---- # it didn't work raise TypeError, "could not get custom interface" iid = ta.guid ! else: ! raise TypeError, "could not get custom interface" ! # XXX We should make sure that our custom interface derives from IDispatch, ! # if not, we need to specify IUnknown in the following call. ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, iid) ! return comobj, typeinfo ! ! ################ PDisp = ctypes.POINTER(comtypes.automation.IDispatch) |
From: Thomas H. <th...@us...> - 2005-03-04 20:41:14
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8791 Modified Files: custom.py Log Message: Does now work with InternetExplorer (and with other out-of-process servers hopefully too). Even if we already have the typeinfo we need (TKIND_INTERFACE), we still have to QueryInterface for exactly this interface, otherwise we have IDispatch but not the custom part of the dual interface. Index: custom.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/custom.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** custom.py 4 Mar 2005 14:38:21 -0000 1.3 --- custom.py 4 Mar 2005 20:41:05 -0000 1.4 *************** *** 7,11 **** def get_type(ti, tdesc): ! # Return an (approximate) ctype for a typedesc if tdesc.vt == 26: return ctypes.POINTER(get_type(ti, tdesc._.lptdesc[0])) --- 7,11 ---- def get_type(ti, tdesc): ! # Return a ctypes type for a typedesc if tdesc.vt == 26: return ctypes.POINTER(get_type(ti, tdesc._.lptdesc[0])) *************** *** 31,35 **** def method_proto(name, ti, fd): ! # return resulttype, argtypes, paramflags for a com method assert fd.funckind == comtypes.automation.typeinfo.FUNC_PUREVIRTUAL, fd.funckind # FUNC_PUREVIRTUAL assert fd.callconv == comtypes.automation.typeinfo.CC_STDCALL, fd.callconv --- 31,35 ---- def method_proto(name, ti, fd): ! # return a function prototype with parmflags: an instance of COMMETHODTYPE assert fd.funckind == comtypes.automation.typeinfo.FUNC_PUREVIRTUAL, fd.funckind # FUNC_PUREVIRTUAL assert fd.callconv == comtypes.automation.typeinfo.CC_STDCALL, fd.callconv *************** *** 47,55 **** def get_custom_interface(comobj, typeinfo=None): if typeinfo is None: typeinfo = comobj.GetTypeInfo() ta = typeinfo.GetTypeAttr() if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: ! # everything ok return comobj, typeinfo if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: --- 47,58 ---- def get_custom_interface(comobj, typeinfo=None): + # Hm, IDispatch? or IUnknown? or what? if typeinfo is None: typeinfo = comobj.GetTypeInfo() ta = typeinfo.GetTypeAttr() if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: ! # correct typeinfo, still need to QI for this interface ! ta = typeinfo.GetTypeAttr() ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, ta.guid) return comobj, typeinfo if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: *************** *** 68,75 **** --- 71,81 ---- PDisp = ctypes.POINTER(comtypes.automation.IDispatch) + PUnk = ctypes.POINTER(comtypes.IUnknown) def _wrap(obj): if isinstance(obj, PDisp): return _Dynamic(obj) + ## if isinstance(obj, PUnk): + ## return _Dynamic(obj) return obj |
From: Thomas H. <th...@us...> - 2005-03-04 14:40:30
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25646 Modified Files: __init__.py Log Message: Added INVOKEKIND constants, and VARIANT can be initialized in the contructor. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 4 Mar 2005 09:09:20 -0000 1.5 --- __init__.py 4 Mar 2005 14:40:18 -0000 1.6 *************** *** 35,38 **** --- 35,46 ---- DISPATCH_PROPERTYPUTREF = 8 + tagINVOKEKIND = c_int + INVOKE_FUNC = DISPATCH_METHOD + INVOKE_PROPERTYGET = DISPATCH_PROPERTYGET + INVOKE_PROPERTYPUT = DISPATCH_PROPERTYPUT + INVOKE_PROPERTYPUTREF = DISPATCH_PROPERTYPUTREF + INVOKEKIND = tagINVOKEKIND + + ################################ # helper constants *************** *** 134,137 **** --- 142,149 ---- ] + def __init__(self, *args): + if args: + self.value = args[0] + # see also c:/sf/pywin32/com/win32com/src/oleargs.cpp 54 def _set_value(self, value): |
From: Thomas H. <th...@us...> - 2005-03-04 14:38:44
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24991 Modified Files: custom.py Log Message: Refactored the _ComBase, _ComProperty, and _ComMethod into one common _ComInvoker class. Refactored the code to get a usable ITypeInfo pointer. Everything seems to work so far. Index: custom.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/custom.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** custom.py 4 Mar 2005 10:42:34 -0000 1.2 --- custom.py 4 Mar 2005 14:38:21 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- # return resulttype, argtypes, paramflags for a com method assert fd.funckind == comtypes.automation.typeinfo.FUNC_PUREVIRTUAL, fd.funckind # FUNC_PUREVIRTUAL + assert fd.callconv == comtypes.automation.typeinfo.CC_STDCALL, fd.callconv ## names = ti.GetNames(fd.memid, fd.cParams + 1) restype = param_info(ti, fd.elemdescFunc)[1] # result type of com method *************** *** 39,43 **** for i in range(fd.cParams): # flags, typ[, default] ! flags, typ = param_info(ti, fd.lprgelemdescParam[i]) argtypes.append(typ) parmflags.append(flags) --- 40,44 ---- for i in range(fd.cParams): # flags, typ[, default] ! flags, typ = param_info(ti, fd.lprgelemdescParam[i])[:2] argtypes.append(typ) parmflags.append(flags) *************** *** 45,59 **** return proto ! # XXX Merge _ComMethod and _ComProperty. ! # Retrieve proto lazy in __call__, __setitem__, __getitem__ ! class _ComBase(object): ! def __init__(self, obj, oVft, name, proto): ! self.comobj = obj._comobj ! self.typecomp = obj._typecomp ! self.typeinfo = obj._typeinfo ! self.comcall = proto(oVft, name) self.name = name ! def do_call(self, comcall, *args, **kw): retvals = [] for index, x in enumerate(comcall.parmflags): --- 46,94 ---- return proto ! def get_custom_interface(comobj, typeinfo=None): ! if typeinfo is None: ! typeinfo = comobj.GetTypeInfo() ! ta = typeinfo.GetTypeAttr() ! if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: ! # everything ok ! return comobj, typeinfo ! if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: ! # try to get the dual interface portion from a dispatch interface ! href = typeinfo.GetRefTypeOfImplType(-1) ! typeinfo = typeinfo.GetRefTypeInfo(href) ! ta = typeinfo.GetTypeAttr() ! if ta.typekind != comtypes.automation.typeinfo.TKIND_INTERFACE: ! # it didn't work ! raise TypeError, "could not get custom interface" ! # we must QI for this interface, but using IDispatch ! iid = ta.guid ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, iid) ! return comobj, typeinfo ! raise TypeError, "could not get custom interface" ! ! PDisp = ctypes.POINTER(comtypes.automation.IDispatch) ! ! def _wrap(obj): ! if isinstance(obj, PDisp): ! return _Dynamic(obj) ! return obj ! ! def _unwrap(obj): ! return getattr(obj, "_comobj", obj) ! ! class _ComInvoker(object): ! def __init__(self, comobj, name, caller=None, getter=None, setter=None): ! self.comobj = comobj self.name = name + self.caller = caller + self.getter = getter + self.setter = setter ! def __repr__(self): ! return "<_ComInvoker %s (call=%s, get=%s, set=%s)>" % \ ! (self.name, self.caller, self.getter, self.setter) ! ! def _do_invoke(self, comcall, args, kw): ! args = [_unwrap(a) for a in args] retvals = [] for index, x in enumerate(comcall.parmflags): *************** *** 61,155 **** typ = comcall.argtypes[index]._type_ inst = typ() ! args = args[:index] + (ctypes.byref(inst),) + args[index:] retvals.append(inst) result = comcall(self.comobj, *args, **kw) if retvals: ! result = tuple([x.value for x in retvals]) if len(result) == 1: result = result[0] return result - class _ComMethod(_ComBase): def __call__(self, *args, **kw): ! # type 1 ! return self.do_call(self.comcall, *args, **kw) ! class _ComProperty(_ComBase): ! def __getitem__(self, args): ! # type 2 ! if not isinstance(args, tuple): ! args = (args,) ! return self.do_call(self.comcall, *args) def __setitem__(self, index, value): ! # type 4 ! kind, desc = self.typecomp.Bind(self.name, 4) ! assert kind == "function" ! proto = method_proto(self.name, self.typeinfo, desc) ! comcall = proto(desc.oVft/4, self.name) if isinstance(index, tuple): ! args = index + (value,) else: ! args = (index, value) ! self.do_call(comcall, *args) def set(self, value): ! self.comcall(self.comobj, value) ! def get_custom_interface(comobj, typeinfo): ! if typeinfo is None: ! typeinfo = comobj.GetTypeInfo() ! ta = typeinfo.GetTypeAttr() ! if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: ! # everything ok ! return typeinfo, comobj ! if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: ! # try to get the dual interface portion from a dispatch interface ! href = typeinfo.GetRefTypeOfImplType(-1) ! typeinfo = typeinfo.GetRefTypeInfo(href) ! ta = typeinfo.GetTypeAttr() ! if ta.typekind != comtypes.automation.typeinfo.TKIND_INTERFACE: ! # it didn't work ! raise TypeError, "could not get custom interface" ! # we must QI for this interface, but using IDispatch ! iid = ta.guid ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, iid) ! return typeinfo, comobj ! raise TypeError, "could not get custom interface" class _Dynamic(object): def __init__(self, comobj, typeinfo=None): ! typeinfo, comobj = get_custom_interface(comobj, typeinfo) self.__dict__["_typeinfo"] = typeinfo ! self.__dict__["_typecomp"] = self._typeinfo.GetTypeComp() self.__dict__["_comobj"] = comobj def __getattr__(self, name): ! kind, desc = self._typecomp.Bind(name, 1 + 2) # only METHOD and PROPGET ! if kind == "function": ! proto = method_proto(name, self._typeinfo, desc) ! if desc.invkind == 2: ! if not [f for f in proto.parmflags if f & 1]: ! # does not need "in" args -> invoke it ! mth = _ComMethod(self, desc.oVft/4, name, proto) ! return mth() ! # We should also try to bind PROPPUT and PROPPUTREF, ! # when _ComProperty.__setitem__ is called. For this, ! # we need self._typecomp in _ComProperty. ! prop = _ComProperty(self, desc.oVft/4, name, proto) ! return prop ! mth = _ComMethod(self, desc.oVft/4, name, proto) ! self.__dict__[name] = mth ! return mth ! raise AttributeError, name def __setattr__(self, name, value): ! kind, desc = self._typecomp.Bind(name, 4) ! if kind == "function": ! proto = method_proto(name, self._typeinfo, desc) ! prop = _ComProperty(self, desc.oVft/4, name, proto) ! prop.set(value) ! return ! raise "NYI" ################################################################ --- 96,188 ---- typ = comcall.argtypes[index]._type_ inst = typ() ! args = args[:index] + [ctypes.byref(inst)] + args[index:] retvals.append(inst) result = comcall(self.comobj, *args, **kw) if retvals: ! result = tuple([_wrap(x.value) for x in retvals]) if len(result) == 1: result = result[0] return result def __call__(self, *args, **kw): ! if not self.caller: ! raise TypeError, "uncallable object" ! return self._do_invoke(self.caller, args, kw) ! def __getitem__(self, index): ! if not self.getter: ! raise TypeError, "unindexable object" ! if isinstance(index, tuple): ! return self._do_invoke(self.getter, index, {}) ! return self._do_invoke(self.getter, (index,), {}) def __setitem__(self, index, value): ! if not self.setter: ! raise TypeError, "object doesn't support item assignment" if isinstance(index, tuple): ! self._do_invoke(self.setter, index + (value,), {}) else: ! self._do_invoke(self.setter, (index, value), {}) def set(self, value): ! self._do_invoke(self.setter, (value,), {}) ! def get(self): ! if not self.getter: ! return self ! if 1 in self.getter.parmflags: ! return self ! return self._do_invoke(self.getter, (), {}) ! ! from comtypes.automation import INVOKE_FUNC as _FUNC, INVOKE_PROPERTYGET as _PROPGET, \ ! INVOKE_PROPERTYPUT as _PROPPUT ! ! ################################################################ class _Dynamic(object): + _typecomp = _typeinfo = _comobj = _commap = None # pychecker + def __init__(self, comobj, typeinfo=None): ! comobj, typeinfo = get_custom_interface(comobj, typeinfo) self.__dict__["_typeinfo"] = typeinfo ! self.__dict__["_typecomp"] = typeinfo.GetTypeComp() self.__dict__["_comobj"] = comobj + self.__dict__["_commap"] = {} def __getattr__(self, name): ! invoker = self.__get_invoker(name, _FUNC | _PROPGET | _PROPPUT) ! return invoker.get() def __setattr__(self, name, value): ! prop = self.__get_invoker(name, _PROPPUT) ! prop.set(value) ! ! def __get_invoker(self, name, what): ! try: ! return self._commap[(name, what)] ! except KeyError: ! prop = self.__create_invoker(name, what) ! self._commap[(name, what)] = prop ! return prop ! ! def __create_invoker(self, name, what): ! comcalls = {} ! for invkind in (_FUNC, _PROPGET, _PROPPUT): ! if what and invkind: ! try: ! kind, desc = self._typecomp.Bind(name, invkind) ! except WindowsError: ! continue ! assert desc.invkind == invkind ! if kind != "function": ! raise "NYI" # can this happen? ! proto = method_proto(name, self._typeinfo, desc) ! comcalls[invkind] = proto(desc.oVft/4, name) ! return _ComInvoker(self._comobj, name, ! caller=comcalls.get(_FUNC), ! getter=comcalls.get(_PROPGET), ! setter=comcalls.get(_PROPPUT)) ! ! ################################################################ |
From: Thomas H. <th...@us...> - 2005-03-04 10:43:29
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22421 Modified Files: custom.py Log Message: Try harder to find the custom interface. Index: custom.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/custom.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** custom.py 4 Mar 2005 09:32:57 -0000 1.1 --- custom.py 4 Mar 2005 10:42:34 -0000 1.2 *************** *** 97,115 **** self.comcall(self.comobj, value) class _Dynamic(object): def __init__(self, comobj, typeinfo=None): ! if typeinfo is None: ! # get typeinfo for DUAL interface. See ITypeInfo::GetRefTypeOfImplType docs ! ti = comobj.GetTypeInfo() ! href = ti.GetRefTypeOfImplType(-1) # dual interface ! ti = self.__dict__["_typeinfo"] = ti.GetRefTypeInfo(href) ! # QI the comobj for this IDispatch derived custom interface ! comobj = comobj.QueryInterface(comtypes.automation.IDispatch, ! ti.GetTypeAttr().guid) ! else: ! self.__dict__["_typeinfo"] = typeinfo ! ! self.__dict__["_comobj"] = comobj self.__dict__["_typecomp"] = self._typeinfo.GetTypeComp() def __getattr__(self, name): --- 97,127 ---- self.comcall(self.comobj, value) + def get_custom_interface(comobj, typeinfo): + if typeinfo is None: + typeinfo = comobj.GetTypeInfo() + ta = typeinfo.GetTypeAttr() + if ta.typekind == comtypes.automation.typeinfo.TKIND_INTERFACE: + # everything ok + return typeinfo, comobj + if ta.typekind == comtypes.automation.typeinfo.TKIND_DISPATCH: + # try to get the dual interface portion from a dispatch interface + href = typeinfo.GetRefTypeOfImplType(-1) + typeinfo = typeinfo.GetRefTypeInfo(href) + ta = typeinfo.GetTypeAttr() + if ta.typekind != comtypes.automation.typeinfo.TKIND_INTERFACE: + # it didn't work + raise TypeError, "could not get custom interface" + # we must QI for this interface, but using IDispatch + iid = ta.guid + comobj = comobj.QueryInterface(comtypes.automation.IDispatch, iid) + return typeinfo, comobj + raise TypeError, "could not get custom interface" + class _Dynamic(object): def __init__(self, comobj, typeinfo=None): ! typeinfo, comobj = get_custom_interface(comobj, typeinfo) ! self.__dict__["_typeinfo"] = typeinfo self.__dict__["_typecomp"] = self._typeinfo.GetTypeComp() + self.__dict__["_comobj"] = comobj def __getattr__(self, name): |
From: Thomas H. <th...@us...> - 2005-03-04 09:40:53
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6314 Removed Files: BSTR.py Log Message: It's overkill to have a separate file for BSTR. --- BSTR.py DELETED --- |
From: Thomas H. <th...@us...> - 2005-03-04 09:39:53
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5993 Modified Files: __init__.py Log Message: It's overkill to have a separate file for BSTR. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** __init__.py 4 Mar 2005 09:37:25 -0000 1.13 --- __init__.py 4 Mar 2005 09:39:43 -0000 1.14 *************** *** 186,192 **** def __repr__(self): return "<%s instance at %x>" % (self.__class__.__name__, id(self)) ################################################################ ! from comtypes.BSTR import BSTR def STDMETHOD(restype, name, argtypes=()): --- 186,206 ---- def __repr__(self): return "<%s instance at %x>" % (self.__class__.__name__, id(self)) + ################################################################ + # Memory mamagement of BSTR is broken. + # + # The way we do them here, it is not possible to transfer the + # ownership of a BSTR instance. ctypes allocates the memory with + # SysAllocString if we call the constructor with a string, and the + # instance calls SysFreeString when it is destroyed. + # So BSTR's received from dll function calls will never be freed, + # and BSTR's we pass to functions are freed too often ;-( ! from ctypes import _SimpleCData ! ! class BSTR(_SimpleCData): ! _type_ = "X" ! def __repr__(self): ! return "%s(%r)" % (self.__class__.__name__, self.value) def STDMETHOD(restype, name, argtypes=()): |
From: Thomas H. <th...@us...> - 2005-03-04 09:37:51
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5389 Modified Files: __init__.py Log Message: Add COMMETHODTYPE, which is WINFUNCTYPE plus parameter flags. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** __init__.py 4 Mar 2005 09:10:42 -0000 1.12 --- __init__.py 4 Mar 2005 09:37:25 -0000 1.13 *************** *** 63,66 **** --- 63,88 ---- atexit.register(_clean_exc_info) + ################################################################ + + from _ctypes import CFuncPtr as _CFuncPtr, FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL + from ctypes import _win_functype_cache + + # For backward compatibility, the signature of WINFUNCTYPE cannot be + # changed, so we have to add this - which is basically the same, but + # allows to specify parameter flags from the win32 PARAMFLAGS + # enumeration. Maybe later we have to add optional default parameter + # values and parameter names as well. + def COMMETHODTYPE(restype, argtypes, paramflags): + flags = paramflags + try: + return _win_functype_cache[(restype, argtypes, flags)] + except KeyError: + class WinFunctionType(_CFuncPtr): + _argtypes_ = argtypes + _restype_ = restype + _flags_ = _FUNCFLAG_STDCALL + parmflags = flags + _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType + return WinFunctionType ################################################################ |
From: Thomas H. <th...@us...> - 2005-03-04 09:33:28
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4147 Added Files: custom.py Log Message: Dynamic binding to custom interfaces. --- NEW FILE: custom.py --- import ctypes import comtypes import comtypes.automation import comtypes.automation.typeinfo ################################################################ def get_type(ti, tdesc): # Return an (approximate) ctype for a typedesc if tdesc.vt == 26: return ctypes.POINTER(get_type(ti, tdesc._.lptdesc[0])) if tdesc.vt == 29: ta = ti.GetRefTypeInfo(tdesc._.hreftype).GetTypeAttr() typ = {0: ctypes.c_int, # TKIND_ENUM # XXX ? TKIND_RECORD, TKIND_MODULE, TKIND_COCLASS, TKIND_ALIAS, TKIND_UNION 3: comtypes.IUnknown, # TKIND_INTERFACE 4: comtypes.automation.IDispatch # TKIND_DISPATCH }[ta.typekind] return typ return comtypes.automation.VT2CTYPE[tdesc.vt] def param_info(ti, ed): # Return a tuple (flags, type) or (flags, type, default) # from an ELEMDESC instance. flags = ed._.paramdesc.wParamFlags typ = get_type(ti, ed.tdesc) if flags & comtypes.automation.typeinfo.PARAMFLAG_FHASDEFAULT: var = ed._.paramdesc.pparamdescex[0].varDefaultValue return flags, typ, var.value return flags, typ def method_proto(name, ti, fd): # return resulttype, argtypes, paramflags for a com method assert fd.funckind == comtypes.automation.typeinfo.FUNC_PUREVIRTUAL, fd.funckind # FUNC_PUREVIRTUAL ## names = ti.GetNames(fd.memid, fd.cParams + 1) restype = param_info(ti, fd.elemdescFunc)[1] # result type of com method argtypes = [] # argument types of com method parmflags = [] for i in range(fd.cParams): # flags, typ[, default] flags, typ = param_info(ti, fd.lprgelemdescParam[i]) argtypes.append(typ) parmflags.append(flags) proto = comtypes.COMMETHODTYPE(restype, tuple(argtypes), tuple(parmflags)) return proto # XXX Merge _ComMethod and _ComProperty. # Retrieve proto lazy in __call__, __setitem__, __getitem__ class _ComBase(object): def __init__(self, obj, oVft, name, proto): self.comobj = obj._comobj self.typecomp = obj._typecomp self.typeinfo = obj._typeinfo self.comcall = proto(oVft, name) self.name = name def do_call(self, comcall, *args, **kw): retvals = [] for index, x in enumerate(comcall.parmflags): if x & 2: # PARAMFLAG_FOUT typ = comcall.argtypes[index]._type_ inst = typ() args = args[:index] + (ctypes.byref(inst),) + args[index:] retvals.append(inst) result = comcall(self.comobj, *args, **kw) if retvals: result = tuple([x.value for x in retvals]) if len(result) == 1: result = result[0] return result class _ComMethod(_ComBase): def __call__(self, *args, **kw): # type 1 return self.do_call(self.comcall, *args, **kw) class _ComProperty(_ComBase): def __getitem__(self, args): # type 2 if not isinstance(args, tuple): args = (args,) return self.do_call(self.comcall, *args) def __setitem__(self, index, value): # type 4 kind, desc = self.typecomp.Bind(self.name, 4) assert kind == "function" proto = method_proto(self.name, self.typeinfo, desc) comcall = proto(desc.oVft/4, self.name) if isinstance(index, tuple): args = index + (value,) else: args = (index, value) self.do_call(comcall, *args) def set(self, value): self.comcall(self.comobj, value) class _Dynamic(object): def __init__(self, comobj, typeinfo=None): if typeinfo is None: # get typeinfo for DUAL interface. See ITypeInfo::GetRefTypeOfImplType docs ti = comobj.GetTypeInfo() href = ti.GetRefTypeOfImplType(-1) # dual interface ti = self.__dict__["_typeinfo"] = ti.GetRefTypeInfo(href) # QI the comobj for this IDispatch derived custom interface comobj = comobj.QueryInterface(comtypes.automation.IDispatch, ti.GetTypeAttr().guid) else: self.__dict__["_typeinfo"] = typeinfo self.__dict__["_comobj"] = comobj self.__dict__["_typecomp"] = self._typeinfo.GetTypeComp() def __getattr__(self, name): kind, desc = self._typecomp.Bind(name, 1 + 2) # only METHOD and PROPGET if kind == "function": proto = method_proto(name, self._typeinfo, desc) if desc.invkind == 2: if not [f for f in proto.parmflags if f & 1]: # does not need "in" args -> invoke it mth = _ComMethod(self, desc.oVft/4, name, proto) return mth() # We should also try to bind PROPPUT and PROPPUTREF, # when _ComProperty.__setitem__ is called. For this, # we need self._typecomp in _ComProperty. prop = _ComProperty(self, desc.oVft/4, name, proto) return prop mth = _ComMethod(self, desc.oVft/4, name, proto) self.__dict__[name] = mth return mth raise AttributeError, name def __setattr__(self, name, value): kind, desc = self._typecomp.Bind(name, 4) if kind == "function": proto = method_proto(name, self._typeinfo, desc) prop = _ComProperty(self, desc.oVft/4, name, proto) prop.set(value) return raise "NYI" ################################################################ def ActiveXObject(progid, interface=comtypes.automation.IDispatch, clsctx=comtypes.CLSCTX_ALL): # XXX Should we also allow GUID instances for the first parameter? # Or strings containing guids? clsid = comtypes.GUID.from_progid(progid) p = comtypes.CoCreateInstance(clsid, interface=interface, clsctx=clsctx) return _Dynamic(p) |
From: Thomas H. <th...@us...> - 2005-03-04 09:25:41
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2413 Modified Files: _ctypes.c Log Message: Todo style comment. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.208 retrieving revision 1.209 diff -C2 -d -r1.208 -r1.209 *** _ctypes.c 16 Feb 2005 20:53:05 -0000 1.208 --- _ctypes.c 4 Mar 2005 09:25:29 -0000 1.209 *************** *** 1843,1846 **** --- 1843,1853 ---- */ + /* + XXX: The trick above is slow... Much faster is it, as it seems, to create + the new instance as if it were standalone, and then patch it afterwards - + even if this means we must PyMem_Free the just allocated memory. + + Fix later. + */ static PyObject * CData_FromBaseObj(PyObject *type, PyObject *base, int index, char *adr) |
From: Thomas H. <th...@us...> - 2005-03-04 09:10:55
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31332 Modified Files: __init__.py Log Message: QueryInterface now takes an optional iid parameter. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** __init__.py 25 Feb 2005 13:57:00 -0000 1.11 --- __init__.py 4 Mar 2005 09:10:42 -0000 1.12 *************** *** 185,192 **** ] ! def QueryInterface(self, interface): "QueryInterface(klass) -> instance" p = POINTER(interface)() ! self.__com_QueryInterface(byref(interface._iid_), byref(p)) return p --- 185,194 ---- ] ! def QueryInterface(self, interface, iid=None): "QueryInterface(klass) -> instance" p = POINTER(interface)() ! if iid is None: ! iid = interface._iid_ ! self.__com_QueryInterface(byref(iid), byref(p)) return p |
From: Thomas H. <th...@us...> - 2005-03-04 09:09:46
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719 Modified Files: __init__.py Log Message: Start a mapping from VT_... codes to C types. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 25 Feb 2005 13:58:09 -0000 1.4 --- __init__.py 4 Mar 2005 09:09:20 -0000 1.5 *************** *** 382,385 **** --- 382,399 ---- DISP_E_UNKNOWNINTERFACE = -2147352575 + VT2CTYPE = { + VT_R4: c_float, + VT_R8: c_double, + VT_I4: c_long, + VT_INT: c_int, + VT_UI4: c_ulong, + VT_VOID: None, + VT_BSTR: BSTR, + VT_DISPATCH: POINTER(IDispatch), + VT_HRESULT: HRESULT, + VT_VARIANT: VARIANT, + VT_BOOL: VARIANT_BOOL, + } + ################################################################ |
From: Thomas H. <th...@us...> - 2005-03-04 08:58:44
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28217 Modified Files: typeinfo.py Log Message: Wrap ITypeComp::BindType. Index: typeinfo.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/typeinfo.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** typeinfo.py 25 Feb 2005 13:58:50 -0000 1.4 --- typeinfo.py 4 Mar 2005 08:58:19 -0000 1.5 *************** *** 379,383 **** raise NameError, "Name %s not found" % name ! ## STDMETHOD(HRESULT, 'BindType', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(POINTER(ITypeComp))]), ################ --- 379,389 ---- raise NameError, "Name %s not found" % name ! def BindType(self, name, lHashVal=0): ! "Bind a type, and return both the typeinfo and typecomp for it." ! ti = POINTER(ITypeInfo)() ! tc = POINTER(ITypeComp)() ! self.__com_BindType(name, lHashVal, byref(ti), byref(tc)) ! return ti, tc ! ################ |
From: Thomas H. <th...@us...> - 2005-02-25 13:59:53
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15127 Modified Files: test_typeinfo.py Log Message: Adapted test to changed GetIDsOfNames signature. Index: test_typeinfo.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/test_typeinfo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_typeinfo.py 24 Feb 2005 16:23:43 -0000 1.1 --- test_typeinfo.py 25 Feb 2005 13:59:45 -0000 1.2 *************** *** 59,63 **** fd = ti.GetFuncDesc(f) names = ti.GetNames(fd.memid, 32) ! ti.GetIDsOfNames(names) ti.GetMops(fd.memid) --- 59,63 ---- fd = ti.GetFuncDesc(f) names = ti.GetNames(fd.memid, 32) ! ti.GetIDsOfNames(*names) ti.GetMops(fd.memid) |
From: Thomas H. <th...@us...> - 2005-02-25 13:59:01
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14831 Modified Files: typeinfo.py Log Message: Fixed ITypeComp.Bind(). Index: typeinfo.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/typeinfo.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** typeinfo.py 25 Feb 2005 09:05:38 -0000 1.3 --- typeinfo.py 25 Feb 2005 13:58:50 -0000 1.4 *************** *** 357,361 **** _iid_ = GUID("{00020403-0000-0000-C000-000000000046}") ! def Bind(self, name, flags, lHashVal=0): "Bind to a name" bindptr = BINDPTR() --- 357,361 ---- _iid_ = GUID("{00020403-0000-0000-C000-000000000046}") ! def Bind(self, name, flags=0, lHashVal=0): "Bind to a name" bindptr = BINDPTR() *************** *** 363,380 **** ti = POINTER(ITypeInfo)() self.__com_Bind(name, lHashVal, flags, byref(ti), byref(desckind), byref(bindptr)) ! if desckind == DESCKIND_FUNCDESC: fd = bindptr.lpfuncdesc[0] fd.__ref__ = weakref.ref(fd, lambda dead: ti.ReleaseFuncDesc(bindptr.lpfuncdesc)) ! return fd ! elif desckind == DESCKIND_VARDESC: vd = bindptr.lpvardesc[0] vd.__ref__ = weakref.ref(vd, lambda dead: ti.ReleaseVarDesc(bindptr.lpvardesc)) ! return vd ! elif desckind == DESCKIND_TYPECOMP: ! return bindptr.lptcomp ! elif desckind == DESCKIND_IMPLICITAPPOBJ: raise "NYI" ! elif desckind == DESCKIND_NONE: ! return None ## STDMETHOD(HRESULT, 'BindType', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(POINTER(ITypeComp))]), --- 363,381 ---- ti = POINTER(ITypeInfo)() self.__com_Bind(name, lHashVal, flags, byref(ti), byref(desckind), byref(bindptr)) ! kind = desckind.value ! if kind == DESCKIND_FUNCDESC: fd = bindptr.lpfuncdesc[0] fd.__ref__ = weakref.ref(fd, lambda dead: ti.ReleaseFuncDesc(bindptr.lpfuncdesc)) ! return "function", fd ! elif kind == DESCKIND_VARDESC: vd = bindptr.lpvardesc[0] vd.__ref__ = weakref.ref(vd, lambda dead: ti.ReleaseVarDesc(bindptr.lpvardesc)) ! return "variable", vd ! elif kind == DESCKIND_TYPECOMP: ! return "type", bindptr.lptcomp ! elif kind == DESCKIND_IMPLICITAPPOBJ: raise "NYI" ! elif kind == DESCKIND_NONE: ! raise NameError, "Name %s not found" % name ## STDMETHOD(HRESULT, 'BindType', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(POINTER(ITypeComp))]), |
From: Thomas H. <th...@us...> - 2005-02-25 13:58:20
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14579 Modified Files: __init__.py Log Message: Default index for IDispatch.GetTypeInfo. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 24 Feb 2005 16:17:23 -0000 1.3 --- __init__.py 25 Feb 2005 13:58:09 -0000 1.4 *************** *** 310,314 **** return r.value ! def GetTypeInfo(self, index, lcid=0): from typeinfo import ITypeInfo p = POINTER(ITypeInfo)() --- 310,316 ---- return r.value ! def GetTypeInfo(self, index=0, lcid=0): ! "Return typeinfo" ! # index=0 specifies typeinfo for IDispatch from typeinfo import ITypeInfo p = POINTER(ITypeInfo)() |
From: Thomas H. <th...@us...> - 2005-02-25 13:57:10
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14172 Modified Files: __init__.py Log Message: Add CLSCTX_ constants. Add COM init and shutdown code. Add CoCreateInstance function. Comment out CoClass. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 24 Feb 2005 16:47:38 -0000 1.10 --- __init__.py 25 Feb 2005 13:57:00 -0000 1.11 *************** *** 8,11 **** --- 8,68 ---- ################################################################ + CLSCTX_INPROC_SERVER = 1 + CLSCTX_INPROC_HANDLER = 2 + CLSCTX_LOCAL_SERVER = 4 + + CLSCTX_INPROC = 3 # Variable c_int + CLSCTX_SERVER = 5 # Variable c_int + CLSCTX_ALL = 7 # Variable c_int + + CLSCTX_INPROC_SERVER16 = 8 + CLSCTX_REMOTE_SERVER = 16 + CLSCTX_INPROC_HANDLER16 = 32 + CLSCTX_RESERVED1 = 64 + CLSCTX_RESERVED2 = 128 + CLSCTX_RESERVED3 = 256 + CLSCTX_RESERVED4 = 512 + CLSCTX_NO_CODE_DOWNLOAD = 1024 + CLSCTX_RESERVED5 = 2048 + CLSCTX_NO_CUSTOM_MARSHAL = 4096 + CLSCTX_ENABLE_CODE_DOWNLOAD = 8192 + CLSCTX_NO_FAILURE_LOG = 16384 + CLSCTX_DISABLE_AAA = 32768 + CLSCTX_ENABLE_AAA = 65536 + CLSCTX_FROM_DEFAULT_CONTEXT = 131072 + + tagCLSCTX = c_int # enum + CLSCTX = tagCLSCTX + + ################################################################ + ole32 = oledll.ole32 + # Still experimenting with COM shutdown without crashes... + + ole32.CoInitialize(None) + + class _Cleaner(object): + def __del__(self, func=ole32.CoUninitialize): + # Sometimes, CoUnititialize, running at Python shutdown, raises an exception. + # We suppress this when __debug__ is False. + if __debug__: + func() + else: + try: func() + except WindowsError: pass + + __cleaner = _Cleaner() + del _Cleaner + + def _clean_exc_info(): + # the purpose of this function is to ensure that no com object + # pointers are in sys.exc_info() + try: 1//0 + except: pass + + import atexit + atexit.register(_clean_exc_info) + + + ################################################################ # The metaclasses... *************** *** 142,158 **** return self.__com_Release() ################ ! class CoClass(object): ! # creation, and so on ! def create_instance(self): ! oledll.ole32.CoInitialize(None) ! p = POINTER(self._com_interfaces_[0])() ! oledll.ole32.CoCreateInstance(byref(self._clsid_), ! None, ! 7, # CLSCTX ! byref(p._iid_), ! byref(p)) ! return p ################ --- 199,230 ---- return self.__com_Release() + ################################################################ + + ##@stdcall(HRESULT, 'ole32', + ## [POINTER(IID), POINTER(IUnknown), c_ulong, + ## POINTER(IID), POINTER(c_void_p)]) + def CoCreateInstance(clsid, interface=IUnknown, clsctx=CLSCTX_ALL, punkouter=None): + p = POINTER(interface)() + iid = interface._iid_ + CoCreateInstance._api_(byref(clsid), punkouter, clsctx, byref(iid), byref(p)) + return p + CoCreateInstance = stdcall(HRESULT, 'ole32', + [POINTER(IID), POINTER(IUnknown), c_ulong, + POINTER(IID), POINTER(c_void_p)]) (CoCreateInstance) + + ################################################################ + ################ ! ##class CoClass(object): ! ## # creation, and so on ! ## def create_instance(self): ! ## p = POINTER(self._com_interfaces_[0])() ! ## oledll.ole32.CoCreateInstance(byref(self._clsid_), ! ## None, ! ## 7, # CLSCTX ! ## byref(p._iid_), ! ## byref(p)) ! ## return p ################ *************** *** 177,215 **** __all__ = ["CoClass", "IUnknown", "GUID", "HRESULT", "BSTR", "STDMETHOD"] - - if __name__ == "__main__": - - ## help(POINTER(IUnknown)) - - class IMyInterface(IUnknown): - pass - - assert issubclass(IMyInterface, IUnknown) - assert issubclass(POINTER(IMyInterface), POINTER(IUnknown)) - - POINTER(IUnknown)() - - p = POINTER(IUnknown)() - - ## assert bool(p) is True - ## assert bool(p) is False - - windll.oleaut32.CreateTypeLib(1, u"blabla", byref(p)) - - print p - - assert (2, 1) == (p.AddRef(), p.Release()) - - p1 = p.QueryInterface(IUnknown) - assert (3, 2) == (p1.AddRef(), p1.Release()) - p2 = p1.QueryInterface(IUnknown) - - assert p1 == p2 - - del p2 - del p - assert (2, 1) == (p1.AddRef(), p1.Release()) - - ## help(POINTER(IUnknown)) - - del p1 --- 249,250 ---- |
From: Thomas H. <th...@us...> - 2005-02-25 09:06:08
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5188 Modified Files: typeinfo.py Log Message: Make ITypeInfo.GetIDsOfNames() signature compatible with IDispatch.GetIDsOfNames(). Index: typeinfo.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/typeinfo.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** typeinfo.py 24 Feb 2005 17:08:22 -0000 1.2 --- typeinfo.py 25 Feb 2005 09:05:38 -0000 1.3 *************** *** 299,303 **** return flags.value ! def GetIDsOfNames(self, names): "Maps function and argument names to identifiers" rgsznames = (c_wchar_p * len(names))(*names) --- 299,303 ---- return flags.value ! def GetIDsOfNames(self, *names): "Maps function and argument names to identifiers" rgsznames = (c_wchar_p * len(names))(*names) |
From: Thomas H. <th...@us...> - 2005-02-24 17:08:33
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17590 Modified Files: typeinfo.py Log Message: Add some enums. Index: typeinfo.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation/typeinfo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typeinfo.py 24 Feb 2005 16:23:34 -0000 1.1 --- typeinfo.py 24 Feb 2005 17:08:22 -0000 1.2 *************** *** 115,118 **** --- 115,177 ---- IMPLTYPEFLAG_FDEFAULTVTABLE = 8 + tagTYPEFLAGS = c_int # enum + TYPEFLAG_FAPPOBJECT = 1 + TYPEFLAG_FCANCREATE = 2 + TYPEFLAG_FLICENSED = 4 + TYPEFLAG_FPREDECLID = 8 + TYPEFLAG_FHIDDEN = 16 + TYPEFLAG_FCONTROL = 32 + TYPEFLAG_FDUAL = 64 + TYPEFLAG_FNONEXTENSIBLE = 128 + TYPEFLAG_FOLEAUTOMATION = 256 + TYPEFLAG_FRESTRICTED = 512 + TYPEFLAG_FAGGREGATABLE = 1024 + TYPEFLAG_FREPLACEABLE = 2048 + TYPEFLAG_FDISPATCHABLE = 4096 + TYPEFLAG_FREVERSEBIND = 8192 + TYPEFLAG_FPROXY = 16384 + TYPEFLAGS = tagTYPEFLAGS + + tagFUNCFLAGS = c_int # enum + FUNCFLAG_FRESTRICTED = 1 + FUNCFLAG_FSOURCE = 2 + FUNCFLAG_FBINDABLE = 4 + FUNCFLAG_FREQUESTEDIT = 8 + FUNCFLAG_FDISPLAYBIND = 16 + FUNCFLAG_FDEFAULTBIND = 32 + FUNCFLAG_FHIDDEN = 64 + FUNCFLAG_FUSESGETLASTERROR = 128 + FUNCFLAG_FDEFAULTCOLLELEM = 256 + FUNCFLAG_FUIDEFAULT = 512 + FUNCFLAG_FNONBROWSABLE = 1024 + FUNCFLAG_FREPLACEABLE = 2048 + FUNCFLAG_FIMMEDIATEBIND = 4096 + FUNCFLAGS = tagFUNCFLAGS + + tagVARFLAGS = c_int # enum + VARFLAG_FREADONLY = 1 + VARFLAG_FSOURCE = 2 + VARFLAG_FBINDABLE = 4 + VARFLAG_FREQUESTEDIT = 8 + VARFLAG_FDISPLAYBIND = 16 + VARFLAG_FDEFAULTBIND = 32 + VARFLAG_FHIDDEN = 64 + VARFLAG_FRESTRICTED = 128 + VARFLAG_FDEFAULTCOLLELEM = 256 + VARFLAG_FUIDEFAULT = 512 + VARFLAG_FNONBROWSABLE = 1024 + VARFLAG_FREPLACEABLE = 2048 + VARFLAG_FIMMEDIATEBIND = 4096 + VARFLAGS = tagVARFLAGS + + PARAMFLAG_NONE = 0 + PARAMFLAG_FIN = 1 + PARAMFLAG_FOUT = 2 + PARAMFLAG_FLCID = 4 + PARAMFLAG_FRETVAL = 8 + PARAMFLAG_FOPT = 16 + PARAMFLAG_FHASDEFAULT = 32 + PARAMFLAG_FHASCUSTDATA = 64 + ################################################################ # interfaces |
From: Thomas H. <th...@us...> - 2005-02-24 16:51:34
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12194 Modified Files: test_basic.py Log Message: Make sure that assigning _methods_ with no _iid_ defined raises an error. Index: test_basic.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/test_basic.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_basic.py 3 Feb 2005 14:10:41 -0000 1.3 --- test_basic.py 24 Feb 2005 16:51:15 -0000 1.4 *************** *** 1,5 **** import unittest from ctypes import windll, POINTER, byref, HRESULT ! from comtypes import IUnknown, STDMETHOD def method_count(interface): --- 1,5 ---- import unittest from ctypes import windll, POINTER, byref, HRESULT ! from comtypes import IUnknown, STDMETHOD, GUID def method_count(interface): *************** *** 50,53 **** --- 50,57 ---- self.failUnlessEqual(method_count(IMyInterface), 3) + # assigning _methods_ does not work until we have an _iid_! + self.assertRaises(AttributeError, + setattr, IMyInterface, "_methods_", []) + IMyInterface._iid_ = GUID.create_new() IMyInterface._methods_ = [] self.failUnlessEqual(method_count(IMyInterface), 3) |
From: Thomas H. <th...@us...> - 2005-02-24 16:50:12
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11603 Modified Files: test_GUID.py Log Message: Add GUID.create_new test. Index: test_GUID.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/test_GUID.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_GUID.py 16 Feb 2005 08:49:41 -0000 1.1 --- test_GUID.py 24 Feb 2005 16:49:54 -0000 1.2 *************** *** 24,27 **** --- 24,29 ---- u'InternetExplorer.Application.1') + self.failIfEqual(GUID.create_new(), GUID.create_new()) + if __name__ == "__main__": unittest.main() |
From: Thomas H. <th...@us...> - 2005-02-24 16:47:56
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10924 Modified Files: __init__.py Log Message: Insist that we have a _iid_ in the very class, when we assign _methods_. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 11 Feb 2005 20:46:07 -0000 1.9 --- __init__.py 24 Feb 2005 16:47:38 -0000 1.10 *************** *** 51,54 **** --- 51,59 ---- def _make_methods(self, methods): + # we insist on an _iid_ in THIS class" + try: + self.__dict__["_iid_"] + except KeyError: + raise AttributeError, "must define _iid_" vtbl_offset = self.__get_baseinterface_methodcount() for i, (restype, name, argtypes) in enumerate(methods): |
From: Thomas H. <th...@us...> - 2005-02-24 16:46:26
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10470 Modified Files: GUID.py Log Message: GUID.create_new calls CoCreateGuid. Index: GUID.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/GUID.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GUID.py 16 Feb 2005 08:49:05 -0000 1.4 --- GUID.py 24 Feb 2005 16:46:07 -0000 1.5 *************** *** 44,47 **** --- 44,48 ---- def from_progid(cls, progid): + "Get guid from progid" inst = cls() _ole32.CLSIDFromProgID(unicode(progid), byref(inst)) *************** *** 50,57 **** --- 51,66 ---- def progid(self): + "Get progid from guid" progid = c_wchar_p() _ole32.ProgIDFromCLSID(byref(self), byref(progid)) return progid.value + def create_new(self): + "Create a brand new guid" + guid = self() + _ole32.CoCreateGuid(byref(guid)) + return guid + create_new = classmethod(create_new) + assert(sizeof(GUID) == 16), sizeof(GUID) |
From: Thomas H. <th...@us...> - 2005-02-24 16:24:06
|
Update of /cvsroot/ctypes/ctypes/comtypes/automation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3070 Added Files: typeinfo.py Log Message: ITypeInfo and ITypeLib interfaces, support structures and functions. --- NEW FILE: typeinfo.py --- # generated by 'xml2py' # flags '..\tools\windows.xml -m comtypes -m comtypes.automation -w -r .*TypeLibEx -r .*TypeLib -o typeinfo.py' # then hacked manually import weakref from ctypes import * from comtypes import STDMETHOD from comtypes import _GUID, GUID from comtypes.automation import BSTR from comtypes.automation import DISPID from comtypes.automation import DISPPARAMS from comtypes.automation import DWORD from comtypes.automation import EXCEPINFO from comtypes.automation import HRESULT from comtypes.automation import IID from comtypes.automation import IUnknown from comtypes.automation import IUnknown from comtypes.automation import LCID from comtypes.automation import LONG from comtypes.automation import SCODE from comtypes.automation import UINT from comtypes.automation import VARIANT from comtypes.automation import VARIANTARG from comtypes.automation import VARTYPE from comtypes.automation import WCHAR from comtypes.automation import WORD from comtypes.automation import tagVARIANT BOOL = c_int HREFTYPE = DWORD INT = c_int MEMBERID = DISPID OLECHAR = WCHAR PVOID = c_void_p SHORT = c_short ULONG_PTR = c_ulong USHORT = c_ushort LPOLESTR = POINTER(OLECHAR) ################################################################ # enums tagSYSKIND = c_int # enum SYS_WIN16 = 0 SYS_WIN32 = 1 SYS_MAC = 2 SYS_WIN64 = 3 SYSKIND = tagSYSKIND tagREGKIND = c_int # enum REGKIND_DEFAULT = 0 REGKIND_REGISTER = 1 REGKIND_NONE = 2 REGKIND = tagREGKIND tagTYPEKIND = c_int # enum TKIND_ENUM = 0 TKIND_RECORD = 1 TKIND_MODULE = 2 TKIND_INTERFACE = 3 TKIND_DISPATCH = 4 TKIND_COCLASS = 5 TKIND_ALIAS = 6 TKIND_UNION = 7 TKIND_MAX = 8 TYPEKIND = tagTYPEKIND tagINVOKEKIND = c_int # enum INVOKE_FUNC = 1 INVOKE_PROPERTYGET = 2 INVOKE_PROPERTYPUT = 4 INVOKE_PROPERTYPUTREF = 8 INVOKEKIND = tagINVOKEKIND tagDESCKIND = c_int # enum DESCKIND_NONE = 0 DESCKIND_FUNCDESC = 1 DESCKIND_VARDESC = 2 DESCKIND_TYPECOMP = 3 DESCKIND_IMPLICITAPPOBJ = 4 DESCKIND_MAX = 5 DESCKIND = tagDESCKIND tagVARKIND = c_int # enum VAR_PERINSTANCE = 0 VAR_STATIC = 1 VAR_CONST = 2 VAR_DISPATCH = 3 VARKIND = tagVARKIND tagFUNCKIND = c_int # enum FUNC_VIRTUAL = 0 FUNC_PUREVIRTUAL = 1 FUNC_NONVIRTUAL = 2 FUNC_STATIC = 3 FUNC_DISPATCH = 4 FUNCKIND = tagFUNCKIND tagCALLCONV = c_int # enum CC_FASTCALL = 0 CC_CDECL = 1 CC_MSCPASCAL = 2 CC_PASCAL = 2 CC_MACPASCAL = 3 CC_STDCALL = 4 CC_FPFASTCALL = 5 CC_SYSCALL = 6 CC_MPWCDECL = 7 CC_MPWPASCAL = 8 CC_MAX = 9 CALLCONV = tagCALLCONV IMPLTYPEFLAG_FDEFAULT = 1 IMPLTYPEFLAG_FSOURCE = 2 IMPLTYPEFLAG_FRESTRICTED = 4 IMPLTYPEFLAG_FDEFAULTVTABLE = 8 ################################################################ # interfaces class ITypeLib(IUnknown): _iid_ = GUID("{00020402-0000-0000-C000-000000000046}") def GetTypeInfoCount(self): "Return the number of type informations" return self.__com_GetTypeInfoCount() def GetTypeInfo(self, index): "Load type info by index" ti = POINTER(ITypeInfo)() self.__com_GetTypeInfo(index, byref(ti)) return ti def GetTypeInfoType(self, index): "Return the TYPEKIND of type information" tkind = TYPEKIND() self.__com_GetTypeInfoType(index, byref(tkind)) return tkind.value def GetTypeInfoOfGuid(self, guid): "Return type information for a guid" ti = POINTER(ITypeInfo)() self.__com_GetTypeInfoOfGuid(byref(guid), byref(ti)) return ti def GetLibAttr(self): "Return type library attributes" ptla = POINTER(TLIBATTR)() self.__com_GetLibAttr(byref(ptla)) result = ptla[0] result.__ref__ = weakref.ref(result, lambda dead: self.ReleaseTLibAttr(ptla)) return result def GetTypeComp(self): "Return an ITypeComp pointer." tc = POINTER(ITypeComp)() self.__com_GetTypeComp(byref(tc)) return tc def GetDocumentation(self, index): "Return documentation for a type description." name = BSTR() docstring = BSTR() helpcontext = DWORD() helpfile = BSTR() self.__com_GetDocumentation(index, byref(name), byref(docstring), byref(helpcontext), byref(helpfile)) return name.value, docstring.value, helpcontext.value, helpfile.value def IsName(self, name, lHashVal=0): "Check if there is type information for this name" result = BOOL() self.__com_IsName(name, lHashVal, byref(result)) return result.value def FindName(self, name, lHashVal=0): # Hm... found = c_ushort(1) tinfo = POINTER(ITypeInfo)() memid = MEMBERID() self.__com_FindName(name, lHashVal, byref(tinfo), byref(memid), byref(found)) if found.value: return memid.value, tinfo def ReleaseTLibAttr(self, ptla): "Release TLIBATTR" self.__com_ReleaseTLibAttr(ptla) ################ class ITypeInfo(IUnknown): _iid_ = GUID("{00020401-0000-0000-C000-000000000046}") def GetTypeAttr(self): "Return TYPEATTR for this type" pta = POINTER(TYPEATTR)() self.__com_GetTypeAttr(byref(pta)) result = pta[0] result.__ref__ = weakref.ref(result, lambda dead: self.ReleaseTypeAttr(pta)) return result def GetTypeComp(self): "Return ITypeComp pointer for this type" tc = POINTER(ITypeComp)() self.__com_GetTypeComp(byref(tc)) return tc def GetFuncDesc(self, index): "Return FUNCDESC for index" pfd = POINTER(FUNCDESC)() self.__com_GetFuncDesc(index, byref(pfd)) fd = pfd[0] fd.__ref__ = weakref.ref(fd, lambda dead: self.ReleaseFuncDesc(pfd)) return fd def GetVarDesc(self, index): "Return VARDESC for index" pvd = POINTER(VARDESC)() self.__com_GetVarDesc(index, byref(pvd)) vd = pvd[0] vd.__ref__ = weakref.ref(vd, lambda dead: self.ReleaseVarDesc(pvd)) return vd def GetNames(self, memid, count=1): "Return names for memid" names = (BSTR * count)() cnames = c_uint() self.__com_GetNames(memid, names, count, byref(cnames)) return names[:cnames.value] def GetRefTypeOfImplType(self, index): "Get the reftype of an implemented type" href = HREFTYPE() self.__com_GetRefTypeOfImplType(index, byref(href)) return href.value def GetImplTypeFlags(self, index): "Get IMPLTYPEFLAGS" flags = c_int() self.__com_GetImplTypeFlags(index, byref(flags)) return flags.value def GetIDsOfNames(self, names): "Maps function and argument names to identifiers" rgsznames = (c_wchar_p * len(names))(*names) ids = (MEMBERID * len(names))() self.__com_GetIDsOfNames(rgsznames, len(names), ids) return ids[:] ## STDMETHOD(HRESULT, 'Invoke', [PVOID, MEMBERID, WORD, POINTER(DISPPARAMS), POINTER(VARIANT), POINTER(EXCEPINFO), POINTER(UINT)]), def GetDocumentation(self, memid): "Return documentation for a type" name = BSTR() docstring = BSTR() helpcontext = DWORD() helpfile = BSTR() self.__com_GetDocumentation(memid, byref(name), byref(docstring), byref(helpcontext), byref(helpfile)) return name.value, docstring.value, helpcontext.value, helpfile.value ## STDMETHOD(HRESULT, 'GetDllEntry', [MEMBERID, INVOKEKIND, POINTER(BSTR), POINTER(BSTR), POINTER(WORD)]), def GetRefTypeInfo(self, href): "Get type info for reftype" ti = POINTER(ITypeInfo)() self.__com_GetRefTypeInfo(href, byref(ti)) return ti ## STDMETHOD(HRESULT, 'AddressOfMember', [MEMBERID, INVOKEKIND, POINTER(PVOID)]), ## STDMETHOD(HRESULT, 'CreateInstance', [POINTER(IUnknown), POINTER(IID), POINTER(PVOID)]), def GetMops(self, index): "Get marshalling opcodes (whatever that is...)" mops = BSTR() self.__com_GetMops(index, byref(mops)) return mops.value def GetContainingTypeLib(self): "Return index into and the containing type lib itself" index = c_uint() tlib = POINTER(ITypeLib)() self.__com_GetContainingTypeLib(byref(tlib), byref(index)) return index.value, tlib def ReleaseTypeAttr(self, pta): self.__com_ReleaseTypeAttr(pta) def ReleaseFuncDesc(self, pfd): self.__com_ReleaseFuncDesc(pfd) def ReleaseVarDesc(self, pvd): self.__com_ReleaseVarDesc(pvd) ################ class ITypeComp(IUnknown): _iid_ = GUID("{00020403-0000-0000-C000-000000000046}") def Bind(self, name, flags, lHashVal=0): "Bind to a name" bindptr = BINDPTR() desckind = DESCKIND() ti = POINTER(ITypeInfo)() self.__com_Bind(name, lHashVal, flags, byref(ti), byref(desckind), byref(bindptr)) if desckind == DESCKIND_FUNCDESC: fd = bindptr.lpfuncdesc[0] fd.__ref__ = weakref.ref(fd, lambda dead: ti.ReleaseFuncDesc(bindptr.lpfuncdesc)) return fd elif desckind == DESCKIND_VARDESC: vd = bindptr.lpvardesc[0] vd.__ref__ = weakref.ref(vd, lambda dead: ti.ReleaseVarDesc(bindptr.lpvardesc)) return vd elif desckind == DESCKIND_TYPECOMP: return bindptr.lptcomp elif desckind == DESCKIND_IMPLICITAPPOBJ: raise "NYI" elif desckind == DESCKIND_NONE: return None ## STDMETHOD(HRESULT, 'BindType', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(POINTER(ITypeComp))]), ################ class ICreateTypeLib(IUnknown): _iid_ = GUID("{00020406-0000-0000-C000-000000000046}") # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 2149 class ICreateTypeInfo(IUnknown): _iid_ = GUID("{00020405-0000-0000-C000-000000000046}") # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 915 ################################################################ # functions def LoadRegTypeLib(guid, wVerMajor, wVerMinor, lcid=0): "Load a registered type library" tlib = POINTER(ITypeLib)() LoadRegTypeLib._api_(byref(guid), wVerMajor, wVerMinor, lcid, byref(tlib)) return tlib LoadRegTypeLib = stdcall(HRESULT, 'oleaut32', [POINTER(GUID), c_ushort, c_ushort, c_ulong, POINTER(POINTER(ITypeLib))]) (LoadRegTypeLib) def LoadTypeLibEx(szFile, regkind=REGKIND_NONE): "Load, and optionally register a type library file" ptl = POINTER(ITypeLib)() LoadTypeLibEx._api_(szFile, regkind, byref(ptl)) return ptl LoadTypeLibEx = stdcall(HRESULT, 'oleaut32', [POINTER(OLECHAR), tagREGKIND, POINTER(POINTER(ITypeLib))]) (LoadTypeLibEx) def LoadTypeLib(szFile): "Load and register a type library file" tlib = POINTER(ITypeLib)() LoadTypeLib._api_(szFile, byref(tlib)) return tlib LoadTypeLib = stdcall(HRESULT, 'oleaut32', [POINTER(OLECHAR), POINTER(POINTER(ITypeLib))]) (LoadTypeLib) def UnRegisterTypeLib(libID, wVerMajor, wVerMinor, lcid=0, syskind=SYS_WIN32): "Unregister a registered type library" return UnRegisterTypeLib._api_(byref(libID), wVerMajor, wVerMinor, lcid, syskind) UnRegisterTypeLib = stdcall(HRESULT, 'oleaut32', [POINTER(GUID), c_ushort, c_ushort, c_ulong, tagSYSKIND]) (UnRegisterTypeLib) def RegisterTypeLib(tlib, fullpath, helpdir=None): "Register a type library in the registry" return RegisterTypeLib._api_(tlib, fullpath, helpdir) RegisterTypeLib = stdcall(HRESULT, 'oleaut32', [POINTER(ITypeLib), POINTER(OLECHAR), POINTER(OLECHAR)]) (RegisterTypeLib) def CreateTypeLib(filename, syskind=SYS_WIN32): "Return a ICreateTypeLib pointer" ctlib = POINTER(ICreateTypeLib)() CreateTypeLib._api_(syskind, filename, byref(ctlib)) return ctlib CreateTypeLib = stdcall(HRESULT, 'oleaut32', [tagSYSKIND, POINTER(OLECHAR), POINTER(POINTER(ICreateTypeLib))]) (CreateTypeLib) def QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid=0): "Return the path of a registered type library" pathname = BSTR() QueryPathOfRegTypeLib._api_(byref(libid), wVerMajor, wVerMinor, lcid, byref(pathname)) return pathname.value QueryPathOfRegTypeLib = stdcall(HRESULT, 'oleaut32', [POINTER(GUID), c_ushort, c_ushort, c_ulong, POINTER(BSTR)]) (QueryPathOfRegTypeLib) ################################################################ # Structures class tagTLIBATTR(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 4437 pass TLIBATTR = tagTLIBATTR class tagTYPEATTR(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 672 pass TYPEATTR = tagTYPEATTR class tagFUNCDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 769 pass FUNCDESC = tagFUNCDESC class tagVARDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 803 pass VARDESC = tagVARDESC class tagBINDPTR(Union): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 3075 pass BINDPTR = tagBINDPTR class tagTYPEDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 582 pass TYPEDESC = tagTYPEDESC class tagIDLDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 633 pass IDLDESC = tagIDLDESC class tagARRAYDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 594 pass ################################################################ # interface vtbl definitions ICreateTypeLib._methods_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 2149 STDMETHOD(HRESULT, 'CreateTypeInfo', [LPOLESTR, TYPEKIND, POINTER(POINTER(ICreateTypeInfo))]), STDMETHOD(HRESULT, 'SetName', [LPOLESTR]), STDMETHOD(HRESULT, 'SetVersion', [WORD, WORD]), STDMETHOD(HRESULT, 'SetGuid', [POINTER(GUID)]), STDMETHOD(HRESULT, 'SetDocString', [LPOLESTR]), STDMETHOD(HRESULT, 'SetHelpFileName', [LPOLESTR]), STDMETHOD(HRESULT, 'SetHelpContext', [DWORD]), STDMETHOD(HRESULT, 'SetLcid', [LCID]), STDMETHOD(HRESULT, 'SetLibFlags', [UINT]), STDMETHOD(HRESULT, 'SaveAllChanges', []), ] ITypeLib._methods_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 4455 STDMETHOD(UINT, 'GetTypeInfoCount', []), STDMETHOD(HRESULT, 'GetTypeInfo', [UINT, POINTER(POINTER(ITypeInfo))]), STDMETHOD(HRESULT, 'GetTypeInfoType', [UINT, POINTER(TYPEKIND)]), STDMETHOD(HRESULT, 'GetTypeInfoOfGuid', [POINTER(GUID), POINTER(POINTER(ITypeInfo))]), STDMETHOD(HRESULT, 'GetLibAttr', [POINTER(POINTER(TLIBATTR))]), STDMETHOD(HRESULT, 'GetTypeComp', [POINTER(POINTER(ITypeComp))]), STDMETHOD(HRESULT, 'GetDocumentation', [INT, POINTER(BSTR), POINTER(BSTR), POINTER(DWORD), POINTER(BSTR)]), STDMETHOD(HRESULT, 'IsName', [LPOLESTR, DWORD, POINTER(BOOL)]), STDMETHOD(HRESULT, 'FindName', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(MEMBERID), POINTER(USHORT)]), STDMETHOD(None, 'ReleaseTLibAttr', [POINTER(TLIBATTR)]), ] ITypeInfo._methods_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 3230 STDMETHOD(HRESULT, 'GetTypeAttr', [POINTER(POINTER(TYPEATTR))]), STDMETHOD(HRESULT, 'GetTypeComp', [POINTER(POINTER(ITypeComp))]), STDMETHOD(HRESULT, 'GetFuncDesc', [UINT, POINTER(POINTER(FUNCDESC))]), STDMETHOD(HRESULT, 'GetVarDesc', [UINT, POINTER(POINTER(VARDESC))]), STDMETHOD(HRESULT, 'GetNames', [MEMBERID, POINTER(BSTR), UINT, POINTER(UINT)]), STDMETHOD(HRESULT, 'GetRefTypeOfImplType', [UINT, POINTER(HREFTYPE)]), STDMETHOD(HRESULT, 'GetImplTypeFlags', [UINT, POINTER(INT)]), ## STDMETHOD(HRESULT, 'GetIDsOfNames', [POINTER(LPOLESTR), UINT, POINTER(MEMBERID)]), # this one changed, to accept c_wchar_p array STDMETHOD(HRESULT, 'GetIDsOfNames', [POINTER(c_wchar_p), UINT, POINTER(MEMBERID)]), STDMETHOD(HRESULT, 'Invoke', [PVOID, MEMBERID, WORD, POINTER(DISPPARAMS), POINTER(VARIANT), POINTER(EXCEPINFO), POINTER(UINT)]), STDMETHOD(HRESULT, 'GetDocumentation', [MEMBERID, POINTER(BSTR), POINTER(BSTR), POINTER(DWORD), POINTER(BSTR)]), STDMETHOD(HRESULT, 'GetDllEntry', [MEMBERID, INVOKEKIND, POINTER(BSTR), POINTER(BSTR), POINTER(WORD)]), STDMETHOD(HRESULT, 'GetRefTypeInfo', [HREFTYPE, POINTER(POINTER(ITypeInfo))]), STDMETHOD(HRESULT, 'AddressOfMember', [MEMBERID, INVOKEKIND, POINTER(PVOID)]), STDMETHOD(HRESULT, 'CreateInstance', [POINTER(IUnknown), POINTER(IID), POINTER(PVOID)]), STDMETHOD(HRESULT, 'GetMops', [MEMBERID, POINTER(BSTR)]), STDMETHOD(HRESULT, 'GetContainingTypeLib', [POINTER(POINTER(ITypeLib)), POINTER(UINT)]), STDMETHOD(None, 'ReleaseTypeAttr', [POINTER(TYPEATTR)]), STDMETHOD(None, 'ReleaseFuncDesc', [POINTER(FUNCDESC)]), STDMETHOD(None, 'ReleaseVarDesc', [POINTER(VARDESC)]), ] ITypeComp._methods_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 3090 STDMETHOD(HRESULT, 'Bind', [LPOLESTR, DWORD, WORD, POINTER(POINTER(ITypeInfo)), POINTER(DESCKIND), POINTER(BINDPTR)]), STDMETHOD(HRESULT, 'BindType', [LPOLESTR, DWORD, POINTER(POINTER(ITypeInfo)), POINTER(POINTER(ITypeComp))]), ] ICreateTypeInfo._methods_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 915 STDMETHOD(HRESULT, 'SetGuid', [POINTER(GUID)]), STDMETHOD(HRESULT, 'SetTypeFlags', [UINT]), STDMETHOD(HRESULT, 'SetDocString', [LPOLESTR]), STDMETHOD(HRESULT, 'SetHelpContext', [DWORD]), STDMETHOD(HRESULT, 'SetVersion', [WORD, WORD]), STDMETHOD(HRESULT, 'AddRefTypeInfo', [POINTER(ITypeInfo), POINTER(HREFTYPE)]), STDMETHOD(HRESULT, 'AddFuncDesc', [UINT, POINTER(FUNCDESC)]), STDMETHOD(HRESULT, 'AddImplType', [UINT, HREFTYPE]), STDMETHOD(HRESULT, 'SetImplTypeFlags', [UINT, INT]), STDMETHOD(HRESULT, 'SetAlignment', [WORD]), STDMETHOD(HRESULT, 'SetSchema', [LPOLESTR]), STDMETHOD(HRESULT, 'AddVarDesc', [UINT, POINTER(VARDESC)]), STDMETHOD(HRESULT, 'SetFuncAndParamNames', [UINT, POINTER(LPOLESTR), UINT]), STDMETHOD(HRESULT, 'SetVarName', [UINT, LPOLESTR]), STDMETHOD(HRESULT, 'SetTypeDescAlias', [POINTER(TYPEDESC)]), STDMETHOD(HRESULT, 'DefineFuncAsDllEntry', [UINT, LPOLESTR, LPOLESTR]), STDMETHOD(HRESULT, 'SetFuncDocString', [UINT, LPOLESTR]), STDMETHOD(HRESULT, 'SetVarDocString', [UINT, LPOLESTR]), STDMETHOD(HRESULT, 'SetFuncHelpContext', [UINT, DWORD]), STDMETHOD(HRESULT, 'SetVarHelpContext', [UINT, DWORD]), STDMETHOD(HRESULT, 'SetMops', [UINT, BSTR]), STDMETHOD(HRESULT, 'SetTypeIdldesc', [POINTER(IDLDESC)]), STDMETHOD(HRESULT, 'LayOut', []), ] ################################################################ # Structure fields tagTLIBATTR._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 4437 ('guid', GUID), ('lcid', LCID), ('syskind', SYSKIND), ('wMajorVerNum', WORD), ('wMinorVerNum', WORD), ('wLibFlags', WORD), ] assert sizeof(tagTLIBATTR) == 32, sizeof(tagTLIBATTR) assert alignment(tagTLIBATTR) == 4, alignment(tagTLIBATTR) class N11tagTYPEDESC5DOLLAR_203E(Union): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 584 pass N11tagTYPEDESC5DOLLAR_203E._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 584 ('lptdesc', POINTER(tagTYPEDESC)), ('lpadesc', POINTER(tagARRAYDESC)), ('hreftype', HREFTYPE), ] assert sizeof(N11tagTYPEDESC5DOLLAR_203E) == 4, sizeof(N11tagTYPEDESC5DOLLAR_203E) assert alignment(N11tagTYPEDESC5DOLLAR_203E) == 4, alignment(N11tagTYPEDESC5DOLLAR_203E) tagTYPEDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 582 # Unnamed field renamed to '_' ('_', N11tagTYPEDESC5DOLLAR_203E), ('vt', VARTYPE), ] assert sizeof(tagTYPEDESC) == 8, sizeof(tagTYPEDESC) assert alignment(tagTYPEDESC) == 4, alignment(tagTYPEDESC) tagIDLDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 633 ('dwReserved', ULONG_PTR), ('wIDLFlags', USHORT), ] assert sizeof(tagIDLDESC) == 8, sizeof(tagIDLDESC) assert alignment(tagIDLDESC) == 4, alignment(tagIDLDESC) tagTYPEATTR._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 672 ('guid', GUID), ('lcid', LCID), ('dwReserved', DWORD), ('memidConstructor', MEMBERID), ('memidDestructor', MEMBERID), ('lpstrSchema', LPOLESTR), ('cbSizeInstance', DWORD), ('typekind', TYPEKIND), ('cFuncs', WORD), ('cVars', WORD), ('cImplTypes', WORD), ('cbSizeVft', WORD), ('cbAlignment', WORD), ('wTypeFlags', WORD), ('wMajorVerNum', WORD), ('wMinorVerNum', WORD), ('tdescAlias', TYPEDESC), ('idldescType', IDLDESC), ] assert sizeof(tagTYPEATTR) == 76, sizeof(tagTYPEATTR) assert alignment(tagTYPEATTR) == 4, alignment(tagTYPEATTR) class N10tagVARDESC5DOLLAR_205E(Union): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 807 pass N10tagVARDESC5DOLLAR_205E._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 807 ('oInst', DWORD), ('lpvarValue', POINTER(VARIANT)), ] assert sizeof(N10tagVARDESC5DOLLAR_205E) == 4, sizeof(N10tagVARDESC5DOLLAR_205E) assert alignment(N10tagVARDESC5DOLLAR_205E) == 4, alignment(N10tagVARDESC5DOLLAR_205E) class tagELEMDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 661 pass class N11tagELEMDESC5DOLLAR_204E(Union): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 663 pass class tagPARAMDESC(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 609 pass class tagPARAMDESCEX(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 601 pass LPPARAMDESCEX = POINTER(tagPARAMDESCEX) tagPARAMDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 609 ('pparamdescex', LPPARAMDESCEX), ('wParamFlags', USHORT), ] assert sizeof(tagPARAMDESC) == 8, sizeof(tagPARAMDESC) assert alignment(tagPARAMDESC) == 4, alignment(tagPARAMDESC) PARAMDESC = tagPARAMDESC N11tagELEMDESC5DOLLAR_204E._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 663 ('idldesc', IDLDESC), ('paramdesc', PARAMDESC), ] assert sizeof(N11tagELEMDESC5DOLLAR_204E) == 8, sizeof(N11tagELEMDESC5DOLLAR_204E) assert alignment(N11tagELEMDESC5DOLLAR_204E) == 4, alignment(N11tagELEMDESC5DOLLAR_204E) tagELEMDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 661 ('tdesc', TYPEDESC), # Unnamed field renamed to '_' ('_', N11tagELEMDESC5DOLLAR_204E), ] assert sizeof(tagELEMDESC) == 16, sizeof(tagELEMDESC) assert alignment(tagELEMDESC) == 4, alignment(tagELEMDESC) ELEMDESC = tagELEMDESC tagVARDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 803 ('memid', MEMBERID), ('lpstrSchema', LPOLESTR), # Unnamed field renamed to '_' ('_', N10tagVARDESC5DOLLAR_205E), ('elemdescVar', ELEMDESC), ('wVarFlags', WORD), ('varkind', VARKIND), ] assert sizeof(tagVARDESC) == 36, sizeof(tagVARDESC) assert alignment(tagVARDESC) == 4, alignment(tagVARDESC) tagBINDPTR._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 3075 ('lpfuncdesc', POINTER(FUNCDESC)), ('lpvardesc', POINTER(VARDESC)), ('lptcomp', POINTER(ITypeComp)), ] assert sizeof(tagBINDPTR) == 4, sizeof(tagBINDPTR) assert alignment(tagBINDPTR) == 4, alignment(tagBINDPTR) tagFUNCDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 769 ('memid', MEMBERID), ('lprgscode', POINTER(SCODE)), ('lprgelemdescParam', POINTER(ELEMDESC)), ('funckind', FUNCKIND), ('invkind', INVOKEKIND), ('callconv', CALLCONV), ('cParams', SHORT), ('cParamsOpt', SHORT), ('oVft', SHORT), ('cScodes', SHORT), ('elemdescFunc', ELEMDESC), ('wFuncFlags', WORD), ] assert sizeof(tagFUNCDESC) == 52, sizeof(tagFUNCDESC) assert alignment(tagFUNCDESC) == 4, alignment(tagFUNCDESC) tagPARAMDESCEX._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 601 ('cBytes', DWORD), ('varDefaultValue', VARIANTARG), ] assert sizeof(tagPARAMDESCEX) == 24, sizeof(tagPARAMDESCEX) assert alignment(tagPARAMDESCEX) == 8, alignment(tagPARAMDESCEX) class tagSAFEARRAYBOUND(Structure): # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 226 _fields_ = [ ('cElements', DWORD), ('lLbound', LONG), ] assert sizeof(tagSAFEARRAYBOUND) == 8, sizeof(tagSAFEARRAYBOUND) assert alignment(tagSAFEARRAYBOUND) == 4, alignment(tagSAFEARRAYBOUND) SAFEARRAYBOUND = tagSAFEARRAYBOUND tagARRAYDESC._fields_ = [ # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 594 ('tdescElem', TYPEDESC), ('cDims', USHORT), ('rgbounds', SAFEARRAYBOUND * 1), ] assert sizeof(tagARRAYDESC) == 20, sizeof(tagARRAYDESC) assert alignment(tagARRAYDESC) == 4, alignment(tagARRAYDESC) |