From: Esme Povirk <esme@codeweavers.com> --- dlls/mscoree/corruntimehost.c | 172 +++++++++++++++------------------ dlls/mscoree/metahost.c | 8 +- dlls/mscoree/mscoree_main.c | 6 +- dlls/mscoree/mscoree_private.h | 8 +- 4 files changed, 88 insertions(+), 106 deletions(-) diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 76adef38044..394bf663ed1 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -115,24 +115,7 @@ struct clrclass_data DWORD res2[2]; }; -static MonoDomain* domain_attach(MonoDomain *domain) -{ - MonoDomain *prev_domain = mono_domain_get(); - - if (prev_domain == domain) - /* Do not set or restore domain. */ - return NULL; - - mono_thread_attach(domain); - - return prev_domain; -} - -static void domain_restore(MonoDomain *prev_domain) -{ - if (prev_domain != NULL) - mono_domain_set(prev_domain, FALSE); -} +static HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk); static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *config_path, MonoDomain **result) { @@ -191,7 +174,7 @@ end: return res; } -static BOOL RuntimeHost_GetMethod(MonoDomain *domain, const char *assemblyname, +static BOOL RuntimeHost_GetMethod(const char *assemblyname, const char *namespace, const char *typename, const char *methodname, int arg_count, MonoMethod **method) { @@ -238,11 +221,11 @@ static BOOL RuntimeHost_GetMethod(MonoDomain *domain, const char *assemblyname, return TRUE; } -static HRESULT RuntimeHost_Invoke(RuntimeHost *This, MonoDomain *domain, +static HRESULT RuntimeHost_Invoke(RuntimeHost *This, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, MonoObject *obj, void **args, int arg_count, MonoObject **result); -static HRESULT RuntimeHost_DoInvoke(RuntimeHost *This, MonoDomain *domain, +static HRESULT RuntimeHost_DoInvoke(RuntimeHost *This, const char *methodname, MonoMethod *method, MonoObject *obj, void **args, MonoObject **result) { MonoObject *exc; @@ -257,7 +240,7 @@ static HRESULT RuntimeHost_DoInvoke(RuntimeHost *This, MonoDomain *domain, if (methodname != get_hresult) { /* Map the exception to an HRESULT. */ - hr = RuntimeHost_Invoke(This, domain, NULL, "System", "Exception", get_hresult, + hr = RuntimeHost_Invoke(This, NULL, "System", "Exception", get_hresult, exc, NULL, 0, &hr_object); if (SUCCEEDED(hr)) hr = *(HRESULT*)mono_object_unbox(hr_object); @@ -273,42 +256,35 @@ static HRESULT RuntimeHost_DoInvoke(RuntimeHost *This, MonoDomain *domain, return S_OK; } -static HRESULT RuntimeHost_Invoke(RuntimeHost *This, MonoDomain *domain, +static HRESULT RuntimeHost_Invoke(RuntimeHost *This, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, MonoObject *obj, void **args, int arg_count, MonoObject **result) { MonoMethod *method; - MonoDomain *prev_domain; HRESULT hr; *result = NULL; - prev_domain = domain_attach(domain); - - if (!RuntimeHost_GetMethod(domain, assemblyname, namespace, typename, methodname, + if (!RuntimeHost_GetMethod(assemblyname, namespace, typename, methodname, arg_count, &method)) { - domain_restore(prev_domain); return E_FAIL; } - hr = RuntimeHost_DoInvoke(This, domain, methodname, method, obj, args, result); + hr = RuntimeHost_DoInvoke(This, methodname, method, obj, args, result); if (FAILED(hr)) { ERR("Method %s.%s:%s raised an exception, hr=%lx\n", namespace, typename, methodname, hr); } - domain_restore(prev_domain); - return hr; } -static HRESULT RuntimeHost_VirtualInvoke(RuntimeHost *This, MonoDomain *domain, +static HRESULT RuntimeHost_VirtualInvoke(RuntimeHost *This, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, MonoObject *obj, void **args, int arg_count, MonoObject **result) { MonoMethod *method; - MonoDomain *prev_domain; HRESULT hr; *result = NULL; @@ -319,12 +295,9 @@ static HRESULT RuntimeHost_VirtualInvoke(RuntimeHost *This, MonoDomain *domain, return E_POINTER; } - prev_domain = domain_attach(domain); - - if (!RuntimeHost_GetMethod(domain, assemblyname, namespace, typename, methodname, + if (!RuntimeHost_GetMethod(assemblyname, namespace, typename, methodname, arg_count, &method)) { - domain_restore(prev_domain); return E_FAIL; } @@ -332,22 +305,19 @@ static HRESULT RuntimeHost_VirtualInvoke(RuntimeHost *This, MonoDomain *domain, if (!method) { ERR("Object %p does not support method %s.%s:%s\n", obj, namespace, typename, methodname); - domain_restore(prev_domain); return E_FAIL; } - hr = RuntimeHost_DoInvoke(This, domain, methodname, method, obj, args, result); + hr = RuntimeHost_DoInvoke(This, methodname, method, obj, args, result); if (FAILED(hr)) { ERR("Method %s.%s:%s raised an exception, hr=%lx\n", namespace, typename, methodname, hr); } - domain_restore(prev_domain); - return hr; } -static HRESULT RuntimeHost_GetObjectForIUnknown(RuntimeHost *This, MonoDomain *domain, +static HRESULT RuntimeHost_GetObjectForIUnknown(RuntimeHost *This, IUnknown *unk, MonoObject **obj) { HRESULT hr; @@ -355,7 +325,7 @@ static HRESULT RuntimeHost_GetObjectForIUnknown(RuntimeHost *This, MonoDomain *d MonoObject *result; args[0] = &unk; - hr = RuntimeHost_Invoke(This, domain, NULL, "System.Runtime.InteropServices", "Marshal", "GetObjectForIUnknown", + hr = RuntimeHost_Invoke(This, NULL, "System.Runtime.InteropServices", "Marshal", "GetObjectForIUnknown", NULL, args, 1, &result); if (SUCCEEDED(hr)) @@ -370,9 +340,10 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn { HRESULT res; char *nameA; - MonoDomain *domain; + MonoDomain *domain, *prev_domain; void *args[3]; MonoObject *new_domain, *id; + void *attach_cookie; res = RuntimeHost_GetDefaultDomain(This, NULL, &domain); if (FAILED(res)) @@ -386,19 +357,23 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn return E_OUTOFMEMORY; } + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); + args[0] = mono_string_new(domain, nameA); free(nameA); if (!args[0]) { + mono_threads_detach_coop(prev_domain, &attach_cookie); return E_OUTOFMEMORY; } if (evidence) { - res = RuntimeHost_GetObjectForIUnknown(This, domain, evidence, (MonoObject **)&args[1]); + res = RuntimeHost_GetObjectForIUnknown(This, evidence, (MonoObject **)&args[1]); if (FAILED(res)) { + mono_threads_detach_coop(prev_domain, &attach_cookie); return res; } } @@ -409,9 +384,10 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn if (setup) { - res = RuntimeHost_GetObjectForIUnknown(This, domain, setup, (MonoObject **)&args[2]); + res = RuntimeHost_GetObjectForIUnknown(This, setup, (MonoObject **)&args[2]); if (FAILED(res)) { + mono_threads_detach_coop(prev_domain, &attach_cookie); return res; } } @@ -420,11 +396,12 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn args[2] = NULL; } - res = RuntimeHost_Invoke(This, domain, NULL, "System", "AppDomain", "CreateDomain", + res = RuntimeHost_Invoke(This, NULL, "System", "AppDomain", "CreateDomain", NULL, args, 3, &new_domain); if (FAILED(res)) { + mono_threads_detach_coop(prev_domain, &attach_cookie); return res; } @@ -434,11 +411,12 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn * Instead, do a vcall. */ - res = RuntimeHost_VirtualInvoke(This, domain, NULL, "System", "AppDomain", "get_Id", + res = RuntimeHost_VirtualInvoke(This, NULL, "System", "AppDomain", "get_Id", new_domain, NULL, 0, &id); if (FAILED(res)) { + mono_threads_detach_coop(prev_domain, &attach_cookie); return res; } @@ -446,16 +424,22 @@ static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnkn *result = mono_domain_get_by_id(*(int *)mono_object_unbox(id)); + mono_threads_detach_coop(prev_domain, &attach_cookie); + return S_OK; } static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *domain, IUnknown **punk) { HRESULT hr; + MonoDomain *prev_domain; MonoObject *appdomain_object; IUnknown *unk; + void *attach_cookie; + + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); - hr = RuntimeHost_Invoke(This, domain, NULL, "System", "AppDomain", "get_CurrentDomain", + hr = RuntimeHost_Invoke(This, NULL, "System", "AppDomain", "get_CurrentDomain", NULL, NULL, 0, &appdomain_object); if (SUCCEEDED(hr)) @@ -468,6 +452,8 @@ static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *d IUnknown_Release(unk); } + mono_threads_detach_coop(prev_domain, &attach_cookie); + return hr; } @@ -475,8 +461,9 @@ void RuntimeHost_ExitProcess(RuntimeHost *This, INT exitcode) { HRESULT hr; void *args[2]; - MonoDomain *domain; + MonoDomain *domain, *prev_domain; MonoObject *dummy; + void *attach_cookie; hr = RuntimeHost_GetDefaultDomain(This, NULL, &domain); if (FAILED(hr)) @@ -485,12 +472,16 @@ void RuntimeHost_ExitProcess(RuntimeHost *This, INT exitcode) return; } + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); + args[0] = &exitcode; args[1] = NULL; - RuntimeHost_Invoke(This, domain, NULL, "System", "Environment", "Exit", + RuntimeHost_Invoke(This, NULL, "System", "Environment", "Exit", NULL, args, 1, &dummy); ERR("Process should have exited\n"); + + mono_threads_detach_coop(prev_domain, &attach_cookie); } static inline RuntimeHost *impl_from_ICLRRuntimeHost( ICLRRuntimeHost *iface ) @@ -710,19 +701,11 @@ static HRESULT WINAPI corruntimehost_CreateDomainSetup( { RuntimeHost *This = impl_from_ICorRuntimeHost( iface ); HRESULT hr; - MonoDomain *domain; - MonoObject *obj; static const WCHAR classnameW[] = {'S','y','s','t','e','m','.','A','p','p','D','o','m','a','i','n','S','e','t','u','p',',','m','s','c','o','r','l','i','b',0}; TRACE("(%p)\n", iface); - hr = RuntimeHost_GetDefaultDomain(This, NULL, &domain); - - if (SUCCEEDED(hr)) - hr = RuntimeHost_CreateManagedInstance(This, classnameW, domain, &obj); - - if (SUCCEEDED(hr)) - hr = RuntimeHost_GetIUnknownForObject(This, obj, appDomainSetup); + hr = RuntimeHost_CreateManagedInstance(This, classnameW, appDomainSetup); return hr; } @@ -880,6 +863,7 @@ static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost* MonoDomain *domain, *prev_domain; MonoObject *result; MonoString *str; + void *attach_cookie; char *filenameA = NULL, *classA = NULL, *methodA = NULL; char *argsA = NULL, *ns; @@ -891,7 +875,7 @@ static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost* if (FAILED(hr)) return hr; - prev_domain = domain_attach(domain); + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); if (SUCCEEDED(hr)) { @@ -937,14 +921,14 @@ static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost* if (SUCCEEDED(hr)) { - hr = RuntimeHost_Invoke(This, domain, filenameA, classA, ns+1, methodA, + hr = RuntimeHost_Invoke(This, filenameA, classA, ns+1, methodA, NULL, (void**)&str, 1, &result); } if (SUCCEEDED(hr)) *pReturnValue = *(DWORD*)mono_object_unbox(result); - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); free(filenameA); free(classA); @@ -971,32 +955,28 @@ static const struct ICLRRuntimeHostVtbl CLRHostVtbl = }; /* Create an instance of a type given its name, by calling its constructor with - * no arguments. Note that result MUST be in the stack, or the garbage - * collector may free it prematurely. */ -HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, - MonoDomain *domain, MonoObject **result) + * no arguments. */ +HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, IUnknown **result) { HRESULT hr=S_OK; char *nameA=NULL; MonoType *type; MonoClass *klass; MonoObject *obj; - MonoDomain *prev_domain; - - if (!domain) - hr = RuntimeHost_GetDefaultDomain(This, NULL, &domain); + MonoDomain *domain, *prev_domain; + void *attach_cookie; + hr = RuntimeHost_GetDefaultDomain(This, NULL, &domain); if (FAILED(hr)) + { return hr; + } - prev_domain = domain_attach(domain); + nameA = WtoA(name); + if (!nameA) + hr = E_OUTOFMEMORY; - if (SUCCEEDED(hr)) - { - nameA = WtoA(name); - if (!nameA) - hr = E_OUTOFMEMORY; - } + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); if (SUCCEEDED(hr)) { @@ -1032,10 +1012,12 @@ HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, { /* FIXME: Detect exceptions from the constructor? */ mono_runtime_object_init(obj); - *result = obj; } - domain_restore(prev_domain); + if (SUCCEEDED(hr)) + hr = RuntimeHost_GetIUnknownForObject(This, obj, result); + + mono_threads_detach_coop(prev_domain, &attach_cookie); free(nameA); @@ -1053,13 +1035,10 @@ HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk) { - MonoDomain *domain; MonoObject *result; HRESULT hr; - domain = mono_object_get_domain(obj); - - hr = RuntimeHost_Invoke(This, domain, NULL, "System.Runtime.InteropServices", "Marshal", "GetIUnknownForObject", + hr = RuntimeHost_Invoke(This, NULL, "System.Runtime.InteropServices", "Marshal", "GetIUnknownForObject", NULL, (void**)&obj, 1, &result); if (SUCCEEDED(hr)) @@ -1266,6 +1245,7 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup) MonoAssembly *assembly=NULL; MonoImageOpenStatus status=0; MonoDomain *domain; + void *attach_cookie; if (fixup->done) return; @@ -1293,7 +1273,7 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup) { MonoDomain *prev_domain; - prev_domain = domain_attach(domain); + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); assembly = mono_assembly_open(filenameA, &status); @@ -1322,7 +1302,7 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup) fixup->done = TRUE; } - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); } if (info != NULL) @@ -1427,10 +1407,11 @@ __int32 WINAPI _CorExeMain(void) int exit_code; int argc; char **argv; - MonoDomain *domain=NULL; + MonoDomain *domain=NULL, *prev_domain=NULL; MonoImage *image; MonoImageOpenStatus status; MonoAssembly *assembly=NULL; + void *attach_cookie; WCHAR filename[MAX_PATH], config_file[MAX_PATH], *temp, **priv_path; SIZE_T config_file_dir_size; char *filenameA; @@ -1490,10 +1471,14 @@ __int32 WINAPI _CorExeMain(void) hr = ICLRRuntimeInfo_GetRuntimeHost(info, &host); if (SUCCEEDED(hr)) + { hr = RuntimeHost_GetDefaultDomain(host, config_file, &domain); + } if (SUCCEEDED(hr)) { + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); + image = mono_image_open_from_module_handle(GetModuleHandleW(NULL), filenameA, 1, &status); @@ -1511,6 +1496,8 @@ __int32 WINAPI _CorExeMain(void) ERR("couldn't load %s, status=%d\n", debugstr_w(filename), status); exit_code = -1; } + + mono_threads_detach_coop(prev_domain, &attach_cookie); } else exit_code = -1; @@ -1908,12 +1895,13 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) MonoDomain *prev_domain; MonoImageOpenStatus status; IUnknown *unk = NULL; + void *attach_cookie; char *filenameA, *ns; char *classA; hr = CLASS_E_CLASSNOTAVAILABLE; - prev_domain = domain_attach(domain); + prev_domain = mono_threads_attach_coop(domain, &attach_cookie); filenameA = WtoA(filename); assembly = mono_assembly_open(filenameA, &status); @@ -1921,7 +1909,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) if (!assembly) { ERR("Cannot open assembly %s, status=%i\n", debugstr_w(filename), status); - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); goto cleanup; } @@ -1929,7 +1917,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) if (!image) { ERR("Couldn't get assembly image\n"); - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); goto cleanup; } @@ -1942,7 +1930,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) if (!klass) { ERR("Couldn't get class from image\n"); - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); goto cleanup; } @@ -1962,7 +1950,7 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) else hr = CLASS_E_CLASSNOTAVAILABLE; - domain_restore(prev_domain); + mono_threads_detach_coop(prev_domain, &attach_cookie); } else hr = CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 0e34d7388a0..eb609fccc29 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -97,7 +97,6 @@ MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const cha static void (CDECL *mono_config_parse)(const char *filename); MonoDomain* (CDECL *mono_domain_get)(void); MonoDomain* (CDECL *mono_domain_get_by_id)(int id); -BOOL (CDECL *mono_domain_set)(MonoDomain *domain,BOOL force); void (CDECL *mono_domain_set_config)(MonoDomain *domain,const char *base_dir,const char *config_file_name); static void (CDECL *mono_free)(void *); MonoImage* (CDECL *mono_get_corlib)(void); @@ -125,8 +124,9 @@ static void (CDECL *mono_set_dirs)(const char *assembly_dir, const char *config_ static void (CDECL *mono_set_verbose_level)(DWORD level); MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str); static char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname); -MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain); void (CDECL *mono_thread_manage)(void); +MonoDomain* (CDECL *mono_threads_attach_coop)(MonoDomain *domain, void *attach_cookie); +void (CDECL *mono_threads_detach_coop)(MonoDomain *orig_domain, void *attach_cookie); void (CDECL *mono_trace_set_print_handler)(MonoPrintCallback callback); void (CDECL *mono_trace_set_printerr_handler)(MonoPrintCallback callback); void (CDECL *mono_trace_set_log_handler)(MonoLogCallback callback, void *user_data); @@ -215,7 +215,6 @@ static HRESULT load_mono(LPCWSTR mono_path) LOAD_MONO_FUNCTION(mono_class_get_method_from_name); LOAD_MONO_FUNCTION(mono_domain_get); LOAD_MONO_FUNCTION(mono_domain_get_by_id); - LOAD_MONO_FUNCTION(mono_domain_set); LOAD_MONO_FUNCTION(mono_domain_set_config); LOAD_MONO_FUNCTION(mono_free); LOAD_MONO_FUNCTION(mono_get_corlib); @@ -237,8 +236,9 @@ static HRESULT load_mono(LPCWSTR mono_path) LOAD_MONO_FUNCTION(mono_set_verbose_level); LOAD_MONO_FUNCTION(mono_stringify_assembly_name); LOAD_MONO_FUNCTION(mono_string_new); - LOAD_MONO_FUNCTION(mono_thread_attach); LOAD_MONO_FUNCTION(mono_thread_manage); + LOAD_MONO_FUNCTION(mono_threads_attach_coop); + LOAD_MONO_FUNCTION(mono_threads_detach_coop); #undef LOAD_MONO_FUNCTION diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 2b9f78a3955..d65cc25993c 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -596,7 +596,6 @@ STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject) HRESULT ret; ICLRRuntimeInfo *info; RuntimeHost *host; - MonoObject *obj; IUnknown *unk; TRACE("(%s,%s,%p)\n", debugstr_w(pTypeName), debugstr_guid(riid), ppObject); @@ -612,10 +611,7 @@ STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject) } if (SUCCEEDED(ret)) - ret = RuntimeHost_CreateManagedInstance(host, pTypeName, NULL, &obj); - - if (SUCCEEDED(ret)) - ret = RuntimeHost_GetIUnknownForObject(host, obj, &unk); + ret = RuntimeHost_CreateManagedInstance(host, pTypeName, &unk); if (SUCCEEDED(ret)) { diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index b8caac1b911..e8520f7fb0d 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -179,7 +179,6 @@ extern MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* na extern MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count); extern MonoDomain* (CDECL *mono_domain_get)(void); extern MonoDomain* (CDECL *mono_domain_get_by_id)(int id); -extern BOOL (CDECL *mono_domain_set)(MonoDomain *domain, BOOL force); extern void (CDECL *mono_domain_set_config)(MonoDomain *domain,const char *base_dir,const char *config_file_name); extern MonoImage* (CDECL *mono_get_corlib)(void); extern int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); @@ -195,8 +194,9 @@ extern MonoObject* (CDECL *mono_runtime_invoke)(MonoMethod *method, void *obj, v extern void (CDECL *mono_runtime_object_init)(MonoObject *this_obj); extern void (CDECL *mono_runtime_quit)(void); extern MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str); -extern MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain); extern void (CDECL *mono_thread_manage)(void); +extern MonoDomain* (CDECL *mono_threads_attach_coop)(MonoDomain *domain, void *attach_cookie); +extern void (CDECL *mono_threads_detach_coop)(MonoDomain *orig_domain, void *attach_cookie); extern void (CDECL *mono_trace_set_print_handler)(MonoPrintCallback callback); extern void (CDECL *mono_trace_set_printerr_handler)(MonoPrintCallback callback); @@ -209,10 +209,8 @@ extern void RuntimeHost_ExitProcess(RuntimeHost *This, INT exitcode); extern HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv); -extern HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk); - extern HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, - MonoDomain *domain, MonoObject **result); + IUnknown **result); HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost* iface, INT32 iExitCode); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10639