2 * IShellDispatch implementation
4 * Copyright 2010 Alexander Morozov for Etersoft
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
22 #include "wine/port.h"
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(shell);
44 IShellDispatch2 IShellDispatch2_iface;
57 FolderItem FolderItem_iface;
63 static inline ShellDispatch *impl_from_IShellDispatch2(IShellDispatch2 *iface)
65 return CONTAINING_RECORD(iface, ShellDispatch, IShellDispatch2_iface);
68 static inline FolderImpl *impl_from_Folder(Folder3 *iface)
70 return CONTAINING_RECORD(iface, FolderImpl, Folder_iface);
73 static inline FolderItemImpl *impl_from_FolderItem(FolderItem *iface)
75 return CONTAINING_RECORD(iface, FolderItemImpl, FolderItem_iface);
78 static HRESULT load_type_info(REFGUID guid, ITypeInfo **pptinfo)
83 ret = LoadRegTypeLib(&LIBID_Shell32, 1, 0, LOCALE_SYSTEM_DEFAULT, &typelib);
86 ERR("LoadRegTypeLib failed: %08x\n", ret);
90 ret = ITypeLib_GetTypeInfoOfGuid(typelib, guid, pptinfo);
91 ITypeLib_Release(typelib);
93 ERR("failed to load ITypeInfo\n");
98 static HRESULT WINAPI FolderItemImpl_QueryInterface(FolderItem *iface,
99 REFIID riid, LPVOID *ppv)
101 FolderItemImpl *This = impl_from_FolderItem(iface);
103 TRACE("(%p,%p,%p)\n", iface, riid, ppv);
105 if (!ppv) return E_INVALIDARG;
107 if (IsEqualIID(&IID_IUnknown, riid) ||
108 IsEqualIID(&IID_IDispatch, riid) ||
109 IsEqualIID(&IID_FolderItem, riid))
113 FIXME("not implemented for %s\n", shdebugstr_guid(riid));
115 return E_NOINTERFACE;
117 IUnknown_AddRef((IUnknown*)*ppv);
121 static ULONG WINAPI FolderItemImpl_AddRef(FolderItem *iface)
123 FolderItemImpl *This = impl_from_FolderItem(iface);
124 ULONG ref = InterlockedIncrement(&This->ref);
126 TRACE("(%p), new refcount=%i\n", iface, ref);
131 static ULONG WINAPI FolderItemImpl_Release(FolderItem *iface)
133 FolderItemImpl *This = impl_from_FolderItem(iface);
134 ULONG ref = InterlockedDecrement(&This->ref);
136 TRACE("(%p), new refcount=%i\n", iface, ref);
140 VariantClear(&This->dir);
141 ITypeInfo_Release(This->iTypeInfo);
142 HeapFree(GetProcessHeap(), 0, This);
147 static HRESULT WINAPI FolderItemImpl_GetTypeInfoCount(FolderItem *iface,
150 TRACE("(%p,%p)\n", iface, pctinfo);
156 static HRESULT WINAPI FolderItemImpl_GetTypeInfo(FolderItem *iface, UINT iTInfo,
157 LCID lcid, ITypeInfo **ppTInfo)
159 FolderItemImpl *This = impl_from_FolderItem(iface);
161 TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
163 ITypeInfo_AddRef(This->iTypeInfo);
164 *ppTInfo = This->iTypeInfo;
168 static HRESULT WINAPI FolderItemImpl_GetIDsOfNames(FolderItem *iface,
169 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
172 FolderItemImpl *This = impl_from_FolderItem(iface);
174 TRACE("(%p,%p,%p,%u,%d,%p)\n", iface, riid, rgszNames, cNames, lcid,
177 return ITypeInfo_GetIDsOfNames(This->iTypeInfo, rgszNames, cNames, rgDispId);
180 static HRESULT WINAPI FolderItemImpl_Invoke(FolderItem *iface,
181 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
182 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
185 FolderItemImpl *This = impl_from_FolderItem(iface);
187 TRACE("(%p,%d,%p,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, riid, lcid,
188 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
190 return ITypeInfo_Invoke(This->iTypeInfo, This, dispIdMember, wFlags,
191 pDispParams, pVarResult, pExcepInfo, puArgErr);
194 static HRESULT WINAPI FolderItemImpl_get_Application(FolderItem *iface,
197 FIXME("(%p,%p)\n", iface, ppid);
203 static HRESULT WINAPI FolderItemImpl_get_Parent(FolderItem *iface,
206 FIXME("(%p,%p)\n", iface, ppid);
212 static HRESULT WINAPI FolderItemImpl_get_Name(FolderItem *iface, BSTR *pbs)
214 FIXME("(%p,%p)\n", iface, pbs);
220 static HRESULT WINAPI FolderItemImpl_put_Name(FolderItem *iface, BSTR bs)
222 FIXME("(%p,%s)\n", iface, debugstr_w(bs));
227 static HRESULT WINAPI FolderItemImpl_get_Path(FolderItem *iface, BSTR *pbs)
229 FolderItemImpl *This = impl_from_FolderItem(iface);
234 TRACE("(%p,%p)\n", iface, pbs);
237 if (V_VT(&This->dir) == VT_I4)
239 pathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
240 if (!pathW) return E_OUTOFMEMORY;
241 ret = SHGetFolderPathW(NULL, V_I4(&This->dir), NULL, SHGFP_TYPE_CURRENT,
244 *pbs = SysAllocString(pathW);
245 else if (ret == E_INVALIDARG)
247 FIXME("not implemented for %#x\n", V_I4(&This->dir));
250 HeapFree(GetProcessHeap(), 0, pathW);
254 pathW = V_BSTR(&This->dir);
255 len = lstrlenW(pathW);
256 *pbs = SysAllocStringLen(pathW, pathW[len - 1] == '\\' ? len - 1 : len);
258 if (ret == S_OK && !*pbs)
263 static HRESULT WINAPI FolderItemImpl_get_GetLink(FolderItem *iface,
266 FIXME("(%p,%p)\n", iface, ppid);
272 static HRESULT WINAPI FolderItemImpl_get_GetFolder(FolderItem *iface,
275 FIXME("(%p,%p)\n", iface, ppid);
281 static HRESULT WINAPI FolderItemImpl_get_IsLink(FolderItem *iface,
284 FIXME("(%p,%p)\n", iface, pb);
289 static HRESULT WINAPI FolderItemImpl_get_IsFolder(FolderItem *iface,
292 FIXME("(%p,%p)\n", iface, pb);
297 static HRESULT WINAPI FolderItemImpl_get_IsFileSystem(FolderItem *iface,
300 FIXME("(%p,%p)\n", iface, pb);
305 static HRESULT WINAPI FolderItemImpl_get_IsBrowsable(FolderItem *iface,
308 FIXME("(%p,%p)\n", iface, pb);
313 static HRESULT WINAPI FolderItemImpl_get_ModifyDate(FolderItem *iface,
316 FIXME("(%p,%p)\n", iface, pdt);
321 static HRESULT WINAPI FolderItemImpl_put_ModifyDate(FolderItem *iface, DATE dt)
323 FIXME("(%p,%f)\n", iface, dt);
328 static HRESULT WINAPI FolderItemImpl_get_Size(FolderItem *iface, LONG *pul)
330 FIXME("(%p,%p)\n", iface, pul);
335 static HRESULT WINAPI FolderItemImpl_get_Type(FolderItem *iface, BSTR *pbs)
337 FIXME("(%p,%p)\n", iface, pbs);
343 static HRESULT WINAPI FolderItemImpl_Verbs(FolderItem *iface,
344 FolderItemVerbs **ppfic)
346 FIXME("(%p,%p)\n", iface, ppfic);
352 static HRESULT WINAPI FolderItemImpl_InvokeVerb(FolderItem *iface,
355 FIXME("(%p)\n", iface);
360 static const FolderItemVtbl FolderItemImpl_Vtbl = {
361 FolderItemImpl_QueryInterface,
362 FolderItemImpl_AddRef,
363 FolderItemImpl_Release,
364 FolderItemImpl_GetTypeInfoCount,
365 FolderItemImpl_GetTypeInfo,
366 FolderItemImpl_GetIDsOfNames,
367 FolderItemImpl_Invoke,
368 FolderItemImpl_get_Application,
369 FolderItemImpl_get_Parent,
370 FolderItemImpl_get_Name,
371 FolderItemImpl_put_Name,
372 FolderItemImpl_get_Path,
373 FolderItemImpl_get_GetLink,
374 FolderItemImpl_get_GetFolder,
375 FolderItemImpl_get_IsLink,
376 FolderItemImpl_get_IsFolder,
377 FolderItemImpl_get_IsFileSystem,
378 FolderItemImpl_get_IsBrowsable,
379 FolderItemImpl_get_ModifyDate,
380 FolderItemImpl_put_ModifyDate,
381 FolderItemImpl_get_Size,
382 FolderItemImpl_get_Type,
383 FolderItemImpl_Verbs,
384 FolderItemImpl_InvokeVerb
387 static HRESULT FolderItem_Constructor(VARIANT *dir, FolderItem **ppfi)
389 FolderItemImpl *This;
394 This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemImpl));
395 if (!This) return E_OUTOFMEMORY;
396 This->FolderItem_iface.lpVtbl = &FolderItemImpl_Vtbl;
399 ret = load_type_info(&IID_FolderItem, &This->iTypeInfo);
402 HeapFree(GetProcessHeap(), 0, This);
406 VariantInit(&This->dir);
407 ret = VariantCopy(&This->dir, dir);
410 ITypeInfo_Release(This->iTypeInfo);
411 HeapFree(GetProcessHeap(), 0, This);
412 return E_OUTOFMEMORY;
415 *ppfi = (FolderItem*)This;
419 static HRESULT WINAPI FolderImpl_QueryInterface(Folder3 *iface, REFIID riid,
422 FolderImpl *This = impl_from_Folder(iface);
424 TRACE("(%p,%p,%p)\n", iface, riid, ppv);
426 if (!ppv) return E_INVALIDARG;
428 if (IsEqualIID(&IID_IUnknown, riid) ||
429 IsEqualIID(&IID_IDispatch, riid) ||
430 IsEqualIID(&IID_Folder, riid) ||
431 IsEqualIID(&IID_Folder2, riid) ||
432 IsEqualIID(&IID_Folder3, riid))
436 FIXME("not implemented for %s\n", shdebugstr_guid(riid));
438 return E_NOINTERFACE;
440 IUnknown_AddRef((IUnknown*)*ppv);
444 static ULONG WINAPI FolderImpl_AddRef(Folder3 *iface)
446 FolderImpl *This = impl_from_Folder(iface);
447 ULONG ref = InterlockedIncrement(&This->ref);
449 TRACE("(%p), new refcount=%i\n", iface, ref);
454 static ULONG WINAPI FolderImpl_Release(Folder3 *iface)
456 FolderImpl *This = impl_from_Folder(iface);
457 ULONG ref = InterlockedDecrement(&This->ref);
459 TRACE("(%p), new refcount=%i\n", iface, ref);
463 VariantClear(&This->dir);
464 ITypeInfo_Release(This->iTypeInfo);
465 HeapFree(GetProcessHeap(), 0, This);
470 static HRESULT WINAPI FolderImpl_GetTypeInfoCount(Folder3 *iface, UINT *pctinfo)
472 TRACE("(%p,%p)\n", iface, pctinfo);
478 static HRESULT WINAPI FolderImpl_GetTypeInfo(Folder3 *iface, UINT iTInfo,
479 LCID lcid, ITypeInfo **ppTInfo)
481 FolderImpl *This = impl_from_Folder(iface);
483 TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
485 ITypeInfo_AddRef(This->iTypeInfo);
486 *ppTInfo = This->iTypeInfo;
490 static HRESULT WINAPI FolderImpl_GetIDsOfNames(Folder3 *iface, REFIID riid,
491 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
493 FolderImpl *This = impl_from_Folder(iface);
495 TRACE("(%p,%p,%p,%u,%d,%p)\n", iface, riid, rgszNames, cNames, lcid,
498 return ITypeInfo_GetIDsOfNames(This->iTypeInfo, rgszNames, cNames,
502 static HRESULT WINAPI FolderImpl_Invoke(Folder3 *iface, DISPID dispIdMember,
503 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
504 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
506 FolderImpl *This = impl_from_Folder(iface);
508 TRACE("(%p,%d,%p,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, riid, lcid,
509 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
511 return ITypeInfo_Invoke(This->iTypeInfo, This, dispIdMember, wFlags,
512 pDispParams, pVarResult, pExcepInfo, puArgErr);
515 static HRESULT WINAPI FolderImpl_get_Title(Folder3 *iface, BSTR *pbs)
517 FolderImpl *This = impl_from_Folder(iface);
521 TRACE("(%p,%p)\n", iface, pbs);
525 if (V_VT(&This->dir) == VT_I4)
527 FIXME("special folder constants are not supported\n");
530 p = PathFindFileNameW(V_BSTR(&This->dir));
532 *pbs = SysAllocStringLen(p, p[len - 1] == '\\' ? len - 1 : len);
533 return *pbs ? S_OK : E_OUTOFMEMORY;
536 static HRESULT WINAPI FolderImpl_get_Application(Folder3 *iface,
539 FIXME("(%p,%p)\n", iface, ppid);
545 static HRESULT WINAPI FolderImpl_get_Parent(Folder3 *iface, IDispatch **ppid)
547 FIXME("(%p,%p)\n", iface, ppid);
553 static HRESULT WINAPI FolderImpl_get_ParentFolder(Folder3 *iface, Folder **ppsf)
555 FIXME("(%p,%p)\n", iface, ppsf);
561 static HRESULT WINAPI FolderImpl_Items(Folder3 *iface, FolderItems **ppid)
563 FIXME("(%p,%p)\n", iface, ppid);
569 static HRESULT WINAPI FolderImpl_ParseName(Folder3 *iface, BSTR bName,
572 FIXME("(%p,%s,%p)\n", iface, debugstr_w(bName), ppid);
578 static HRESULT WINAPI FolderImpl_NewFolder(Folder3 *iface, BSTR bName,
581 FIXME("(%p,%s)\n", iface, debugstr_w(bName));
586 static HRESULT WINAPI FolderImpl_MoveHere(Folder3 *iface, VARIANT vItem,
589 FIXME("(%p)\n", iface);
594 static HRESULT WINAPI FolderImpl_CopyHere(Folder3 *iface, VARIANT vItem,
597 FIXME("(%p)\n", iface);
602 static HRESULT WINAPI FolderImpl_GetDetailsOf(Folder3 *iface, VARIANT vItem,
603 int iColumn, BSTR *pbs)
605 FIXME("(%p,%d,%p)\n", iface, iColumn, pbs);
611 static HRESULT WINAPI FolderImpl_get_Self(Folder3 *iface, FolderItem **ppfi)
613 FolderImpl *This = impl_from_Folder(iface);
615 TRACE("(%p,%p)\n", iface, ppfi);
617 return FolderItem_Constructor(&This->dir, ppfi);
620 static HRESULT WINAPI FolderImpl_get_OfflineStatus(Folder3 *iface, LONG *pul)
622 FIXME("(%p,%p)\n", iface, pul);
627 static HRESULT WINAPI FolderImpl_Synchronize(Folder3 *iface)
629 FIXME("(%p)\n", iface);
634 static HRESULT WINAPI FolderImpl_get_HaveToShowWebViewBarricade(Folder3 *iface,
635 VARIANT_BOOL *pbHaveToShowWebViewBarricade)
637 FIXME("(%p,%p)\n", iface, pbHaveToShowWebViewBarricade);
642 static HRESULT WINAPI FolderImpl_DismissedWebViewBarricade(Folder3 *iface)
644 FIXME("(%p)\n", iface);
649 static HRESULT WINAPI FolderImpl_get_ShowWebViewBarricade(Folder3 *iface,
650 VARIANT_BOOL *pbShowWebViewBarricade)
652 FIXME("(%p,%p)\n", iface, pbShowWebViewBarricade);
657 static HRESULT WINAPI FolderImpl_put_ShowWebViewBarricade(Folder3 *iface,
658 VARIANT_BOOL bShowWebViewBarricade)
660 FIXME("(%p,%d)\n", iface, bShowWebViewBarricade);
665 static const Folder3Vtbl FolderImpl_Vtbl = {
666 FolderImpl_QueryInterface,
669 FolderImpl_GetTypeInfoCount,
670 FolderImpl_GetTypeInfo,
671 FolderImpl_GetIDsOfNames,
673 FolderImpl_get_Title,
674 FolderImpl_get_Application,
675 FolderImpl_get_Parent,
676 FolderImpl_get_ParentFolder,
678 FolderImpl_ParseName,
679 FolderImpl_NewFolder,
682 FolderImpl_GetDetailsOf,
684 FolderImpl_get_OfflineStatus,
685 FolderImpl_Synchronize,
686 FolderImpl_get_HaveToShowWebViewBarricade,
687 FolderImpl_DismissedWebViewBarricade,
688 FolderImpl_get_ShowWebViewBarricade,
689 FolderImpl_put_ShowWebViewBarricade
692 static HRESULT Folder_Constructor(VARIANT *dir, Folder **ppsdf)
702 /* FIXME: add some checks */
705 if (PathIsDirectoryW(V_BSTR(dir)) &&
706 !PathIsRelativeW(V_BSTR(dir)) &&
707 PathFileExistsW(V_BSTR(dir)))
713 This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderImpl));
714 if (!This) return E_OUTOFMEMORY;
715 This->Folder_iface.lpVtbl = &FolderImpl_Vtbl;
718 ret = load_type_info(&IID_Folder3, &This->iTypeInfo);
721 HeapFree(GetProcessHeap(), 0, This);
725 VariantInit(&This->dir);
726 ret = VariantCopy(&This->dir, dir);
729 ITypeInfo_Release(This->iTypeInfo);
730 HeapFree(GetProcessHeap(), 0, This);
731 return E_OUTOFMEMORY;
734 *ppsdf = (Folder*)This;
738 static HRESULT WINAPI ShellDispatch_QueryInterface(IShellDispatch2 *iface,
739 REFIID riid, LPVOID *ppv)
741 ShellDispatch *This = impl_from_IShellDispatch2(iface);
743 TRACE("(%p,%p,%p)\n", iface, riid, ppv);
745 if (!ppv) return E_INVALIDARG;
747 if (IsEqualIID(&IID_IUnknown, riid) ||
748 IsEqualIID(&IID_IDispatch, riid) ||
749 IsEqualIID(&IID_IShellDispatch, riid) ||
750 IsEqualIID(&IID_IShellDispatch2, riid))
754 FIXME("not implemented for %s\n", shdebugstr_guid(riid));
756 return E_NOINTERFACE;
759 IShellDispatch2_AddRef(iface);
763 static ULONG WINAPI ShellDispatch_AddRef(IShellDispatch2 *iface)
765 ShellDispatch *This = impl_from_IShellDispatch2(iface);
766 ULONG ref = InterlockedIncrement(&This->ref);
768 TRACE("(%p), new refcount=%i\n", iface, ref);
773 static ULONG WINAPI ShellDispatch_Release(IShellDispatch2 *iface)
775 ShellDispatch *This = impl_from_IShellDispatch2(iface);
776 ULONG ref = InterlockedDecrement(&This->ref);
778 TRACE("(%p), new refcount=%i\n", iface, ref);
782 ITypeInfo_Release(This->typeinfo);
783 HeapFree(GetProcessHeap(), 0, This);
788 static HRESULT WINAPI ShellDispatch_GetTypeInfoCount(IShellDispatch2 *iface,
791 TRACE("(%p,%p)\n", iface, pctinfo);
797 static HRESULT WINAPI ShellDispatch_GetTypeInfo(IShellDispatch2 *iface,
798 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
800 ShellDispatch *This = impl_from_IShellDispatch2(iface);
802 TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
804 ITypeInfo_AddRef(This->typeinfo);
805 *ppTInfo = This->typeinfo;
809 static HRESULT WINAPI ShellDispatch_GetIDsOfNames(IShellDispatch2 *iface,
810 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
812 ShellDispatch *This = impl_from_IShellDispatch2(iface);
814 TRACE("(%p,%p,%p,%u,%d,%p)\n", iface, riid, rgszNames, cNames, lcid,
817 return ITypeInfo_GetIDsOfNames(This->typeinfo, rgszNames, cNames, rgDispId);
820 static HRESULT WINAPI ShellDispatch_Invoke(IShellDispatch2 *iface,
821 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
822 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
825 ShellDispatch *This = impl_from_IShellDispatch2(iface);
827 TRACE("(%p,%d,%p,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, riid, lcid,
828 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
830 return ITypeInfo_Invoke(This->typeinfo, This, dispIdMember, wFlags,
831 pDispParams, pVarResult, pExcepInfo, puArgErr);
834 static HRESULT WINAPI ShellDispatch_get_Application(IShellDispatch2 *iface,
837 FIXME("(%p,%p)\n", iface, ppid);
843 static HRESULT WINAPI ShellDispatch_get_Parent(IShellDispatch2 *iface,
846 FIXME("(%p,%p)\n", iface, ppid);
852 static HRESULT WINAPI ShellDispatch_NameSpace(IShellDispatch2 *iface,
853 VARIANT vDir, Folder **ppsdf)
855 TRACE("(%p,%p)\n", iface, ppsdf);
857 return Folder_Constructor(&vDir, ppsdf);
860 static HRESULT WINAPI ShellDispatch_BrowseForFolder(IShellDispatch2 *iface,
861 LONG Hwnd, BSTR Title, LONG Options, VARIANT RootFolder, Folder **ppsdf)
863 FIXME("(%p,%x,%s,%x,%p)\n", iface, Hwnd, debugstr_w(Title), Options, ppsdf);
869 static HRESULT WINAPI ShellDispatch_Windows(IShellDispatch2 *iface,
872 FIXME("(%p,%p)\n", iface, ppid);
878 static HRESULT WINAPI ShellDispatch_Open(IShellDispatch2 *iface, VARIANT vDir)
880 FIXME("(%p)\n", iface);
885 static HRESULT WINAPI ShellDispatch_Explore(IShellDispatch2 *iface, VARIANT vDir)
887 FIXME("(%p)\n", iface);
892 static HRESULT WINAPI ShellDispatch_MinimizeAll(IShellDispatch2 *iface)
894 FIXME("(%p)\n", iface);
899 static HRESULT WINAPI ShellDispatch_UndoMinimizeALL(IShellDispatch2 *iface)
901 FIXME("(%p)\n", iface);
906 static HRESULT WINAPI ShellDispatch_FileRun(IShellDispatch2 *iface)
908 FIXME("(%p)\n", iface);
913 static HRESULT WINAPI ShellDispatch_CascadeWindows(IShellDispatch2 *iface)
915 FIXME("(%p)\n", iface);
920 static HRESULT WINAPI ShellDispatch_TileVertically(IShellDispatch2 *iface)
922 FIXME("(%p)\n", iface);
927 static HRESULT WINAPI ShellDispatch_TileHorizontally(IShellDispatch2 *iface)
929 FIXME("(%p)\n", iface);
934 static HRESULT WINAPI ShellDispatch_ShutdownWindows(IShellDispatch2 *iface)
936 FIXME("(%p)\n", iface);
941 static HRESULT WINAPI ShellDispatch_Suspend(IShellDispatch2 *iface)
943 FIXME("(%p)\n", iface);
948 static HRESULT WINAPI ShellDispatch_EjectPC(IShellDispatch2 *iface)
950 FIXME("(%p)\n", iface);
955 static HRESULT WINAPI ShellDispatch_SetTime(IShellDispatch2 *iface)
957 FIXME("(%p)\n", iface);
962 static HRESULT WINAPI ShellDispatch_TrayProperties(IShellDispatch2 *iface)
964 FIXME("(%p)\n", iface);
969 static HRESULT WINAPI ShellDispatch_Help(IShellDispatch2 *iface)
971 FIXME("(%p)\n", iface);
976 static HRESULT WINAPI ShellDispatch_FindFiles(IShellDispatch2 *iface)
978 FIXME("(%p)\n", iface);
983 static HRESULT WINAPI ShellDispatch_FindComputer(IShellDispatch2 *iface)
985 FIXME("(%p)\n", iface);
990 static HRESULT WINAPI ShellDispatch_RefreshMenu(IShellDispatch2 *iface)
992 FIXME("(%p)\n", iface);
997 static HRESULT WINAPI ShellDispatch_ControlPanelItem(IShellDispatch2 *iface,
1000 FIXME("(%p,%s)\n", iface, debugstr_w(szDir));
1005 static HRESULT WINAPI ShellDispatch_IsRestricted(IShellDispatch2 *iface, BSTR group, BSTR restriction, LONG *value)
1007 FIXME("(%s, %s, %p): stub\n", debugstr_w(group), debugstr_w(restriction), value);
1011 static HRESULT WINAPI ShellDispatch_ShellExecute(IShellDispatch2 *iface, BSTR file, VARIANT args, VARIANT dir,
1012 VARIANT op, VARIANT show)
1014 FIXME("(%s): stub\n", debugstr_w(file));
1018 static HRESULT WINAPI ShellDispatch_FindPrinter(IShellDispatch2 *iface, BSTR name, BSTR location, BSTR model)
1020 FIXME("(%s, %s, %s): stub\n", debugstr_w(name), debugstr_w(location), debugstr_w(model));
1024 static HRESULT WINAPI ShellDispatch_GetSystemInformation(IShellDispatch2 *iface, BSTR name, VARIANT *ret)
1026 FIXME("(%s, %p): stub\n", debugstr_w(name), ret);
1030 static HRESULT WINAPI ShellDispatch_ServiceStart(IShellDispatch2 *iface, BSTR service, VARIANT persistent, VARIANT *ret)
1032 FIXME("(%s, %p): stub\n", debugstr_w(service), ret);
1036 static HRESULT WINAPI ShellDispatch_ServiceStop(IShellDispatch2 *iface, BSTR service, VARIANT persistent, VARIANT *ret)
1038 FIXME("(%s, %p): stub\n", debugstr_w(service), ret);
1042 static HRESULT WINAPI ShellDispatch_IsServiceRunning(IShellDispatch2 *iface, BSTR name, VARIANT *running)
1044 SERVICE_STATUS_PROCESS status;
1045 SC_HANDLE scm, service;
1048 TRACE("(%s, %p)\n", debugstr_w(name), running);
1050 V_VT(running) = VT_BOOL;
1051 V_BOOL(running) = VARIANT_FALSE;
1053 scm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
1056 ERR("failed to connect to service manager\n");
1060 service = OpenServiceW(scm, name, SERVICE_QUERY_STATUS);
1063 ERR("Failed to open service %s (%u)\n", debugstr_w(name), GetLastError());
1064 CloseServiceHandle(scm);
1068 if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO, (BYTE *)&status,
1069 sizeof(SERVICE_STATUS_PROCESS), &dummy))
1071 TRACE("failed to query service status (%u)\n", GetLastError());
1072 CloseServiceHandle(service);
1073 CloseServiceHandle(scm);
1077 if (status.dwCurrentState == SERVICE_RUNNING)
1078 V_BOOL(running) = VARIANT_TRUE;
1080 CloseServiceHandle(service);
1081 CloseServiceHandle(scm);
1086 static HRESULT WINAPI ShellDispatch_CanStartStopService(IShellDispatch2 *iface, BSTR service, VARIANT *ret)
1088 FIXME("(%s, %p): stub\n", debugstr_w(service), ret);
1092 static HRESULT WINAPI ShellDispatch_ShowBrowserBar(IShellDispatch2 *iface, BSTR clsid, VARIANT show, VARIANT *ret)
1094 FIXME("(%s, %p): stub\n", debugstr_w(clsid), ret);
1098 static const IShellDispatch2Vtbl ShellDispatch2Vtbl = {
1099 ShellDispatch_QueryInterface,
1100 ShellDispatch_AddRef,
1101 ShellDispatch_Release,
1102 ShellDispatch_GetTypeInfoCount,
1103 ShellDispatch_GetTypeInfo,
1104 ShellDispatch_GetIDsOfNames,
1105 ShellDispatch_Invoke,
1106 ShellDispatch_get_Application,
1107 ShellDispatch_get_Parent,
1108 ShellDispatch_NameSpace,
1109 ShellDispatch_BrowseForFolder,
1110 ShellDispatch_Windows,
1112 ShellDispatch_Explore,
1113 ShellDispatch_MinimizeAll,
1114 ShellDispatch_UndoMinimizeALL,
1115 ShellDispatch_FileRun,
1116 ShellDispatch_CascadeWindows,
1117 ShellDispatch_TileVertically,
1118 ShellDispatch_TileHorizontally,
1119 ShellDispatch_ShutdownWindows,
1120 ShellDispatch_Suspend,
1121 ShellDispatch_EjectPC,
1122 ShellDispatch_SetTime,
1123 ShellDispatch_TrayProperties,
1125 ShellDispatch_FindFiles,
1126 ShellDispatch_FindComputer,
1127 ShellDispatch_RefreshMenu,
1128 ShellDispatch_ControlPanelItem,
1129 ShellDispatch_IsRestricted,
1130 ShellDispatch_ShellExecute,
1131 ShellDispatch_FindPrinter,
1132 ShellDispatch_GetSystemInformation,
1133 ShellDispatch_ServiceStart,
1134 ShellDispatch_ServiceStop,
1135 ShellDispatch_IsServiceRunning,
1136 ShellDispatch_CanStartStopService,
1137 ShellDispatch_ShowBrowserBar
1140 HRESULT WINAPI IShellDispatch_Constructor(IUnknown *outer, REFIID riid, void **ppv)
1142 ShellDispatch *This;
1145 TRACE("(%p, %s)\n", outer, debugstr_guid(riid));
1149 if (outer) return CLASS_E_NOAGGREGATION;
1151 This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellDispatch));
1152 if (!This) return E_OUTOFMEMORY;
1153 This->IShellDispatch2_iface.lpVtbl = &ShellDispatch2Vtbl;
1156 ret = load_type_info(&IID_IShellDispatch2, &This->typeinfo);
1159 HeapFree(GetProcessHeap(), 0, This);
1163 ret = IShellDispatch2_QueryInterface(&This->IShellDispatch2_iface, riid, ppv);
1164 IShellDispatch2_Release(&This->IShellDispatch2_iface);