urlmon: Added stub for CoInternetGetSecurityUrlEx.
[wine] / dlls / shell32 / shelldispatch.c
1 /*
2  * IShellDispatch implementation
3  *
4  * Copyright 2010 Alexander Morozov for Etersoft
5  *
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.
10  *
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.
15  *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22 #include "wine/port.h"
23
24 #include <stdarg.h>
25
26 #define COBJMACROS
27
28 #include "windef.h"
29 #include "winbase.h"
30
31 #include "shlobj.h"
32 #include "shldisp.h"
33 #include "debughlp.h"
34
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(shell);
38
39 typedef struct {
40     IShellDispatch IShellDispatch_iface;
41     LONG ref;
42 } ShellDispatch;
43
44 static inline ShellDispatch *impl_from_IShellDispatch(IShellDispatch *iface)
45 {
46     return CONTAINING_RECORD(iface, ShellDispatch, IShellDispatch_iface);
47 }
48
49 static HRESULT WINAPI ShellDispatch_QueryInterface(IShellDispatch *iface,
50         REFIID riid, LPVOID *ppv)
51 {
52     ShellDispatch *This = impl_from_IShellDispatch(iface);
53
54     TRACE("(%p,%p,%p)\n", iface, riid, ppv);
55
56     if (!ppv) return E_INVALIDARG;
57
58     if (IsEqualIID(&IID_IUnknown, riid) ||
59         IsEqualIID(&IID_IDispatch, riid) ||
60         IsEqualIID(&IID_IShellDispatch, riid))
61         *ppv = This;
62     else
63     {
64         FIXME("not implemented for %s\n", shdebugstr_guid(riid));
65         *ppv = NULL;
66         return E_NOINTERFACE;
67     }
68     IUnknown_AddRef((IUnknown*)*ppv);
69     return S_OK;
70 }
71
72 static ULONG WINAPI ShellDispatch_AddRef(IShellDispatch *iface)
73 {
74     ShellDispatch *This = impl_from_IShellDispatch(iface);
75     ULONG ref = InterlockedIncrement(&This->ref);
76
77     TRACE("(%p), new refcount=%i\n", iface, ref);
78
79     return ref;
80 }
81
82 static ULONG WINAPI ShellDispatch_Release(IShellDispatch *iface)
83 {
84     ShellDispatch *This = impl_from_IShellDispatch(iface);
85     ULONG ref = InterlockedDecrement(&This->ref);
86
87     TRACE("(%p), new refcount=%i\n", iface, ref);
88
89     if (!ref)
90         HeapFree(GetProcessHeap(), 0, This);
91     return ref;
92 }
93
94 static HRESULT WINAPI ShellDispatch_GetTypeInfoCount(IShellDispatch *iface,
95         UINT *pctinfo)
96 {
97     FIXME("(%p,%p)\n", iface, pctinfo);
98
99     return E_NOTIMPL;
100 }
101
102 static HRESULT WINAPI ShellDispatch_GetTypeInfo(IShellDispatch *iface,
103         UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
104 {
105     FIXME("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
106
107     *ppTInfo = NULL;
108     return E_NOTIMPL;
109 }
110
111 static HRESULT WINAPI ShellDispatch_GetIDsOfNames(IShellDispatch *iface,
112         REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
113 {
114     FIXME("(%p,%p,%p,%u,%d,%p)\n", iface, riid, rgszNames, cNames, lcid,
115             rgDispId);
116
117     return E_NOTIMPL;
118 }
119
120 static HRESULT WINAPI ShellDispatch_Invoke(IShellDispatch *iface,
121         DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
122         DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
123         UINT *puArgErr)
124 {
125     FIXME("(%p,%d,%p,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, riid, lcid,
126             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
127
128     return E_NOTIMPL;
129 }
130
131 static HRESULT WINAPI ShellDispatch_get_Application(IShellDispatch *iface,
132         IDispatch **ppid)
133 {
134     FIXME("(%p,%p)\n", iface, ppid);
135
136     *ppid = NULL;
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI ShellDispatch_get_Parent(IShellDispatch *iface,
141         IDispatch **ppid)
142 {
143     FIXME("(%p,%p)\n", iface, ppid);
144
145     *ppid = NULL;
146     return E_NOTIMPL;
147 }
148
149 static HRESULT WINAPI ShellDispatch_NameSpace(IShellDispatch *iface,
150         VARIANT vDir, Folder **ppsdf)
151 {
152     FIXME("(%p,%p)\n", iface, ppsdf);
153
154     *ppsdf = NULL;
155     return E_NOTIMPL;
156 }
157
158 static HRESULT WINAPI ShellDispatch_BrowseForFolder(IShellDispatch *iface,
159         LONG Hwnd, BSTR Title, LONG Options, VARIANT RootFolder, Folder **ppsdf)
160 {
161     FIXME("(%p,%x,%s,%x,%p)\n", iface, Hwnd, debugstr_w(Title), Options, ppsdf);
162
163     *ppsdf = NULL;
164     return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI ShellDispatch_Windows(IShellDispatch *iface,
168         IDispatch **ppid)
169 {
170     FIXME("(%p,%p)\n", iface, ppid);
171
172     *ppid = NULL;
173     return E_NOTIMPL;
174 }
175
176 static HRESULT WINAPI ShellDispatch_Open(IShellDispatch *iface, VARIANT vDir)
177 {
178     FIXME("(%p)\n", iface);
179
180     return E_NOTIMPL;
181 }
182
183 static HRESULT WINAPI ShellDispatch_Explore(IShellDispatch *iface, VARIANT vDir)
184 {
185     FIXME("(%p)\n", iface);
186
187     return E_NOTIMPL;
188 }
189
190 static HRESULT WINAPI ShellDispatch_MinimizeAll(IShellDispatch *iface)
191 {
192     FIXME("(%p)\n", iface);
193
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI ShellDispatch_UndoMinimizeALL(IShellDispatch *iface)
198 {
199     FIXME("(%p)\n", iface);
200
201     return E_NOTIMPL;
202 }
203
204 static HRESULT WINAPI ShellDispatch_FileRun(IShellDispatch *iface)
205 {
206     FIXME("(%p)\n", iface);
207
208     return E_NOTIMPL;
209 }
210
211 static HRESULT WINAPI ShellDispatch_CascadeWindows(IShellDispatch *iface)
212 {
213     FIXME("(%p)\n", iface);
214
215     return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI ShellDispatch_TileVertically(IShellDispatch *iface)
219 {
220     FIXME("(%p)\n", iface);
221
222     return E_NOTIMPL;
223 }
224
225 static HRESULT WINAPI ShellDispatch_TileHorizontally(IShellDispatch *iface)
226 {
227     FIXME("(%p)\n", iface);
228
229     return E_NOTIMPL;
230 }
231
232 static HRESULT WINAPI ShellDispatch_ShutdownWindows(IShellDispatch *iface)
233 {
234     FIXME("(%p)\n", iface);
235
236     return E_NOTIMPL;
237 }
238
239 static HRESULT WINAPI ShellDispatch_Suspend(IShellDispatch *iface)
240 {
241     FIXME("(%p)\n", iface);
242
243     return E_NOTIMPL;
244 }
245
246 static HRESULT WINAPI ShellDispatch_EjectPC(IShellDispatch *iface)
247 {
248     FIXME("(%p)\n", iface);
249
250     return E_NOTIMPL;
251 }
252
253 static HRESULT WINAPI ShellDispatch_SetTime(IShellDispatch *iface)
254 {
255     FIXME("(%p)\n", iface);
256
257     return E_NOTIMPL;
258 }
259
260 static HRESULT WINAPI ShellDispatch_TrayProperties(IShellDispatch *iface)
261 {
262     FIXME("(%p)\n", iface);
263
264     return E_NOTIMPL;
265 }
266
267 static HRESULT WINAPI ShellDispatch_Help(IShellDispatch *iface)
268 {
269     FIXME("(%p)\n", iface);
270
271     return E_NOTIMPL;
272 }
273
274 static HRESULT WINAPI ShellDispatch_FindFiles(IShellDispatch *iface)
275 {
276     FIXME("(%p)\n", iface);
277
278     return E_NOTIMPL;
279 }
280
281 static HRESULT WINAPI ShellDispatch_FindComputer(IShellDispatch *iface)
282 {
283     FIXME("(%p)\n", iface);
284
285     return E_NOTIMPL;
286 }
287
288 static HRESULT WINAPI ShellDispatch_RefreshMenu(IShellDispatch *iface)
289 {
290     FIXME("(%p)\n", iface);
291
292     return E_NOTIMPL;
293 }
294
295 static HRESULT WINAPI ShellDispatch_ControlPanelItem(IShellDispatch *iface,
296         BSTR szDir)
297 {
298     FIXME("(%p,%s)\n", iface, debugstr_w(szDir));
299
300     return E_NOTIMPL;
301 }
302
303 static const IShellDispatchVtbl ShellDispatch_Vtbl = {
304     ShellDispatch_QueryInterface,
305     ShellDispatch_AddRef,
306     ShellDispatch_Release,
307     ShellDispatch_GetTypeInfoCount,
308     ShellDispatch_GetTypeInfo,
309     ShellDispatch_GetIDsOfNames,
310     ShellDispatch_Invoke,
311     ShellDispatch_get_Application,
312     ShellDispatch_get_Parent,
313     ShellDispatch_NameSpace,
314     ShellDispatch_BrowseForFolder,
315     ShellDispatch_Windows,
316     ShellDispatch_Open,
317     ShellDispatch_Explore,
318     ShellDispatch_MinimizeAll,
319     ShellDispatch_UndoMinimizeALL,
320     ShellDispatch_FileRun,
321     ShellDispatch_CascadeWindows,
322     ShellDispatch_TileVertically,
323     ShellDispatch_TileHorizontally,
324     ShellDispatch_ShutdownWindows,
325     ShellDispatch_Suspend,
326     ShellDispatch_EjectPC,
327     ShellDispatch_SetTime,
328     ShellDispatch_TrayProperties,
329     ShellDispatch_Help,
330     ShellDispatch_FindFiles,
331     ShellDispatch_FindComputer,
332     ShellDispatch_RefreshMenu,
333     ShellDispatch_ControlPanelItem
334 };
335
336 HRESULT WINAPI IShellDispatch_Constructor(IUnknown *pUnkOuter, REFIID riid,
337         LPVOID *ppv)
338 {
339     ShellDispatch *This;
340     HRESULT ret;
341
342     TRACE("(%p,%s)\n", pUnkOuter, debugstr_guid(riid));
343
344     *ppv = NULL;
345
346     if (pUnkOuter) return CLASS_E_NOAGGREGATION;
347
348     This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellDispatch));
349     if (!This) return E_OUTOFMEMORY;
350     This->IShellDispatch_iface.lpVtbl = &ShellDispatch_Vtbl;
351     This->ref = 1;
352
353     ret = ShellDispatch_QueryInterface(&This->IShellDispatch_iface, riid, ppv);
354     ShellDispatch_Release(&This->IShellDispatch_iface);
355     return ret;
356 }