Implementation of Dispatch API.
[wine] / dlls / oleaut32 / dispatch.c
1 /**
2  * Dispatch API functions
3  *
4  * Copyright 2000  Francois Jacques, Macadamian Technologies Inc.
5  *
6  * ---
7  *
8  * TODO: Type coercion is implemented in variant.c but not called yet.
9  */
10
11 #include <stdlib.h>
12 #include <string.h>
13 #include <stdio.h>
14 #include <ctype.h>
15 #include "winerror.h"
16 #include "winreg.h"         /* for HKEY_LOCAL_MACHINE */
17 #include "winnls.h"         /* for PRIMARYLANGID */
18 #include "ole.h"
19 #include "heap.h"
20 #include "wine/obj_oleaut.h"
21 #include "debugtools.h"
22
23 DEFAULT_DEBUG_CHANNEL(ole);
24 DECLARE_DEBUG_CHANNEL(typelib);
25
26
27 /******************************************************************************
28  *         DispInvoke    (OLEAUT32.30)
29  *
30  *
31  * Calls method of an object through its IDispatch interface.
32  *
33  * NOTES
34  *              - Defer method invocation to ITypeInfo::Invoke()
35  *
36  * RETURNS
37  *
38  *              S_OK on success.
39  */
40 HRESULT WINAPI
41 DispInvoke(VOID*            _this,          /* object instance */
42            ITypeInfo*       ptinfo,         /* object's type info */
43            DISPID           dispidMember,   /* member id */
44            USHORT           wFlags,         /* kind of method call */
45            DISPPARAMS*      pparams,        /* array of arguments */
46            VARIANT*         pvarResult,     /* result of method call */
47            EXCEPINFO*       pexcepinfo,     /* information about exception */
48            UINT*            puArgErr        /* index of bad argument(if any) */
49           )
50 {
51     HRESULT hr = E_FAIL;
52
53     /**
54      * TODO:
55      * For each param, call DispGetParam to perform type coercion
56      */
57     FIXME("Coercion of arguments not implemented\n");
58
59     hr = ICOM_CALL7(Invoke,
60                     ptinfo,
61                     _this,
62                     dispidMember,
63                     wFlags,
64                     pparams, pvarResult, pexcepinfo, puArgErr);
65
66     return (hr);
67 }
68
69
70 /******************************************************************************
71  *         DispGetIDsOfNames (OLEAUT32.29)
72  *
73  * Convert a set of names to dispids, based on information 
74  * contained in object's type library.
75  * 
76  * NOTES
77  *              - Defers to ITypeInfo::GetIDsOfNames()
78  *
79  * RETURNS
80  *
81  *              S_OK on success.
82  */
83 HRESULT WINAPI
84 DispGetIDsOfNames(ITypeInfo* ptinfo,
85                   OLECHAR**  rgszNames,
86                   UINT       cNames,
87                   DISPID*    rgdispid)
88 {
89     HRESULT hr = E_FAIL;
90
91     hr = ICOM_CALL3(GetIDsOfNames,
92                     ptinfo,
93                     rgszNames,
94                     cNames,
95                     rgdispid);
96     return (hr);
97 }
98
99 /******************************************************************************
100  *         DispGetParam    (OLEAUT32.30)
101  *
102  * Retrive a parameter from a DISPPARAMS structures and coerce it to
103  * specified variant type
104  *
105  * NOTES
106  *              Coercion is done using system (0) locale.
107  *
108  * RETURNS
109  *
110  *              S_OK on success.
111  */
112 HRESULT WINAPI
113 DispGetParam(DISPPARAMS*    pdispparams,
114              UINT           position,
115              VARTYPE        vtTarg)
116 {
117     HRESULT hr = E_FAIL;
118
119     /**
120      * TODO : Call VariantChangeTypeEx with LCID 0 (system)
121      */
122
123     FIXME("Coercion of arguments not implemented\n");
124     return (hr);
125 }