ole32: Implement CoAddRefServerProcess and CoReleaseServerProcess.

This commit is contained in:
Rob Shearman 2007-03-09 18:55:13 +00:00 committed by Alexandre Julliard
parent 789f344c2b
commit f0189b8789
2 changed files with 38 additions and 5 deletions

View File

@ -106,6 +106,8 @@ struct registered_psclsid
* libraries are freed
*/
static LONG s_COMLockCount = 0;
/* Reference count used by CoAddRefServerProcess/CoReleaseServerProcess */
static LONG s_COMServerProcessReferences = 0;
/*
* This linked list contains the list of registered class objects. These
@ -2771,11 +2773,23 @@ HRESULT WINAPI CoSuspendClassObjects(void)
*
* RETURNS
* New reference count.
*
* SEE ALSO
* CoReleaseServerProcess().
*/
ULONG WINAPI CoAddRefServerProcess(void)
{
FIXME("\n");
return 2;
ULONG refs;
TRACE("\n");
EnterCriticalSection(&csRegisteredClassList);
refs = ++s_COMServerProcessReferences;
LeaveCriticalSection(&csRegisteredClassList);
TRACE("refs before: %d\n", refs - 1);
return refs;
}
/***********************************************************************
@ -2786,11 +2800,30 @@ ULONG WINAPI CoAddRefServerProcess(void)
*
* RETURNS
* New reference count.
*
* NOTES
* When reference count reaches 0, this function suspends all registered
* classes so no new connections are accepted.
*
* SEE ALSO
* CoAddRefServerProcess(), CoSuspendClassObjects().
*/
ULONG WINAPI CoReleaseServerProcess(void)
{
FIXME("\n");
return 1;
ULONG refs;
TRACE("\n");
EnterCriticalSection(&csRegisteredClassList);
refs = --s_COMServerProcessReferences;
/* FIXME: if (!refs) COM_SuspendClassObjects(); */
LeaveCriticalSection(&csRegisteredClassList);
TRACE("refs after: %d\n", refs);
return refs;
}
/***********************************************************************

View File

@ -2303,7 +2303,7 @@ static void test_local_server(void)
/* wait for shutdown signal */
ret = WaitForSingleObject(heventShutdown, 0);
todo_wine { ok(ret != WAIT_TIMEOUT, "Server didn't shut down\n"); }
ok(ret != WAIT_TIMEOUT, "Server didn't shut down\n");
/* try to connect again after SCM has suspended registered class objects */
hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, NULL,