itss: DllCanUnloadNow code clean up.
This commit is contained in:
parent
b79fa300ad
commit
162b3350e1
|
@ -93,13 +93,13 @@ ITSSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
|||
|
||||
static ULONG WINAPI ITSSCF_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
InterlockedIncrement(&dll_count);
|
||||
ITSS_LockModule();
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ITSSCF_Release(LPCLASSFACTORY iface)
|
||||
{
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -127,9 +127,9 @@ static HRESULT WINAPI ITSSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
|
|||
TRACE("(%p)->(%d)\n", iface, dolock);
|
||||
|
||||
if (dolock)
|
||||
InterlockedIncrement(&dll_count);
|
||||
ITSS_LockModule();
|
||||
else
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ static ULONG WINAPI ITStorageImpl_Release(
|
|||
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -364,8 +364,8 @@ static HRESULT ITSS_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|||
|
||||
TRACE("-> %p\n", its);
|
||||
*ppObj = (LPVOID) its;
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,4 +35,9 @@ extern HRESULT ITS_IParseDisplayName_create(
|
|||
IUnknown *pUnkOuter,
|
||||
LPVOID *ppObj);
|
||||
|
||||
extern LONG dll_count;
|
||||
static inline void ITSS_LockModule(void) { InterlockedIncrement(&dll_count); }
|
||||
static inline void ITSS_UnlockModule(void) { InterlockedDecrement(&dll_count); }
|
||||
|
||||
|
||||
#endif /* __WINE_ITS_STORAGE_PRIVATE__ */
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(itss);
|
||||
|
||||
extern LONG dll_count;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
|
@ -91,7 +89,7 @@ static ULONG WINAPI ITS_IMonikerImpl_Release(
|
|||
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -369,8 +367,8 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPWSTR name, DWORD n )
|
|||
TRACE("-> %p %s %s\n", itsmon,
|
||||
debugstr_w(itsmon->szFile), debugstr_w(itsmon->szHtml) );
|
||||
*ppObj = (IMoniker*) itsmon;
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -416,7 +414,7 @@ static ULONG WINAPI ITS_IParseDisplayNameImpl_Release(
|
|||
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -480,7 +478,7 @@ HRESULT ITS_IParseDisplayName_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|||
|
||||
TRACE("-> %p\n", its);
|
||||
*ppObj = (LPVOID) its;
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(itss);
|
||||
|
||||
extern LONG dll_count;
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
typedef struct _ITSS_IStorageImpl
|
||||
|
@ -128,7 +126,7 @@ static ULONG WINAPI ITSS_IEnumSTATSTG_Release(
|
|||
This->first = t;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -254,8 +252,8 @@ static IEnumSTATSTG_Impl *ITSS_create_enum( void )
|
|||
stgenum->first = NULL;
|
||||
stgenum->last = NULL;
|
||||
stgenum->current = NULL;
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
TRACE(" -> %p\n", stgenum );
|
||||
|
||||
return stgenum;
|
||||
|
@ -299,7 +297,7 @@ static ULONG WINAPI ITSS_IStorageImpl_Release(
|
|||
if (ref == 0)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -574,8 +572,8 @@ static HRESULT ITSS_create_chm_storage(
|
|||
strcpyW( stg->dir, dir );
|
||||
|
||||
*ppstgOpen = (IStorage*) stg;
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -638,8 +636,8 @@ static ULONG WINAPI ITSS_IStream_Release(
|
|||
if (ref == 0)
|
||||
{
|
||||
IStorage_Release( (IStorage*) This->stg );
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
InterlockedDecrement(&dll_count);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
ITSS_UnlockModule();
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -825,7 +823,8 @@ static IStream_Impl *ITSS_create_stream(
|
|||
memcpy( &stm->ui, ui, sizeof stm->ui );
|
||||
stm->stg = stg;
|
||||
IStorage_AddRef( (IStorage*) stg );
|
||||
InterlockedIncrement(&dll_count);
|
||||
|
||||
ITSS_LockModule();
|
||||
|
||||
TRACE(" -> %p\n", stm );
|
||||
|
||||
|
|
Loading…
Reference in New Issue