2 * Dispatch API functions
4 * Copyright 2000 Francois Jacques, Macadamian Technologies Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * TODO: Type coercion is implemented in variant.c but not called yet.
34 #include "winreg.h" /* for HKEY_LOCAL_MACHINE */
35 #include "winnls.h" /* for PRIMARYLANGID */
37 #include "wine/obj_oleaut.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 WINE_DECLARE_DEBUG_CHANNEL(typelib);
45 /******************************************************************************
46 * DispInvoke (OLEAUT32.30)
49 * Calls method of an object through its IDispatch interface.
52 * - Defer method invocation to ITypeInfo::Invoke()
58 HRESULT WINAPI DispInvoke(
59 VOID *_this, /* [in] object instance */
60 ITypeInfo *ptinfo, /* [in] object's type info */
61 DISPID dispidMember, /* [in] member id */
62 USHORT wFlags, /* [in] kind of method call */
63 DISPPARAMS *pparams, /* [in] array of arguments */
64 VARIANT *pvarResult, /* [out] result of method call */
65 EXCEPINFO *pexcepinfo, /* [out] information about exception */
66 UINT *puArgErr) /* [out] index of bad argument(if any) */
72 * For each param, call DispGetParam to perform type coercion
74 FIXME("Coercion of arguments not implemented\n");
76 hr = ICOM_CALL7(Invoke,
81 pparams, pvarResult, pexcepinfo, puArgErr);
87 /******************************************************************************
88 * DispGetIDsOfNames (OLEAUT32.29)
90 * Convert a set of names to dispids, based on information
91 * contained in object's type library.
94 * - Defers to ITypeInfo::GetIDsOfNames()
100 HRESULT WINAPI DispGetIDsOfNames(
101 ITypeInfo *ptinfo, /* [in] */
102 OLECHAR **rgszNames, /* [in] */
103 UINT cNames, /* [in] */
104 DISPID *rgdispid) /* [out] */
108 hr = ICOM_CALL3(GetIDsOfNames,
116 /******************************************************************************
117 * DispGetParam (OLEAUT32.28)
119 * Retrive a parameter from a DISPPARAMS structures and coerce it to
120 * specified variant type
123 * Coercion is done using system (0) locale.
129 HRESULT WINAPI DispGetParam(
130 DISPPARAMS *pdispparams, /* [in] */
131 UINT position, /* [in] */
132 VARTYPE vtTarg, /* [in] */
133 VARIANT *pvarResult, /* [out] */
134 UINT *puArgErr) /* [out] */
136 /* position is counted backwards */
140 TRACE("position=%d, cArgs=%d, cNamedArgs=%d\n",
141 position, pdispparams->cArgs, pdispparams->cNamedArgs);
142 if (position < pdispparams->cArgs) {
143 /* positional arg? */
144 pos = pdispparams->cArgs - position - 1;
146 /* FIXME: is this how to handle named args? */
147 for (pos=0; pos<pdispparams->cNamedArgs; pos++)
148 if (pdispparams->rgdispidNamedArgs[pos] == position) break;
150 if (pos==pdispparams->cNamedArgs)
151 return DISP_E_PARAMNOTFOUND;
153 hr = VariantChangeType(pvarResult,
154 &pdispparams->rgvarg[pos],
156 if (hr == DISP_E_TYPEMISMATCH) *puArgErr = pos;