Implement some IRunningObject functions that actually start the server

and initialize it.
This commit is contained in:
Robert Shearman 2005-09-23 10:08:35 +00:00 committed by Alexandre Julliard
parent 3daf39fb0c
commit 53ef9950f2
1 changed files with 57 additions and 22 deletions

View File

@ -103,6 +103,10 @@ struct DefaultHandler
LPWSTR containerApp; LPWSTR containerApp;
LPWSTR containerObj; LPWSTR containerObj;
/* IOleObject delegate */
IOleObject *pOleDelegate;
/* IPersistStorage delegate */
IPersistStorage *pPSDelegate;
}; };
typedef struct DefaultHandler DefaultHandler; typedef struct DefaultHandler DefaultHandler;
@ -1117,17 +1121,13 @@ static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
/************************************************************************ /************************************************************************
* DefaultHandler_GetRunningClass (IRunnableObject) * DefaultHandler_GetRunningClass (IRunnableObject)
* *
* According to Brockscmidt, Chapter 19, the default handler's
* implementation of IRunnableobject does nothing until the object
* is actually running.
*
* See Windows documentation for more details on IRunnableObject methods. * See Windows documentation for more details on IRunnableObject methods.
*/ */
static HRESULT WINAPI DefaultHandler_GetRunningClass( static HRESULT WINAPI DefaultHandler_GetRunningClass(
IRunnableObject* iface, IRunnableObject* iface,
LPCLSID lpClsid) LPCLSID lpClsid)
{ {
TRACE("()\n"); FIXME("()\n");
return S_OK; return S_OK;
} }
@ -1135,33 +1135,65 @@ static HRESULT WINAPI DefaultHandler_Run(
IRunnableObject* iface, IRunnableObject* iface,
IBindCtx* pbc) IBindCtx* pbc)
{ {
FIXME(": Stub\n"); DefaultHandler *This = impl_from_IRunnableObject(iface);
return E_NOTIMPL; HRESULT hr;
FIXME("(%p): semi-stub\n", pbc);
/* already running? if so nothing to do */
if (This->pOleDelegate)
return S_OK;
hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_IOleObject, (void **)&This->pOleDelegate);
if (FAILED(hr))
return hr;
if (This->clientSite)
hr = IOleObject_SetClientSite(This->pOleDelegate, This->clientSite);
if (SUCCEEDED(hr))
{
IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage, (void **)&This->pPSDelegate);
if (This->pPSDelegate)
hr = IPersistStorage_InitNew(This->pPSDelegate, NULL);
}
if (SUCCEEDED(hr) && This->containerApp)
hr = IOleObject_SetHostNames(This->pOleDelegate, This->containerApp, This->containerObj);
/* FIXME: do more stuff here:
* - IOleObject_GetMiscStatus
* - IOleObject_Advise
* - IOleObject_GetMoniker
* - advise data cache that we've connected some how?
*/
/* FIXME: if we failed, Close the object */
return hr;
} }
/************************************************************************ /************************************************************************
* DefaultHandler_IsRunning (IRunnableObject) * DefaultHandler_IsRunning (IRunnableObject)
* *
* According to Brockscmidt, Chapter 19, the default handler's
* implementation of IRunnableobject does nothing until the object
* is actually running.
*
* See Windows documentation for more details on IRunnableObject methods. * See Windows documentation for more details on IRunnableObject methods.
*/ */
static BOOL WINAPI DefaultHandler_IsRunning( static BOOL WINAPI DefaultHandler_IsRunning(
IRunnableObject* iface) IRunnableObject* iface)
{ {
DefaultHandler *This = impl_from_IRunnableObject(iface);
TRACE("()\n"); TRACE("()\n");
return S_FALSE;
if (This->pOleDelegate)
return TRUE;
else
return FALSE;
} }
/************************************************************************ /************************************************************************
* DefaultHandler_LockRunning (IRunnableObject) * DefaultHandler_LockRunning (IRunnableObject)
* *
* According to Brockscmidt, Chapter 19, the default handler's
* implementation of IRunnableobject does nothing until the object
* is actually running.
*
* See Windows documentation for more details on IRunnableObject methods. * See Windows documentation for more details on IRunnableObject methods.
*/ */
static HRESULT WINAPI DefaultHandler_LockRunning( static HRESULT WINAPI DefaultHandler_LockRunning(
@ -1169,24 +1201,20 @@ static HRESULT WINAPI DefaultHandler_LockRunning(
BOOL fLock, BOOL fLock,
BOOL fLastUnlockCloses) BOOL fLastUnlockCloses)
{ {
TRACE("()\n"); FIXME("()\n");
return S_OK; return S_OK;
} }
/************************************************************************ /************************************************************************
* DefaultHandler_SetContainedObject (IRunnableObject) * DefaultHandler_SetContainedObject (IRunnableObject)
* *
* According to Brockscmidt, Chapter 19, the default handler's
* implementation of IRunnableobject does nothing until the object
* is actually running.
*
* See Windows documentation for more details on IRunnableObject methods. * See Windows documentation for more details on IRunnableObject methods.
*/ */
static HRESULT WINAPI DefaultHandler_SetContainedObject( static HRESULT WINAPI DefaultHandler_SetContainedObject(
IRunnableObject* iface, IRunnableObject* iface,
BOOL fContained) BOOL fContained)
{ {
TRACE("()\n"); FIXME("()\n");
return S_OK; return S_OK;
} }
@ -1314,6 +1342,8 @@ static DefaultHandler* DefaultHandler_Construct(
This->dataAdviseHolder = NULL; This->dataAdviseHolder = NULL;
This->containerApp = NULL; This->containerApp = NULL;
This->containerObj = NULL; This->containerObj = NULL;
This->pOleDelegate = NULL;
This->pPSDelegate = NULL;
return This; return This;
} }
@ -1321,6 +1351,11 @@ static DefaultHandler* DefaultHandler_Construct(
static void DefaultHandler_Destroy( static void DefaultHandler_Destroy(
DefaultHandler* This) DefaultHandler* This)
{ {
if (This->pOleDelegate)
IOleObject_Release(This->pOleDelegate);
if (This->pPSDelegate)
IPersistStorage_Release(This->pPSDelegate);
/* Free the strings idenfitying the object */ /* Free the strings idenfitying the object */
HeapFree( GetProcessHeap(), 0, This->containerApp ); HeapFree( GetProcessHeap(), 0, This->containerApp );
This->containerApp = NULL; This->containerApp = NULL;