From 397a0a0fc281eee9be2229bdd90edab0f0e6e8a6 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 23 Feb 2011 15:29:58 -0600 Subject: [PATCH 3/3] mscoree: Always return S_FALSE from DllCanUnloadNow. We can't really unload after Mono is loaded unless we're exiting the process. We could before that, but it's probably not worth the effort. --- dlls/mscoree/corruntimehost.c | 7 ------- dlls/mscoree/metadata.c | 4 ---- dlls/mscoree/metahost.c | 8 -------- dlls/mscoree/mscoree_main.c | 7 +------ dlls/mscoree/mscoree_private.h | 4 ---- 5 files changed, 1 insertions(+), 29 deletions(-) diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 0254753..bcdd485 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -95,8 +95,6 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, MonoDomain **result) list_add_tail(&This->domains, &entry->entry); - MSCOREE_LockModule(); - *result = entry->domain; end: @@ -137,7 +135,6 @@ static void RuntimeHost_DeleteDomain(RuntimeHost *This, MonoDomain *domain) if (This->default_domain == domain) This->default_domain = NULL; HeapFree(GetProcessHeap(), 0, entry); - MSCOREE_UnlockModule(); break; } } @@ -183,8 +180,6 @@ static ULONG WINAPI corruntimehost_AddRef(ICorRuntimeHost* iface) { RuntimeHost *This = impl_from_ICorRuntimeHost( iface ); - MSCOREE_LockModule(); - return InterlockedIncrement( &This->ref ); } @@ -193,8 +188,6 @@ static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost* iface) RuntimeHost *This = impl_from_ICorRuntimeHost( iface ); ULONG ref; - MSCOREE_UnlockModule(); - ref = InterlockedDecrement( &This->ref ); return ref; diff --git a/dlls/mscoree/metadata.c b/dlls/mscoree/metadata.c index 7a5336d..a2db508 100644 --- a/dlls/mscoree/metadata.c +++ b/dlls/mscoree/metadata.c @@ -79,8 +79,6 @@ static ULONG WINAPI MetaDataDispenser_AddRef(IMetaDataDispenserEx* iface) TRACE("%p ref=%u\n", This, ref); - MSCOREE_LockModule(); - return ref; } @@ -96,8 +94,6 @@ static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface) HeapFree(GetProcessHeap(), 0, This); } - MSCOREE_UnlockModule(); - return ref; } diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 01d70b0..05636b1 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -325,13 +325,11 @@ static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo* iface, static ULONG WINAPI CLRRuntimeInfo_AddRef(ICLRRuntimeInfo* iface) { - MSCOREE_LockModule(); return 2; } static ULONG WINAPI CLRRuntimeInfo_Release(ICLRRuntimeInfo* iface) { - MSCOREE_UnlockModule(); return 1; } @@ -788,8 +786,6 @@ static ULONG WINAPI InstalledRuntimeEnum_AddRef(IEnumUnknown* iface) struct InstalledRuntimeEnum *This = (struct InstalledRuntimeEnum*)iface; ULONG ref = InterlockedIncrement(&This->ref); - MSCOREE_LockModule(); - TRACE("(%p) refcount=%u\n", iface, ref); return ref; @@ -800,8 +796,6 @@ static ULONG WINAPI InstalledRuntimeEnum_Release(IEnumUnknown* iface) struct InstalledRuntimeEnum *This = (struct InstalledRuntimeEnum*)iface; ULONG ref = InterlockedDecrement(&This->ref); - MSCOREE_UnlockModule(); - TRACE("(%p) refcount=%u\n", iface, ref); if (ref == 0) @@ -942,13 +936,11 @@ static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost* iface, static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost* iface) { - MSCOREE_LockModule(); return 2; } static ULONG WINAPI CLRMetaHost_Release(ICLRMetaHost* iface) { - MSCOREE_UnlockModule(); return 1; } diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 6901f7a..6f53c8f 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -47,8 +47,6 @@ WINE_DEFAULT_DEBUG_CHANNEL( mscoree ); -LONG dll_refs = 0; - char *WtoA(LPCWSTR wstr) { int length; @@ -459,10 +457,7 @@ HRESULT WINAPI DllUnregisterServer(void) HRESULT WINAPI DllCanUnloadNow(VOID) { - if (dll_refs) - return S_FALSE; - else - return S_OK; + return S_FALSE; } INT WINAPI ND_RU1( const void *ptr, INT offset ) diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index 16ae5d3..aa0ee2e 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -20,10 +20,6 @@ #ifndef __MSCOREE_PRIVATE__ #define __MSCOREE_PRIVATE__ -extern LONG dll_refs; -static inline void MSCOREE_LockModule(void) { InterlockedIncrement(&dll_refs); } -static inline void MSCOREE_UnlockModule(void) { InterlockedDecrement(&dll_refs); } - extern char *WtoA(LPCWSTR wstr); extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj); -- 1.7.1