mscoree: Add a proper implementation of DllCanUnloadNow.
This commit is contained in:
parent
e5d3294b83
commit
1309731b4a
|
@ -108,6 +108,8 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, MonoDomain **result)
|
|||
|
||||
list_add_tail(&This->domains, &entry->entry);
|
||||
|
||||
MSCOREE_LockModule();
|
||||
|
||||
*result = entry->domain;
|
||||
|
||||
end:
|
||||
|
@ -149,6 +151,7 @@ static void RuntimeHost_DeleteDomain(RuntimeHost *This, MonoDomain *domain)
|
|||
if (This->default_domain == domain)
|
||||
This->default_domain = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, entry);
|
||||
MSCOREE_UnlockModule();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +196,9 @@ static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost* iface,
|
|||
static ULONG WINAPI corruntimehost_AddRef(ICorRuntimeHost* iface)
|
||||
{
|
||||
RuntimeHost *This = impl_from_ICorRuntimeHost( iface );
|
||||
|
||||
MSCOREE_LockModule();
|
||||
|
||||
return InterlockedIncrement( &This->ref );
|
||||
}
|
||||
|
||||
|
@ -201,6 +207,8 @@ static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost* iface)
|
|||
RuntimeHost *This = impl_from_ICorRuntimeHost( iface );
|
||||
ULONG ref;
|
||||
|
||||
MSCOREE_UnlockModule();
|
||||
|
||||
ref = InterlockedDecrement( &This->ref );
|
||||
|
||||
return ref;
|
||||
|
|
|
@ -225,11 +225,13 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -668,6 +670,8 @@ 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;
|
||||
|
@ -678,6 +682,8 @@ 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)
|
||||
|
@ -818,11 +824,13 @@ 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
|
||||
|
||||
LONG dll_refs = 0;
|
||||
|
||||
static BOOL get_install_root(LPWSTR install_dir)
|
||||
{
|
||||
const WCHAR dotnet_key[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\','.','N','E','T','F','r','a','m','e','w','o','r','k','\\',0};
|
||||
|
@ -398,7 +400,10 @@ HRESULT WINAPI DllUnregisterServer(void)
|
|||
|
||||
HRESULT WINAPI DllCanUnloadNow(VOID)
|
||||
{
|
||||
return S_OK;
|
||||
if (dll_refs)
|
||||
return S_FALSE;
|
||||
else
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
INT WINAPI ND_RU1( const void *ptr, INT offset )
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#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 HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
|
||||
|
||||
typedef struct tagASSEMBLY ASSEMBLY;
|
||||
|
|
Loading…
Reference in New Issue