[python-win32] COM server and pointer to pointer parameter

ricercar at infinito.it ricercar at infinito.it
Tue Nov 11 09:43:01 CET 2008


Hello, some weeks ago I posted a message, and opened a bug ticket, but got
not reply. Probably few of us are working with servers or dealing with
pointer to pointer parameters (or simply have no time). Anyway I try to post
the request once again, maybe somebody missed the issue. (Unfortunately at
the moment I'm not in the condition to debug the library so my last option
is to write the server in C.). Sorry for those who already read this
message.

================================
I have the same problem with pippo_server, the test file in the win32com
package. I don't know if somebody can have more info from this.
I used a client written with python and comtypes and, with a little effort I
can see the call to QueryInterface with IID_NULL (as happens if the caller
is a C++ client).
The client is very simple (it needs comtypes):
-------------------
import comtypes
from comtypes.client import *
from comtypes.GUID import GUID
from ctypes import *
tlb_id = GUID('{41059C57-975F-4B36-8FF3-C5117426647A}')
GetModule((tlb_id, 1, 0))
import comtypes.gen.TESTSERVERLib as llib
obj = CreateObject('Python.Test.Pippo', interface=llib.IPippo)
p = obj.Method1()
------------------

To show the problem I registered the pippo_server with the --debug option.

Then I changed the function Method1 in this way to have a debug output:
def Method1(self):
#return wrap(CPippo())
return wrap(CPippo(),useDispatcher=1)

Last, in the file policy.py at line 261, at the begin of the
_QueryInterface_ function I added a line:
print iid

The result in PythonWin trace Collector is:
Object with win32trace dispatcher created (object=None)
Object with win32trace dispatcher created (object=<pippo_server.CPippo
instance at 0x015DF210>)
{00000000-0000-0000-0000-000000000000}Traceback (most recent call last):
File "C:Python25Libsite-packageswin32comserverdispatcher.py", line 41, in
_QueryInterface_
return self.policy._QueryInterface_(iid)
File "C:Python25libsite-packageswin32comserverpolicy.py", line 261, in
_QueryInterface_
print iid
com_error: (-2147221005, "Stringa dell'interfaccia non valida.", None, None)
pythoncom error: Failed to call the universal dispatcher

There is a QueryInterface with iid={00000000-0000-0000-0000-000000000000}
and I don't know who's doing it.

Thanks for any tip,
Enrico




More information about the python-win32 mailing list