[SHELL32] CDrivesFolder: Implement the eject and disconnect menu items. CORE-13841
[reactos.git] / dll / win32 / shell32 / CShellDispatch.cpp
1 /*
2 * IShellDispatch implementation
3 *
4 * Copyright 2015 Mark Jansen
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 "precomp.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(shell);
24
25
26 CShellDispatch::CShellDispatch()
27 {
28 }
29
30 CShellDispatch::~CShellDispatch()
31 {
32 }
33
34 HRESULT CShellDispatch::Initialize()
35 {
36 return S_OK;
37 }
38
39 // *** IShellDispatch methods ***
40 HRESULT STDMETHODCALLTYPE CShellDispatch::get_Application(IDispatch **ppid)
41 {
42 TRACE("(%p, %p)\n", this, ppid);
43 return E_NOTIMPL;
44 }
45
46 HRESULT STDMETHODCALLTYPE CShellDispatch::get_Parent(IDispatch **ppid)
47 {
48 TRACE("(%p, %p)\n", this, ppid);
49 return E_NOTIMPL;
50 }
51
52 HRESULT VariantToIdlist(VARIANT* var, LPITEMIDLIST* idlist)
53 {
54 HRESULT hr = S_FALSE;
55 if(V_VT(var) == VT_I4)
56 {
57 hr = SHGetSpecialFolderLocation(NULL, V_I4(var), idlist);
58 }
59 else if(V_VT(var) == VT_BSTR)
60 {
61 hr = SHILCreateFromPathW(V_BSTR(var), idlist, NULL);
62 }
63 return hr;
64 }
65
66 HRESULT STDMETHODCALLTYPE CShellDispatch::NameSpace(VARIANT vDir, Folder **ppsdf)
67 {
68 TRACE("(%p, %s, %p)\n", this, debugstr_variant(&vDir), ppsdf);
69 if (!ppsdf)
70 return E_POINTER;
71 *ppsdf = NULL;
72 LPITEMIDLIST idlist = NULL;
73 HRESULT hr = VariantToIdlist(&vDir, &idlist);
74 if (!SUCCEEDED(hr) || !idlist)
75 return S_FALSE;
76 CFolder* fld = new CComObject<CFolder>();
77 fld->Init(idlist);
78 *ppsdf = fld;
79 fld->AddRef();
80 return hr;
81 }
82
83 HRESULT STDMETHODCALLTYPE CShellDispatch::BrowseForFolder(LONG Hwnd, BSTR Title, LONG Options, VARIANT RootFolder, Folder **ppsdf)
84 {
85 TRACE("(%p, %lu, %ls, %lu, %s, %p)\n", this, Hwnd, Title, Options, debugstr_variant(&RootFolder), ppsdf);
86 return E_NOTIMPL;
87 }
88
89 HRESULT STDMETHODCALLTYPE CShellDispatch::Windows(IDispatch **ppid)
90 {
91 TRACE("(%p, %p)\n", this, ppid);
92 return E_NOTIMPL;
93 }
94
95 HRESULT STDMETHODCALLTYPE CShellDispatch::Open(VARIANT vDir)
96 {
97 TRACE("(%p, %s)\n", this, debugstr_variant(&vDir));
98 return E_NOTIMPL;
99 }
100
101 HRESULT STDMETHODCALLTYPE CShellDispatch::Explore(VARIANT vDir)
102 {
103 TRACE("(%p, %s)\n", this, debugstr_variant(&vDir));
104 return E_NOTIMPL;
105 }
106
107 HRESULT STDMETHODCALLTYPE CShellDispatch::MinimizeAll()
108 {
109 TRACE("(%p)\n", this);
110 return E_NOTIMPL;
111 }
112
113 HRESULT STDMETHODCALLTYPE CShellDispatch::UndoMinimizeALL()
114 {
115 TRACE("(%p)\n", this);
116 return E_NOTIMPL;
117 }
118
119 HRESULT STDMETHODCALLTYPE CShellDispatch::FileRun()
120 {
121 TRACE("(%p)\n", this);
122 return E_NOTIMPL;
123 }
124
125 HRESULT STDMETHODCALLTYPE CShellDispatch::CascadeWindows()
126 {
127 TRACE("(%p)\n", this);
128 return E_NOTIMPL;
129 }
130
131 HRESULT STDMETHODCALLTYPE CShellDispatch::TileVertically()
132 {
133 TRACE("(%p)\n", this);
134 return E_NOTIMPL;
135 }
136
137 HRESULT STDMETHODCALLTYPE CShellDispatch::TileHorizontally()
138 {
139 TRACE("(%p)\n", this);
140 return E_NOTIMPL;
141 }
142
143 HRESULT STDMETHODCALLTYPE CShellDispatch::ShutdownWindows()
144 {
145 ExitWindowsDialog(NULL);
146 return S_OK;
147 }
148
149 HRESULT STDMETHODCALLTYPE CShellDispatch::Suspend()
150 {
151 TRACE("(%p)\n", this);
152 return E_NOTIMPL;
153 }
154
155 HRESULT STDMETHODCALLTYPE CShellDispatch::EjectPC()
156 {
157 TRACE("(%p)\n", this);
158 return E_NOTIMPL;
159 }
160
161 HRESULT STDMETHODCALLTYPE CShellDispatch::SetTime()
162 {
163 TRACE("(%p)\n", this);
164 return E_NOTIMPL;
165 }
166
167 HRESULT STDMETHODCALLTYPE CShellDispatch::TrayProperties()
168 {
169 TRACE("(%p)\n", this);
170 return E_NOTIMPL;
171 }
172
173 HRESULT STDMETHODCALLTYPE CShellDispatch::Help()
174 {
175 TRACE("(%p)\n", this);
176 return E_NOTIMPL;
177 }
178
179 HRESULT STDMETHODCALLTYPE CShellDispatch::FindFiles()
180 {
181 TRACE("(%p)\n", this);
182 return E_NOTIMPL;
183 }
184
185 HRESULT STDMETHODCALLTYPE CShellDispatch::FindComputer()
186 {
187 TRACE("(%p)\n", this);
188 return E_NOTIMPL;
189 }
190
191 HRESULT STDMETHODCALLTYPE CShellDispatch::RefreshMenu()
192 {
193 TRACE("(%p)\n", this);
194 return E_NOTIMPL;
195 }
196
197 HRESULT STDMETHODCALLTYPE CShellDispatch::ControlPanelItem(BSTR szDir)
198 {
199 TRACE("(%p, %ls)\n", this, szDir);
200 return E_NOTIMPL;
201 }
202
203
204 // *** IShellDispatch2 methods ***
205 HRESULT STDMETHODCALLTYPE CShellDispatch::IsRestricted(BSTR group, BSTR restriction, LONG *value)
206 {
207 TRACE("(%p, %ls, %ls, %p)\n", this, group, restriction, value);
208 return E_NOTIMPL;
209 }
210
211 HRESULT STDMETHODCALLTYPE CShellDispatch::ShellExecute(BSTR file, VARIANT args, VARIANT dir, VARIANT op, VARIANT show)
212 {
213 TRACE("(%p, %ls, %s, %s, %s, %s)\n", this, file, debugstr_variant(&args), debugstr_variant(&dir), debugstr_variant(&op), debugstr_variant(&show));
214 return E_NOTIMPL;
215 }
216
217 HRESULT STDMETHODCALLTYPE CShellDispatch::FindPrinter(BSTR name, BSTR location, BSTR model)
218 {
219 TRACE("(%p, %ls, %ls, %ls)\n", this, name, location, model);
220 return E_NOTIMPL;
221 }
222
223 HRESULT STDMETHODCALLTYPE CShellDispatch::GetSystemInformation(BSTR name, VARIANT *ret)
224 {
225 TRACE("(%p, %ls, %p)\n", this, name, ret);
226 return E_NOTIMPL;
227 }
228
229 HRESULT STDMETHODCALLTYPE CShellDispatch::ServiceStart(BSTR service, VARIANT persistent, VARIANT *ret)
230 {
231 TRACE("(%p, %ls, %s, %p)\n", this, service, wine_dbgstr_variant(&persistent), ret);
232 return E_NOTIMPL;
233 }
234
235 HRESULT STDMETHODCALLTYPE CShellDispatch::ServiceStop(BSTR service, VARIANT persistent, VARIANT *ret)
236 {
237 TRACE("(%p, %ls, %s, %p)\n", this, service, wine_dbgstr_variant(&persistent), ret);
238 return E_NOTIMPL;
239 }
240
241 HRESULT STDMETHODCALLTYPE CShellDispatch::IsServiceRunning(BSTR service, VARIANT *running)
242 {
243 TRACE("(%p, %ls, %p)\n", this, service, running);
244 return E_NOTIMPL;
245 }
246
247 HRESULT STDMETHODCALLTYPE CShellDispatch::CanStartStopService(BSTR service, VARIANT *ret)
248 {
249 TRACE("(%p, %ls, %p)\n", this, service, ret);
250 return E_NOTIMPL;
251 }
252
253 HRESULT STDMETHODCALLTYPE CShellDispatch::ShowBrowserBar(BSTR clsid, VARIANT show, VARIANT *ret)
254 {
255 TRACE("(%p, %ls, %s, %p)\n", this, clsid, wine_dbgstr_variant(&show), ret);
256 return E_NOTIMPL;
257 }
258
259
260 // *** IShellDispatch3 methods ***
261 HRESULT STDMETHODCALLTYPE CShellDispatch::AddToRecent(VARIANT file, BSTR category)
262 {
263 TRACE("(%p, %s, %ls)\n", this, wine_dbgstr_variant(&file), category);
264 return E_NOTIMPL;
265 }
266
267
268 // *** IShellDispatch4 methods ***
269 HRESULT STDMETHODCALLTYPE CShellDispatch::WindowsSecurity()
270 {
271 TRACE("(%p)\n", this);
272 return E_NOTIMPL;
273 }
274
275 HRESULT STDMETHODCALLTYPE CShellDispatch::ToggleDesktop()
276 {
277 TRACE("(%p)\n", this);
278 return E_NOTIMPL;
279 }
280
281 HRESULT STDMETHODCALLTYPE CShellDispatch::ExplorerPolicy(BSTR policy, VARIANT *value)
282 {
283 TRACE("(%p, %ls, %p)\n", this, policy, value);
284 return E_NOTIMPL;
285 }
286
287 HRESULT STDMETHODCALLTYPE CShellDispatch::GetSetting(LONG setting, VARIANT_BOOL *result)
288 {
289 TRACE("(%p, %lu, %p)\n", this, setting, result);
290 return E_NOTIMPL;
291 }
292
293
294 // *** IObjectSafety methods ***
295 HRESULT STDMETHODCALLTYPE CShellDispatch::GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
296 {
297 TRACE("(%p, %s, %p, %p)\n", this, wine_dbgstr_guid(&riid), pdwSupportedOptions, pdwEnabledOptions);
298 return E_NOTIMPL;
299 }
300
301 HRESULT STDMETHODCALLTYPE CShellDispatch::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
302 {
303 TRACE("(%p, %s, %lu, %lu)\n", this, wine_dbgstr_guid(&riid), dwOptionSetMask, dwEnabledOptions);
304 return E_NOTIMPL;
305 }
306
307
308 // *** IObjectWithSite methods ***
309 HRESULT STDMETHODCALLTYPE CShellDispatch::SetSite(IUnknown *pUnkSite)
310 {
311 TRACE("(%p, %p)\n", this, pUnkSite);
312 return E_NOTIMPL;
313 }
314
315 HRESULT STDMETHODCALLTYPE CShellDispatch::GetSite(REFIID riid, PVOID *ppvSite)
316 {
317 TRACE("(%p, %s, %p)\n", this, wine_dbgstr_guid(&riid), ppvSite);
318 return E_NOTIMPL;
319 }
320
321 HRESULT WINAPI CShellDispatch_Constructor(REFIID riid, LPVOID * ppvOut)
322 {
323 return ShellObjectCreatorInit<CShellDispatch>(riid, ppvOut);
324 }
325