From 23e43d886e7983eda033d4668cbbdbb1d0821dac Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 7 May 2007 23:59:56 +0100 Subject: [PATCH] ole32: Split CoRevokeClassObject into a separate function, COM_RevokeRegisteredClassObject, which acts on a RegisteredClass object. --- dlls/ole32/compobj.c | 77 ++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 121b3fd9927..808d94e79ed 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1624,21 +1624,6 @@ static HRESULT COM_GetRegisteredClassObject( return hr; } -static void COM_RevokeAllClasses(struct apartment *apt) -{ - RegisteredClass *curClass, *cursor; - - EnterCriticalSection( &csRegisteredClassList ); - - LIST_FOR_EACH_ENTRY_SAFE(curClass, cursor, &RegisteredClassList, RegisteredClass, entry) - { - if (curClass->apartment_id == apt->oxid) - CoRevokeClassObject(curClass->dwCookie); - } - - LeaveCriticalSection( &csRegisteredClassList ); -} - /****************************************************************************** * CoRegisterClassObject [OLE32.@] * @@ -1766,6 +1751,44 @@ HRESULT WINAPI CoRegisterClassObject( return S_OK; } +static void COM_RevokeRegisteredClassObject(RegisteredClass *curClass) +{ + list_remove(&curClass->entry); + + if (curClass->runContext & CLSCTX_LOCAL_SERVER) + RPC_StopLocalServer(curClass->RpcRegistration); + + /* + * Release the reference to the class object. + */ + IUnknown_Release(curClass->classObject); + + if (curClass->pMarshaledData) + { + LARGE_INTEGER zero; + memset(&zero, 0, sizeof(zero)); + IStream_Seek(curClass->pMarshaledData, zero, STREAM_SEEK_SET, NULL); + CoReleaseMarshalData(curClass->pMarshaledData); + } + + HeapFree(GetProcessHeap(), 0, curClass); +} + +static void COM_RevokeAllClasses(struct apartment *apt) +{ + RegisteredClass *curClass, *cursor; + + EnterCriticalSection( &csRegisteredClassList ); + + LIST_FOR_EACH_ENTRY_SAFE(curClass, cursor, &RegisteredClassList, RegisteredClass, entry) + { + if (curClass->apartment_id == apt->oxid) + COM_RevokeRegisteredClassObject(curClass); + } + + LeaveCriticalSection( &csRegisteredClassList ); +} + /*********************************************************************** * CoRevokeClassObject [OLE32.@] * @@ -1798,29 +1821,7 @@ HRESULT WINAPI CoRevokeClassObject( */ if (curClass->dwCookie == dwRegister) { - list_remove(&curClass->entry); - - if (curClass->runContext & CLSCTX_LOCAL_SERVER) - RPC_StopLocalServer(curClass->RpcRegistration); - - /* - * Release the reference to the class object. - */ - IUnknown_Release(curClass->classObject); - - if (curClass->pMarshaledData) - { - LARGE_INTEGER zero; - memset(&zero, 0, sizeof(zero)); - IStream_Seek(curClass->pMarshaledData, zero, STREAM_SEEK_SET, NULL); - CoReleaseMarshalData(curClass->pMarshaledData); - } - - /* - * Free the memory used by the chain node. - */ - HeapFree(GetProcessHeap(), 0, curClass); - + COM_RevokeRegisteredClassObject(curClass); hr = S_OK; break; }