2 * Copyright 2011 Jacek Caban for CodeWeavers
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.
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.
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
19 #include "wshom_private.h"
25 #include "wine/debug.h"
26 #include "wine/unicode.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(wshom
);
30 static const char *debugstr_variant(const VARIANT
*v
)
41 return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v
));
43 return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v
));
45 return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v
)));
47 return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v
));
49 return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v
));
51 return wine_dbg_sprintf("{VT_UNKNOWN: %p}", V_UNKNOWN(v
));
53 return wine_dbg_sprintf("{VT_UINT: %u}", V_UINT(v
));
54 case VT_BSTR
|VT_BYREF
:
55 return wine_dbg_sprintf("{VT_BSTR|VT_BYREF: ptr %p, data %s}",
56 V_BSTRREF(v
), debugstr_w(V_BSTRREF(v
) ? *V_BSTRREF(v
) : NULL
));
58 return wine_dbg_sprintf("{vt %d}", V_VT(v
));
62 static IWshShell3 WshShell3
;
66 IWshCollection IWshCollection_iface
;
72 IWshShortcut IWshShortcut_iface
;
79 static inline WshCollection
*impl_from_IWshCollection( IWshCollection
*iface
)
81 return CONTAINING_RECORD(iface
, WshCollection
, IWshCollection_iface
);
84 static inline WshShortcut
*impl_from_IWshShortcut( IWshShortcut
*iface
)
86 return CONTAINING_RECORD(iface
, WshShortcut
, IWshShortcut_iface
);
89 static HRESULT WINAPI
WshCollection_QueryInterface(IWshCollection
*iface
, REFIID riid
, void **ppv
)
91 WshCollection
*This
= impl_from_IWshCollection(iface
);
93 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppv
);
95 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
96 IsEqualGUID(riid
, &IID_IDispatch
) ||
97 IsEqualGUID(riid
, &IID_IWshCollection
))
101 FIXME("Unknown iface %s\n", debugstr_guid(riid
));
103 return E_NOINTERFACE
;
106 IUnknown_AddRef((IUnknown
*)*ppv
);
110 static ULONG WINAPI
WshCollection_AddRef(IWshCollection
*iface
)
112 WshCollection
*This
= impl_from_IWshCollection(iface
);
113 LONG ref
= InterlockedIncrement(&This
->ref
);
114 TRACE("(%p) ref = %d\n", This
, ref
);
118 static ULONG WINAPI
WshCollection_Release(IWshCollection
*iface
)
120 WshCollection
*This
= impl_from_IWshCollection(iface
);
121 LONG ref
= InterlockedDecrement(&This
->ref
);
122 TRACE("(%p) ref = %d\n", This
, ref
);
125 HeapFree(GetProcessHeap(), 0, This
);
130 static HRESULT WINAPI
WshCollection_GetTypeInfoCount(IWshCollection
*iface
, UINT
*pctinfo
)
132 WshCollection
*This
= impl_from_IWshCollection(iface
);
133 TRACE("(%p)->(%p)\n", This
, pctinfo
);
138 static HRESULT WINAPI
WshCollection_GetTypeInfo(IWshCollection
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
140 WshCollection
*This
= impl_from_IWshCollection(iface
);
141 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
142 return get_typeinfo(IWshCollection_tid
, ppTInfo
);
145 static HRESULT WINAPI
WshCollection_GetIDsOfNames(IWshCollection
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
146 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
148 WshCollection
*This
= impl_from_IWshCollection(iface
);
152 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
154 hr
= get_typeinfo(IWshCollection_tid
, &typeinfo
);
157 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
158 ITypeInfo_Release(typeinfo
);
164 static HRESULT WINAPI
WshCollection_Invoke(IWshCollection
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
165 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
167 WshCollection
*This
= impl_from_IWshCollection(iface
);
171 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
172 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
174 hr
= get_typeinfo(IWshCollection_tid
, &typeinfo
);
177 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IWshCollection_iface
, dispIdMember
, wFlags
,
178 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
179 ITypeInfo_Release(typeinfo
);
185 static HRESULT WINAPI
WshCollection_Item(IWshCollection
*iface
, VARIANT
*index
, VARIANT
*value
)
187 WshCollection
*This
= impl_from_IWshCollection(iface
);
188 static const WCHAR allusersdesktopW
[] = {'A','l','l','U','s','e','r','s','D','e','s','k','t','o','p',0};
189 static const WCHAR allusersprogramsW
[] = {'A','l','l','U','s','e','r','s','P','r','o','g','r','a','m','s',0};
190 static const WCHAR desktopW
[] = {'D','e','s','k','t','o','p',0};
191 PIDLIST_ABSOLUTE pidl
;
192 WCHAR pathW
[MAX_PATH
];
197 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(index
), value
);
199 if (V_VT(index
) != VT_BSTR
)
201 FIXME("only BSTR index supported, got %d\n", V_VT(index
));
205 folder
= V_BSTR(index
);
206 if (!strcmpiW(folder
, desktopW
))
207 kind
= CSIDL_DESKTOP
;
208 else if (!strcmpiW(folder
, allusersdesktopW
))
209 kind
= CSIDL_COMMON_DESKTOPDIRECTORY
;
210 else if (!strcmpiW(folder
, allusersprogramsW
))
211 kind
= CSIDL_COMMON_PROGRAMS
;
214 FIXME("folder kind %s not supported\n", debugstr_w(folder
));
218 hr
= SHGetSpecialFolderLocation(NULL
, kind
, &pidl
);
219 if (hr
!= S_OK
) return hr
;
221 if (SHGetPathFromIDListW(pidl
, pathW
))
223 V_VT(value
) = VT_BSTR
;
224 V_BSTR(value
) = SysAllocString(pathW
);
225 hr
= V_BSTR(value
) ? S_OK
: E_OUTOFMEMORY
;
235 static HRESULT WINAPI
WshCollection_Count(IWshCollection
*iface
, LONG
*count
)
237 WshCollection
*This
= impl_from_IWshCollection(iface
);
238 FIXME("(%p)->(%p): stub\n", This
, count
);
242 static HRESULT WINAPI
WshCollection_get_length(IWshCollection
*iface
, LONG
*count
)
244 WshCollection
*This
= impl_from_IWshCollection(iface
);
245 FIXME("(%p)->(%p): stub\n", This
, count
);
249 static HRESULT WINAPI
WshCollection__NewEnum(IWshCollection
*iface
, IUnknown
*Enum
)
251 WshCollection
*This
= impl_from_IWshCollection(iface
);
252 FIXME("(%p)->(%p): stub\n", This
, Enum
);
256 static const IWshCollectionVtbl WshCollectionVtbl
= {
257 WshCollection_QueryInterface
,
258 WshCollection_AddRef
,
259 WshCollection_Release
,
260 WshCollection_GetTypeInfoCount
,
261 WshCollection_GetTypeInfo
,
262 WshCollection_GetIDsOfNames
,
263 WshCollection_Invoke
,
266 WshCollection_get_length
,
267 WshCollection__NewEnum
270 static HRESULT
WshCollection_Create(IWshCollection
**collection
)
274 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
275 if (!This
) return E_OUTOFMEMORY
;
277 This
->IWshCollection_iface
.lpVtbl
= &WshCollectionVtbl
;
280 *collection
= &This
->IWshCollection_iface
;
286 static HRESULT WINAPI
WshShortcut_QueryInterface(IWshShortcut
*iface
, REFIID riid
, void **ppv
)
288 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
290 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppv
);
292 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
293 IsEqualGUID(riid
, &IID_IDispatch
) ||
294 IsEqualGUID(riid
, &IID_IWshShortcut
))
298 FIXME("Unknown iface %s\n", debugstr_guid(riid
));
300 return E_NOINTERFACE
;
303 IUnknown_AddRef((IUnknown
*)*ppv
);
307 static ULONG WINAPI
WshShortcut_AddRef(IWshShortcut
*iface
)
309 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
310 LONG ref
= InterlockedIncrement(&This
->ref
);
311 TRACE("(%p) ref = %d\n", This
, ref
);
315 static ULONG WINAPI
WshShortcut_Release(IWshShortcut
*iface
)
317 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
318 LONG ref
= InterlockedDecrement(&This
->ref
);
319 TRACE("(%p) ref = %d\n", This
, ref
);
323 SysFreeString(This
->path_link
);
324 IShellLinkW_Release(This
->link
);
325 HeapFree(GetProcessHeap(), 0, This
);
331 static HRESULT WINAPI
WshShortcut_GetTypeInfoCount(IWshShortcut
*iface
, UINT
*pctinfo
)
333 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
334 TRACE("(%p)->(%p)\n", This
, pctinfo
);
339 static HRESULT WINAPI
WshShortcut_GetTypeInfo(IWshShortcut
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
341 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
342 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
343 return get_typeinfo(IWshShortcut_tid
, ppTInfo
);
346 static HRESULT WINAPI
WshShortcut_GetIDsOfNames(IWshShortcut
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
347 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
349 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
353 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
355 hr
= get_typeinfo(IWshShortcut_tid
, &typeinfo
);
358 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
359 ITypeInfo_Release(typeinfo
);
365 static HRESULT WINAPI
WshShortcut_Invoke(IWshShortcut
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
366 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
368 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
372 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
373 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
375 hr
= get_typeinfo(IWshShortcut_tid
, &typeinfo
);
378 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IWshShortcut_iface
, dispIdMember
, wFlags
,
379 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
380 ITypeInfo_Release(typeinfo
);
386 static HRESULT WINAPI
WshShortcut_get_FullName(IWshShortcut
*iface
, BSTR
*name
)
388 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
389 FIXME("(%p)->(%p): stub\n", This
, name
);
393 static HRESULT WINAPI
WshShortcut_get_Arguments(IWshShortcut
*iface
, BSTR
*Arguments
)
395 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
396 FIXME("(%p)->(%p): stub\n", This
, Arguments
);
400 static HRESULT WINAPI
WshShortcut_put_Arguments(IWshShortcut
*iface
, BSTR Arguments
)
402 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
403 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(Arguments
));
407 static HRESULT WINAPI
WshShortcut_get_Description(IWshShortcut
*iface
, BSTR
*Description
)
409 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
410 FIXME("(%p)->(%p): stub\n", This
, Description
);
414 static HRESULT WINAPI
WshShortcut_put_Description(IWshShortcut
*iface
, BSTR Description
)
416 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
417 TRACE("(%p)->(%s)\n", This
, debugstr_w(Description
));
418 return IShellLinkW_SetDescription(This
->link
, Description
);
421 static HRESULT WINAPI
WshShortcut_get_Hotkey(IWshShortcut
*iface
, BSTR
*Hotkey
)
423 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
424 FIXME("(%p)->(%p): stub\n", This
, Hotkey
);
428 static HRESULT WINAPI
WshShortcut_put_Hotkey(IWshShortcut
*iface
, BSTR Hotkey
)
430 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
431 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(Hotkey
));
435 static HRESULT WINAPI
WshShortcut_get_IconLocation(IWshShortcut
*iface
, BSTR
*IconPath
)
437 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
438 FIXME("(%p)->(%p): stub\n", This
, IconPath
);
442 static HRESULT WINAPI
WshShortcut_put_IconLocation(IWshShortcut
*iface
, BSTR IconPath
)
444 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
445 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(IconPath
));
449 static HRESULT WINAPI
WshShortcut_put_RelativePath(IWshShortcut
*iface
, BSTR rhs
)
451 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
452 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(rhs
));
456 static HRESULT WINAPI
WshShortcut_get_TargetPath(IWshShortcut
*iface
, BSTR
*Path
)
458 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
459 FIXME("(%p)->(%p): stub\n", This
, Path
);
463 static HRESULT WINAPI
WshShortcut_put_TargetPath(IWshShortcut
*iface
, BSTR Path
)
465 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
466 TRACE("(%p)->(%s)\n", This
, debugstr_w(Path
));
467 return IShellLinkW_SetPath(This
->link
, Path
);
470 static HRESULT WINAPI
WshShortcut_get_WindowStyle(IWshShortcut
*iface
, int *ShowCmd
)
472 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
473 TRACE("(%p)->(%p)\n", This
, ShowCmd
);
474 return IShellLinkW_GetShowCmd(This
->link
, ShowCmd
);
477 static HRESULT WINAPI
WshShortcut_put_WindowStyle(IWshShortcut
*iface
, int ShowCmd
)
479 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
480 TRACE("(%p)->(%d)\n", This
, ShowCmd
);
481 return IShellLinkW_SetShowCmd(This
->link
, ShowCmd
);
484 static HRESULT WINAPI
WshShortcut_get_WorkingDirectory(IWshShortcut
*iface
, BSTR
*WorkingDirectory
)
486 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
487 FIXME("(%p)->(%p): stub\n", This
, WorkingDirectory
);
491 static HRESULT WINAPI
WshShortcut_put_WorkingDirectory(IWshShortcut
*iface
, BSTR WorkingDirectory
)
493 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
494 TRACE("(%p)->(%s): stub\n", This
, debugstr_w(WorkingDirectory
));
495 return IShellLinkW_SetWorkingDirectory(This
->link
, WorkingDirectory
);
498 static HRESULT WINAPI
WshShortcut_Load(IWshShortcut
*iface
, BSTR PathLink
)
500 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
501 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(PathLink
));
505 static HRESULT WINAPI
WshShortcut_Save(IWshShortcut
*iface
)
507 WshShortcut
*This
= impl_from_IWshShortcut(iface
);
511 TRACE("(%p)\n", This
);
513 IShellLinkW_QueryInterface(This
->link
, &IID_IPersistFile
, (void**)&file
);
514 hr
= IPersistFile_Save(file
, This
->path_link
, TRUE
);
515 IPersistFile_Release(file
);
520 static const IWshShortcutVtbl WshShortcutVtbl
= {
521 WshShortcut_QueryInterface
,
524 WshShortcut_GetTypeInfoCount
,
525 WshShortcut_GetTypeInfo
,
526 WshShortcut_GetIDsOfNames
,
528 WshShortcut_get_FullName
,
529 WshShortcut_get_Arguments
,
530 WshShortcut_put_Arguments
,
531 WshShortcut_get_Description
,
532 WshShortcut_put_Description
,
533 WshShortcut_get_Hotkey
,
534 WshShortcut_put_Hotkey
,
535 WshShortcut_get_IconLocation
,
536 WshShortcut_put_IconLocation
,
537 WshShortcut_put_RelativePath
,
538 WshShortcut_get_TargetPath
,
539 WshShortcut_put_TargetPath
,
540 WshShortcut_get_WindowStyle
,
541 WshShortcut_put_WindowStyle
,
542 WshShortcut_get_WorkingDirectory
,
543 WshShortcut_put_WorkingDirectory
,
548 static HRESULT
WshShortcut_Create(const WCHAR
*path
, IDispatch
**shortcut
)
555 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
556 if (!This
) return E_OUTOFMEMORY
;
558 This
->IWshShortcut_iface
.lpVtbl
= &WshShortcutVtbl
;
561 hr
= CoCreateInstance(&CLSID_ShellLink
, NULL
, CLSCTX_INPROC_SERVER
,
562 &IID_IShellLinkW
, (void**)&This
->link
);
565 HeapFree(GetProcessHeap(), 0, This
);
569 This
->path_link
= SysAllocString(path
);
570 *shortcut
= (IDispatch
*)&This
->IWshShortcut_iface
;
575 static HRESULT WINAPI
WshShell3_QueryInterface(IWshShell3
*iface
, REFIID riid
, void **ppv
)
577 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppv
);
579 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
580 IsEqualGUID(riid
, &IID_IDispatch
) ||
581 IsEqualGUID(riid
, &IID_IWshShell3
))
585 FIXME("Unknown iface %s\n", debugstr_guid(riid
));
587 return E_NOINTERFACE
;
590 IWshShell3_AddRef(iface
);
594 static ULONG WINAPI
WshShell3_AddRef(IWshShell3
*iface
)
600 static ULONG WINAPI
WshShell3_Release(IWshShell3
*iface
)
606 static HRESULT WINAPI
WshShell3_GetTypeInfoCount(IWshShell3
*iface
, UINT
*pctinfo
)
608 TRACE("(%p)\n", pctinfo
);
613 static HRESULT WINAPI
WshShell3_GetTypeInfo(IWshShell3
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
615 TRACE("(%u %u %p)\n", iTInfo
, lcid
, ppTInfo
);
616 return get_typeinfo(IWshShell3_tid
, ppTInfo
);
619 static HRESULT WINAPI
WshShell3_GetIDsOfNames(IWshShell3
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
620 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
625 TRACE("(%s %p %u %u %p)\n", debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
627 hr
= get_typeinfo(IWshShell3_tid
, &typeinfo
);
630 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
631 ITypeInfo_Release(typeinfo
);
637 static HRESULT WINAPI
WshShell3_Invoke(IWshShell3
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
638 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
643 TRACE("(%d %s %d %d %p %p %p %p)\n", dispIdMember
, debugstr_guid(riid
),
644 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
646 hr
= get_typeinfo(IWshShell3_tid
, &typeinfo
);
649 hr
= ITypeInfo_Invoke(typeinfo
, &WshShell3
, dispIdMember
, wFlags
,
650 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
651 ITypeInfo_Release(typeinfo
);
657 static HRESULT WINAPI
WshShell3_get_SpecialFolders(IWshShell3
*iface
, IWshCollection
**folders
)
659 TRACE("(%p)\n", folders
);
660 return WshCollection_Create(folders
);
663 static HRESULT WINAPI
WshShell3_get_Environment(IWshShell3
*iface
, VARIANT
*Type
, IWshEnvironment
**out_Env
)
665 FIXME("(%p %p): stub\n", Type
, out_Env
);
669 static HRESULT WINAPI
WshShell3_Run(IWshShell3
*iface
, BSTR cmd
, VARIANT
*style
, VARIANT
*WaitOnReturn
, int *exit_code
)
671 SHELLEXECUTEINFOW info
;
676 TRACE("(%s %s %s %p)\n", debugstr_w(cmd
), debugstr_variant(style
), debugstr_variant(WaitOnReturn
), exit_code
);
679 hr
= VariantChangeType(&s
, style
, 0, VT_I4
);
682 ERR("failed to convert style argument, 0x%08x\n", hr
);
687 hr
= VariantChangeType(&w
, WaitOnReturn
, 0, VT_I4
);
690 ERR("failed to convert wait argument, 0x%08x\n", hr
);
694 memset(&info
, 0, sizeof(info
));
695 info
.cbSize
= sizeof(info
);
697 waitforprocess
= V_I4(&w
);
699 info
.fMask
= waitforprocess
? SEE_MASK_NOASYNC
| SEE_MASK_NOCLOSEPROCESS
: SEE_MASK_DEFAULT
;
701 info
.nShow
= V_I4(&s
);
703 if (!ShellExecuteExW(&info
))
705 TRACE("ShellExecute failed, %d\n", GetLastError());
706 return HRESULT_FROM_WIN32(GetLastError());
715 GetExitCodeProcess(info
.hProcess
, &code
);
718 CloseHandle(info
.hProcess
);
721 if (exit_code
) *exit_code
= 0;
727 static HRESULT WINAPI
WshShell3_Popup(IWshShell3
*iface
, BSTR Text
, VARIANT
* SecondsToWait
, VARIANT
*Title
, VARIANT
*Type
, int *button
)
729 FIXME("(%s %s %s %s %p): stub\n", debugstr_w(Text
), debugstr_variant(SecondsToWait
),
730 debugstr_variant(Title
), debugstr_variant(Type
), button
);
734 static HRESULT WINAPI
WshShell3_CreateShortcut(IWshShell3
*iface
, BSTR PathLink
, IDispatch
** Shortcut
)
736 TRACE("(%s %p)\n", debugstr_w(PathLink
), Shortcut
);
737 return WshShortcut_Create(PathLink
, Shortcut
);
740 static HRESULT WINAPI
WshShell3_ExpandEnvironmentStrings(IWshShell3
*iface
, BSTR Src
, BSTR
* out_Dst
)
742 FIXME("(%s %p): stub\n", debugstr_w(Src
), out_Dst
);
746 static HRESULT WINAPI
WshShell3_RegRead(IWshShell3
*iface
, BSTR Name
, VARIANT
* out_Value
)
748 FIXME("(%s %p): stub\n", debugstr_w(Name
), out_Value
);
752 static HRESULT WINAPI
WshShell3_RegWrite(IWshShell3
*iface
, BSTR Name
, VARIANT
*Value
, VARIANT
*Type
)
754 FIXME("(%s %s %s): stub\n", debugstr_w(Name
), debugstr_variant(Value
), debugstr_variant(Type
));
758 static HRESULT WINAPI
WshShell3_RegDelete(IWshShell3
*iface
, BSTR Name
)
760 FIXME("(%s): stub\n", debugstr_w(Name
));
764 static HRESULT WINAPI
WshShell3_LogEvent(IWshShell3
*iface
, VARIANT
*Type
, BSTR Message
, BSTR Target
, VARIANT_BOOL
*out_Success
)
766 FIXME("(%s %s %s %p): stub\n", debugstr_variant(Type
), debugstr_w(Message
), debugstr_w(Target
), out_Success
);
770 static HRESULT WINAPI
WshShell3_AppActivate(IWshShell3
*iface
, VARIANT
*App
, VARIANT
*Wait
, VARIANT_BOOL
*out_Success
)
772 FIXME("(%s %s %p): stub\n", debugstr_variant(App
), debugstr_variant(Wait
), out_Success
);
776 static HRESULT WINAPI
WshShell3_SendKeys(IWshShell3
*iface
, BSTR Keys
, VARIANT
*Wait
)
778 FIXME("(%s %p): stub\n", debugstr_w(Keys
), Wait
);
782 static const IWshShell3Vtbl WshShell3Vtbl
= {
783 WshShell3_QueryInterface
,
786 WshShell3_GetTypeInfoCount
,
787 WshShell3_GetTypeInfo
,
788 WshShell3_GetIDsOfNames
,
790 WshShell3_get_SpecialFolders
,
791 WshShell3_get_Environment
,
794 WshShell3_CreateShortcut
,
795 WshShell3_ExpandEnvironmentStrings
,
800 WshShell3_AppActivate
,
804 static IWshShell3 WshShell3
= { &WshShell3Vtbl
};
806 HRESULT WINAPI
WshShellFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
808 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
810 return IWshShell3_QueryInterface(&WshShell3
, riid
, ppv
);