msscript: Implement SetClientSite()/GetClientSite().
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:
parent
bcbacd7594
commit
b67a6a3c4b
|
@ -32,6 +32,7 @@ struct ScriptControl {
|
||||||
IScriptControl IScriptControl_iface;
|
IScriptControl IScriptControl_iface;
|
||||||
IOleObject IOleObject_iface;
|
IOleObject IOleObject_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
IOleClientSite *site;
|
||||||
};
|
};
|
||||||
|
|
||||||
static HINSTANCE msscript_instance;
|
static HINSTANCE msscript_instance;
|
||||||
|
@ -168,8 +169,11 @@ static ULONG WINAPI ScriptControl_Release(IScriptControl *iface)
|
||||||
|
|
||||||
TRACE("(%p) ref=%d\n", This, ref);
|
TRACE("(%p) ref=%d\n", This, ref);
|
||||||
|
|
||||||
if(!ref)
|
if(!ref) {
|
||||||
|
if (This->site)
|
||||||
|
IOleClientSite_Release(This->site);
|
||||||
heap_free(This);
|
heap_free(This);
|
||||||
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -445,18 +449,30 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
||||||
{
|
{
|
||||||
ScriptControl *This = impl_from_IOleObject(iface);
|
ScriptControl *This = impl_from_IOleObject(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%p)\n", This, site);
|
TRACE("(%p)->(%p)\n", This, site);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (This->site)
|
||||||
|
IOleClientSite_Release(This->site);
|
||||||
|
|
||||||
|
if ((This->site = site))
|
||||||
|
IOleClientSite_AddRef(site);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **site)
|
static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **site)
|
||||||
{
|
{
|
||||||
ScriptControl *This = impl_from_IOleObject(iface);
|
ScriptControl *This = impl_from_IOleObject(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%p)\n", This, site);
|
TRACE("(%p)->(%p)\n", This, site);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (!site)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
if ((*site = This->site))
|
||||||
|
IOleClientSite_AddRef(*site);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerobj)
|
static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerobj)
|
||||||
|
@ -673,6 +689,7 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
|
||||||
script_control->IScriptControl_iface.lpVtbl = &ScriptControlVtbl;
|
script_control->IScriptControl_iface.lpVtbl = &ScriptControlVtbl;
|
||||||
script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl;
|
script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl;
|
||||||
script_control->ref = 1;
|
script_control->ref = 1;
|
||||||
|
script_control->site = NULL;
|
||||||
|
|
||||||
hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
|
hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
|
||||||
IScriptControl_Release(&script_control->IScriptControl_iface);
|
IScriptControl_Release(&script_control->IScriptControl_iface);
|
||||||
|
|
|
@ -25,8 +25,77 @@
|
||||||
#include "msscript.h"
|
#include "msscript.h"
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
if (IsEqualIID(riid, &IID_IOleClientSite) || IsEqualIID(riid, &IID_IUnknown))
|
||||||
|
{
|
||||||
|
*obj = iface;
|
||||||
|
IOleClientSite_AddRef(iface);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
*obj = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI OleClientSite_AddRef(IOleClientSite *iface)
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI OleClientSite_Release(IOleClientSite *iface)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_SaveObject(IOleClientSite *iface)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_GetMoniker(IOleClientSite *iface, DWORD assign,
|
||||||
|
DWORD which, IMoniker **moniker)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_GetContainer(IOleClientSite *iface, IOleContainer **container)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_ShowObject(IOleClientSite *iface)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_OnShowWindow(IOleClientSite *iface, BOOL show)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI OleClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IOleClientSiteVtbl OleClientSiteVtbl = {
|
||||||
|
OleClientSite_QueryInterface,
|
||||||
|
OleClientSite_AddRef,
|
||||||
|
OleClientSite_Release,
|
||||||
|
OleClientSite_SaveObject,
|
||||||
|
OleClientSite_GetMoniker,
|
||||||
|
OleClientSite_GetContainer,
|
||||||
|
OleClientSite_ShowObject,
|
||||||
|
OleClientSite_OnShowWindow,
|
||||||
|
OleClientSite_RequestNewObjectLayout
|
||||||
|
};
|
||||||
|
|
||||||
|
static IOleClientSite testclientsite = { &OleClientSiteVtbl };
|
||||||
|
|
||||||
static void test_oleobject(void)
|
static void test_oleobject(void)
|
||||||
{
|
{
|
||||||
|
IOleClientSite *site;
|
||||||
IOleObject *obj;
|
IOleObject *obj;
|
||||||
DWORD status;
|
DWORD status;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -43,6 +112,24 @@ static void test_oleobject(void)
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(status != 0, "got 0x%08x\n", status);
|
ok(status != 0, "got 0x%08x\n", status);
|
||||||
|
|
||||||
|
hr = IOleObject_SetClientSite(obj, &testclientsite);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
if (0) /* crashes on w2k3 */
|
||||||
|
hr = IOleObject_GetClientSite(obj, NULL);
|
||||||
|
|
||||||
|
hr = IOleObject_GetClientSite(obj, &site);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(site == &testclientsite, "got %p, %p\n", site, &testclientsite);
|
||||||
|
IOleClientSite_Release(site);
|
||||||
|
|
||||||
|
hr = IOleObject_SetClientSite(obj, NULL);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IOleObject_GetClientSite(obj, &site);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(site == NULL, "got %p\n", site);
|
||||||
|
|
||||||
IOleObject_Release(obj);
|
IOleObject_Release(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue