msscript: Added IPersistStreamInit stub.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-06-08 07:47:26 +03:00 committed by Alexandre Julliard
parent 431f613beb
commit 859d880b66
2 changed files with 112 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "windows.h"
#include "initguid.h"
#include "ole2.h"
#include "olectl.h"
#include "rpcproxy.h"
#include "msscript.h"
@ -30,6 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msscript);
struct ScriptControl {
IScriptControl IScriptControl_iface;
IPersistStreamInit IPersistStreamInit_iface;
IOleObject IOleObject_iface;
LONG ref;
IOleClientSite *site;
@ -126,6 +128,11 @@ static inline ScriptControl *impl_from_IOleObject(IOleObject *iface)
return CONTAINING_RECORD(iface, ScriptControl, IOleObject_iface);
}
static inline ScriptControl *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
{
return CONTAINING_RECORD(iface, ScriptControl, IPersistStreamInit_iface);
}
static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID riid, void **ppv)
{
ScriptControl *This = impl_from_IScriptControl(iface);
@ -142,6 +149,12 @@ static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID
}else if(IsEqualGUID(&IID_IOleObject, riid)) {
TRACE("(%p)->(IID_IOleObject %p\n", This, ppv);
*ppv = &This->IOleObject_iface;
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
TRACE("(%p)->(IID_IPersistStreamInit %p\n", This, ppv);
*ppv = &This->IPersistStreamInit_iface;
}else if(IsEqualGUID(&IID_IPersist, riid)) {
TRACE("(%p)->(IID_IPersist %p\n", This, ppv);
*ppv = &This->IPersistStreamInit_iface;
}else {
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
*ppv = NULL;
@ -675,6 +688,90 @@ static const IOleObjectVtbl OleObjectVtbl = {
OleObject_SetColorScheme
};
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface, REFIID riid, void **obj)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
}
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
return IScriptControl_AddRef(&This->IScriptControl_iface);
}
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
return IScriptControl_Release(&This->IScriptControl_iface);
}
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *clsid)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)->(%p)\n", This, clsid);
return E_NOTIMPL;
}
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream *stream)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)->(%p)\n", This, stream);
return E_NOTIMPL;
}
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, IStream *stream, BOOL clear_dirty)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)->(%p %d)\n", This, stream, clear_dirty);
return E_NOTIMPL;
}
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface, ULARGE_INTEGER *size)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)->(%p)\n", This, size);
return E_NOTIMPL;
}
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
{
ScriptControl *This = impl_from_IPersistStreamInit(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
PersistStreamInit_QueryInterface,
PersistStreamInit_AddRef,
PersistStreamInit_Release,
PersistStreamInit_GetClassID,
PersistStreamInit_IsDirty,
PersistStreamInit_Load,
PersistStreamInit_Save,
PersistStreamInit_GetSizeMax,
PersistStreamInit_InitNew
};
static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
{
ScriptControl *script_control;
@ -687,6 +784,7 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
return E_OUTOFMEMORY;
script_control->IScriptControl_iface.lpVtbl = &ScriptControlVtbl;
script_control->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl;
script_control->ref = 1;
script_control->site = NULL;

View File

@ -21,6 +21,7 @@
#include <initguid.h>
#include <ole2.h>
#include <olectl.h>
#include "msscript.h"
#include "wine/test.h"
@ -133,6 +134,18 @@ static void test_oleobject(void)
IOleObject_Release(obj);
}
static void test_persiststreaminit(void)
{
IPersistStreamInit *init;
HRESULT hr;
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IPersistStreamInit, (void**)&init);
ok(hr == S_OK, "got 0x%08x\n", hr);
IPersistStreamInit_Release(init);
}
START_TEST(msscript)
{
IUnknown *unk;
@ -149,6 +162,7 @@ START_TEST(msscript)
IUnknown_Release(unk);
test_oleobject();
test_persiststreaminit();
CoUninitialize();
}