Commit 23fe903d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wshom.ocx: Added IWshShortcut stub.

parent 7f2d4f29
...@@ -66,11 +66,22 @@ typedef struct ...@@ -66,11 +66,22 @@ typedef struct
LONG ref; LONG ref;
} WshCollection; } WshCollection;
typedef struct
{
IWshShortcut IWshShortcut_iface;
LONG ref;
} WshShortcut;
static inline WshCollection *impl_from_IWshCollection( IWshCollection *iface ) static inline WshCollection *impl_from_IWshCollection( IWshCollection *iface )
{ {
return CONTAINING_RECORD(iface, WshCollection, IWshCollection_iface); return CONTAINING_RECORD(iface, WshCollection, IWshCollection_iface);
} }
static inline WshShortcut *impl_from_IWshShortcut( IWshShortcut *iface )
{
return CONTAINING_RECORD(iface, WshShortcut, IWshShortcut_iface);
}
static HRESULT WINAPI WshCollection_QueryInterface(IWshCollection *iface, REFIID riid, void **ppv) static HRESULT WINAPI WshCollection_QueryInterface(IWshCollection *iface, REFIID riid, void **ppv)
{ {
WshCollection *This = impl_from_IWshCollection(iface); WshCollection *This = impl_from_IWshCollection(iface);
...@@ -267,11 +278,277 @@ static HRESULT WshCollection_Create(IWshCollection **collection) ...@@ -267,11 +278,277 @@ static HRESULT WshCollection_Create(IWshCollection **collection)
return S_OK; return S_OK;
} }
/* IWshShortcut */
static HRESULT WINAPI WshShortcut_QueryInterface(IWshShortcut *iface, REFIID riid, void **ppv)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDispatch) ||
IsEqualGUID(riid, &IID_IWshShortcut))
{
*ppv = iface;
}else {
FIXME("Unknown iface %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI WshShortcut_AddRef(IWshShortcut *iface)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref = %d\n", This, ref);
return ref;
}
static ULONG WINAPI WshShortcut_Release(IWshShortcut *iface)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref = %d\n", This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI WshShortcut_GetTypeInfoCount(IWshShortcut *iface, UINT *pctinfo)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
}
static HRESULT WINAPI WshShortcut_GetTypeInfo(IWshShortcut *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return get_typeinfo(IWshShortcut_tid, ppTInfo);
}
static HRESULT WINAPI WshShortcut_GetIDsOfNames(IWshShortcut *iface, REFIID riid, LPOLESTR *rgszNames,
UINT cNames, LCID lcid, DISPID *rgDispId)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
hr = get_typeinfo(IWshShortcut_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI WshShortcut_Invoke(IWshShortcut *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IWshShortcut_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IWshShortcut_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI WshShortcut_get_FullName(IWshShortcut *iface, BSTR *name)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, name);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_Arguments(IWshShortcut *iface, BSTR *Arguments)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, Arguments);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_Arguments(IWshShortcut *iface, BSTR Arguments)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(Arguments));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_Description(IWshShortcut *iface, BSTR *Description)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, Description);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_Description(IWshShortcut *iface, BSTR Description)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(Description));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_Hotkey(IWshShortcut *iface, BSTR *Hotkey)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, Hotkey);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_Hotkey(IWshShortcut *iface, BSTR Hotkey)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(Hotkey));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *IconPath)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, IconPath);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_IconLocation(IWshShortcut *iface, BSTR IconPath)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(IconPath));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_RelativePath(IWshShortcut *iface, BSTR rhs)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(rhs));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_TargetPath(IWshShortcut *iface, BSTR *Path)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, Path);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_TargetPath(IWshShortcut *iface, BSTR Path)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(Path));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_WindowStyle(IWshShortcut *iface, int *ShowCmd)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, ShowCmd);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_WindowStyle(IWshShortcut *iface, int ShowCmd)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%d): stub\n", This, ShowCmd);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_get_WorkingDirectory(IWshShortcut *iface, BSTR *WorkingDirectory)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%p): stub\n", This, WorkingDirectory);
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_put_WorkingDirectory(IWshShortcut *iface, BSTR WorkingDirectory)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(WorkingDirectory));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_Load(IWshShortcut *iface, BSTR PathLink)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_w(PathLink));
return E_NOTIMPL;
}
static HRESULT WINAPI WshShortcut_Save(IWshShortcut *iface)
{
WshShortcut *This = impl_from_IWshShortcut(iface);
FIXME("(%p): stub\n", This);
return E_NOTIMPL;
}
static const IWshShortcutVtbl WshShortcutVtbl = {
WshShortcut_QueryInterface,
WshShortcut_AddRef,
WshShortcut_Release,
WshShortcut_GetTypeInfoCount,
WshShortcut_GetTypeInfo,
WshShortcut_GetIDsOfNames,
WshShortcut_Invoke,
WshShortcut_get_FullName,
WshShortcut_get_Arguments,
WshShortcut_put_Arguments,
WshShortcut_get_Description,
WshShortcut_put_Description,
WshShortcut_get_Hotkey,
WshShortcut_put_Hotkey,
WshShortcut_get_IconLocation,
WshShortcut_put_IconLocation,
WshShortcut_put_RelativePath,
WshShortcut_get_TargetPath,
WshShortcut_put_TargetPath,
WshShortcut_get_WindowStyle,
WshShortcut_put_WindowStyle,
WshShortcut_get_WorkingDirectory,
WshShortcut_put_WorkingDirectory,
WshShortcut_Load,
WshShortcut_Save
};
static HRESULT WshShortcut_Create(IDispatch **shortcut)
{
WshShortcut *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
This->ref = 1;
*shortcut = (IDispatch*)&This->IWshShortcut_iface;
return S_OK;
}
static HRESULT WINAPI WshShell3_QueryInterface(IWshShell3 *iface, REFIID riid, void **ppv) static HRESULT WINAPI WshShell3_QueryInterface(IWshShell3 *iface, REFIID riid, void **ppv)
{ {
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv); TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
if(IsEqualGUID(riid, &IID_IUnknown) || if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IDispatch) ||
IsEqualGUID(riid, &IID_IWshShell3)) IsEqualGUID(riid, &IID_IWshShell3))
{ {
...@@ -374,10 +651,10 @@ static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR Text, VARIANT* Sec ...@@ -374,10 +651,10 @@ static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR Text, VARIANT* Sec
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI WshShell3_CreateShortcut(IWshShell3 *iface, BSTR PathLink, IDispatch** out_Shortcut) static HRESULT WINAPI WshShell3_CreateShortcut(IWshShell3 *iface, BSTR PathLink, IDispatch** Shortcut)
{ {
FIXME("(%s %p): stub\n", debugstr_w(PathLink), out_Shortcut); TRACE("(%s %p)\n", debugstr_w(PathLink), Shortcut);
return E_NOTIMPL; return WshShortcut_Create(Shortcut);
} }
static HRESULT WINAPI WshShell3_ExpandEnvironmentStrings(IWshShell3 *iface, BSTR Src, BSTR* out_Dst) static HRESULT WINAPI WshShell3_ExpandEnvironmentStrings(IWshShell3 *iface, BSTR Src, BSTR* out_Dst)
......
...@@ -34,11 +34,12 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); ...@@ -34,11 +34,12 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static void test_wshshell(void) static void test_wshshell(void)
{ {
static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0};
static const WCHAR lnk1W[] = {'f','i','l','e','.','l','n','k',0};
IWshShell3 *sh3; IWshShell3 *sh3;
IDispatchEx *dispex; IDispatchEx *dispex;
IWshCollection *coll; IWshCollection *coll;
IDispatch *disp; IDispatch *disp, *shortcut;
IUnknown *shell; IUnknown *shell, *unk;
IFolderCollection *folders; IFolderCollection *folders;
ITypeInfo *ti; ITypeInfo *ti;
HRESULT hr; HRESULT hr;
...@@ -98,10 +99,20 @@ static void test_wshshell(void) ...@@ -98,10 +99,20 @@ static void test_wshshell(void)
V_VT(&res) = VT_EMPTY; V_VT(&res) = VT_EMPTY;
hr = IWshCollection_Item(coll, &arg, &res); hr = IWshCollection_Item(coll, &arg, &res);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
SysFreeString(str);
ok(V_VT(&res) == VT_BSTR, "got res type %d\n", V_VT(&res)); ok(V_VT(&res) == VT_BSTR, "got res type %d\n", V_VT(&res));
SysFreeString(str);
VariantClear(&res); VariantClear(&res);
/* CreateShortcut() */
str = SysAllocString(lnk1W);
hr = IWshShell3_CreateShortcut(sh3, str, &shortcut);
EXPECT_HR(hr, S_OK);
SysFreeString(str);
hr = IDispatch_QueryInterface(shortcut, &IID_IWshShortcut, (void**)&unk);
EXPECT_HR(hr, S_OK);
IUnknown_Release(unk);
IDispatch_Release(shortcut);
IWshCollection_Release(coll); IWshCollection_Release(coll);
IDispatch_Release(disp); IDispatch_Release(disp);
IWshShell3_Release(sh3); IWshShell3_Release(sh3);
......
...@@ -444,6 +444,68 @@ library IWshRuntimeLibrary ...@@ -444,6 +444,68 @@ library IWshRuntimeLibrary
}; };
[ [
uuid(f935dc23-1cf0-11d0-adb9-00c04fd58a0b),
odl,
dual,
oleautomation
]
interface IWshShortcut : IDispatch {
[id(DISPID_VALUE), propget]
HRESULT FullName([out, retval] BSTR* name);
[id(0x03e8), propget]
HRESULT Arguments([out, retval] BSTR* Arguments);
[id(0x03e8), propput]
HRESULT Arguments([in] BSTR Arguments);
[id(0x03e9), propget]
HRESULT Description([out, retval] BSTR* Description);
[id(0x03e9), propput]
HRESULT Description([in] BSTR Description);
[id(0x03ea), propget]
HRESULT Hotkey([out, retval] BSTR* HotKey);
[id(0x03ea), propput]
HRESULT Hotkey([in] BSTR HotKey);
[id(0x03eb), propget]
HRESULT IconLocation([out, retval] BSTR* IconPath);
[id(0x03eb), propput]
HRESULT IconLocation([in] BSTR IconPath);
[id(0x03ec), propput]
HRESULT RelativePath([in] BSTR rhs);
[id(0x03ed), propget]
HRESULT TargetPath([out, retval] BSTR* Path);
[id(0x03ed), propput]
HRESULT TargetPath([in] BSTR Path);
[id(0x03ee), propget]
HRESULT WindowStyle([out, retval] int* ShowCmd);
[id(0x03ee), propput]
HRESULT WindowStyle([in] int ShowCmd);
[id(0x03ef), propget]
HRESULT WorkingDirectory([out, retval] BSTR* WorkingDirectory);
[id(0x03ef), propput]
HRESULT WorkingDirectory([in] BSTR WorkingDirectory);
[id(0x07d0), hidden]
HRESULT Load([in] BSTR PathLink);
[id(0x07d1)]
HRESULT Save();
};
[
uuid(f935dc21-1cf0-11d0-adb9-00c04fd58a0b), uuid(f935dc21-1cf0-11d0-adb9-00c04fd58a0b),
odl, odl,
dual, dual,
......
...@@ -444,6 +444,68 @@ library IWshRuntimeLibrary ...@@ -444,6 +444,68 @@ library IWshRuntimeLibrary
}; };
[ [
uuid(f935dc23-1cf0-11d0-adb9-00c04fd58a0b),
odl,
dual,
oleautomation
]
interface IWshShortcut : IDispatch {
[id(DISPID_VALUE), propget]
HRESULT FullName([out, retval] BSTR* name);
[id(0x03e8), propget]
HRESULT Arguments([out, retval] BSTR* Arguments);
[id(0x03e8), propput]
HRESULT Arguments([in] BSTR Arguments);
[id(0x03e9), propget]
HRESULT Description([out, retval] BSTR* Description);
[id(0x03e9), propput]
HRESULT Description([in] BSTR Description);
[id(0x03ea), propget]
HRESULT Hotkey([out, retval] BSTR* HotKey);
[id(0x03ea), propput]
HRESULT Hotkey([in] BSTR HotKey);
[id(0x03eb), propget]
HRESULT IconLocation([out, retval] BSTR* IconPath);
[id(0x03eb), propput]
HRESULT IconLocation([in] BSTR IconPath);
[id(0x03ec), propput]
HRESULT RelativePath([in] BSTR rhs);
[id(0x03ed), propget]
HRESULT TargetPath([out, retval] BSTR* Path);
[id(0x03ed), propput]
HRESULT TargetPath([in] BSTR Path);
[id(0x03ee), propget]
HRESULT WindowStyle([out, retval] int* ShowCmd);
[id(0x03ee), propput]
HRESULT WindowStyle([in] int ShowCmd);
[id(0x03ef), propget]
HRESULT WorkingDirectory([out, retval] BSTR* WorkingDirectory);
[id(0x03ef), propput]
HRESULT WorkingDirectory([in] BSTR WorkingDirectory);
[id(0x07d0), hidden]
HRESULT Load([in] BSTR PathLink);
[id(0x07d1)]
HRESULT Save();
};
[
uuid(f935dc21-1cf0-11d0-adb9-00c04fd58a0b), uuid(f935dc21-1cf0-11d0-adb9-00c04fd58a0b),
odl, odl,
dual, dual,
......
...@@ -34,7 +34,8 @@ static ITypeInfo *typeinfos[LAST_tid]; ...@@ -34,7 +34,8 @@ static ITypeInfo *typeinfos[LAST_tid];
static REFIID tid_ids[] = { static REFIID tid_ids[] = {
&IID_NULL, &IID_NULL,
&IID_IWshShell3, &IID_IWshShell3,
&IID_IWshCollection &IID_IWshCollection,
&IID_IWshShortcut
}; };
static HRESULT load_typelib(void) static HRESULT load_typelib(void)
......
...@@ -29,6 +29,7 @@ typedef enum tid_t { ...@@ -29,6 +29,7 @@ typedef enum tid_t {
NULL_tid, NULL_tid,
IWshShell3_tid, IWshShell3_tid,
IWshCollection_tid, IWshCollection_tid,
IWshShortcut_tid,
LAST_tid LAST_tid
} tid_t; } tid_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment