[python-win32] about thre return value from pycom server

winterTTr winterttr at gmail.com
Mon May 25 03:43:21 CEST 2009


I recently write a com server as shell extension .
And ,  i want to implement a interface call "IQueryInfo"
which you can find some information about it via MSDN .
As I can't find it the pythoncom , i implement it using the
TypeLibrary as following lines.

[shell_extension.idl]
----------------from-------------------------
       [
               object,
               uuid(00021500-0000-0000-C000-000000000046),
               helpstring("IQueryInfo Interface"),
               pointer_default(unique)
       ]
       interface IQueryInfo : IUnknown
       {
       HRESULT GetInfoFlags ([out] long * pdwFlags);
       HRESULT GetInfoTip([in] long dwFlags , [out] wchar_t ** ppwszTip);
       };
-----------------to-------------------------------

and implement the interface function as follow

# it is a member function of a class
def GetInfoFlags(self ):
   return 0

when i run the code , the program ( which is explore.exe ) crashed ,
my god ! 0_0

i analyze the win32com code , and find that the program crashed when
running the code
in [universal.py] as follow :
WriteFromOutTuple(retVal, meth._gw_out_args, argPtr)

As i know , this function may write the return value to caller of the
com server .

As the interface defined , maybe i show return a pointer of long as
return value , not
long itself. So "return 0" may cause the access violation.

Question is :
how can i deal with this case ? I don't know how to return a long
pointer to the caller in py code.
or may be there is another way to solve this problem , any advise ? Thx.


More information about the python-win32 mailing list