ReactOS 0.4.15-dev-7788-g1ad9096
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
86{
87 if (This->major == 1)
88 MESSAGE("wine: Install Mono 2.6 for Windows to run .NET 1.1 applications.\n");
89 else if (This->major == 2)
90 MESSAGE("wine: Install Mono for Windows to run .NET 2.0 applications.\n");
91 else if (This->major == 4)
92 MESSAGE("wine: Install Mono 2.8 or greater for Windows to run .NET 4.0 applications.\n");
93}
94
96{
97 static const WCHAR bin[] = {'\\','b','i','n',0};
98 static const WCHAR lib[] = {'\\','l','i','b',0};
99 static const WCHAR etc[] = {'\\','e','t','c',0};
100 static const WCHAR glibdll[] = {'l','i','b','g','l','i','b','-','2','.','0','-','0','.','d','l','l',0};
101 WCHAR mono_dll_path[MAX_PATH+16], mono_bin_path[MAX_PATH+4];
102 WCHAR mono_lib_path[MAX_PATH+4], mono_etc_path[MAX_PATH+4];
103 char mono_lib_path_a[MAX_PATH], mono_etc_path_a[MAX_PATH];
104 int trace_size;
105 char trace_setting[256];
106
107 if (This->mono_abi_version <= 0 || This->mono_abi_version > NUM_ABI_VERSIONS)
108 {
110 return E_FAIL;
111 }
112
113 *result = &loaded_monos[This->mono_abi_version-1];
114
115 if ((*result)->is_shutdown)
116 {
117 ERR("Cannot load Mono after it has been shut down.\n");
118 *result = NULL;
119 return E_FAIL;
120 }
121
122 if (!(*result)->mono_handle)
123 {
124 strcpyW(mono_bin_path, This->mono_path);
125 strcatW(mono_bin_path, bin);
126 set_environment(mono_bin_path);
127
128 strcpyW(mono_lib_path, This->mono_path);
129 strcatW(mono_lib_path, lib);
130 WideCharToMultiByte(CP_UTF8, 0, mono_lib_path, -1, mono_lib_path_a, MAX_PATH, NULL, NULL);
131
132 strcpyW(mono_etc_path, This->mono_path);
133 strcatW(mono_etc_path, etc);
134 WideCharToMultiByte(CP_UTF8, 0, mono_etc_path, -1, mono_etc_path_a, MAX_PATH, NULL, NULL);
135
136 if (!find_mono_dll(This->mono_path, mono_dll_path, This->mono_abi_version)) goto fail;
137
138 (*result)->mono_handle = LoadLibraryW(mono_dll_path);
139
140 if (!(*result)->mono_handle) goto fail;
141
142#define LOAD_MONO_FUNCTION(x) do { \
143 (*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
144 if (!(*result)->x) { \
145 goto fail; \
146 } \
147} while (0);
148
149 LOAD_MONO_FUNCTION(mono_assembly_get_image);
150 LOAD_MONO_FUNCTION(mono_assembly_load_from);
151 LOAD_MONO_FUNCTION(mono_assembly_open);
152 LOAD_MONO_FUNCTION(mono_config_parse);
153 LOAD_MONO_FUNCTION(mono_class_from_mono_type);
154 LOAD_MONO_FUNCTION(mono_class_from_name);
155 LOAD_MONO_FUNCTION(mono_class_get_method_from_name);
156 LOAD_MONO_FUNCTION(mono_domain_assembly_open);
157 LOAD_MONO_FUNCTION(mono_image_open_from_module_handle);
158 LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook);
159 LOAD_MONO_FUNCTION(mono_jit_exec);
160 LOAD_MONO_FUNCTION(mono_jit_init);
161 LOAD_MONO_FUNCTION(mono_jit_set_trace_options);
162 LOAD_MONO_FUNCTION(mono_marshal_get_vtfixup_ftnptr);
163 LOAD_MONO_FUNCTION(mono_object_get_domain);
164 LOAD_MONO_FUNCTION(mono_object_new);
165 LOAD_MONO_FUNCTION(mono_object_unbox);
166 LOAD_MONO_FUNCTION(mono_profiler_install);
167 LOAD_MONO_FUNCTION(mono_reflection_type_from_name);
168 LOAD_MONO_FUNCTION(mono_runtime_invoke);
169 LOAD_MONO_FUNCTION(mono_runtime_object_init);
170 LOAD_MONO_FUNCTION(mono_runtime_quit);
171 LOAD_MONO_FUNCTION(mono_set_dirs);
172 LOAD_MONO_FUNCTION(mono_stringify_assembly_name);
173 LOAD_MONO_FUNCTION(mono_string_new);
174 LOAD_MONO_FUNCTION(mono_thread_attach);
175
176 /* GLib imports obsoleted by the 2.0 ABI */
177 if (This->mono_abi_version == 1)
178 {
179 (*result)->glib_handle = LoadLibraryW(glibdll);
180 if (!(*result)->glib_handle) goto fail;
181
182 (*result)->mono_free = (void*)GetProcAddress((*result)->glib_handle, "g_free");
183 if (!(*result)->mono_free) goto fail;
184 }
185 else
186 {
187 LOAD_MONO_FUNCTION(mono_free);
188 }
189
190#undef LOAD_MONO_FUNCTION
191
192#define LOAD_OPT_VOID_MONO_FUNCTION(x) do { \
193 (*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
194 if (!(*result)->x) { \
195 (*result)->x = do_nothing; \
196 } \
197} while (0);
198
199 LOAD_OPT_VOID_MONO_FUNCTION(mono_runtime_set_shutting_down);
200 LOAD_OPT_VOID_MONO_FUNCTION(mono_thread_pool_cleanup);
201 LOAD_OPT_VOID_MONO_FUNCTION(mono_thread_suspend_all_other_threads);
202 LOAD_OPT_VOID_MONO_FUNCTION(mono_threads_set_shutting_down);
203
204#undef LOAD_OPT_VOID_MONO_FUNCTION
205
206 (*result)->mono_profiler_install((MonoProfiler*)*result, mono_shutdown_callback_fn);
207
208 (*result)->mono_set_dirs(mono_lib_path_a, mono_etc_path_a);
209
210 (*result)->mono_config_parse(NULL);
211
212 (*result)->mono_install_assembly_preload_hook(mono_assembly_search_hook_fn, *result);
213
214 trace_size = GetEnvironmentVariableA("WINE_MONO_TRACE", trace_setting, sizeof(trace_setting));
215
216 if (trace_size)
217 {
218 (*result)->mono_jit_set_trace_options(trace_setting);
219 }
220 }
221
222 return S_OK;
223
224fail:
225 ERR("Could not load Mono into this process\n");
226 FreeLibrary((*result)->mono_handle);
227 FreeLibrary((*result)->glib_handle);
228 (*result)->mono_handle = NULL;
229 (*result)->glib_handle = NULL;
230 return E_FAIL;
231}
232
234{
235 loaded_mono *mono = (loaded_mono*)prof;
236
237 mono->is_shutdown = TRUE;
238}
239
241{
242 HRESULT hr = S_OK;
243 loaded_mono *ploaded_mono;
244
245 if (This->loaded_runtime)
246 {
247 *result = This->loaded_runtime;
248 return hr;
249 }
250
252
253 hr = load_mono(This, &ploaded_mono);
254
255 if (SUCCEEDED(hr))
256 hr = RuntimeHost_Construct(This, ploaded_mono, &This->loaded_runtime);
257
259
260 if (SUCCEEDED(hr))
261 *result = This->loaded_runtime;
262
263 return hr;
264}
265
267{
268 int i;
269
270 for (i=0; i<NUM_ABI_VERSIONS; i++)
271 {
272 loaded_mono *mono = &loaded_monos[i];
273 if (mono->mono_handle && mono->is_started && !mono->is_shutdown)
274 {
275 /* Copied from Mono's ves_icall_System_Environment_Exit */
276 mono->mono_threads_set_shutting_down();
277 mono->mono_runtime_set_shutting_down();
278 mono->mono_thread_pool_cleanup();
279 mono->mono_thread_suspend_all_other_threads();
280 mono->mono_runtime_quit();
281 }
282 }
283
284 for (i=0; i<NUM_RUNTIMES; i++)
287}
288
290{
291 int i;
292
293 for (i=0; i<NUM_ABI_VERSIONS; i++)
294 {
295 loaded_mono *mono = &loaded_monos[i];
296 if (mono->mono_handle && mono->is_started && !mono->is_shutdown)
297 {
298 ERR("Process exited with a Mono runtime loaded.\n");
299 return;
300 }
301 }
302}
303
305{
307}
308
310 REFIID riid,
311 void **ppvObject)
312{
313 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
314
315 if ( IsEqualGUID( riid, &IID_ICLRRuntimeInfo ) ||
317 {
318 *ppvObject = iface;
319 }
320 else
321 {
322 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
323 return E_NOINTERFACE;
324 }
325
326 ICLRRuntimeInfo_AddRef( iface );
327
328 return S_OK;
329}
330
332{
333 return 2;
334}
335
337{
338 return 1;
339}
340
342 LPWSTR pwzBuffer, DWORD *pcchBuffer)
343{
345 DWORD buffer_size = *pcchBuffer;
346 HRESULT hr = S_OK;
347 char version[11];
348 DWORD size;
349
350 TRACE("%p %p %p\n", iface, pwzBuffer, pcchBuffer);
351
352 size = snprintf(version, sizeof(version), "v%u.%u.%u", This->major, This->minor, This->build);
353
354 assert(size <= sizeof(version));
355
356 *pcchBuffer = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
357
358 if (pwzBuffer)
359 {
360 if (buffer_size >= *pcchBuffer)
361 MultiByteToWideChar(CP_UTF8, 0, version, -1, pwzBuffer, buffer_size);
362 else
364 }
365
366 return hr;
367}
368
369static BOOL get_install_root(LPWSTR install_dir)
370{
371 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};
372 const WCHAR install_root[] = {'I','n','s','t','a','l','l','R','o','o','t',0};
373
374 DWORD len;
375 HKEY key;
376
377 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, dotnet_key, 0, KEY_READ, &key))
378 return FALSE;
379
380 len = MAX_PATH * sizeof(WCHAR);
381 if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)install_dir, &len))
382 {
384 return FALSE;
385 }
387
388 return TRUE;
389}
390
392 LPWSTR pwzBuffer, DWORD *pcchBuffer)
393{
394 static const WCHAR slash[] = {'\\',0};
395 DWORD buffer_size = *pcchBuffer;
396 WCHAR system_dir[MAX_PATH];
398 DWORD version_size, size;
399 HRESULT hr = S_OK;
400
401 TRACE("%p %p %p\n", iface, pwzBuffer, pcchBuffer);
402
403 if (!get_install_root(system_dir))
404 {
405 ERR("error reading registry key for installroot\n");
406 return E_FAIL;
407 }
408 else
409 {
410 version_size = MAX_PATH;
411 ICLRRuntimeInfo_GetVersionString(iface, version, &version_size);
412 lstrcatW(system_dir, version);
413 lstrcatW(system_dir, slash);
414 size = lstrlenW(system_dir) + 1;
415 }
416
417 *pcchBuffer = size;
418
419 if (pwzBuffer)
420 {
421 if (buffer_size >= size)
422 strcpyW(pwzBuffer, system_dir);
423 else
425 }
426
427 return hr;
428}
429
431 HANDLE hndProcess, BOOL *pbLoaded)
432{
433 FIXME("%p %p %p\n", iface, hndProcess, pbLoaded);
434
435 return E_NOTIMPL;
436}
437
439 UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
440{
441 FIXME("%p %u %p %p %x\n", iface, iResourceID, pwzBuffer, pcchBuffer, iLocaleid);
442
443 return E_NOTIMPL;
444}
445
447 LPCWSTR pwzDllName, HMODULE *phndModule)
448{
450 HRESULT hr;
452
453 TRACE("%p %s %p\n", iface, debugstr_w(pwzDllName), phndModule);
454
456 hr = ICLRRuntimeInfo_GetVersionString(iface, version, &cchBuffer);
457 if (FAILED(hr)) return hr;
458
459 return LoadLibraryShim(pwzDllName, version, NULL, phndModule);
460}
461
463 LPCSTR pszProcName, LPVOID *ppProc)
464{
465 FIXME("%p %s %p\n", iface, debugstr_a(pszProcName), ppProc);
466
467 return E_NOTIMPL;
468}
469
471 REFCLSID rclsid, REFIID riid, LPVOID *ppUnk)
472{
475 HRESULT hr;
476
477 TRACE("%p %s %s %p\n", iface, debugstr_guid(rclsid), debugstr_guid(riid), ppUnk);
478
480
481 if (SUCCEEDED(hr))
482 hr = RuntimeHost_GetInterface(host, rclsid, riid, ppUnk);
483
484 return hr;
485}
486
488 BOOL *pbLoadable)
489{
490 FIXME("%p %p\n", iface, pbLoadable);
491
492 return E_NOTIMPL;
493}
494
496 DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
497{
498 FIXME("%p %x %s\n", iface, dwStartupFlags, debugstr_w(pwzHostConfigFile));
499
500 return E_NOTIMPL;
501}
502
504 DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
505{
506 FIXME("%p %p %p %p\n", iface, pdwStartupFlags, pwzHostConfigFile, pcchHostConfigFile);
507
508 return E_NOTIMPL;
509}
510
512{
513 FIXME("%p\n", iface);
514
515 return E_NOTIMPL;
516}
517
519 BOOL *pbStarted, DWORD *pdwStartupFlags)
520{
521 FIXME("%p %p %p\n", iface, pbStarted, pdwStartupFlags);
522
523 return E_NOTIMPL;
524}
525
526static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl = {
542};
543
545{
547
548 assert(This->ICLRRuntimeInfo_iface.lpVtbl == &CLRRuntimeInfoVtbl);
549
551}
552
553#ifdef __i386__
554static const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','-','x','8','6','.','d','l','l',0};
555#elif defined(__x86_64__)
556static 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};
557#else
558static const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0};
559#endif
560
561static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version)
562{
563 static const WCHAR mono_dll[] = {'\\','b','i','n','\\','m','o','n','o','.','d','l','l',0};
564 static const WCHAR libmono_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','.','d','l','l',0};
565 static const WCHAR mono2_dll[] = {'\\','b','i','n','\\','m','o','n','o','-','2','.','0','.','d','l','l',0};
566 static const WCHAR libmono2_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0};
568
569 if (abi_version == 1)
570 {
571 strcpyW(dll_path, path);
572 strcatW(dll_path, mono_dll);
573 attributes = GetFileAttributesW(dll_path);
574
575 if (attributes == INVALID_FILE_ATTRIBUTES)
576 {
577 strcpyW(dll_path, path);
578 strcatW(dll_path, libmono_dll);
579 attributes = GetFileAttributesW(dll_path);
580 }
581 }
582 else if (abi_version == 2)
583 {
584 strcpyW(dll_path, path);
585 strcatW(dll_path, libmono2_arch_dll);
586 attributes = GetFileAttributesW(dll_path);
587
588 if (attributes == INVALID_FILE_ATTRIBUTES)
589 {
590 strcpyW(dll_path, path);
591 strcatW(dll_path, mono2_dll);
592 attributes = GetFileAttributesW(dll_path);
593 }
594
595 if (attributes == INVALID_FILE_ATTRIBUTES)
596 {
597 strcpyW(dll_path, path);
598 strcatW(dll_path, libmono2_dll);
599 attributes = GetFileAttributesW(dll_path);
600 }
601 }
602
603 return (attributes != INVALID_FILE_ATTRIBUTES);
604}
605
607{
608 static const WCHAR mono_key[] = {'S','o','f','t','w','a','r','e','\\','N','o','v','e','l','l','\\','M','o','n','o',0};
609 static const WCHAR defaul_clr[] = {'D','e','f','a','u','l','t','C','L','R',0};
610 static const WCHAR install_root[] = {'S','d','k','I','n','s','t','a','l','l','R','o','o','t',0};
611 static const WCHAR slash[] = {'\\',0};
612
613 WCHAR version[64], version_key[MAX_PATH];
614 DWORD len;
615 HKEY key;
616 WCHAR dll_path[MAX_PATH];
617
618 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, mono_key, 0, KEY_READ, &key))
619 return FALSE;
620
621 len = sizeof(version);
622 if (RegQueryValueExW(key, defaul_clr, 0, NULL, (LPBYTE)version, &len))
623 {
625 return FALSE;
626 }
628
629 lstrcpyW(version_key, mono_key);
630 lstrcatW(version_key, slash);
631 lstrcatW(version_key, version);
632
633 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, version_key, 0, KEY_READ, &key))
634 return FALSE;
635
636 len = sizeof(WCHAR) * MAX_PATH;
637 if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)path, &len))
638 {
640 return FALSE;
641 }
643
644 return find_mono_dll(path, dll_path, abi_version);
645}
646
648{
649 static const WCHAR mono_one_dot_zero[] = {'\\','m','o','n','o','-','1','.','0', 0};
650 static const WCHAR mono_two_dot_zero[] = {'\\','m','o','n','o','-','2','.','0', 0};
651 WCHAR mono_dll_path[MAX_PATH];
652 BOOL found = FALSE;
653
655
656 if (abi_version == 1)
657 strcatW(mono_path, mono_one_dot_zero);
658 else if (abi_version == 2)
659 strcatW(mono_path, mono_two_dot_zero);
660
661 found = find_mono_dll(mono_path, mono_dll_path, abi_version);
662
663 return found;
664}
665
666static BOOL get_mono_path(LPWSTR path, int abi_version)
667{
668 static const WCHAR subdir_mono[] = {'\\','m','o','n','o',0};
669 static const WCHAR sibling_mono[] = {'\\','.','.','\\','m','o','n','o',0};
670 WCHAR base_path[MAX_PATH];
671 const char *unix_data_dir;
672 WCHAR *dos_data_dir;
673 int build_tree=0;
674 static WCHAR* (CDECL *wine_get_dos_file_name)(const char*);
675
676 /* First try c:\windows\mono */
677 GetWindowsDirectoryW(base_path, MAX_PATH);
678 strcatW(base_path, subdir_mono);
679
680 if (get_mono_path_from_folder(base_path, path, abi_version))
681 return TRUE;
682
683 /* Next: /usr/share/wine/mono */
684 unix_data_dir = wine_get_data_dir();
685
686 if (!unix_data_dir)
687 {
688 unix_data_dir = wine_get_build_dir();
689 build_tree = 1;
690 }
691
692 if (unix_data_dir)
693 {
695 wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "wine_get_dos_file_name");
696
698 {
699 dos_data_dir = wine_get_dos_file_name(unix_data_dir);
700
701 if (dos_data_dir)
702 {
703 strcpyW(base_path, dos_data_dir);
704 strcatW(base_path, build_tree ? sibling_mono : subdir_mono);
705
706 HeapFree(GetProcessHeap(), 0, dos_data_dir);
707
708 if (get_mono_path_from_folder(base_path, path, abi_version))
709 return TRUE;
710 }
711 }
712 }
713
714 /* Last: the registry */
715 return get_mono_path_from_registry(path, abi_version);
716}
717
718static void find_runtimes(void)
719{
720 int abi_version, i;
721 static const WCHAR libmono[] = {'\\','l','i','b','\\','m','o','n','o','\\',0};
722 static const WCHAR mscorlib[] = {'\\','m','s','c','o','r','l','i','b','.','d','l','l',0};
723 WCHAR mono_path[MAX_PATH], lib_path[MAX_PATH];
724 BOOL any_runtimes_found = FALSE;
725
726 if (runtimes_initialized) return;
727
729
730 if (runtimes_initialized) goto end;
731
732 for (abi_version=NUM_ABI_VERSIONS; abi_version>0; abi_version--)
733 {
734 if (!get_mono_path(mono_path, abi_version))
735 continue;
736
737 for (i=0; i<NUM_RUNTIMES; i++)
738 {
739 if (runtimes[i].mono_abi_version == 0)
740 {
741 strcpyW(lib_path, mono_path);
742 strcatW(lib_path, libmono);
743 strcatW(lib_path, runtimes[i].mono_libdir);
744 strcatW(lib_path, mscorlib);
745
747 {
748 runtimes[i].mono_abi_version = abi_version;
749
751 strcpyW(runtimes[i].mscorlib_path, lib_path);
752
753 any_runtimes_found = TRUE;
754 }
755 }
756 }
757 }
758
759 if (!any_runtimes_found)
760 {
761 /* Report all runtimes are available if Mono isn't installed.
762 * FIXME: Remove this when Mono is properly packaged. */
763 for (i=0; i<NUM_RUNTIMES; i++)
765 }
766
768
769end:
771}
772
774{
778};
779
780static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl;
781
783{
785}
786
788 void **ppvObject)
789{
790 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
791
794 {
795 *ppvObject = iface;
796 }
797 else
798 {
799 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
800 return E_NOINTERFACE;
801 }
802
803 IEnumUnknown_AddRef( iface );
804
805 return S_OK;
806}
807
809{
812
813 TRACE("(%p) refcount=%u\n", iface, ref);
814
815 return ref;
816}
817
819{
822
823 TRACE("(%p) refcount=%u\n", iface, ref);
824
825 if (ref == 0)
826 {
828 }
829
830 return ref;
831}
832
834 IUnknown **rgelt, ULONG *pceltFetched)
835{
837 int num_fetched = 0;
839 IUnknown *item;
840
841 TRACE("(%p,%u,%p,%p)\n", iface, celt, rgelt, pceltFetched);
842
843 while (num_fetched < celt)
844 {
845 if (This->pos >= NUM_RUNTIMES)
846 {
847 hr = S_FALSE;
848 break;
849 }
850 if (runtimes[This->pos].mono_abi_version)
851 {
852 item = (IUnknown*)&runtimes[This->pos].ICLRRuntimeInfo_iface;
853 IUnknown_AddRef(item);
854 rgelt[num_fetched] = item;
855 num_fetched++;
856 }
857 This->pos++;
858 }
859
860 if (pceltFetched)
861 *pceltFetched = num_fetched;
862
863 return hr;
864}
865
867{
869 int num_fetched = 0;
871
872 TRACE("(%p,%u)\n", iface, celt);
873
874 while (num_fetched < celt)
875 {
876 if (This->pos >= NUM_RUNTIMES)
877 {
878 hr = S_FALSE;
879 break;
880 }
881 if (runtimes[This->pos].mono_abi_version)
882 {
883 num_fetched++;
884 }
885 This->pos++;
886 }
887
888 return hr;
889}
890
892{
894
895 TRACE("(%p)\n", iface);
896
897 This->pos = 0;
898
899 return S_OK;
900}
901
903{
905 struct InstalledRuntimeEnum *new_enum;
906
907 TRACE("(%p)\n", iface);
908
909 new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_enum));
910 if (!new_enum)
911 return E_OUTOFMEMORY;
912
914 new_enum->ref = 1;
915 new_enum->pos = This->pos;
916
917 *ppenum = &new_enum->IEnumUnknown_iface;
918
919 return S_OK;
920}
921
922static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl = {
930};
931
933{
935};
936
938
940 REFIID riid,
941 void **ppvObject)
942{
943 TRACE("%s %p\n", debugstr_guid(riid), ppvObject);
944
945 if ( IsEqualGUID( riid, &IID_ICLRMetaHost ) ||
947 {
948 *ppvObject = iface;
949 }
950 else
951 {
952 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
953 return E_NOINTERFACE;
954 }
955
956 ICLRMetaHost_AddRef( iface );
957
958 return S_OK;
959}
960
962{
963 return 2;
964}
965
967{
968 return 1;
969}
970
972{
973 *major = 0;
974 *minor = 0;
975 *build = 0;
976
977 if (version[0] == 'v' || version[0] == 'V')
978 {
979 version++;
980 if (!isdigit(*version))
981 return FALSE;
982
983 while (isdigit(*version))
984 *major = *major * 10 + (*version++ - '0');
985
986 if (*version == 0)
987 return TRUE;
988
989 if (*version++ != '.' || !isdigit(*version))
990 return FALSE;
991
992 while (isdigit(*version))
993 *minor = *minor * 10 + (*version++ - '0');
994
995 if (*version == 0)
996 return TRUE;
997
998 if (*version++ != '.' || !isdigit(*version))
999 return FALSE;
1000
1001 while (isdigit(*version))
1002 *build = *build * 10 + (*version++ - '0');
1003
1004 return *version == 0;
1005 }
1006 else
1007 return FALSE;
1008}
1009
1011 LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
1012{
1013 int i;
1014 DWORD major, minor, build;
1015
1016 TRACE("%s %s %p\n", debugstr_w(pwzVersion), debugstr_guid(iid), ppRuntime);
1017
1018 if (!pwzVersion)
1019 return E_POINTER;
1020
1021 if (!parse_runtime_version(pwzVersion, &major, &minor, &build))
1022 {
1023 ERR("Cannot parse %s\n", debugstr_w(pwzVersion));
1024 return CLR_E_SHIM_RUNTIME;
1025 }
1026
1027 find_runtimes();
1028
1029 for (i=0; i<NUM_RUNTIMES; i++)
1030 {
1031 if (runtimes[i].major == major && runtimes[i].minor == minor &&
1032 runtimes[i].build == build)
1033 {
1034 if (runtimes[i].mono_abi_version)
1035 return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface, iid,
1036 ppRuntime);
1037 else
1038 {
1040 return CLR_E_SHIM_RUNTIME;
1041 }
1042 }
1043 }
1044
1045 FIXME("Unrecognized version %s\n", debugstr_w(pwzVersion));
1046 return CLR_E_SHIM_RUNTIME;
1047}
1048
1050 LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
1051{
1053 HRESULT hr;
1054 LPSTR version;
1055 ULONG buffer_size=*pcchBuffer;
1056
1057 TRACE("%s %p %p\n", debugstr_w(pwzFilePath), pwzBuffer, pcchBuffer);
1058
1059 hr = assembly_create(&assembly, pwzFilePath);
1060
1061 if (SUCCEEDED(hr))
1062 {
1064
1065 if (SUCCEEDED(hr))
1066 {
1067 *pcchBuffer = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
1068
1069 if (pwzBuffer)
1070 {
1071 if (buffer_size >= *pcchBuffer)
1072 MultiByteToWideChar(CP_UTF8, 0, version, -1, pwzBuffer, buffer_size);
1073 else
1075 }
1076 }
1077
1079 }
1080
1081 return hr;
1082}
1083
1085 IEnumUnknown **ppEnumerator)
1086{
1087 struct InstalledRuntimeEnum *new_enum;
1088
1089 TRACE("%p\n", ppEnumerator);
1090
1091 find_runtimes();
1092
1093 new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_enum));
1094 if (!new_enum)
1095 return E_OUTOFMEMORY;
1096
1098 new_enum->ref = 1;
1099 new_enum->pos = 0;
1100
1101 *ppEnumerator = &new_enum->IEnumUnknown_iface;
1102
1103 return S_OK;
1104}
1105
1107 HANDLE hndProcess, IEnumUnknown **ppEnumerator)
1108{
1109 FIXME("%p %p\n", hndProcess, ppEnumerator);
1110
1111 return E_NOTIMPL;
1112}
1113
1115 RuntimeLoadedCallbackFnPtr pCallbackFunction)
1116{
1117 FIXME("%p\n", pCallbackFunction);
1118
1119 return E_NOTIMPL;
1120}
1121
1123 REFIID riid, LPVOID *ppUnk)
1124{
1125 FIXME("%s %p\n", debugstr_guid(riid), ppUnk);
1126
1127 return E_NOTIMPL;
1128}
1129
1131{
1132 FIXME("%i: stub\n", iExitCode);
1133
1134 ExitProcess(iExitCode);
1135}
1136
1137static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl =
1138{
1149};
1150
1151static struct CLRMetaHost GlobalCLRMetaHost = {
1152 { &CLRMetaHost_vtbl }
1153};
1154
1156{
1157 return ICLRMetaHost_QueryInterface(&GlobalCLRMetaHost.ICLRMetaHost_iface, riid, ppobj);
1158}
1159
1160static MonoAssembly* mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data)
1161{
1162 loaded_mono *mono = user_data;
1163 HRESULT hr=S_OK;
1165 char *stringname=NULL;
1166 LPWSTR stringnameW;
1167 int stringnameW_size;
1168 IAssemblyCache *asmcache;
1171 char *pathA;
1173 static WCHAR fusiondll[] = {'f','u','s','i','o','n',0};
1174 HMODULE hfusion=NULL;
1175 static HRESULT (WINAPI *pCreateAssemblyCache)(IAssemblyCache**,DWORD);
1176
1177 stringname = mono->mono_stringify_assembly_name(aname);
1178
1179 TRACE("%s\n", debugstr_a(stringname));
1180
1181 if (!stringname) return NULL;
1182
1183 /* FIXME: We should search the given paths before the GAC. */
1184
1185 if (!pCreateAssemblyCache)
1186 {
1187 hr = LoadLibraryShim(fusiondll, NULL, NULL, &hfusion);
1188
1189 if (SUCCEEDED(hr))
1190 {
1191 pCreateAssemblyCache = (void*)GetProcAddress(hfusion, "CreateAssemblyCache");
1192 if (!pCreateAssemblyCache)
1193 hr = E_FAIL;
1194 }
1195 }
1196
1197 if (SUCCEEDED(hr))
1198 hr = pCreateAssemblyCache(&asmcache, 0);
1199
1200 if (SUCCEEDED(hr))
1201 {
1202 stringnameW_size = MultiByteToWideChar(CP_UTF8, 0, stringname, -1, NULL, 0);
1203
1204 stringnameW = HeapAlloc(GetProcessHeap(), 0, stringnameW_size * sizeof(WCHAR));
1205 if (stringnameW)
1206 MultiByteToWideChar(CP_UTF8, 0, stringname, -1, stringnameW, stringnameW_size);
1207 else
1208 hr = E_OUTOFMEMORY;
1209
1210 if (SUCCEEDED(hr))
1211 {
1212 info.cbAssemblyInfo = sizeof(info);
1213 info.pszCurrentAssemblyPathBuf = path;
1214 info.cchBuf = MAX_PATH;
1215 path[0] = 0;
1216
1217 hr = IAssemblyCache_QueryAssemblyInfo(asmcache, 0, stringnameW, &info);
1218 }
1219
1220 HeapFree(GetProcessHeap(), 0, stringnameW);
1221
1222 IAssemblyCache_Release(asmcache);
1223 }
1224
1225 if (SUCCEEDED(hr))
1226 {
1227 TRACE("found: %s\n", debugstr_w(path));
1228
1229 pathA = WtoA(path);
1230
1231 if (pathA)
1232 {
1234
1235 if (!result)
1236 ERR("Failed to load %s, status=%u\n", debugstr_w(path), stat);
1237
1239 }
1240 }
1241
1242 mono->mono_free(stringname);
1243
1244 return result;
1245}
1246
1248 DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
1249{
1250 static const WCHAR dotconfig[] = {'.','c','o','n','f','i','g',0};
1251 static const DWORD supported_startup_flags = 0;
1252 static const DWORD supported_runtime_flags = RUNTIME_INFO_UPGRADE_VERSION;
1253 int i;
1254 WCHAR local_version[MAX_PATH];
1255 ULONG local_version_size = MAX_PATH;
1256 WCHAR local_config_file[MAX_PATH];
1257 HRESULT hr;
1258 parsed_config_file parsed_config;
1259
1260 if (startup_flags & ~supported_startup_flags)
1261 FIXME("unsupported startup flags %x\n", startup_flags & ~supported_startup_flags);
1262
1263 if (runtimeinfo_flags & ~supported_runtime_flags)
1264 FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags);
1265
1266 if (exefile && !config_file)
1267 {
1268 strcpyW(local_config_file, exefile);
1269 strcatW(local_config_file, dotconfig);
1270
1271 config_file = local_config_file;
1272 }
1273
1274 if (config_file)
1275 {
1276 int found=0;
1277 hr = parse_config_file(config_file, &parsed_config);
1278
1279 if (SUCCEEDED(hr))
1280 {
1283 {
1284 hr = CLRMetaHost_GetRuntime(0, entry->version, &IID_ICLRRuntimeInfo, (void**)result);
1285 if (SUCCEEDED(hr))
1286 {
1287 found = 1;
1288 break;
1289 }
1290 }
1291 }
1292 else
1293 {
1294 WARN("failed to parse config file %s, hr=%x\n", debugstr_w(config_file), hr);
1295 }
1296
1297 free_parsed_config_file(&parsed_config);
1298
1299 if (found)
1300 return S_OK;
1301 }
1302
1303 if (exefile && !version)
1304 {
1305 hr = CLRMetaHost_GetVersionFromFile(0, exefile, local_version, &local_version_size);
1306
1307 version = local_version;
1308
1309 if (FAILED(hr)) return hr;
1310 }
1311
1312 if (version)
1313 {
1314 hr = CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)result);
1315 if(SUCCEEDED(hr))
1316 return hr;
1317 }
1318
1319 if (runtimeinfo_flags & RUNTIME_INFO_UPGRADE_VERSION)
1320 {
1321 DWORD major, minor, build;
1322
1323 if (version && !parse_runtime_version(version, &major, &minor, &build))
1324 {
1325 ERR("Cannot parse %s\n", debugstr_w(version));
1326 return CLR_E_SHIM_RUNTIME;
1327 }
1328
1329 find_runtimes();
1330
1331 if (legacy)
1332 i = 2;
1333 else
1334 i = NUM_RUNTIMES;
1335
1336 while (i--)
1337 {
1338 if (runtimes[i].mono_abi_version)
1339 {
1340 /* Must be greater or equal to the version passed in. */
1341 if (!version || ((runtimes[i].major >= major && runtimes[i].minor >= minor && runtimes[i].build >= build) ||
1342 (runtimes[i].major >= major && runtimes[i].minor > minor) ||
1343 (runtimes[i].major > major)))
1344 {
1345 return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface,
1346 &IID_ICLRRuntimeInfo, (void **)result);
1347 }
1348 }
1349 }
1350
1351 if (legacy)
1353 else
1355
1356 return CLR_E_SHIM_RUNTIME;
1357 }
1358
1359 return CLR_E_SHIM_RUNTIME;
1360}
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
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
#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:3362
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4132
#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:1487
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:446
static HRESULT WINAPI CLRRuntimeInfo_IsStarted(ICLRRuntimeInfo *iface, BOOL *pbStarted, DWORD *pdwStartupFlags)
Definition: metahost.c:518
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:470
static HRESULT WINAPI CLRRuntimeInfo_GetRuntimeDirectory(ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:391
static HRESULT WINAPI InstalledRuntimeEnum_Skip(IEnumUnknown *iface, ULONG celt)
Definition: metahost.c:866
static void CDECL do_nothing(void)
Definition: metahost.c:81
static ULONG WINAPI InstalledRuntimeEnum_Release(IEnumUnknown *iface)
Definition: metahost.c:818
static ULONG WINAPI CLRRuntimeInfo_AddRef(ICLRRuntimeInfo *iface)
Definition: metahost.c:331
void expect_no_runtimes(void)
Definition: metahost.c:289
static HRESULT WINAPI InstalledRuntimeEnum_Reset(IEnumUnknown *iface)
Definition: metahost.c:891
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1247
static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString(ICLRRuntimeInfo *iface, UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
Definition: metahost.c:438
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:971
static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost *iface, IEnumUnknown **ppEnumerator)
Definition: metahost.c:1084
static struct InstalledRuntimeEnum * impl_from_IEnumUnknown(IEnumUnknown *iface)
Definition: metahost.c:782
static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl
Definition: metahost.c:780
HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost *iface, LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:1049
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:233
static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:939
static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost **result)
Definition: metahost.c:240
#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:666
static HRESULT WINAPI InstalledRuntimeEnum_Clone(IEnumUnknown *iface, IEnumUnknown **ppenum)
Definition: metahost.c:902
static const WCHAR libmono2_arch_dll[]
Definition: metahost.c:558
static HRESULT WINAPI CLRRuntimeInfo_IsLoadable(ICLRRuntimeInfo *iface, BOOL *pbLoadable)
Definition: metahost.c:487
static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
Definition: metahost.c:95
static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo *iface, LPCSTR pszProcName, LPVOID *ppProc)
Definition: metahost.c:462
static CLRRuntimeInfo * impl_from_ICLRRuntimeInfo(ICLRRuntimeInfo *iface)
Definition: metahost.c:304
static ULONG WINAPI InstalledRuntimeEnum_AddRef(IEnumUnknown *iface)
Definition: metahost.c:808
static BOOL get_mono_path_from_folder(LPCWSTR folder, LPWSTR mono_path, int abi_version)
Definition: metahost.c:647
static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version)
Definition: metahost.c:561
static HRESULT WINAPI CLRRuntimeInfo_BindAsLegacyV2Runtime(ICLRRuntimeInfo *iface)
Definition: metahost.c:511
static HRESULT WINAPI CLRRuntimeInfo_GetVersionString(ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:341
static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl
Definition: metahost.c:1137
static MonoAssembly * mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data)
Definition: metahost.c:1160
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:336
static struct CLRMetaHost GlobalCLRMetaHost
Definition: metahost.c:937
static void missing_runtime_message(const CLRRuntimeInfo *This)
Definition: metahost.c:85
static HRESULT WINAPI CLRRuntimeInfo_IsLoaded(ICLRRuntimeInfo *iface, HANDLE hndProcess, BOOL *pbLoaded)
Definition: metahost.c:430
static BOOL get_install_root(LPWSTR install_dir)
Definition: metahost.c:369
static HRESULT WINAPI CLRRuntimeInfo_SetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
Definition: metahost.c:495
void unload_all_runtimes(void)
Definition: metahost.c:266
static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost *iface, REFIID riid, LPVOID *ppUnk)
Definition: metahost.c:1122
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:606
HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
Definition: metahost.c:1155
static ULONG WINAPI CLRMetaHost_Release(ICLRMetaHost *iface)
Definition: metahost.c:966
static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification(ICLRMetaHost *iface, RuntimeLoadedCallbackFnPtr pCallbackFunction)
Definition: metahost.c:1114
static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes(ICLRMetaHost *iface, HANDLE hndProcess, IEnumUnknown **ppEnumerator)
Definition: metahost.c:1106
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:544
static const WCHAR net_40_subdir[]
Definition: metahost.c:32
static HRESULT WINAPI InstalledRuntimeEnum_QueryInterface(IEnumUnknown *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:787
static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:309
static CRITICAL_SECTION_DEBUG runtime_list_cs_debug
Definition: metahost.c:47
static void find_runtimes(void)
Definition: metahost.c:718
static HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost *iface, INT32 iExitCode)
Definition: metahost.c:1130
static HRESULT WINAPI InstalledRuntimeEnum_Next(IEnumUnknown *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
Definition: metahost.c:833
static HRESULT WINAPI CLRRuntimeInfo_GetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
Definition: metahost.c:503
HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost *iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
Definition: metahost.c:1010
static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost *iface)
Definition: metahost.c:961
#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
GLenum GLsizei len
Definition: glext.h:6722
GLuint pathA
Definition: glext.h:11719
GLuint64EXT * result
Definition: glext.h:11304
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
static ATOM item
Definition: dde.c:856
@ 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:351
struct _MonoProfiler MonoProfiler
struct _MonoAssemblyName MonoAssemblyName
struct _MonoAssembly MonoAssembly
MonoImageOpenStatus
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define DWORD
Definition: nt_native.h:44
const GUID IID_IEnumUnknown
long LONG
Definition: pedump.c:60
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define strlenW(s)
Definition: unicode.h:28
#define strcatW(d, s)
Definition: unicode.h:30
#define strcpyW(d, s)
Definition: unicode.h:29
#define CP_UTF8
Definition: nls.h:20
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
ICLRMetaHost ICLRMetaHost_iface
Definition: metahost.c:934
WCHAR mscorlib_path[MAX_PATH]
struct RuntimeHost * loaded_runtime
WCHAR mono_path[MAX_PATH]
ICLRRuntimeInfo ICLRRuntimeInfo_iface
IEnumUnknown IEnumUnknown_iface
Definition: metahost.c:775
LIST_ENTRY ProcessLocksList
Definition: winbase.h:883
Definition: fci.c:116
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
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#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
char * host
Definition: whois.c:55
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define snprintf
Definition: wintirpc.h:48
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185