Commit 07e9d33f authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

packager: Implement IOleObject::SetClientSite.

parent eb4d39b9
......@@ -44,6 +44,8 @@ struct Package {
LONG ref;
WCHAR filename[MAX_PATH];
IOleClientSite *clientsite;
};
static inline struct Package *impl_from_IOleObject(IOleObject *iface)
......@@ -95,6 +97,9 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref){
if(This->clientsite)
IOleClientSite_Release(This->clientsite);
if(*This->filename)
DeleteFileW(This->filename);
......@@ -107,8 +112,17 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
{
struct Package *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%p)\n", This, pClientSite);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pClientSite);
if(This->clientsite)
IOleClientSite_Release(This->clientsite);
This->clientsite = pClientSite;
if(pClientSite)
IOleClientSite_AddRef(pClientSite);
return S_OK;
}
static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
......
......@@ -334,6 +334,78 @@ static IStorage stg = {
&stg_vtbl
};
static HRESULT WINAPI clientsite_QueryInterface(IOleClientSite* This,
REFIID riid, void **ppvObject)
{
ok(0, "query interface\n");
return E_NOINTERFACE;
}
static ULONG WINAPI clientsite_AddRef(IOleClientSite* This)
{
return 2;
}
static ULONG WINAPI clientsite_Release(IOleClientSite* This)
{
return 1;
}
static HRESULT WINAPI clientsite_SaveObject(IOleClientSite* This)
{
ok(0, "saveobject\n");
return E_NOTIMPL;
}
static HRESULT WINAPI clientsite_GetMoniker(IOleClientSite* This,
DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
{
ok(0, "getmoniker\n");
return E_NOTIMPL;
}
static HRESULT WINAPI clientsite_GetContainer(IOleClientSite* This,
IOleContainer **ppContainer)
{
ok(0, "getcontainer\n");
return E_NOTIMPL;
}
static HRESULT WINAPI clientsite_ShowObject(IOleClientSite* This)
{
ok(0, "showobject\n");
return E_NOTIMPL;
}
static HRESULT WINAPI clientsite_OnShowWindow(IOleClientSite* This,
BOOL fShow)
{
ok(0, "onshowwindow\n");
return E_NOTIMPL;
}
static HRESULT WINAPI clientsite_RequestNewObjectLayout(IOleClientSite* This)
{
ok(0, "requestnewobjectlayout\n");
return E_NOTIMPL;
}
static IOleClientSiteVtbl clientsite_vtbl = {
clientsite_QueryInterface,
clientsite_AddRef,
clientsite_Release,
clientsite_SaveObject,
clientsite_GetMoniker,
clientsite_GetContainer,
clientsite_ShowObject,
clientsite_OnShowWindow,
clientsite_RequestNewObjectLayout
};
static IOleClientSite clientsite = {
&clientsite_vtbl
};
static void test_packager(void)
{
IOleObject *oleobj;
......@@ -363,6 +435,12 @@ static void test_packager(void)
&IID_IOleObject, (void**)&oleobj);
ok(hr == S_OK, "CoCreateInstance(CLSID_Package_Alt) failed: %08x\n", hr);
hr = IOleObject_SetClientSite(oleobj, NULL);
ok(hr == S_OK, "SetClientSite failed: %08x\n", hr);
hr = IOleObject_SetClientSite(oleobj, &clientsite);
ok(hr == S_OK, "SetClientSite failed: %08x\n", hr);
hr = IOleObject_QueryInterface(oleobj, &IID_IPersistStorage, (void**)&persist);
ok(hr == S_OK, "QueryInterface(IPersistStorage) failed: %08x\n", hr);
......
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