2 * IShellDispatch implementation
4 * Copyright 2015 Mark Jansen
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
26 CShellDispatch::CShellDispatch()
30 CShellDispatch::~CShellDispatch()
34 HRESULT
CShellDispatch::Initialize()
39 // *** IShellDispatch methods ***
40 HRESULT STDMETHODCALLTYPE
CShellDispatch::get_Application(IDispatch
**ppid
)
42 TRACE("(%p, %p)\n", this, ppid
);
46 HRESULT STDMETHODCALLTYPE
CShellDispatch::get_Parent(IDispatch
**ppid
)
48 TRACE("(%p, %p)\n", this, ppid
);
52 HRESULT
VariantToIdlist(VARIANT
* var
, LPITEMIDLIST
* idlist
)
55 if(V_VT(var
) == VT_I4
)
57 hr
= SHGetSpecialFolderLocation(NULL
, V_I4(var
), idlist
);
59 else if(V_VT(var
) == VT_BSTR
)
61 hr
= SHILCreateFromPathW(V_BSTR(var
), idlist
, NULL
);
66 HRESULT STDMETHODCALLTYPE
CShellDispatch::NameSpace(VARIANT vDir
, Folder
**ppsdf
)
68 TRACE("(%p, %s, %p)\n", this, debugstr_variant(&vDir
), ppsdf
);
72 LPITEMIDLIST idlist
= NULL
;
73 HRESULT hr
= VariantToIdlist(&vDir
, &idlist
);
74 if (!SUCCEEDED(hr
) || !idlist
)
76 CFolder
* fld
= new CComObject
<CFolder
>();
83 HRESULT STDMETHODCALLTYPE
CShellDispatch::BrowseForFolder(LONG Hwnd
, BSTR Title
, LONG Options
, VARIANT RootFolder
, Folder
**ppsdf
)
85 TRACE("(%p, %lu, %ls, %lu, %s, %p)\n", this, Hwnd
, Title
, Options
, debugstr_variant(&RootFolder
), ppsdf
);
89 HRESULT STDMETHODCALLTYPE
CShellDispatch::Windows(IDispatch
**ppid
)
91 TRACE("(%p, %p)\n", this, ppid
);
95 HRESULT STDMETHODCALLTYPE
CShellDispatch::Open(VARIANT vDir
)
97 TRACE("(%p, %s)\n", this, debugstr_variant(&vDir
));
101 HRESULT STDMETHODCALLTYPE
CShellDispatch::Explore(VARIANT vDir
)
103 TRACE("(%p, %s)\n", this, debugstr_variant(&vDir
));
107 HRESULT STDMETHODCALLTYPE
CShellDispatch::MinimizeAll()
109 TRACE("(%p)\n", this);
113 HRESULT STDMETHODCALLTYPE
CShellDispatch::UndoMinimizeALL()
115 TRACE("(%p)\n", this);
119 HRESULT STDMETHODCALLTYPE
CShellDispatch::FileRun()
121 TRACE("(%p)\n", this);
125 HRESULT STDMETHODCALLTYPE
CShellDispatch::CascadeWindows()
127 TRACE("(%p)\n", this);
131 HRESULT STDMETHODCALLTYPE
CShellDispatch::TileVertically()
133 TRACE("(%p)\n", this);
137 HRESULT STDMETHODCALLTYPE
CShellDispatch::TileHorizontally()
139 TRACE("(%p)\n", this);
143 HRESULT STDMETHODCALLTYPE
CShellDispatch::ShutdownWindows()
145 TRACE("(%p)\n", this);
149 HRESULT STDMETHODCALLTYPE
CShellDispatch::Suspend()
151 TRACE("(%p)\n", this);
155 HRESULT STDMETHODCALLTYPE
CShellDispatch::EjectPC()
157 TRACE("(%p)\n", this);
161 HRESULT STDMETHODCALLTYPE
CShellDispatch::SetTime()
163 TRACE("(%p)\n", this);
167 HRESULT STDMETHODCALLTYPE
CShellDispatch::TrayProperties()
169 TRACE("(%p)\n", this);
173 HRESULT STDMETHODCALLTYPE
CShellDispatch::Help()
175 TRACE("(%p)\n", this);
179 HRESULT STDMETHODCALLTYPE
CShellDispatch::FindFiles()
181 TRACE("(%p)\n", this);
185 HRESULT STDMETHODCALLTYPE
CShellDispatch::FindComputer()
187 TRACE("(%p)\n", this);
191 HRESULT STDMETHODCALLTYPE
CShellDispatch::RefreshMenu()
193 TRACE("(%p)\n", this);
197 HRESULT STDMETHODCALLTYPE
CShellDispatch::ControlPanelItem(BSTR szDir
)
199 TRACE("(%p, %ls)\n", this, szDir
);
204 // *** IShellDispatch2 methods ***
205 HRESULT STDMETHODCALLTYPE
CShellDispatch::IsRestricted(BSTR group
, BSTR restriction
, LONG
*value
)
207 TRACE("(%p, %ls, %ls, %p)\n", this, group
, restriction
, value
);
211 HRESULT STDMETHODCALLTYPE
CShellDispatch::ShellExecute(BSTR file
, VARIANT args
, VARIANT dir
, VARIANT op
, VARIANT show
)
213 TRACE("(%p, %ls, %s, %s, %s, %s)\n", this, file
, debugstr_variant(&args
), debugstr_variant(&dir
), debugstr_variant(&op
), debugstr_variant(&show
));
217 HRESULT STDMETHODCALLTYPE
CShellDispatch::FindPrinter(BSTR name
, BSTR location
, BSTR model
)
219 TRACE("(%p, %ls, %ls, %ls)\n", this, name
, location
, model
);
223 HRESULT STDMETHODCALLTYPE
CShellDispatch::GetSystemInformation(BSTR name
, VARIANT
*ret
)
225 TRACE("(%p, %ls, %p)\n", this, name
, ret
);
229 HRESULT STDMETHODCALLTYPE
CShellDispatch::ServiceStart(BSTR service
, VARIANT persistent
, VARIANT
*ret
)
231 TRACE("(%p, %ls, %s, %p)\n", this, service
, wine_dbgstr_variant(&persistent
), ret
);
235 HRESULT STDMETHODCALLTYPE
CShellDispatch::ServiceStop(BSTR service
, VARIANT persistent
, VARIANT
*ret
)
237 TRACE("(%p, %ls, %s, %p)\n", this, service
, wine_dbgstr_variant(&persistent
), ret
);
241 HRESULT STDMETHODCALLTYPE
CShellDispatch::IsServiceRunning(BSTR service
, VARIANT
*running
)
243 TRACE("(%p, %ls, %p)\n", this, service
, running
);
247 HRESULT STDMETHODCALLTYPE
CShellDispatch::CanStartStopService(BSTR service
, VARIANT
*ret
)
249 TRACE("(%p, %ls, %p)\n", this, service
, ret
);
253 HRESULT STDMETHODCALLTYPE
CShellDispatch::ShowBrowserBar(BSTR clsid
, VARIANT show
, VARIANT
*ret
)
255 TRACE("(%p, %ls, %s, %p)\n", this, clsid
, wine_dbgstr_variant(&show
), ret
);
260 // *** IShellDispatch3 methods ***
261 HRESULT STDMETHODCALLTYPE
CShellDispatch::AddToRecent(VARIANT file
, BSTR category
)
263 TRACE("(%p, %s, %ls)\n", this, wine_dbgstr_variant(&file
), category
);
268 // *** IShellDispatch4 methods ***
269 HRESULT STDMETHODCALLTYPE
CShellDispatch::WindowsSecurity()
271 TRACE("(%p)\n", this);
275 HRESULT STDMETHODCALLTYPE
CShellDispatch::ToggleDesktop()
277 TRACE("(%p)\n", this);
281 HRESULT STDMETHODCALLTYPE
CShellDispatch::ExplorerPolicy(BSTR policy
, VARIANT
*value
)
283 TRACE("(%p, %ls, %p)\n", this, policy
, value
);
287 HRESULT STDMETHODCALLTYPE
CShellDispatch::GetSetting(LONG setting
, VARIANT_BOOL
*result
)
289 TRACE("(%p, %lu, %p)\n", this, setting
, result
);
294 // *** IObjectSafety methods ***
295 HRESULT STDMETHODCALLTYPE
CShellDispatch::GetInterfaceSafetyOptions(REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
297 TRACE("(%p, %s, %p, %p)\n", this, wine_dbgstr_guid(&riid
), pdwSupportedOptions
, pdwEnabledOptions
);
301 HRESULT STDMETHODCALLTYPE
CShellDispatch::SetInterfaceSafetyOptions(REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
303 TRACE("(%p, %s, %lu, %lu)\n", this, wine_dbgstr_guid(&riid
), dwOptionSetMask
, dwEnabledOptions
);
308 // *** IObjectWithSite methods ***
309 HRESULT STDMETHODCALLTYPE
CShellDispatch::SetSite(IUnknown
*pUnkSite
)
311 TRACE("(%p, %p)\n", this, pUnkSite
);
315 HRESULT STDMETHODCALLTYPE
CShellDispatch::GetSite(REFIID riid
, PVOID
*ppvSite
)
317 TRACE("(%p, %s, %p)\n", this, wine_dbgstr_guid(&riid
), ppvSite
);
321 HRESULT WINAPI
CShellDispatch_Constructor(REFIID riid
, LPVOID
* ppvOut
)
323 return ShellObjectCreatorInit
<CShellDispatch
>(riid
, ppvOut
);