wiaservc: COM cleanup for the IWiaDevMgr iface.
[wine] / programs / wscript / host.c
1 /*
2  * Copyright 2010 Jacek Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include <stdarg.h>
20
21 #define COBJMACROS
22 #define CONST_VTABLE
23
24 #include <windef.h>
25 #include <winbase.h>
26 #include <ole2.h>
27
28 #include "wscript.h"
29
30 #include <wine/debug.h>
31
32 WINE_DEFAULT_DEBUG_CHANNEL(wscript);
33
34 static HRESULT WINAPI Host_QueryInterface(IHost *iface, REFIID riid, void **ppv)
35 {
36     WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
37
38     if(IsEqualGUID(&IID_IUnknown, riid)
39        || IsEqualGUID(&IID_IDispatch, riid)
40        || IsEqualGUID(&IID_IHost, riid)) {
41         *ppv = iface;
42         return S_OK;
43     }
44
45     *ppv = NULL;
46     return E_NOINTERFACE;
47 }
48
49 static ULONG WINAPI Host_AddRef(IHost *iface)
50 {
51     return 2;
52 }
53
54 static ULONG WINAPI Host_Release(IHost *iface)
55 {
56     return 1;
57 }
58
59 static HRESULT WINAPI Host_GetTypeInfoCount(IHost *iface, UINT *pctinfo)
60 {
61     WINE_TRACE("(%p)\n", pctinfo);
62     *pctinfo = 1;
63     return S_OK;
64 }
65
66 static HRESULT WINAPI Host_GetTypeInfo(IHost *iface, UINT iTInfo, LCID lcid,
67         ITypeInfo **ppTInfo)
68 {
69     WINE_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
70
71     ITypeInfo_AddRef(host_ti);
72     *ppTInfo = host_ti;
73     return S_OK;
74 }
75
76 static HRESULT WINAPI Host_GetIDsOfNames(IHost *iface, REFIID riid, LPOLESTR *rgszNames,
77         UINT cNames, LCID lcid, DISPID *rgDispId)
78 {
79     WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
80         cNames, lcid, rgDispId);
81
82     return ITypeInfo_GetIDsOfNames(host_ti, rgszNames, cNames, rgDispId);
83 }
84
85 static HRESULT WINAPI Host_Invoke(IHost *iface, DISPID dispIdMember, REFIID riid,
86         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
87         EXCEPINFO *pExcepInfo, UINT *puArgErr)
88 {
89     WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
90
91     return ITypeInfo_Invoke(host_ti, iface, dispIdMember, wFlags, pDispParams,
92             pVarResult, pExcepInfo, puArgErr);
93 }
94
95 static HRESULT WINAPI Host_get_Name(IHost *iface, BSTR *out_Name)
96 {
97     WINE_FIXME("(%p)\n", out_Name);
98     return E_NOTIMPL;
99 }
100
101 static HRESULT WINAPI Host_get_Application(IHost *iface, IDispatch **out_Dispatch)
102 {
103     WINE_FIXME("(%p)\n", out_Dispatch);
104     return E_NOTIMPL;
105 }
106
107 static HRESULT WINAPI Host_get_FullName(IHost *iface, BSTR *out_Path)
108 {
109     WINE_FIXME("(%p)\n", out_Path);
110     return E_NOTIMPL;
111 }
112
113 static HRESULT WINAPI Host_get_Path(IHost *iface, BSTR *out_Path)
114 {
115     WINE_FIXME("(%p)\n", out_Path);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI Host_get_Interactive(IHost *iface, VARIANT_BOOL *out_Interactive)
120 {
121     WINE_FIXME("(%p)\n", out_Interactive);
122     return E_NOTIMPL;
123 }
124
125 static HRESULT WINAPI Host_put_Interactive(IHost *iface, VARIANT_BOOL v)
126 {
127     WINE_FIXME("(%x)\n", v);
128     return E_NOTIMPL;
129 }
130
131 static HRESULT WINAPI Host_Quit(IHost *iface, int ExitCode)
132 {
133     WINE_FIXME("(%d)\n", ExitCode);
134     return E_NOTIMPL;
135 }
136
137 static HRESULT WINAPI Host_get_ScriptName(IHost *iface, BSTR *out_ScriptName)
138 {
139     WINE_FIXME("(%p)\n", out_ScriptName);
140     return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI Host_get_ScriptFullName(IHost *iface, BSTR *out_ScriptFullName)
144 {
145     WINE_FIXME("(%p)\n", out_ScriptFullName);
146     return E_NOTIMPL;
147 }
148
149 static HRESULT WINAPI Host_get_Arguments(IHost *iface, IArguments2 **out_Arguments)
150 {
151     WINE_FIXME("(%p)\n", out_Arguments);
152     return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI Host_get_Version(IHost *iface, BSTR *out_Version)
156 {
157     WINE_FIXME("(%p)\n", out_Version);
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI Host_get_BuildVersion(IHost *iface, int *out_Build)
162 {
163     WINE_FIXME("(%p)\n", out_Build);
164     return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI Host_get_Timeout(IHost *iface, LONG *out_Timeout)
168 {
169     WINE_FIXME("(%p)\n", out_Timeout);
170     return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI Host_put_Timeout(IHost *iface, LONG v)
174 {
175     WINE_FIXME("(%d)\n", v);
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI Host_CreateObject(IHost *iface, BSTR ProgID, BSTR Prefix,
180         IDispatch **out_Dispatch)
181 {
182     WINE_FIXME("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
183     return E_NOTIMPL;
184 }
185
186 static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)
187 {
188     WINE_FIXME("(%p)\n", args);
189     return E_NOTIMPL;
190 }
191
192 static HRESULT WINAPI Host_GetObject(IHost *iface, BSTR Pathname, BSTR ProgID,
193         BSTR Prefix, IDispatch **out_Dispatch)
194 {
195     WINE_FIXME("(%s %s %s %p)\n", wine_dbgstr_w(Pathname), wine_dbgstr_w(ProgID),
196         wine_dbgstr_w(Prefix), out_Dispatch);
197     return E_NOTIMPL;
198 }
199
200 static HRESULT WINAPI Host_DisconnectObject(IHost *iface, IDispatch *Object)
201 {
202     WINE_FIXME("(%p)\n", Object);
203     return E_NOTIMPL;
204 }
205
206 static HRESULT WINAPI Host_Sleep(IHost *iface, LONG Time)
207 {
208     WINE_FIXME("(%d)\n", Time);
209     return E_NOTIMPL;
210 }
211
212 static HRESULT WINAPI Host_ConnectObject(IHost *iface, IDispatch *Object, BSTR Prefix)
213 {
214     WINE_FIXME("(%p %s)\n", Object, wine_dbgstr_w(Prefix));
215     return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI Host_get_StdIn(IHost *iface, ITextStream **ppts)
219 {
220     WINE_FIXME("(%p)\n", ppts);
221     return E_NOTIMPL;
222 }
223
224 static HRESULT WINAPI Host_get_StdOut(IHost *iface, ITextStream **ppts)
225 {
226     WINE_FIXME("(%p)\n", ppts);
227     return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI Host_get_StdErr(IHost *iface, ITextStream **ppts)
231 {
232     WINE_FIXME("(%p)\n", ppts);
233     return E_NOTIMPL;
234 }
235
236 static const IHostVtbl HostVtbl = {
237     Host_QueryInterface,
238     Host_AddRef,
239     Host_Release,
240     Host_GetTypeInfoCount,
241     Host_GetTypeInfo,
242     Host_GetIDsOfNames,
243     Host_Invoke,
244     Host_get_Name,
245     Host_get_Application,
246     Host_get_FullName,
247     Host_get_Path,
248     Host_get_Interactive,
249     Host_put_Interactive,
250     Host_Quit,
251     Host_get_ScriptName,
252     Host_get_ScriptFullName,
253     Host_get_Arguments,
254     Host_get_Version,
255     Host_get_BuildVersion,
256     Host_get_Timeout,
257     Host_put_Timeout,
258     Host_CreateObject,
259     Host_Echo,
260     Host_GetObject,
261     Host_DisconnectObject,
262     Host_Sleep,
263     Host_ConnectObject,
264     Host_get_StdIn,
265     Host_get_StdOut,
266     Host_get_StdErr
267 };
268
269 IHost host_obj = { &HostVtbl };