ReactOS 0.4.16-dev-1946-g52006dd
metahost.c
Go to the documentation of this file.
1/*
2 * ICLRMetaHost - discovery and management of available .NET runtimes
3 *
4 * Copyright 2010 Vincent Povirk for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "mscoree_private.h"
22
23#include <stdio.h>
24#include <assert.h>
25
26#include <wine/library.h>
27
28#include <fusion.h>
29
30static const WCHAR net_11_subdir[] = {'1','.','0',0};
31static const WCHAR net_20_subdir[] = {'2','.','0',0};
32static const WCHAR net_40_subdir[] = {'4','.','0',0};
33
34static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl;
35
36#define NUM_RUNTIMES 3
37
39 {{&CLRRuntimeInfoVtbl}, net_11_subdir, 1, 1, 4322, 0},
40 {{&CLRRuntimeInfoVtbl}, net_20_subdir, 2, 0, 50727, 0},
41 {{&CLRRuntimeInfoVtbl}, net_40_subdir, 4, 0, 30319, 0}
42};
43
45
48{
49 0, 0, &runtime_list_cs,
52 0, 0, { (DWORD_PTR)(__FILE__ ": runtime_list_cs") }
53};
54static CRITICAL_SECTION runtime_list_cs = { &runtime_list_cs_debug, -1, 0, 0, 0, 0 };
55
56#define NUM_ABI_VERSIONS 2
57
59
60static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version);
61
62static MonoAssembly* mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
63
65
66static void set_environment(LPCWSTR bin_path)
67{
68 WCHAR path_env[MAX_PATH];
69 int len;
70
71 static const WCHAR pathW[] = {'P','A','T','H',0};
72
73 /* We have to modify PATH as Mono loads other DLLs from this directory. */
74 GetEnvironmentVariableW(pathW, path_env, sizeof(path_env)/sizeof(WCHAR));
75 len = strlenW(path_env);
76 path_env[len++] = ';';
77 strcpyW(path_env+len, bin_path);
78 SetEnvironmentVariableW(pathW, path_env);
79}
80
81static void CDECL do_nothing(void)
82{
83}
84
85#ifdef __REACTOS__
86int WINAPIV ShellMessageBoxA(HINSTANCE hAppInst, HWND hWnd, LPCSTR lpcText, LPCSTR lpcTitle, UINT fuStyle, ...);
87#undef MESSAGE
88#define MESSAGE(msg) \
89do { \
90 WINE_MESSAGE((msg)); \
91 ShellMessageBoxA(NULL, NULL, (msg), "Wine Mono", MB_OK | MB_ICONSTOP); \
92} while(0)
93//
94// NOTE for wine-syncs: This warning is gradually removed in Wine commits:
95// c99754ef15a8, 6b889fe9188a, 5cd6db03495d, and 26c9bd9f15c3
96//
97#endif
99{
100 if (This->major == 1)
101 MESSAGE("wine: Install Mono 2.6 for Windows to run .NET 1.1 applications.\n");
102 else if (This->major == 2)
103 MESSAGE("wine: Install Mono for Windows to run .NET 2.0 applications.\n");
104 else if (This->major == 4)
105 MESSAGE("wine: Install Mono 2.8 or greater for Windows to run .NET 4.0 applications.\n");
106}
107
109{
110 static const WCHAR bin[] = {'\\','b','i','n',0};
111 static const WCHAR lib[] = {'\\','l','i','b',0};
112 static const WCHAR etc[] = {'\\','e','t','c',0};
113 static const WCHAR glibdll[] = {'l','i','b','g','l','i','b','-','2','.','0','-','0','.','d','l','l',0};
114 WCHAR mono_dll_path[MAX_PATH+16], mono_bin_path[MAX_PATH+4];
115 WCHAR mono_lib_path[MAX_PATH+4], mono_etc_path[MAX_PATH+4];
116 char mono_lib_path_a[MAX_PATH], mono_etc_path_a[MAX_PATH];
117 int trace_size;
118 char trace_setting[256];
119
120 if (This->mono_abi_version <= 0 || This->mono_abi_version > NUM_ABI_VERSIONS)
121 {
123 return E_FAIL;
124 }
125
126 *result = &loaded_monos[This->mono_abi_version-1];
127
128 if ((*result)->is_shutdown)
129 {
130 ERR("Cannot load Mono after it has been shut down.\n");
131 *result = NULL;
132 return E_FAIL;
133 }
134
135 if (!(*result)->mono_handle)
136 {
137 strcpyW(mono_bin_path, This->mono_path);
138 strcatW(mono_bin_path, bin);
139 set_environment(mono_bin_path);
140
141 strcpyW(mono_lib_path, This->mono_path);
142 strcatW(mono_lib_path, lib);
143 WideCharToMultiByte(CP_UTF8, 0, mono_lib_path, -1, mono_lib_path_a, MAX_PATH, NULL, NULL);
144
145 strcpyW(mono_etc_path, This->mono_path);
146 strcatW(mono_etc_path, etc);
147 WideCharToMultiByte(CP_UTF8, 0, mono_etc_path, -1, mono_etc_path_a, MAX_PATH, NULL, NULL);
148
149 if (!find_mono_dll(This->mono_path, mono_dll_path, This->mono_abi_version)) goto fail;
150
151 (*result)->mono_handle = LoadLibraryW(mono_dll_path);
152
153 if (!(*result)->mono_handle) goto fail;
154
155#define LOAD_MONO_FUNCTION(x) do { \
156 (*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
157 if (!(*result)->x) { \
158 goto fail; \
159 } \
160} while (0);
161
162 LOAD_MONO_FUNCTION(mono_assembly_get_image);
163 LOAD_MONO_FUNCTION(mono_assembly_load_from);
164 LOAD_MONO_FUNCTION(mono_assembly_open);
165 LOAD_MONO_FUNCTION(mono_config_parse);
166 LOAD_MONO_FUNCTION(mono_class_from_mono_type);
167 LOAD_MONO_FUNCTION(mono_class_from_name);
168 LOAD_MONO_FUNCTION(mono_class_get_method_from_name);
169 LOAD_MONO_FUNCTION(mono_domain_assembly_open);
170 LOAD_MONO_FUNCTION(mono_image_open_from_module_handle);
171 LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook);
172 LOAD_MONO_FUNCTION(mono_jit_exec);
173 LOAD_MONO_FUNCTION(mono_jit_init);
174 LOAD_MONO_FUNCTION(mono_jit_set_trace_options);
175 LOAD_MONO_FUNCTION(mono_marshal_get_vtfixup_ftnptr);
176 LOAD_MONO_FUNCTION(mono_object_get_domain);
177 LOAD_MONO_FUNCTION(mono_object_new);
178 LOAD_MONO_FUNCTION(mono_object_unbox);
179 LOAD_MONO_FUNCTION(mono_profiler_install);
180 LOAD_MONO_FUNCTION(mono_reflection_type_from_name);
181 LOAD_MONO_FUNCTION(mono_runtime_invoke);
182 LOAD_MONO_FUNCTION(mono_runtime_object_init);
183 LOAD_MONO_FUNCTION(mono_runtime_quit);
184 LOAD_MONO_FUNCTION(mono_set_dirs);
185 LOAD_MONO_FUNCTION(mono_stringify_assembly_name);
186 LOAD_MONO_FUNCTION(mono_string_new);
187 LOAD_MONO_FUNCTION(mono_thread_attach);
188
189 /* GLib imports obsoleted by the 2.0 ABI */
190 if (This->mono_abi_version == 1)
191 {
192 (*result)->glib_handle = LoadLibraryW(glibdll);
193 if (!(*result)->glib_handle) goto fail;
194
195 (*result)->mono_free = (void*)GetProcAddress((*result)->glib_handle, "g_free");
196 if (!(*result)->mono_free) goto fail;
197 }
198 else
199 {
200 LOAD_MONO_FUNCTION(mono_free);
201 }
202
203#undef LOAD_MONO_FUNCTION
204
205#define LOAD_OPT_VOID_MONO_FUNCTION(x) do { \
206 (*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
207 if (!(*result)->x) { \
208 (*result)->x = do_nothing; \
209 } \
210} while (0);
211
212 LOAD_OPT_VOID_MONO_FUNCTION(mono_runtime_set_shutting_down);
213 LOAD_OPT_VOID_MONO_FUNCTION(mono_thread_pool_cleanup);
214 LOAD_OPT_VOID_MONO_FUNCTION(mono_thread_suspend_all_other_threads);
215 LOAD_OPT_VOID_MONO_FUNCTION(mono_threads_set_shutting_down);
216
217#undef LOAD_OPT_VOID_MONO_FUNCTION
218
219 (*result)->mono_profiler_install((MonoProfiler*)*result, mono_shutdown_callback_fn);
220
221 (*result)->mono_set_dirs(mono_lib_path_a, mono_etc_path_a);
222
223 (*result)->mono_config_parse(NULL);
224
225 (*result)->mono_install_assembly_preload_hook(mono_assembly_search_hook_fn, *result);
226
227 trace_size = GetEnvironmentVariableA("WINE_MONO_TRACE", trace_setting, sizeof(trace_setting));
228
229 if (trace_size)
230 {
231 (*result)->mono_jit_set_trace_options(trace_setting);
232 }
233 }
234
235 return S_OK;
236
237fail:
238 ERR("Could not load Mono into this process\n");
239 FreeLibrary((*result)->mono_handle);
240 FreeLibrary((*result)->glib_handle);
241 (*result)->mono_handle = NULL;
242 (*result)->glib_handle = NULL;
243 return E_FAIL;
244}
245
247{
248 loaded_mono *mono = (loaded_mono*)prof;
249
250 mono->is_shutdown = TRUE;
251}
252
254{
255 HRESULT hr = S_OK;
256 loaded_mono *ploaded_mono;
257
258 if (This->loaded_runtime)
259 {
260 *result = This->loaded_runtime;
261 return hr;
262 }
263
265
266 hr = load_mono(This, &ploaded_mono);
267
268 if (SUCCEEDED(hr))
269 hr = RuntimeHost_Construct(This, ploaded_mono, &This->loaded_runtime);
270
272
273 if (SUCCEEDED(hr))
274 *result = This->loaded_runtime;
275
276 return hr;
277}
278
280{
281 int i;
282
283 for (i=0; i<NUM_ABI_VERSIONS; i++)
284 {
285 loaded_mono *mono = &loaded_monos[i];
286 if (mono->mono_handle && mono->is_started && !mono->is_shutdown)
287 {
288 /* Copied from Mono's ves_icall_System_Environment_Exit */
289 mono->mono_threads_set_shutting_down();
290 mono->mono_runtime_set_shutting_down();
291 mono->mono_thread_pool_cleanup();
292 mono->mono_thread_suspend_all_other_threads();
293 mono->mono_runtime_quit();
294 }
295 }
296
297 for (i=0; i<NUM_RUNTIMES; i++)
300}
301
303{
304 int i;
305
306 for (i=0; i<NUM_ABI_VERSIONS; i++)
307 {
308 loaded_mono *mono = &loaded_monos[i];
309 if (mono->mono_handle && mono->is_started && !mono->is_shutdown)
310 {
311 ERR("Process exited with a Mono runtime loaded.\n");
312 return;
313 }
314 }
315}
316
318{
320}
321
323 REFIID riid,
324 void **ppvObject)
325{
326 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
327
328 if ( IsEqualGUID( riid, &IID_ICLRRuntimeInfo ) ||
330 {
331 *ppvObject = iface;
332 }
333 else
334 {
335 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
336 return E_NOINTERFACE;
337 }
338
339 ICLRRuntimeInfo_AddRef( iface );
340
341 return S_OK;
342}
343
345{
346 return 2;
347}
348
350{
351 return 1;
352}
353
355 LPWSTR pwzBuffer, DWORD *pcchBuffer)
356{
358 DWORD buffer_size = *pcchBuffer;
359 HRESULT hr = S_OK;
360 char version[11];
361 DWORD size;
362
363 TRACE("%p %p %p\n", iface, pwzBuffer, pcchBuffer);
364
365 size = snprintf(version, sizeof(version), "v%u.%u.%u", This->major, This->minor, This->build);
366
367 assert(size <= sizeof(version));
368
369 *pcchBuffer = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
370
371 if (pwzBuffer)
372 {
373 if (buffer_size >= *pcchBuffer)
374 MultiByteToWideChar(CP_UTF8, 0, version, -1, pwzBuffer, buffer_size);
375 else
377 }
378
379 return hr;
380}
381
382static BOOL get_install_root(LPWSTR install_dir)
383{
384 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};
385 const WCHAR install_root[] = {'I','n','s','t','a','l','l','R','o','o','t',0};
386
387 DWORD len;
388 HKEY key;
389
390 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, dotnet_key, 0, KEY_READ, &key))
391 return FALSE;
392
393 len = MAX_PATH * sizeof(WCHAR);
394 if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)install_dir, &len))
395 {
397 return FALSE;
398 }
400
401 return TRUE;
402}
403
405 LPWSTR pwzBuffer, DWORD *pcchBuffer)
406{
407 static const WCHAR slash[] = {'\\',0};
408 DWORD buffer_size = *pcchBuffer;
411 DWORD version_size, size;
412 HRESULT hr = S_OK;
413
414 TRACE("%p %p %p\n", iface, pwzBuffer, pcchBuffer);
415
417 {
418 ERR("error reading registry key for installroot\n");
419 return E_FAIL;
420 }
421 else
422 {
423 version_size = MAX_PATH;
424 ICLRRuntimeInfo_GetVersionString(iface, version, &version_size);
426 lstrcatW(system_dir, slash);
427 size = lstrlenW(system_dir) + 1;
428 }
429
430 *pcchBuffer = size;
431
432 if (pwzBuffer)
433 {
434 if (buffer_size >= size)
435 strcpyW(pwzBuffer, system_dir);
436 else
438 }
439
440 return hr;
441}
442
444 HANDLE hndProcess, BOOL *pbLoaded)
445{
446 FIXME("%p %p %p\n", iface, hndProcess, pbLoaded);
447
448 return E_NOTIMPL;
449}
450
452 UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
453{
454 FIXME("%p %u %p %p %x\n", iface, iResourceID, pwzBuffer, pcchBuffer, iLocaleid);
455
456 return E_NOTIMPL;
457}
458
460 LPCWSTR pwzDllName, HMODULE *phndModule)
461{
463 HRESULT hr;
465
466 TRACE("%p %s %p\n", iface, debugstr_w(pwzDllName), phndModule);
467
469 hr = ICLRRuntimeInfo_GetVersionString(iface, version, &cchBuffer);
470 if (FAILED(hr)) return hr;
471
472 return LoadLibraryShim(pwzDllName, version, NULL, phndModule);
473}
474
476 LPCSTR pszProcName, LPVOID *ppProc)
477{
478 FIXME("%p %s %p\n", iface, debugstr_a(pszProcName), ppProc);
479
480 return E_NOTIMPL;
481}
482
484 REFCLSID rclsid, REFIID riid, LPVOID *ppUnk)
485{
488 HRESULT hr;
489
490 TRACE("%p %s %s %p\n", iface, debugstr_guid(rclsid), debugstr_guid(riid), ppUnk);
491
493
494 if (SUCCEEDED(hr))
495 hr = RuntimeHost_GetInterface(host, rclsid, riid, ppUnk);
496
497 return hr;
498}
499
501 BOOL *pbLoadable)
502{
503 FIXME("%p %p\n", iface, pbLoadable);
504
505 return E_NOTIMPL;
506}
507
509 DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
510{
511 FIXME("%p %x %s\n", iface, dwStartupFlags, debugstr_w(pwzHostConfigFile));
512
513 return E_NOTIMPL;
514}
515
517 DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
518{
519 FIXME("%p %p %p %p\n", iface, pdwStartupFlags, pwzHostConfigFile, pcchHostConfigFile);
520
521 return E_NOTIMPL;
522}
523
525{
526 FIXME("%p\n", iface);
527
528 return E_NOTIMPL;
529}
530
532 BOOL *pbStarted, DWORD *pdwStartupFlags)
533{
534 FIXME("%p %p %p\n", iface, pbStarted, pdwStartupFlags);
535
536 return E_NOTIMPL;
537}
538
539static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl = {
555};
556
558{
560
561 assert(This->ICLRRuntimeInfo_iface.lpVtbl == &CLRRuntimeInfoVtbl);
562
564}
565
566#ifdef __i386__
567static const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','-','x','8','6','.','d','l','l',0};
568#elif defined(__x86_64__)
569static const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','-','x','8','6','_','6','4','.','d','l','l',0};
570#else
571static const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0};
572#endif
573
574static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version)
575{
576 static const WCHAR mono_dll[] = {'\\','b','i','n','\\','m','o','n','o','.','d','l','l',0};
577 static const WCHAR libmono_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','.','d','l','l',0};
578 static const WCHAR mono2_dll[] = {'\\','b','i','n','\\','m','o','n','o','-','2','.','0','.','d','l','l',0};
579 static const WCHAR libmono2_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0};
581
582 if (abi_version == 1)
583 {
584 strcpyW(dll_path, path);
585 strcatW(dll_path, mono_dll);
586 attributes = GetFileAttributesW(dll_path);
587
588 if (attributes == INVALID_FILE_ATTRIBUTES)
589 {
590 strcpyW(dll_path, path);
591 strcatW(dll_path, libmono_dll);
592 attributes = GetFileAttributesW(dll_path);
593 }
594 }
595 else if (abi_version == 2)
596 {
597 strcpyW(dll_path, path);
598 strcatW(dll_path, libmono2_arch_dll);
599 attributes = GetFileAttributesW(dll_path);
600
601 if (attributes == INVALID_FILE_ATTRIBUTES)
602 {
603 strcpyW(dll_path, path);
604 strcatW(dll_path, mono2_dll);
605 attributes = GetFileAttributesW(dll_path);
606 }
607
608 if (attributes == INVALID_FILE_ATTRIBUTES)
609 {
610 strcpyW(dll_path, path);
611 strcatW(dll_path, libmono2_dll);
612 attributes = GetFileAttributesW(dll_path);
613 }
614 }
615
616 return (attributes != INVALID_FILE_ATTRIBUTES);
617}
618
620{
621 static const WCHAR mono_key[] = {'S','o','f','t','w','a','r','e','\\','N','o','v','e','l','l','\\','M','o','n','o',0};
622 static const WCHAR defaul_clr[] = {'D','e','f','a','u','l','t','C','L','R',0};
623 static const WCHAR install_root[] = {'S','d','k','I','n','s','t','a','l','l','R','o','o','t',0};
624 static const WCHAR slash[] = {'\\',0};
625
626 WCHAR version[64], version_key[MAX_PATH];
627 DWORD len;
628 HKEY key;
629 WCHAR dll_path[MAX_PATH];
630
631 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, mono_key, 0, KEY_READ, &key))
632 return FALSE;
633
634 len = sizeof(version);
635 if (RegQueryValueExW(key, defaul_clr, 0, NULL, (LPBYTE)version, &len))
636 {
638 return FALSE;
639 }
641
642 lstrcpyW(version_key, mono_key);
643 lstrcatW(version_key, slash);
644 lstrcatW(version_key, version);
645
646 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, version_key, 0, KEY_READ, &key))
647 return FALSE;
648
649 len = sizeof(WCHAR) * MAX_PATH;
650 if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)path, &len))
651 {
653 return FALSE;
654 }
656
657 return find_mono_dll(path, dll_path, abi_version);
658}
659
661{
662 static const WCHAR mono_one_dot_zero[] = {'\\','m','o','n','o','-','1','.','0', 0};
663 static const WCHAR mono_two_dot_zero[] = {'\\','m','o','n','o','-','2','.','0', 0};
664 WCHAR mono_dll_path[MAX_PATH];
665 BOOL found = FALSE;
666
668
669 if (abi_version == 1)
670 strcatW(mono_path, mono_one_dot_zero);
671 else if (abi_version == 2)
672 strcatW(mono_path, mono_two_dot_zero);
673
674 found = find_mono_dll(mono_path, mono_dll_path, abi_version);
675
676 return found;
677}
678
679static BOOL get_mono_path(LPWSTR path, int abi_version)
680{
681 static const WCHAR subdir_mono[] = {'\\','m','o','n','o',0};
682 static const WCHAR sibling_mono[] = {'\\','.','.','\\','m','o','n','o',0};
683 WCHAR base_path[MAX_PATH];
684 const char *unix_data_dir;
685 WCHAR *dos_data_dir;
686 int build_tree=0;
687 static WCHAR* (CDECL *wine_get_dos_file_name)(const char*);
688
689 /* First try c:\windows\mono */
690 GetWindowsDirectoryW(base_path, MAX_PATH);
691 strcatW(base_path, subdir_mono);
692
693 if (get_mono_path_from_folder(base_path, path, abi_version))
694 return TRUE;
695
696 /* Next: /usr/share/wine/mono */
697 unix_data_dir = wine_get_data_dir();
698
699 if (!unix_data_dir)
700 {
701 unix_data_dir = wine_get_build_dir();
702 build_tree = 1;
703 }
704
705 if (unix_data_dir)
706 {
708 wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "wine_get_dos_file_name");
709
711 {
712 dos_data_dir = wine_get_dos_file_name(unix_data_dir);
713
714 if (dos_data_dir)
715 {
716 strcpyW(base_path, dos_data_dir);
717 strcatW(base_path, build_tree ? sibling_mono : subdir_mono);
718
719 HeapFree(GetProcessHeap(), 0, dos_data_dir);
720
721 if (get_mono_path_from_folder(base_path, path, abi_version))
722 return TRUE;
723 }
724 }
725 }
726
727 /* Last: the registry */
728 return get_mono_path_from_registry(path, abi_version);
729}
730
731static void find_runtimes(void)
732{
733 int abi_version, i;
734 static const WCHAR libmono[] = {'\\','l','i','b','\\','m','o','n','o','\\',0};
735 static const WCHAR mscorlib[] = {'\\','m','s','c','o','r','l','i','b','.','d','l','l',0};
736 WCHAR mono_path[MAX_PATH], lib_path[MAX_PATH];
737 BOOL any_runtimes_found = FALSE;
738
739 if (runtimes_initialized) return;
740
742
743 if (runtimes_initialized) goto end;
744
745 for (abi_version=NUM_ABI_VERSIONS; abi_version>0; abi_version--)
746 {
747 if (!get_mono_path(mono_path, abi_version))
748 continue;
749
750 for (i=0; i<NUM_RUNTIMES; i++)
751 {
752 if (runtimes[i].mono_abi_version == 0)
753 {
754 strcpyW(lib_path, mono_path);
755 strcatW(lib_path, libmono);
756 strcatW(lib_path, runtimes[i].mono_libdir);
757 strcatW(lib_path, mscorlib);
758
760 {
761 runtimes[i].mono_abi_version = abi_version;
762
764 strcpyW(runtimes[i].mscorlib_path, lib_path);
765
766 any_runtimes_found = TRUE;
767 }
768 }
769 }
770 }
771
772 if (!any_runtimes_found)
773 {
774 /* Report all runtimes are available if Mono isn't installed.
775 * FIXME: Remove this when Mono is properly packaged. */
776 for (i=0; i<NUM_RUNTIMES; i++)
778 }
779
781
782end:
784}
785
787{
791};
792
793static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl;
794
796{
798}
799
801 void **ppvObject)
802{
803 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
804
807 {
808 *ppvObject = iface;
809 }
810 else
811 {
812 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
813 return E_NOINTERFACE;
814 }
815
816 IEnumUnknown_AddRef( iface );
817
818 return S_OK;
819}
820
822{
825
826 TRACE("(%p) refcount=%u\n", iface, ref);
827
828 return ref;
829}
830
832{
835
836 TRACE("(%p) refcount=%u\n", iface, ref);
837
838 if (ref == 0)
839 {
841 }
842
843 return ref;
844}
845
847 IUnknown **rgelt, ULONG *pceltFetched)
848{
850 int num_fetched = 0;
852 IUnknown *item;
853
854 TRACE("(%p,%u,%p,%p)\n", iface, celt, rgelt, pceltFetched);
855
856 while (num_fetched < celt)
857 {
858 if (This->pos >= NUM_RUNTIMES)
859 {
860 hr = S_FALSE;
861 break;
862 }
863 if (runtimes[This->pos].mono_abi_version)
864 {
865 item = (IUnknown*)&runtimes[This->pos].ICLRRuntimeInfo_iface;
866 IUnknown_AddRef(item);
867 rgelt[num_fetched] = item;
868 num_fetched++;
869 }
870 This->pos++;
871 }
872
873 if (pceltFetched)
874 *pceltFetched = num_fetched;
875
876 return hr;
877}
878
880{
882 int num_fetched = 0;
884
885 TRACE("(%p,%u)\n", iface, celt);
886
887 while (num_fetched < celt)
888 {
889 if (This->pos >= NUM_RUNTIMES)
890 {
891 hr = S_FALSE;
892 break;
893 }
894 if (runtimes[This->pos].mono_abi_version)
895 {
896 num_fetched++;
897 }
898 This->pos++;
899 }
900
901 return hr;
902}
903
905{
907
908 TRACE("(%p)\n", iface);
909
910 This->pos = 0;
911
912 return S_OK;
913}
914
916{
918 struct InstalledRuntimeEnum *new_enum;
919
920 TRACE("(%p)\n", iface);
921
922 new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_enum));
923 if (!new_enum)
924 return E_OUTOFMEMORY;
925
927 new_enum->ref = 1;
928 new_enum->pos = This->pos;
929
930 *ppenum = &new_enum->IEnumUnknown_iface;
931
932 return S_OK;
933}
934
935static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl = {
943};
944
946{
948};
949
951
953 REFIID riid,
954 void **ppvObject)
955{
956 TRACE("%s %p\n", debugstr_guid(riid), ppvObject);
957
958 if ( IsEqualGUID( riid, &IID_ICLRMetaHost ) ||
960 {
961 *ppvObject = iface;
962 }
963 else
964 {
965 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
966 return E_NOINTERFACE;
967 }
968
969 ICLRMetaHost_AddRef( iface );
970
971 return S_OK;
972}
973
975{
976 return 2;
977}
978
980{
981 return 1;
982}
983
985{
986 *major = 0;
987 *minor = 0;
988 *build = 0;
989
990 if (version[0] == 'v' || version[0] == 'V')
991 {
992 version++;
993 if (!isdigit(*version))
994 return FALSE;
995
996 while (isdigit(*version))
997 *major = *major * 10 + (*version++ - '0');
998
999 if (*version == 0)
1000 return TRUE;
1001
1002 if (*version++ != '.' || !isdigit(*version))
1003 return FALSE;
1004
1005 while (isdigit(*version))
1006 *minor = *minor * 10 + (*version++ - '0');
1007
1008 if (*version == 0)
1009 return TRUE;
1010
1011 if (*version++ != '.' || !isdigit(*version))
1012 return FALSE;
1013
1014 while (isdigit(*version))
1015 *build = *build * 10 + (*version++ - '0');
1016
1017 return *version == 0;
1018 }
1019 else
1020 return FALSE;
1021}
1022
1024 LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
1025{
1026 int i;
1027 DWORD major, minor, build;
1028
1029 TRACE("%s %s %p\n", debugstr_w(pwzVersion), debugstr_guid(iid), ppRuntime);
1030
1031 if (!pwzVersion)
1032 return E_POINTER;
1033
1034 if (!parse_runtime_version(pwzVersion, &major, &minor, &build))
1035 {
1036 ERR("Cannot parse %s\n", debugstr_w(pwzVersion));
1037 return CLR_E_SHIM_RUNTIME;
1038 }
1039
1040 find_runtimes();
1041
1042 for (i=0; i<NUM_RUNTIMES; i++)
1043 {
1044 if (runtimes[i].major == major && runtimes[i].minor == minor &&
1045 runtimes[i].build == build)
1046 {
1047 if (runtimes[i].mono_abi_version)
1048 return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface, iid,
1049 ppRuntime);
1050 else
1051 {
1053 return CLR_E_SHIM_RUNTIME;
1054 }
1055 }
1056 }
1057
1058 FIXME("Unrecognized version %s\n", debugstr_w(pwzVersion));
1059 return CLR_E_SHIM_RUNTIME;
1060}
1061
1063 LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
1064{
1066 HRESULT hr;
1067 LPSTR version;
1068 ULONG buffer_size=*pcchBuffer;
1069
1070 TRACE("%s %p %p\n", debugstr_w(pwzFilePath), pwzBuffer, pcchBuffer);
1071
1072 hr = assembly_create(&assembly, pwzFilePath);
1073
1074 if (SUCCEEDED(hr))
1075 {
1077
1078 if (SUCCEEDED(hr))
1079 {
1080 *pcchBuffer = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
1081
1082 if (pwzBuffer)
1083 {
1084 if (buffer_size >= *pcchBuffer)
1085 MultiByteToWideChar(CP_UTF8, 0, version, -1, pwzBuffer, buffer_size);
1086 else
1088 }
1089 }
1090
1092 }
1093
1094 return hr;
1095}
1096
1098 IEnumUnknown **ppEnumerator)
1099{
1100 struct InstalledRuntimeEnum *new_enum;
1101
1102 TRACE("%p\n", ppEnumerator);
1103
1104 find_runtimes();
1105
1106 new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_enum));
1107 if (!new_enum)
1108 return E_OUTOFMEMORY;
1109
1111 new_enum->ref = 1;
1112 new_enum->pos = 0;
1113
1114 *ppEnumerator = &new_enum->IEnumUnknown_iface;
1115
1116 return S_OK;
1117}
1118
1120 HANDLE hndProcess, IEnumUnknown **ppEnumerator)
1121{
1122 FIXME("%p %p\n", hndProcess, ppEnumerator);
1123
1124 return E_NOTIMPL;
1125}
1126
1128 RuntimeLoadedCallbackFnPtr pCallbackFunction)
1129{
1130 FIXME("%p\n", pCallbackFunction);
1131
1132 return E_NOTIMPL;
1133}
1134
1136 REFIID riid, LPVOID *ppUnk)
1137{
1138 FIXME("%s %p\n", debugstr_guid(riid), ppUnk);
1139
1140 return E_NOTIMPL;
1141}
1142
1144{
1145 FIXME("%i: stub\n", iExitCode);
1146
1147 ExitProcess(iExitCode);
1148}
1149
1150static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl =
1151{
1162};
1163
1164static struct CLRMetaHost GlobalCLRMetaHost = {
1165 { &CLRMetaHost_vtbl }
1166};
1167
1169{
1170 return ICLRMetaHost_QueryInterface(&GlobalCLRMetaHost.ICLRMetaHost_iface, riid, ppobj);
1171}
1172
1173static MonoAssembly* mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data)
1174{
1175 loaded_mono *mono = user_data;
1176 HRESULT hr=S_OK;
1178 char *stringname=NULL;
1179 LPWSTR stringnameW;
1180 int stringnameW_size;
1181 IAssemblyCache *asmcache;
1184 char *pathA;
1186 static WCHAR fusiondll[] = {'f','u','s','i','o','n',0};
1187 HMODULE hfusion=NULL;
1188 static HRESULT (WINAPI *pCreateAssemblyCache)(IAssemblyCache**,DWORD);
1189
1190 stringname = mono->mono_stringify_assembly_name(aname);
1191
1192 TRACE("%s\n", debugstr_a(stringname));
1193
1194 if (!stringname) return NULL;
1195
1196 /* FIXME: We should search the given paths before the GAC. */
1197
1198 if (!pCreateAssemblyCache)
1199 {
1200 hr = LoadLibraryShim(fusiondll, NULL, NULL, &hfusion);
1201
1202 if (SUCCEEDED(hr))
1203 {
1204 pCreateAssemblyCache = (void*)GetProcAddress(hfusion, "CreateAssemblyCache");
1205 if (!pCreateAssemblyCache)
1206 hr = E_FAIL;
1207 }
1208 }
1209
1210 if (SUCCEEDED(hr))
1211 hr = pCreateAssemblyCache(&asmcache, 0);
1212
1213 if (SUCCEEDED(hr))
1214 {
1215 stringnameW_size = MultiByteToWideChar(CP_UTF8, 0, stringname, -1, NULL, 0);
1216
1217 stringnameW = HeapAlloc(GetProcessHeap(), 0, stringnameW_size * sizeof(WCHAR));
1218 if (stringnameW)
1219 MultiByteToWideChar(CP_UTF8, 0, stringname, -1, stringnameW, stringnameW_size);
1220 else
1221 hr = E_OUTOFMEMORY;
1222
1223 if (SUCCEEDED(hr))
1224 {
1225 info.cbAssemblyInfo = sizeof(info);
1226 info.pszCurrentAssemblyPathBuf = path;
1227 info.cchBuf = MAX_PATH;
1228 path[0] = 0;
1229
1230 hr = IAssemblyCache_QueryAssemblyInfo(asmcache, 0, stringnameW, &info);
1231 }
1232
1233 HeapFree(GetProcessHeap(), 0, stringnameW);
1234
1235 IAssemblyCache_Release(asmcache);
1236 }
1237
1238 if (SUCCEEDED(hr))
1239 {
1240 TRACE("found: %s\n", debugstr_w(path));
1241
1242 pathA = WtoA(path);
1243
1244 if (pathA)
1245 {
1247
1248 if (!result)
1249 ERR("Failed to load %s, status=%u\n", debugstr_w(path), stat);
1250
1252 }
1253 }
1254
1255 mono->mono_free(stringname);
1256
1257 return result;
1258}
1259
1261 DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
1262{
1263 static const WCHAR dotconfig[] = {'.','c','o','n','f','i','g',0};
1264 static const DWORD supported_startup_flags = 0;
1265 static const DWORD supported_runtime_flags = RUNTIME_INFO_UPGRADE_VERSION;
1266 int i;
1267 WCHAR local_version[MAX_PATH];
1268 ULONG local_version_size = MAX_PATH;
1269 WCHAR local_config_file[MAX_PATH];
1270 HRESULT hr;
1271 parsed_config_file parsed_config;
1272
1273 if (startup_flags & ~supported_startup_flags)
1274 FIXME("unsupported startup flags %x\n", startup_flags & ~supported_startup_flags);
1275
1276 if (runtimeinfo_flags & ~supported_runtime_flags)
1277 FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags);
1278
1279 if (exefile && !config_file)
1280 {
1281 strcpyW(local_config_file, exefile);
1282 strcatW(local_config_file, dotconfig);
1283
1284 config_file = local_config_file;
1285 }
1286
1287 if (config_file)
1288 {
1289 int found=0;
1290 hr = parse_config_file(config_file, &parsed_config);
1291
1292 if (SUCCEEDED(hr))
1293 {
1296 {
1297 hr = CLRMetaHost_GetRuntime(0, entry->version, &IID_ICLRRuntimeInfo, (void**)result);
1298 if (SUCCEEDED(hr))
1299 {
1300 found = 1;
1301 break;
1302 }
1303 }
1304 }
1305 else
1306 {
1307 WARN("failed to parse config file %s, hr=%x\n", debugstr_w(config_file), hr);
1308 }
1309
1310 free_parsed_config_file(&parsed_config);
1311
1312 if (found)
1313 return S_OK;
1314 }
1315
1316 if (exefile && !version)
1317 {
1318 hr = CLRMetaHost_GetVersionFromFile(0, exefile, local_version, &local_version_size);
1319
1320 version = local_version;
1321
1322 if (FAILED(hr)) return hr;
1323 }
1324
1325 if (version)
1326 {
1327 hr = CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)result);
1328 if(SUCCEEDED(hr))
1329 return hr;
1330 }
1331
1332 if (runtimeinfo_flags & RUNTIME_INFO_UPGRADE_VERSION)
1333 {
1334 DWORD major, minor, build;
1335
1336 if (version && !parse_runtime_version(version, &major, &minor, &build))
1337 {
1338 ERR("Cannot parse %s\n", debugstr_w(version));
1339 return CLR_E_SHIM_RUNTIME;
1340 }
1341
1342 find_runtimes();
1343
1344 if (legacy)
1345 i = 2;
1346 else
1347 i = NUM_RUNTIMES;
1348
1349 while (i--)
1350 {
1351 if (runtimes[i].mono_abi_version)
1352 {
1353 /* Must be greater or equal to the version passed in. */
1354 if (!version || ((runtimes[i].major >= major && runtimes[i].minor >= minor && runtimes[i].build >= build) ||
1355 (runtimes[i].major >= major && runtimes[i].minor > minor) ||
1356 (runtimes[i].major > major)))
1357 {
1358 return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface,
1359 &IID_ICLRRuntimeInfo, (void **)result);
1360 }
1361 }
1362 }
1363
1364 if (legacy)
1366 else
1368
1369 return CLR_E_SHIM_RUNTIME;
1370 }
1371
1372 return CLR_E_SHIM_RUNTIME;
1373}
signed int INT32
#define isdigit(c)
Definition: acclib.h:68
#define stat
Definition: acwin.h:99
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
#define CLR_E_SHIM_RUNTIME
Definition: corerror.h:127
HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv)
HRESULT RuntimeHost_Destroy(RuntimeHost *This)
HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version, loaded_mono *loaded_mono, RuntimeHost **result)
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define CDECL
Definition: compat.h:29
#define GetProcessHeap()
Definition: compat.h:736
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define wine_get_dos_file_name(__x)
Definition: compat.h:61
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
static DWORD cchBuffer
Definition: fusion.c:85
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1489
const WCHAR system_dir[]
Definition: file.c:68
HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result)
Definition: config.c:419
void free_parsed_config_file(parsed_config_file *file)
Definition: config.c:448
static HRESULT WINAPI CLRRuntimeInfo_LoadLibrary(ICLRRuntimeInfo *iface, LPCWSTR pwzDllName, HMODULE *phndModule)
Definition: metahost.c:459
static HRESULT WINAPI CLRRuntimeInfo_IsStarted(ICLRRuntimeInfo *iface, BOOL *pbStarted, DWORD *pdwStartupFlags)
Definition: metahost.c:531
static struct CLRRuntimeInfo runtimes[NUM_RUNTIMES]
Definition: metahost.c:38
static HRESULT WINAPI CLRRuntimeInfo_GetInterface(ICLRRuntimeInfo *iface, REFCLSID rclsid, REFIID riid, LPVOID *ppUnk)
Definition: metahost.c:483
static HRESULT WINAPI CLRRuntimeInfo_GetRuntimeDirectory(ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:404
static HRESULT WINAPI InstalledRuntimeEnum_Skip(IEnumUnknown *iface, ULONG celt)
Definition: metahost.c:879
static void CDECL do_nothing(void)
Definition: metahost.c:81
static ULONG WINAPI InstalledRuntimeEnum_Release(IEnumUnknown *iface)
Definition: metahost.c:831
static ULONG WINAPI CLRRuntimeInfo_AddRef(ICLRRuntimeInfo *iface)
Definition: metahost.c:344
void expect_no_runtimes(void)
Definition: metahost.c:302
static HRESULT WINAPI InstalledRuntimeEnum_Reset(IEnumUnknown *iface)
Definition: metahost.c:904
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1260
static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString(ICLRRuntimeInfo *iface, UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
Definition: metahost.c:451
static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl
Definition: metahost.c:34
static BOOL parse_runtime_version(LPCWSTR version, DWORD *major, DWORD *minor, DWORD *build)
Definition: metahost.c:984
static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost *iface, IEnumUnknown **ppEnumerator)
Definition: metahost.c:1097
static struct InstalledRuntimeEnum * impl_from_IEnumUnknown(IEnumUnknown *iface)
Definition: metahost.c:795
static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl
Definition: metahost.c:793
HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost *iface, LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:1062
static loaded_mono loaded_monos[NUM_ABI_VERSIONS]
Definition: metahost.c:58
static const WCHAR net_11_subdir[]
Definition: metahost.c:30
static void mono_shutdown_callback_fn(MonoProfiler *prof)
Definition: metahost.c:246
static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:952
static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost **result)
Definition: metahost.c:253
#define NUM_RUNTIMES
Definition: metahost.c:36
#define LOAD_OPT_VOID_MONO_FUNCTION(x)
static BOOL get_mono_path(LPWSTR path, int abi_version)
Definition: metahost.c:679
static HRESULT WINAPI InstalledRuntimeEnum_Clone(IEnumUnknown *iface, IEnumUnknown **ppenum)
Definition: metahost.c:915
static const WCHAR libmono2_arch_dll[]
Definition: metahost.c:571
static HRESULT WINAPI CLRRuntimeInfo_IsLoadable(ICLRRuntimeInfo *iface, BOOL *pbLoadable)
Definition: metahost.c:500
static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
Definition: metahost.c:108
static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo *iface, LPCSTR pszProcName, LPVOID *ppProc)
Definition: metahost.c:475
static CLRRuntimeInfo * impl_from_ICLRRuntimeInfo(ICLRRuntimeInfo *iface)
Definition: metahost.c:317
static ULONG WINAPI InstalledRuntimeEnum_AddRef(IEnumUnknown *iface)
Definition: metahost.c:821
static BOOL get_mono_path_from_folder(LPCWSTR folder, LPWSTR mono_path, int abi_version)
Definition: metahost.c:660
static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version)
Definition: metahost.c:574
static HRESULT WINAPI CLRRuntimeInfo_BindAsLegacyV2Runtime(ICLRRuntimeInfo *iface)
Definition: metahost.c:524
static HRESULT WINAPI CLRRuntimeInfo_GetVersionString(ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:354
static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl
Definition: metahost.c:1150
static MonoAssembly * mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data)
Definition: metahost.c:1173
static int runtimes_initialized
Definition: metahost.c:44
static CRITICAL_SECTION runtime_list_cs
Definition: metahost.c:46
#define NUM_ABI_VERSIONS
Definition: metahost.c:56
#define LOAD_MONO_FUNCTION(x)
static void set_environment(LPCWSTR bin_path)
Definition: metahost.c:66
static ULONG WINAPI CLRRuntimeInfo_Release(ICLRRuntimeInfo *iface)
Definition: metahost.c:349
static struct CLRMetaHost GlobalCLRMetaHost
Definition: metahost.c:950
static void missing_runtime_message(const CLRRuntimeInfo *This)
Definition: metahost.c:98
static HRESULT WINAPI CLRRuntimeInfo_IsLoaded(ICLRRuntimeInfo *iface, HANDLE hndProcess, BOOL *pbLoaded)
Definition: metahost.c:443
static BOOL get_install_root(LPWSTR install_dir)
Definition: metahost.c:382
static HRESULT WINAPI CLRRuntimeInfo_SetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
Definition: metahost.c:508
void unload_all_runtimes(void)
Definition: metahost.c:279
static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost *iface, REFIID riid, LPVOID *ppUnk)
Definition: metahost.c:1135
static const WCHAR net_20_subdir[]
Definition: metahost.c:31
static BOOL get_mono_path_from_registry(LPWSTR path, int abi_version)
Definition: metahost.c:619
HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
Definition: metahost.c:1168
static ULONG WINAPI CLRMetaHost_Release(ICLRMetaHost *iface)
Definition: metahost.c:979
static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification(ICLRMetaHost *iface, RuntimeLoadedCallbackFnPtr pCallbackFunction)
Definition: metahost.c:1127
static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes(ICLRMetaHost *iface, HANDLE hndProcess, IEnumUnknown **ppEnumerator)
Definition: metahost.c:1119
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:557
static const WCHAR net_40_subdir[]
Definition: metahost.c:32
static HRESULT WINAPI InstalledRuntimeEnum_QueryInterface(IEnumUnknown *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:800
static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:322
static CRITICAL_SECTION_DEBUG runtime_list_cs_debug
Definition: metahost.c:47
static void find_runtimes(void)
Definition: metahost.c:731
static HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost *iface, INT32 iExitCode)
Definition: metahost.c:1143
static HRESULT WINAPI InstalledRuntimeEnum_Next(IEnumUnknown *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
Definition: metahost.c:846
static HRESULT WINAPI CLRRuntimeInfo_GetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
Definition: metahost.c:516
HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost *iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
Definition: metahost.c:1023
static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost *iface)
Definition: metahost.c:974
#define assert(x)
Definition: debug.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT assembly_release(ASSEMBLY *assembly)
Definition: assembly.c:694
HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version)
Definition: assembly.c:865
HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
Definition: assembly.c:641
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
GLuint pathA
Definition: glext.h:11719
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
const char * wine_get_build_dir(void)
Definition: config.c:30
const char * wine_get_data_dir(void)
Definition: config.c:24
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
void(__stdcall * RuntimeLoadedCallbackFnPtr)(ICLRRuntimeInfo *pRuntimeInfo, CallbackThreadSetFnPtr pfnCallbackThreadSet, CallbackThreadUnsetFnPtr pfnCallbackThreadUnset)
Definition: metahost.idl:88
BOOL legacy
Definition: mkisofs.c:131
#define MESSAGE
Definition: options.h:86
static struct _PeImage bin
@ RUNTIME_INFO_UPGRADE_VERSION
Definition: mscoree.idl:40
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
HRESULT WINAPI LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
Definition: mscoree_main.c:353
struct _MonoProfiler MonoProfiler
struct _MonoAssemblyName MonoAssemblyName
struct _MonoAssembly MonoAssembly
MonoImageOpenStatus
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44
const GUID IID_IEnumUnknown
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define WINAPIV
Definition: sdbpapi.h:64
#define CP_UTF8
Definition: nls.h:20
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
int ShellMessageBoxA(HINSTANCE hInstance, HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,...)
Definition: shellord.c:626
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
ICLRMetaHost ICLRMetaHost_iface
Definition: metahost.c:947
WCHAR mscorlib_path[MAX_PATH]
struct RuntimeHost * loaded_runtime
WCHAR mono_path[MAX_PATH]
ICLRRuntimeInfo ICLRRuntimeInfo_iface
IEnumUnknown IEnumUnknown_iface
Definition: metahost.c:788
Definition: fci.c:116
Definition: txthost.c:37
Definition: copy.c:22
HMODULE mono_handle
char *CDECL * mono_stringify_assembly_name(MonoAssemblyName *aname)
MonoAssembly *CDECL * mono_assembly_open(const char *filename, MonoImageOpenStatus *status)
struct list supported_runtimes
Definition: send.c:48
Definition: stat.h:55
#define DWORD_PTR
Definition: treelist.c:76
void build_tree(deflate_state *s, tree_desc *desc)
Definition: trees.c:615
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define strlenW(s)
Definition: unicode.h:34
#define strcatW(d, s)
Definition: unicode.h:36
#define strcpyW(d, s)
Definition: unicode.h:35
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define snprintf
Definition: wintirpc.h:48
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182