From b4800237522c9553c23f420531990428d921b924 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 6 Jun 2016 12:45:54 +0300 Subject: [PATCH] msscript: Added IOleObject stub. Signed-off-by: Nikolay Sivov Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- configure | 1 + configure.ac | 1 + dlls/msscript.ocx/msscript.c | 246 +++++++++++++++++++++ dlls/msscript.ocx/tests/Makefile.in | 7 + dlls/msscript.ocx/tests/msscript.c | 58 +++++ dlls/msscript.ocx/tests/msscript.idl | 306 +++++++++++++++++++++++++++ 6 files changed, 619 insertions(+) create mode 100644 dlls/msscript.ocx/tests/Makefile.in create mode 100644 dlls/msscript.ocx/tests/msscript.c create mode 100644 dlls/msscript.ocx/tests/msscript.idl diff --git a/configure b/configure index 432e501fd43..9c4b81d1524 100755 --- a/configure +++ b/configure @@ -17833,6 +17833,7 @@ wine_fn_config_dll mspatcha enable_mspatcha implib wine_fn_config_dll msrle32 enable_msrle32 clean wine_fn_config_test dlls/msrle32/tests msrle32_test wine_fn_config_dll msscript.ocx enable_msscript_ocx clean +wine_fn_config_test dlls/msscript.ocx/tests msscript.ocx_test clean wine_fn_config_dll mssign32 enable_mssign32 wine_fn_config_dll mssip32 enable_mssip32 wine_fn_config_dll mstask enable_mstask clean diff --git a/configure.ac b/configure.ac index bf3fb1f6ebe..6f0cd70c2fd 100644 --- a/configure.ac +++ b/configure.ac @@ -3079,6 +3079,7 @@ WINE_CONFIG_DLL(mspatcha,,[implib]) WINE_CONFIG_DLL(msrle32,,[clean]) WINE_CONFIG_TEST(dlls/msrle32/tests) WINE_CONFIG_DLL(msscript.ocx,,[clean]) +WINE_CONFIG_TEST(dlls/msscript.ocx/tests,[clean]) WINE_CONFIG_DLL(mssign32) WINE_CONFIG_DLL(mssip32) WINE_CONFIG_DLL(mstask,,[clean]) diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index b4e933172b8..188980e4959 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msscript); struct ScriptControl { IScriptControl IScriptControl_iface; + IOleObject IOleObject_iface; LONG ref; }; @@ -119,6 +120,11 @@ static inline ScriptControl *impl_from_IScriptControl(IScriptControl *iface) return CONTAINING_RECORD(iface, ScriptControl, IScriptControl_iface); } +static inline ScriptControl *impl_from_IOleObject(IOleObject *iface) +{ + return CONTAINING_RECORD(iface, ScriptControl, IOleObject_iface); +} + static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID riid, void **ppv) { ScriptControl *This = impl_from_IScriptControl(iface); @@ -132,6 +138,9 @@ static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID }else if(IsEqualGUID(&IID_IScriptControl, riid)) { TRACE("(%p)->(IID_IScriptControl %p)\n", This, ppv); *ppv = &This->IScriptControl_iface; + }else if(IsEqualGUID(&IID_IOleObject, riid)) { + TRACE("(%p)->(IID_IOleObject %p\n", This, ppv); + *ppv = &This->IOleObject_iface; }else { FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; @@ -414,6 +423,242 @@ static const IScriptControlVtbl ScriptControlVtbl = { ScriptControl_Run }; +static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **obj) +{ + ScriptControl *This = impl_from_IOleObject(iface); + return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj); +} + +static ULONG WINAPI OleObject_AddRef(IOleObject *iface) +{ + ScriptControl *This = impl_from_IOleObject(iface); + return IScriptControl_AddRef(&This->IScriptControl_iface); +} + +static ULONG WINAPI OleObject_Release(IOleObject *iface) +{ + ScriptControl *This = impl_from_IOleObject(iface); + return IScriptControl_Release(&This->IScriptControl_iface); +} + +static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *site) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, site); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **site) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, site); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerobj) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%s %s)\n", This, debugstr_w(containerapp), debugstr_w(containerobj)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD save) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d)\n", This, save); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD which, IMoniker *moniker) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, which, moniker); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD assign, DWORD which, IMoniker **moniker) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %d %p)\n", This, assign, which, moniker); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *dataobj, BOOL creation, + DWORD reserved) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p %d %d)\n", This, dataobj, creation, reserved); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD reserved, IDataObject **dataobj) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, reserved, dataobj); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG verb, LPMSG msg, IOleClientSite *active_site, + LONG index, HWND hwndParent, LPCRECT rect) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p %p %d %p %p)\n", This, verb, msg, active_site, index, hwndParent, rect); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **enumoleverb) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, enumoleverb); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Update(IOleObject *iface) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *clsid) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, clsid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD form_of_type, LPOLESTR *usertype) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, form_of_type, usertype); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD aspect, SIZEL *size) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, aspect, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL *size) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, aspect, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p %p)\n", This, sink, connection); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD connection) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d)\n", This, connection); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **enumadvise) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, enumadvise); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD aspect, DWORD *status) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%d %p)\n", This, aspect, status); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *logpal) +{ + ScriptControl *This = impl_from_IOleObject(iface); + + FIXME("(%p)->(%p)\n", This, logpal); + + return E_NOTIMPL; +} + +static const IOleObjectVtbl OleObjectVtbl = { + OleObject_QueryInterface, + OleObject_AddRef, + OleObject_Release, + OleObject_SetClientSite, + OleObject_GetClientSite, + OleObject_SetHostNames, + OleObject_Close, + OleObject_SetMoniker, + OleObject_GetMoniker, + OleObject_InitFromData, + OleObject_GetClipboardData, + OleObject_DoVerb, + OleObject_EnumVerbs, + OleObject_Update, + OleObject_IsUpToDate, + OleObject_GetUserClassID, + OleObject_GetUserType, + OleObject_SetExtent, + OleObject_GetExtent, + OleObject_Advise, + OleObject_Unadvise, + OleObject_EnumAdvise, + OleObject_GetMiscStatus, + OleObject_SetColorScheme +}; + static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv) { ScriptControl *script_control; @@ -426,6 +671,7 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow return E_OUTOFMEMORY; script_control->IScriptControl_iface.lpVtbl = &ScriptControlVtbl; + script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl; script_control->ref = 1; hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv); diff --git a/dlls/msscript.ocx/tests/Makefile.in b/dlls/msscript.ocx/tests/Makefile.in new file mode 100644 index 00000000000..597214ac735 --- /dev/null +++ b/dlls/msscript.ocx/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = msscript.ocx +IMPORTS = ole32 + +C_SRCS = \ + msscript.c + +IDL_SRCS = msscript.idl diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c new file mode 100644 index 00000000000..89ce1ec806d --- /dev/null +++ b/dlls/msscript.ocx/tests/msscript.c @@ -0,0 +1,58 @@ +/* + * Copyright 2016 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#define CONST_VTABLE + +#include +#include + +#include "msscript.h" +#include "wine/test.h" + +static void test_oleobject(void) +{ + IOleObject *obj; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + &IID_IOleObject, (void**)&obj); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IOleObject_Release(obj); +} + +START_TEST(msscript) +{ + IUnknown *unk; + HRESULT hr; + + CoInitialize(NULL); + + hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + &IID_IUnknown, (void**)&unk); + if (FAILED(hr)) { + win_skip("Could not create ScriptControl object: %08x\n", hr); + return; + } + IUnknown_Release(unk); + + test_oleobject(); + + CoUninitialize(); +} diff --git a/dlls/msscript.ocx/tests/msscript.idl b/dlls/msscript.ocx/tests/msscript.idl new file mode 100644 index 00000000000..f90219dda8a --- /dev/null +++ b/dlls/msscript.ocx/tests/msscript.idl @@ -0,0 +1,306 @@ +/* + * Copyright 2015 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep + +import "oaidl.idl"; + +[ + helpstring("Microsoft Script Control 1.0"), + uuid(0e59f1d2-1fbe-11d0-8ff2-00a0d10038bc), + version(1.0) +] +library MSScriptControl +{ + importlib("stdole2.tlb"); + + typedef enum { + Initialized = 0, + Connected = 1 + } ScriptControlStates; + + [ + dual, + uuid(70841c73-067d-11d0-95d8-00a02463ab28), + odl, + hidden, + nonextensible, + oleautomation + ] + interface IScriptProcedure : IDispatch { + [id(DISPID_VALUE), propget] + HRESULT Name([out, retval] BSTR *pbstrName); + + [id(0x0064), propget] + HRESULT NumArgs([out, retval] long *pcArgs); + + [id(0x0065), propget] + HRESULT HasReturnValue([out, retval] VARIANT_BOOL *pfHasReturnValue); + } + + [ + dual, + uuid(70841c71-067d-11d0-95d8-00a02463ab28), + odl, + hidden, + nonextensible, + oleautomation + ] + interface IScriptProcedureCollection : IDispatch { + [id(DISPID_NEWENUM), propget] + HRESULT _NewEnum([out, retval] IUnknown *ppenumProcedures); + + [id(DISPID_VALUE), propget] + HRESULT Item( + [in] VARIANT Index, + [out, retval] IScriptProcedure **ppdispProcedure); + + [id(1), propget] + HRESULT Count([out, retval] long *plCount); + } + + [ + dual, + uuid(70841c70-067d-11d0-95d8-00a02463ab28), + odl, + hidden, + nonextensible, + oleautomation + ] + interface IScriptModule : IDispatch { + [id(DISPID_VALUE), propget] + HRESULT Name([out, retval] BSTR *pbstrName); + + [id(0x03e8), propget] + HRESULT CodeObject([out, retval] IDispatch *ppdispObject); + + [id(0x03e9), propget] + HRESULT Procedures([out, retval] IScriptProcedureCollection **ppdispProcedures); + + [id(0x07d0)] + HRESULT AddCode([in] BSTR Code); + + [id(0x07d1)] + HRESULT Eval( + [in] BSTR Expression, + [out, retval] VARIANT *pvarResult); + + [id(0x07d2)] + HRESULT ExecuteStatement([in] BSTR Statement); + + [id(0x07d3), vararg] + HRESULT Run( + [in] BSTR ProcedureName, + [in] SAFEARRAY(VARIANT) *Parameters, + [out, retval] VARIANT *pvarResult); + } + + [ + dual, + uuid(70841c6f-067d-11d0-95d8-00a02463ab28), + odl, + hidden, + nonextensible, + oleautomation + ] + interface IScriptModuleCollection : IDispatch { + [id(DISPID_NEWENUM), propget] + HRESULT _NewEnum([out, retval] IUnknown *ppenumContexts); + + [id(DISPID_VALUE), propget] + HRESULT Item( + [in] VARIANT Index, + [out, retval] IScriptModule **ppmod); + + [id(1), propget] + HRESULT Count([out, retval] long *plCount); + + [id(2)] + HRESULT Add( + [in] BSTR Name, + [in, optional] VARIANT *Object, + [out, retval] IScriptModule **ppmod); + } + + [ + dual, + uuid(70841c78-067d-11d0-95d8-00a02463ab28), + odl, + helpstring("Provides access to scripting error information"), + helpcontext(0x00113eb6), + hidden, + nonextensible, + oleautomation + ] + interface IScriptError : IDispatch { + [id(0x00c9), propget] + HRESULT Number([out, retval] long *plNumber); + + [id(0x00ca), propget] + HRESULT Source([out, retval] BSTR *pbstrSource); + + [id(0x00cb), propget] + HRESULT Description([out, retval] BSTR *pbstrDescription); + + [id(0x00cc), propget] + HRESULT HelpFile([out, retval] BSTR *pbstrHelpFile); + + [id(0x00cd), propget] + HRESULT HelpContext([out, retval] long *plHelpContext); + + [id(0xfffffdfb), propget] + HRESULT Text([out, retval] BSTR *pbstrText); + + [id(0x00ce), propget] + HRESULT Line([out, retval] long *plLine); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long *plColumn); + + [id(0x00d0)] + HRESULT Clear(); + } + + [ + dual, + uuid(0e59f1d3-1fbe-11d0-8ff2-00a0d10038bc), + odl, + hidden, + nonextensible, + oleautomation + ] + interface IScriptControl : IDispatch { + [id(0x05dc), propget] HRESULT Language([out, retval] BSTR *pbstrLanguage); + [id(0x05dc), propput] HRESULT Language([in] BSTR pbstrLanguage); + + [id(0x05dd), propget] HRESULT State([out, retval] ScriptControlStates *pssState); + [id(0x05dd), propput] HRESULT State([in] ScriptControlStates pssState); + + [id(0x05de), propput] HRESULT SitehWnd([in] long rhs); + [id(0x05de), propget] HRESULT SitehWnd([out, retval] long *rhs); + + [id(0x05df), propget] HRESULT Timeout([out, retval] long *plMilleseconds); + [id(0x05df), propput] HRESULT Timeout([in] long plMilleseconds); + + [id(0x05e0), propget] HRESULT AllowUI([out, retval] VARIANT_BOOL *pfAllowUI); + [id(0x05e0), propput] HRESULT AllowUI([in] VARIANT_BOOL pfAllowUI); + + [id(0x05e1), propget] HRESULT UseSafeSubset([out, retval] VARIANT_BOOL *pfUseSafeSubset); + [id(0x05e1), propput] HRESULT UseSafeSubset([in] VARIANT_BOOL pfUseSafeSubset); + + [id(0x05e2), propget] HRESULT Modules([out, retval] IScriptModuleCollection **ppmods); + + [id(0x05e3), propget] HRESULT Error([out, retval] IScriptError **ppse); + + [id(0x03e8), propget] HRESULT CodeObject([out, retval] IDispatch **ppdispObject); + + [id(0x03e9), propget] HRESULT Procedures([out, retval] IScriptProcedureCollection **ppdispProcedures); + + [id(0xfffffdd8)] + HRESULT _AboutBox(); + + [id(0x09c4)] + HRESULT AddObject( + [in] BSTR Name, + [in] IDispatch *Object, + [in, optional, defaultvalue(0)] VARIANT_BOOL AddMembers); + + [id(0x09c5)] + HRESULT Reset(); + + [id(0x07d0)] + HRESULT AddCode([in] BSTR Code); + + [id(0x07d1)] + HRESULT Eval( + [in] BSTR Expression, + [out, retval] VARIANT *pvarResult); + + [id(0x07d2)] + HRESULT ExecuteStatement([in] BSTR Statement); + + [id(0x07d3), vararg] + HRESULT Run( + [in] BSTR ProcedureName, + [in] SAFEARRAY(VARIANT) *Parameters, + [out, retval] VARIANT *pvarResult); + } + + [ + uuid(8b167d60-8605-11d0-abcb-00a0c90fffc0), + hidden + ] + dispinterface DScriptControlSource { + properties: + methods: + [id(0x0bb8)] void Error(); + [id(0x0bb9)] void Timeout(); + } + + [ + uuid(0e59f1da-1fbe-11d0-8ff2-00a0d10038bc), + noncreatable + ] + coclass Procedure { + [default] interface IScriptProcedure; + } + + [ + uuid(0e59f1db-1fbe-11d0-8ff2-00a0d10038bc), + noncreatable + ] + coclass Procedures { + [default] interface IScriptProcedureCollection; + } + + [ + uuid(0e59f1dc-1fbe-11d0-8ff2-00a0d10038bc), + noncreatable + ] + coclass Module { + [default] interface IScriptModule; + } + + [ + uuid(0e59f1dd-1fbe-11d0-8ff2-00a0d10038bc), + noncreatable + ] + coclass Modules { + [default] interface IScriptModuleCollection; + } + + [ + uuid(0e59f1de-1fbe-11d0-8ff2-00a0d10038bc), + noncreatable + ] + coclass Error { + [default] interface IScriptError; + } + + [ + helpstring("ScriptControl Object"), + uuid(0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc), + threading(apartment), + progid("MSScriptControl.ScriptControl.1"), + vi_progid("MSScriptControl.ScriptControl") + ] + coclass ScriptControl { + [default] interface IScriptControl; + [default, source] dispinterface DScriptControlSource; + } +}