OleAut32.dll.DispCallFunc

Fabian Cenedese Cenedese at indel.ch
Tue Oct 22 03:16:57 CDT 2002


Hi all

My app stumbled over a not implemented function from oleaut32.dll
called DispCallFunc. It's only available as stub. I tried to find some info
about this but it's an undocumented "feature". MSDN doesn't mention it
at all (obviously) and on the net I could only find this short description:

***
   ITypeInfo::Invoke (or DispInvoke) needs v-table to call-in a method.
But when we are talking about pure disp-interfaces - they don't have any
info about v-table, but just a mapping between DISPID and method signature.
Therefore these functions would fail miserably to convey the call to pure
dispinterface, but as all we know - the majority of sources(/events)
interfaces are these pesky dispinterfaces. DispCallFunc is a low-level
routine (that btw is used by DispInvoke and ITypeInfo::Invoke internally).
It pushes arguments from DISPPARAMS argument to the stack accordingly to
supplied description of the method, calls specified function pointer and on
the return adjusts stack back and return retval (both variant and HRESULT)
to the caller.
***

And I also found this example:

***
//Helper for invoking the event
HRESULT InvokeFromFuncInfo(void (__stdcall T::*pEvent)(), _ATL_FUNC_INFO& 
info,
                            DISPPARAMS* pdispparams, VARIANT* pvarResult)
{
     T* pT = static_cast<T*>(this);
     VARIANTARG** pVarArgs = info.nParams ?
                        (VARIANTARG**)alloca(sizeof(VARIANTARG*)*info.nParams) 
: 0;
     for (int i=0; i<info.nParams; i++)
         pVarArgs[i] = &pdispparams->rgvarg[info.nParams - i - 1];

     CComStdCallThunk<T> thunk;
     thunk.Init(pEvent, pT);
     CComVariant tmpResult;
     if (pvarResult == NULL)
         pvarResult = &tmpResult;

     HRESULT hr = DispCallFunc(
         &thunk,
         0,
         info.cc,
         info.vtReturn,
         info.nParams,
         info.pVarTypes,
         pVarArgs,
         pvarResult);
     ATLASSERT(SUCCEEDED(hr));
     return hr;
}
***

Does anyone know more about this function? Where would this have to be
implemented?

Thanks

bye  Fabi





More information about the wine-devel mailing list