ReactOS 0.4.16-dev-1948-gd260c1d
metahost.c File Reference
#include "mscoree_private.h"
#include <stdio.h>
#include <assert.h>
#include <wine/library.h>
#include <fusion.h>
Include dependency graph for metahost.c:

Go to the source code of this file.

Classes

struct  InstalledRuntimeEnum
 
struct  CLRMetaHost
 

Macros

#define NUM_RUNTIMES   3
 
#define NUM_ABI_VERSIONS   2
 
#define LOAD_MONO_FUNCTION(x)
 
#define LOAD_OPT_VOID_MONO_FUNCTION(x)
 

Functions

static BOOL find_mono_dll (LPCWSTR path, LPWSTR dll_path, int abi_version)
 
static MonoAssemblymono_assembly_search_hook_fn (MonoAssemblyName *aname, char **assemblies_path, void *user_data)
 
static void mono_shutdown_callback_fn (MonoProfiler *prof)
 
static void set_environment (LPCWSTR bin_path)
 
static void CDECL do_nothing (void)
 
static void missing_runtime_message (const CLRRuntimeInfo *This)
 
static HRESULT load_mono (CLRRuntimeInfo *This, loaded_mono **result)
 
static HRESULT CLRRuntimeInfo_GetRuntimeHost (CLRRuntimeInfo *This, RuntimeHost **result)
 
void unload_all_runtimes (void)
 
void expect_no_runtimes (void)
 
static CLRRuntimeInfoimpl_from_ICLRRuntimeInfo (ICLRRuntimeInfo *iface)
 
static HRESULT WINAPI CLRRuntimeInfo_QueryInterface (ICLRRuntimeInfo *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI CLRRuntimeInfo_AddRef (ICLRRuntimeInfo *iface)
 
static ULONG WINAPI CLRRuntimeInfo_Release (ICLRRuntimeInfo *iface)
 
static HRESULT WINAPI CLRRuntimeInfo_GetVersionString (ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
 
static BOOL get_install_root (LPWSTR install_dir)
 
static HRESULT WINAPI CLRRuntimeInfo_GetRuntimeDirectory (ICLRRuntimeInfo *iface, LPWSTR pwzBuffer, DWORD *pcchBuffer)
 
static HRESULT WINAPI CLRRuntimeInfo_IsLoaded (ICLRRuntimeInfo *iface, HANDLE hndProcess, BOOL *pbLoaded)
 
static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString (ICLRRuntimeInfo *iface, UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
 
static HRESULT WINAPI CLRRuntimeInfo_LoadLibrary (ICLRRuntimeInfo *iface, LPCWSTR pwzDllName, HMODULE *phndModule)
 
static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress (ICLRRuntimeInfo *iface, LPCSTR pszProcName, LPVOID *ppProc)
 
static HRESULT WINAPI CLRRuntimeInfo_GetInterface (ICLRRuntimeInfo *iface, REFCLSID rclsid, REFIID riid, LPVOID *ppUnk)
 
static HRESULT WINAPI CLRRuntimeInfo_IsLoadable (ICLRRuntimeInfo *iface, BOOL *pbLoadable)
 
static HRESULT WINAPI CLRRuntimeInfo_SetDefaultStartupFlags (ICLRRuntimeInfo *iface, DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
 
static HRESULT WINAPI CLRRuntimeInfo_GetDefaultStartupFlags (ICLRRuntimeInfo *iface, DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
 
static HRESULT WINAPI CLRRuntimeInfo_BindAsLegacyV2Runtime (ICLRRuntimeInfo *iface)
 
static HRESULT WINAPI CLRRuntimeInfo_IsStarted (ICLRRuntimeInfo *iface, BOOL *pbStarted, DWORD *pdwStartupFlags)
 
HRESULT ICLRRuntimeInfo_GetRuntimeHost (ICLRRuntimeInfo *iface, RuntimeHost **result)
 
static BOOL get_mono_path_from_registry (LPWSTR path, int abi_version)
 
static BOOL get_mono_path_from_folder (LPCWSTR folder, LPWSTR mono_path, int abi_version)
 
static BOOL get_mono_path (LPWSTR path, int abi_version)
 
static void find_runtimes (void)
 
static struct InstalledRuntimeEnumimpl_from_IEnumUnknown (IEnumUnknown *iface)
 
static HRESULT WINAPI InstalledRuntimeEnum_QueryInterface (IEnumUnknown *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI InstalledRuntimeEnum_AddRef (IEnumUnknown *iface)
 
static ULONG WINAPI InstalledRuntimeEnum_Release (IEnumUnknown *iface)
 
static HRESULT WINAPI InstalledRuntimeEnum_Next (IEnumUnknown *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI InstalledRuntimeEnum_Skip (IEnumUnknown *iface, ULONG celt)
 
static HRESULT WINAPI InstalledRuntimeEnum_Reset (IEnumUnknown *iface)
 
static HRESULT WINAPI InstalledRuntimeEnum_Clone (IEnumUnknown *iface, IEnumUnknown **ppenum)
 
static HRESULT WINAPI CLRMetaHost_QueryInterface (ICLRMetaHost *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI CLRMetaHost_AddRef (ICLRMetaHost *iface)
 
static ULONG WINAPI CLRMetaHost_Release (ICLRMetaHost *iface)
 
static BOOL parse_runtime_version (LPCWSTR version, DWORD *major, DWORD *minor, DWORD *build)
 
HRESULT WINAPI CLRMetaHost_GetRuntime (ICLRMetaHost *iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
 
HRESULT WINAPI CLRMetaHost_GetVersionFromFile (ICLRMetaHost *iface, LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
 
static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes (ICLRMetaHost *iface, IEnumUnknown **ppEnumerator)
 
static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes (ICLRMetaHost *iface, HANDLE hndProcess, IEnumUnknown **ppEnumerator)
 
static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification (ICLRMetaHost *iface, RuntimeLoadedCallbackFnPtr pCallbackFunction)
 
static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding (ICLRMetaHost *iface, REFIID riid, LPVOID *ppUnk)
 
static HRESULT WINAPI CLRMetaHost_ExitProcess (ICLRMetaHost *iface, INT32 iExitCode)
 
HRESULT CLRMetaHost_CreateInstance (REFIID riid, void **ppobj)
 
HRESULT get_runtime_info (LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
 

Variables

static const WCHAR net_11_subdir [] = {'1','.','0',0}
 
static const WCHAR net_20_subdir [] = {'2','.','0',0}
 
static const WCHAR net_40_subdir [] = {'4','.','0',0}
 
static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl
 
static struct CLRRuntimeInfo runtimes [NUM_RUNTIMES]
 
static int runtimes_initialized
 
static CRITICAL_SECTION runtime_list_cs = { &runtime_list_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG runtime_list_cs_debug
 
static loaded_mono loaded_monos [NUM_ABI_VERSIONS]
 
static const WCHAR libmono2_arch_dll [] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0}
 
static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl
 
static struct CLRMetaHost GlobalCLRMetaHost
 
static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl
 

Macro Definition Documentation

◆ LOAD_MONO_FUNCTION

#define LOAD_MONO_FUNCTION (   x)
Value:
do { \
(*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
if (!(*result)->x) { \
goto fail; \
} \
} while (0);
#define GetProcAddress(x, y)
Definition: compat.h:753
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

◆ LOAD_OPT_VOID_MONO_FUNCTION

#define LOAD_OPT_VOID_MONO_FUNCTION (   x)
Value:
do { \
(*result)->x = (void*)GetProcAddress((*result)->mono_handle, #x); \
if (!(*result)->x) { \
(*result)->x = do_nothing; \
} \
} while (0);
static void CDECL do_nothing(void)
Definition: metahost.c:81

◆ NUM_ABI_VERSIONS

#define NUM_ABI_VERSIONS   2

Definition at line 56 of file metahost.c.

◆ NUM_RUNTIMES

#define NUM_RUNTIMES   3

Definition at line 36 of file metahost.c.

Function Documentation

◆ CLRMetaHost_AddRef()

static ULONG WINAPI CLRMetaHost_AddRef ( ICLRMetaHost iface)
static

Definition at line 974 of file metahost.c.

975{
976 return 2;
977}

◆ CLRMetaHost_CreateInstance()

HRESULT CLRMetaHost_CreateInstance ( REFIID  riid,
void **  ppobj 
)

Definition at line 1168 of file metahost.c.

1169{
1170 return ICLRMetaHost_QueryInterface(&GlobalCLRMetaHost.ICLRMetaHost_iface, riid, ppobj);
1171}
static struct CLRMetaHost GlobalCLRMetaHost
Definition: metahost.c:950
REFIID riid
Definition: atlbase.h:39

Referenced by CLRCreateInstance().

◆ CLRMetaHost_EnumerateInstalledRuntimes()

static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes ( ICLRMetaHost iface,
IEnumUnknown **  ppEnumerator 
)
static

Definition at line 1097 of file metahost.c.

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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl
Definition: metahost.c:793
static void find_runtimes(void)
Definition: metahost.c:731
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4
IEnumUnknown IEnumUnknown_iface
Definition: metahost.c:788

◆ CLRMetaHost_EnumerateLoadedRuntimes()

static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes ( ICLRMetaHost iface,
HANDLE  hndProcess,
IEnumUnknown **  ppEnumerator 
)
static

Definition at line 1119 of file metahost.c.

1121{
1122 FIXME("%p %p\n", hndProcess, ppEnumerator);
1123
1124 return E_NOTIMPL;
1125}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRMetaHost_ExitProcess()

static HRESULT WINAPI CLRMetaHost_ExitProcess ( ICLRMetaHost iface,
INT32  iExitCode 
)
static

Definition at line 1143 of file metahost.c.

1144{
1145 FIXME("%i: stub\n", iExitCode);
1146
1147 ExitProcess(iExitCode);
1148}
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1489

◆ CLRMetaHost_GetRuntime()

HRESULT WINAPI CLRMetaHost_GetRuntime ( ICLRMetaHost iface,
LPCWSTR  pwzVersion,
REFIID  iid,
LPVOID ppRuntime 
)

Definition at line 1023 of file metahost.c.

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}
#define ERR(fmt,...)
Definition: precomp.h:57
#define CLR_E_SHIM_RUNTIME
Definition: corerror.h:127
static struct CLRRuntimeInfo runtimes[NUM_RUNTIMES]
Definition: metahost.c:38
static BOOL parse_runtime_version(LPCWSTR version, DWORD *major, DWORD *minor, DWORD *build)
Definition: metahost.c:984
#define NUM_RUNTIMES
Definition: metahost.c:36
static void missing_runtime_message(const CLRRuntimeInfo *This)
Definition: metahost.c:98
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
#define E_POINTER
Definition: winerror.h:3480

Referenced by CreateDebuggingInterfaceFromVersion(), and get_runtime_info().

◆ CLRMetaHost_GetVersionFromFile()

HRESULT WINAPI CLRMetaHost_GetVersionFromFile ( ICLRMetaHost iface,
LPCWSTR  pwzFilePath,
LPWSTR  pwzBuffer,
DWORD pcchBuffer 
)

Definition at line 1062 of file metahost.c.

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}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR version[]
Definition: asmname.c:66
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
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define CP_UTF8
Definition: nls.h:20
HRESULT hr
Definition: shlfolder.c:183
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
uint32_t ULONG
Definition: typedefs.h:59
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
char * LPSTR
Definition: xmlstorage.h:182

Referenced by get_runtime_info(), and GetFileVersion().

◆ CLRMetaHost_QueryInterface()

static HRESULT WINAPI CLRMetaHost_QueryInterface ( ICLRMetaHost iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 952 of file metahost.c.

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}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ CLRMetaHost_QueryLegacyV2RuntimeBinding()

static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding ( ICLRMetaHost iface,
REFIID  riid,
LPVOID ppUnk 
)
static

Definition at line 1135 of file metahost.c.

1137{
1138 FIXME("%s %p\n", debugstr_guid(riid), ppUnk);
1139
1140 return E_NOTIMPL;
1141}

◆ CLRMetaHost_Release()

static ULONG WINAPI CLRMetaHost_Release ( ICLRMetaHost iface)
static

Definition at line 979 of file metahost.c.

980{
981 return 1;
982}

◆ CLRMetaHost_RequestRuntimeLoadedNotification()

static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification ( ICLRMetaHost iface,
RuntimeLoadedCallbackFnPtr  pCallbackFunction 
)
static

Definition at line 1127 of file metahost.c.

1129{
1130 FIXME("%p\n", pCallbackFunction);
1131
1132 return E_NOTIMPL;
1133}

◆ CLRRuntimeInfo_AddRef()

static ULONG WINAPI CLRRuntimeInfo_AddRef ( ICLRRuntimeInfo iface)
static

Definition at line 344 of file metahost.c.

345{
346 return 2;
347}

◆ CLRRuntimeInfo_BindAsLegacyV2Runtime()

static HRESULT WINAPI CLRRuntimeInfo_BindAsLegacyV2Runtime ( ICLRRuntimeInfo iface)
static

Definition at line 524 of file metahost.c.

525{
526 FIXME("%p\n", iface);
527
528 return E_NOTIMPL;
529}

◆ CLRRuntimeInfo_GetDefaultStartupFlags()

static HRESULT WINAPI CLRRuntimeInfo_GetDefaultStartupFlags ( ICLRRuntimeInfo iface,
DWORD pdwStartupFlags,
LPWSTR  pwzHostConfigFile,
DWORD pcchHostConfigFile 
)
static

Definition at line 516 of file metahost.c.

518{
519 FIXME("%p %p %p %p\n", iface, pdwStartupFlags, pwzHostConfigFile, pcchHostConfigFile);
520
521 return E_NOTIMPL;
522}

◆ CLRRuntimeInfo_GetInterface()

static HRESULT WINAPI CLRRuntimeInfo_GetInterface ( ICLRRuntimeInfo iface,
REFCLSID  rclsid,
REFIID  riid,
LPVOID ppUnk 
)
static

Definition at line 483 of file metahost.c.

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}
HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv)
static HRESULT CLRRuntimeInfo_GetRuntimeHost(CLRRuntimeInfo *This, RuntimeHost **result)
Definition: metahost.c:253
static CLRRuntimeInfo * impl_from_ICLRRuntimeInfo(ICLRRuntimeInfo *iface)
Definition: metahost.c:317
Definition: txthost.c:37

◆ CLRRuntimeInfo_GetProcAddress()

static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress ( ICLRRuntimeInfo iface,
LPCSTR  pszProcName,
LPVOID ppProc 
)
static

Definition at line 475 of file metahost.c.

477{
478 FIXME("%p %s %p\n", iface, debugstr_a(pszProcName), ppProc);
479
480 return E_NOTIMPL;
481}
#define debugstr_a
Definition: kernel32.h:31

◆ CLRRuntimeInfo_GetRuntimeDirectory()

static HRESULT WINAPI CLRRuntimeInfo_GetRuntimeDirectory ( ICLRRuntimeInfo iface,
LPWSTR  pwzBuffer,
DWORD pcchBuffer 
)
static

Definition at line 404 of file metahost.c.

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}
#define E_FAIL
Definition: ddrawi.h:102
#define MAX_PATH
Definition: compat.h:34
#define lstrlenW
Definition: compat.h:750
const WCHAR system_dir[]
Definition: file.c:68
static BOOL get_install_root(LPWSTR install_dir)
Definition: metahost.c:382
GLsizeiptr size
Definition: glext.h:5919
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define strcpyW(d, s)
Definition: unicode.h:35
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ CLRRuntimeInfo_GetRuntimeHost()

static HRESULT CLRRuntimeInfo_GetRuntimeHost ( CLRRuntimeInfo This,
RuntimeHost **  result 
)
static

Definition at line 253 of file metahost.c.

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}
HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version, loaded_mono *loaded_mono, RuntimeHost **result)
static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
Definition: metahost.c:108
static CRITICAL_SECTION runtime_list_cs
Definition: metahost.c:46
GLuint64EXT * result
Definition: glext.h:11304
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by CLRRuntimeInfo_GetInterface(), and ICLRRuntimeInfo_GetRuntimeHost().

◆ CLRRuntimeInfo_GetVersionString()

static HRESULT WINAPI CLRRuntimeInfo_GetVersionString ( ICLRRuntimeInfo iface,
LPWSTR  pwzBuffer,
DWORD pcchBuffer 
)
static

Definition at line 354 of file metahost.c.

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}
#define assert(x)
Definition: debug.h:53
#define snprintf
Definition: wintirpc.h:48

◆ CLRRuntimeInfo_IsLoadable()

static HRESULT WINAPI CLRRuntimeInfo_IsLoadable ( ICLRRuntimeInfo iface,
BOOL pbLoadable 
)
static

Definition at line 500 of file metahost.c.

502{
503 FIXME("%p %p\n", iface, pbLoadable);
504
505 return E_NOTIMPL;
506}

◆ CLRRuntimeInfo_IsLoaded()

static HRESULT WINAPI CLRRuntimeInfo_IsLoaded ( ICLRRuntimeInfo iface,
HANDLE  hndProcess,
BOOL pbLoaded 
)
static

Definition at line 443 of file metahost.c.

445{
446 FIXME("%p %p %p\n", iface, hndProcess, pbLoaded);
447
448 return E_NOTIMPL;
449}

◆ CLRRuntimeInfo_IsStarted()

static HRESULT WINAPI CLRRuntimeInfo_IsStarted ( ICLRRuntimeInfo iface,
BOOL pbStarted,
DWORD pdwStartupFlags 
)
static

Definition at line 531 of file metahost.c.

533{
534 FIXME("%p %p %p\n", iface, pbStarted, pdwStartupFlags);
535
536 return E_NOTIMPL;
537}

◆ CLRRuntimeInfo_LoadErrorString()

static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString ( ICLRRuntimeInfo iface,
UINT  iResourceID,
LPWSTR  pwzBuffer,
DWORD pcchBuffer,
LONG  iLocaleid 
)
static

Definition at line 451 of file metahost.c.

453{
454 FIXME("%p %u %p %p %x\n", iface, iResourceID, pwzBuffer, pcchBuffer, iLocaleid);
455
456 return E_NOTIMPL;
457}

◆ CLRRuntimeInfo_LoadLibrary()

static HRESULT WINAPI CLRRuntimeInfo_LoadLibrary ( ICLRRuntimeInfo iface,
LPCWSTR  pwzDllName,
HMODULE phndModule 
)
static

Definition at line 459 of file metahost.c.

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}
static DWORD cchBuffer
Definition: fusion.c:85
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT WINAPI LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
Definition: mscoree_main.c:353

◆ CLRRuntimeInfo_QueryInterface()

static HRESULT WINAPI CLRRuntimeInfo_QueryInterface ( ICLRRuntimeInfo iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 322 of file metahost.c.

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}

◆ CLRRuntimeInfo_Release()

static ULONG WINAPI CLRRuntimeInfo_Release ( ICLRRuntimeInfo iface)
static

Definition at line 349 of file metahost.c.

350{
351 return 1;
352}

◆ CLRRuntimeInfo_SetDefaultStartupFlags()

static HRESULT WINAPI CLRRuntimeInfo_SetDefaultStartupFlags ( ICLRRuntimeInfo iface,
DWORD  dwStartupFlags,
LPCWSTR  pwzHostConfigFile 
)
static

Definition at line 508 of file metahost.c.

510{
511 FIXME("%p %x %s\n", iface, dwStartupFlags, debugstr_w(pwzHostConfigFile));
512
513 return E_NOTIMPL;
514}

◆ do_nothing()

static void CDECL do_nothing ( void  )
static

Definition at line 81 of file metahost.c.

82{
83}

◆ expect_no_runtimes()

void expect_no_runtimes ( void  )

Definition at line 302 of file metahost.c.

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}
static loaded_mono loaded_monos[NUM_ABI_VERSIONS]
Definition: metahost.c:58
#define NUM_ABI_VERSIONS
Definition: metahost.c:56
HMODULE mono_handle

Referenced by DllMain().

◆ find_mono_dll()

static BOOL find_mono_dll ( LPCWSTR  path,
LPWSTR  dll_path,
int  abi_version 
)
static

Definition at line 574 of file metahost.c.

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}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
static const WCHAR libmono2_arch_dll[]
Definition: metahost.c:571
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define strcatW(d, s)
Definition: unicode.h:36

Referenced by get_mono_path_from_folder(), get_mono_path_from_registry(), and load_mono().

◆ find_runtimes()

static void find_runtimes ( void  )
static

Definition at line 731 of file metahost.c.

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
763 strcpyW(runtimes[i].mono_path, mono_path);
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++)
777 runtimes[i].mono_abi_version = -1;
778 }
779
781
782end:
784}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL get_mono_path(LPWSTR path, int abi_version)
Definition: metahost.c:679
static int runtimes_initialized
Definition: metahost.c:44
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint end
Definition: gl.h:1545

Referenced by CLRMetaHost_EnumerateInstalledRuntimes(), CLRMetaHost_GetRuntime(), and get_runtime_info().

◆ get_install_root()

static BOOL get_install_root ( LPWSTR  install_dir)
static

Definition at line 382 of file metahost.c.

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}
#define RegCloseKey(hKey)
Definition: registry.h:49
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
GLenum GLsizei len
Definition: glext.h:6722
#define KEY_READ
Definition: nt_native.h:1026
Definition: copy.c:22
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CLRRuntimeInfo_GetRuntimeDirectory().

◆ get_mono_path()

static BOOL get_mono_path ( LPWSTR  path,
int  abi_version 
)
static

Definition at line 679 of file metahost.c.

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}
#define CDECL
Definition: compat.h:29
#define HeapFree(x, y, z)
Definition: compat.h:735
#define wine_get_dos_file_name(__x)
Definition: compat.h:61
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
static BOOL get_mono_path_from_folder(LPCWSTR folder, LPWSTR mono_path, int abi_version)
Definition: metahost.c:660
static BOOL get_mono_path_from_registry(LPWSTR path, int abi_version)
Definition: metahost.c:619
const char * wine_get_build_dir(void)
Definition: config.c:30
const char * wine_get_data_dir(void)
Definition: config.c:24
void build_tree(deflate_state *s, tree_desc *desc)
Definition: trees.c:615

Referenced by find_runtimes().

◆ get_mono_path_from_folder()

static BOOL get_mono_path_from_folder ( LPCWSTR  folder,
LPWSTR  mono_path,
int  abi_version 
)
static

Definition at line 660 of file metahost.c.

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
667 strcpyW(mono_path, folder);
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}
static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path, int abi_version)
Definition: metahost.c:574
Definition: fci.c:116

Referenced by get_mono_path().

◆ get_mono_path_from_registry()

static BOOL get_mono_path_from_registry ( LPWSTR  path,
int  abi_version 
)
static

Definition at line 619 of file metahost.c.

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}
#define lstrcpyW
Definition: compat.h:749

Referenced by get_mono_path().

◆ get_runtime_info()

HRESULT get_runtime_info ( LPCWSTR  exefile,
LPCWSTR  version,
LPCWSTR  config_file,
DWORD  startup_flags,
DWORD  runtimeinfo_flags,
BOOL  legacy,
ICLRRuntimeInfo **  result 
)

Definition at line 1260 of file metahost.c.

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}
#define WARN(fmt,...)
Definition: precomp.h:61
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
HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost *iface, LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
Definition: metahost.c:1062
HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost *iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
Definition: metahost.c:1023
uint32_t entry
Definition: isohybrid.c:63
BOOL legacy
Definition: mkisofs.c:131
@ RUNTIME_INFO_UPGRADE_VERSION
Definition: mscoree.idl:40
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list supported_runtimes

Referenced by _CorExeMain(), ClrCreateManagedInstance(), CorBindToRuntimeEx(), CorBindToRuntimeHost(), create_monodata(), GetCORSystemDirectory(), GetCORVersion(), GetRequestedRuntimeInfo(), and ReallyFixupVTable().

◆ ICLRRuntimeInfo_GetRuntimeHost()

HRESULT ICLRRuntimeInfo_GetRuntimeHost ( ICLRRuntimeInfo iface,
RuntimeHost **  result 
)

Definition at line 557 of file metahost.c.

558{
560
561 assert(This->ICLRRuntimeInfo_iface.lpVtbl == &CLRRuntimeInfoVtbl);
562
564}
static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl
Definition: metahost.c:34

Referenced by _CorExeMain(), ClrCreateManagedInstance(), create_monodata(), and ReallyFixupVTable().

◆ impl_from_ICLRRuntimeInfo()

static CLRRuntimeInfo * impl_from_ICLRRuntimeInfo ( ICLRRuntimeInfo iface)
inlinestatic

Definition at line 317 of file metahost.c.

318{
319 return CONTAINING_RECORD(iface, CLRRuntimeInfo, ICLRRuntimeInfo_iface);
320}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by CLRRuntimeInfo_GetInterface(), CLRRuntimeInfo_GetVersionString(), and ICLRRuntimeInfo_GetRuntimeHost().

◆ impl_from_IEnumUnknown()

static struct InstalledRuntimeEnum * impl_from_IEnumUnknown ( IEnumUnknown iface)
inlinestatic

◆ InstalledRuntimeEnum_AddRef()

static ULONG WINAPI InstalledRuntimeEnum_AddRef ( IEnumUnknown iface)
static

Definition at line 821 of file metahost.c.

822{
825
826 TRACE("(%p) refcount=%u\n", iface, ref);
827
828 return ref;
829}
#define InterlockedIncrement
Definition: armddk.h:53
static struct InstalledRuntimeEnum * impl_from_IEnumUnknown(IEnumUnknown *iface)
Definition: metahost.c:795
Definition: send.c:48

◆ InstalledRuntimeEnum_Clone()

static HRESULT WINAPI InstalledRuntimeEnum_Clone ( IEnumUnknown iface,
IEnumUnknown **  ppenum 
)
static

Definition at line 915 of file metahost.c.

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}

◆ InstalledRuntimeEnum_Next()

static HRESULT WINAPI InstalledRuntimeEnum_Next ( IEnumUnknown iface,
ULONG  celt,
IUnknown **  rgelt,
ULONG pceltFetched 
)
static

Definition at line 846 of file metahost.c.

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}
#define S_FALSE
Definition: winerror.h:3451

◆ InstalledRuntimeEnum_QueryInterface()

static HRESULT WINAPI InstalledRuntimeEnum_QueryInterface ( IEnumUnknown iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 800 of file metahost.c.

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}
const GUID IID_IEnumUnknown

◆ InstalledRuntimeEnum_Release()

static ULONG WINAPI InstalledRuntimeEnum_Release ( IEnumUnknown iface)
static

Definition at line 831 of file metahost.c.

832{
835
836 TRACE("(%p) refcount=%u\n", iface, ref);
837
838 if (ref == 0)
839 {
841 }
842
843 return ref;
844}
#define InterlockedDecrement
Definition: armddk.h:52

◆ InstalledRuntimeEnum_Reset()

static HRESULT WINAPI InstalledRuntimeEnum_Reset ( IEnumUnknown iface)
static

Definition at line 904 of file metahost.c.

905{
907
908 TRACE("(%p)\n", iface);
909
910 This->pos = 0;
911
912 return S_OK;
913}

◆ InstalledRuntimeEnum_Skip()

static HRESULT WINAPI InstalledRuntimeEnum_Skip ( IEnumUnknown iface,
ULONG  celt 
)
static

Definition at line 879 of file metahost.c.

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}

◆ load_mono()

static HRESULT load_mono ( CLRRuntimeInfo This,
loaded_mono **  result 
)
static

Definition at line 108 of file metahost.c.

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}
#define FreeLibrary(x)
Definition: compat.h:748
#define WideCharToMultiByte
Definition: compat.h:111
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
#define LoadLibraryW(x)
Definition: compat.h:747
static void mono_shutdown_callback_fn(MonoProfiler *prof)
Definition: metahost.c:246
#define LOAD_OPT_VOID_MONO_FUNCTION(x)
static MonoAssembly * mono_assembly_search_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data)
Definition: metahost.c:1173
#define LOAD_MONO_FUNCTION(x)
static void set_environment(LPCWSTR bin_path)
Definition: metahost.c:66
static struct _PeImage bin
struct _MonoProfiler MonoProfiler

Referenced by CLRRuntimeInfo_GetRuntimeHost().

◆ missing_runtime_message()

static void missing_runtime_message ( const CLRRuntimeInfo This)
static

Definition at line 98 of file metahost.c.

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}
#define MESSAGE
Definition: options.h:86

Referenced by CLRMetaHost_GetRuntime(), get_runtime_info(), and load_mono().

◆ mono_assembly_search_hook_fn()

static MonoAssembly * mono_assembly_search_hook_fn ( MonoAssemblyName aname,
char **  assemblies_path,
void user_data 
)
static

Definition at line 1173 of file metahost.c.

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}
#define stat
Definition: acwin.h:99
GLuint pathA
Definition: glext.h:11719
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
struct _MonoAssembly MonoAssembly
MonoImageOpenStatus
#define DWORD
Definition: nt_native.h:44
char *CDECL * mono_stringify_assembly_name(MonoAssemblyName *aname)
MonoAssembly *CDECL * mono_assembly_open(const char *filename, MonoImageOpenStatus *status)
Definition: stat.h:55
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by load_mono().

◆ mono_shutdown_callback_fn()

static void mono_shutdown_callback_fn ( MonoProfiler prof)
static

Definition at line 246 of file metahost.c.

247{
248 loaded_mono *mono = (loaded_mono*)prof;
249
250 mono->is_shutdown = TRUE;
251}

Referenced by load_mono().

◆ parse_runtime_version()

static BOOL parse_runtime_version ( LPCWSTR  version,
DWORD major,
DWORD minor,
DWORD build 
)
static

Definition at line 984 of file metahost.c.

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}
#define isdigit(c)
Definition: acclib.h:68

Referenced by CLRMetaHost_GetRuntime(), and get_runtime_info().

◆ set_environment()

static void set_environment ( LPCWSTR  bin_path)
static

Definition at line 66 of file metahost.c.

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}
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
#define strlenW(s)
Definition: unicode.h:34

Referenced by load_mono().

◆ unload_all_runtimes()

void unload_all_runtimes ( void  )

Definition at line 279 of file metahost.c.

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++)
298 if (runtimes[i].loaded_runtime)
299 RuntimeHost_Destroy(runtimes[i].loaded_runtime);
300}
HRESULT RuntimeHost_Destroy(RuntimeHost *This)

Referenced by _CorExeMain(), and CorExitProcess().

Variable Documentation

◆ CLRMetaHost_vtbl

const struct ICLRMetaHostVtbl CLRMetaHost_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost *iface, IEnumUnknown **ppEnumerator)
Definition: metahost.c:1097
static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:952
static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost *iface, REFIID riid, LPVOID *ppUnk)
Definition: metahost.c:1135
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
static HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost *iface, INT32 iExitCode)
Definition: metahost.c:1143
static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost *iface)
Definition: metahost.c:974

Definition at line 1150 of file metahost.c.

◆ CLRRuntimeInfoVtbl

static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl
static
Initial value:
= {
}
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 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 ULONG WINAPI CLRRuntimeInfo_AddRef(ICLRRuntimeInfo *iface)
Definition: metahost.c:344
static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString(ICLRRuntimeInfo *iface, UINT iResourceID, LPWSTR pwzBuffer, DWORD *pcchBuffer, LONG iLocaleid)
Definition: metahost.c:451
static HRESULT WINAPI CLRRuntimeInfo_IsLoadable(ICLRRuntimeInfo *iface, BOOL *pbLoadable)
Definition: metahost.c:500
static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo *iface, LPCSTR pszProcName, LPVOID *ppProc)
Definition: metahost.c:475
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 ULONG WINAPI CLRRuntimeInfo_Release(ICLRRuntimeInfo *iface)
Definition: metahost.c:349
static HRESULT WINAPI CLRRuntimeInfo_IsLoaded(ICLRRuntimeInfo *iface, HANDLE hndProcess, BOOL *pbLoaded)
Definition: metahost.c:443
static HRESULT WINAPI CLRRuntimeInfo_SetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD dwStartupFlags, LPCWSTR pwzHostConfigFile)
Definition: metahost.c:508
static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:322
static HRESULT WINAPI CLRRuntimeInfo_GetDefaultStartupFlags(ICLRRuntimeInfo *iface, DWORD *pdwStartupFlags, LPWSTR pwzHostConfigFile, DWORD *pcchHostConfigFile)
Definition: metahost.c:516

Definition at line 34 of file metahost.c.

Referenced by ICLRRuntimeInfo_GetRuntimeHost().

◆ GlobalCLRMetaHost

static struct CLRMetaHost GlobalCLRMetaHost
static
Initial value:
= {
}
static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl
Definition: metahost.c:1150

Definition at line 950 of file metahost.c.

Referenced by CLRMetaHost_CreateInstance().

◆ InstalledRuntimeEnum_Vtbl

static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI InstalledRuntimeEnum_Skip(IEnumUnknown *iface, ULONG celt)
Definition: metahost.c:879
static ULONG WINAPI InstalledRuntimeEnum_Release(IEnumUnknown *iface)
Definition: metahost.c:831
static HRESULT WINAPI InstalledRuntimeEnum_Reset(IEnumUnknown *iface)
Definition: metahost.c:904
static HRESULT WINAPI InstalledRuntimeEnum_Clone(IEnumUnknown *iface, IEnumUnknown **ppenum)
Definition: metahost.c:915
static ULONG WINAPI InstalledRuntimeEnum_AddRef(IEnumUnknown *iface)
Definition: metahost.c:821
static HRESULT WINAPI InstalledRuntimeEnum_QueryInterface(IEnumUnknown *iface, REFIID riid, void **ppvObject)
Definition: metahost.c:800
static HRESULT WINAPI InstalledRuntimeEnum_Next(IEnumUnknown *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
Definition: metahost.c:846

Definition at line 793 of file metahost.c.

Referenced by CLRMetaHost_EnumerateInstalledRuntimes(), and InstalledRuntimeEnum_Clone().

◆ libmono2_arch_dll

const WCHAR libmono2_arch_dll[] = {'\\','b','i','n','\\','l','i','b','m','o','n','o','-','2','.','0','.','d','l','l',0}
static

Definition at line 571 of file metahost.c.

Referenced by find_mono_dll().

◆ loaded_monos

loaded_mono loaded_monos[NUM_ABI_VERSIONS]
static

Definition at line 58 of file metahost.c.

Referenced by expect_no_runtimes(), load_mono(), and unload_all_runtimes().

◆ net_11_subdir

const WCHAR net_11_subdir[] = {'1','.','0',0}
static

Definition at line 30 of file metahost.c.

◆ net_20_subdir

const WCHAR net_20_subdir[] = {'2','.','0',0}
static

Definition at line 31 of file metahost.c.

◆ net_40_subdir

const WCHAR net_40_subdir[] = {'4','.','0',0}
static

Definition at line 32 of file metahost.c.

◆ runtime_list_cs

static CRITICAL_SECTION runtime_list_cs = { &runtime_list_cs_debug, -1, 0, 0, 0, 0 }
static

Definition at line 46 of file metahost.c.

Referenced by CLRRuntimeInfo_GetRuntimeHost(), and find_runtimes().

◆ runtime_list_cs_debug

CRITICAL_SECTION_DEBUG runtime_list_cs_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": runtime_list_cs") }
}
static CRITICAL_SECTION_DEBUG runtime_list_cs_debug
Definition: metahost.c:47
#define DWORD_PTR
Definition: treelist.c:76

Definition at line 47 of file metahost.c.

◆ runtimes

Initial value:
= {
{{&CLRRuntimeInfoVtbl}, net_11_subdir, 1, 1, 4322, 0},
{{&CLRRuntimeInfoVtbl}, net_20_subdir, 2, 0, 50727, 0},
{{&CLRRuntimeInfoVtbl}, net_40_subdir, 4, 0, 30319, 0}
}
static const WCHAR net_11_subdir[]
Definition: metahost.c:30
static const WCHAR net_20_subdir[]
Definition: metahost.c:31
static const WCHAR net_40_subdir[]
Definition: metahost.c:32

Definition at line 38 of file metahost.c.

Referenced by CLRMetaHost_GetRuntime(), find_runtimes(), get_runtime_info(), InstalledRuntimeEnum_Next(), InstalledRuntimeEnum_Skip(), and unload_all_runtimes().

◆ runtimes_initialized

int runtimes_initialized
static

Definition at line 44 of file metahost.c.

Referenced by find_runtimes().