3 * Copyright 2008 Alistair Leslie-Hughes
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef __MSCOREE_PRIVATE__
21 #define __MSCOREE_PRIVATE__
23 extern char *WtoA(LPCWSTR wstr
) DECLSPEC_HIDDEN
;
25 extern HRESULT
CLRMetaHost_CreateInstance(REFIID riid
, void **ppobj
) DECLSPEC_HIDDEN
;
26 extern HRESULT
CLRMetaHostPolicy_CreateInstance(REFIID riid
, void **ppobj
) DECLSPEC_HIDDEN
;
28 extern HRESULT WINAPI
CLRMetaHost_GetVersionFromFile(ICLRMetaHost
* iface
,
29 LPCWSTR pwzFilePath
, LPWSTR pwzBuffer
, DWORD
*pcchBuffer
) DECLSPEC_HIDDEN
;
31 typedef struct _VTableFixup
{
37 typedef struct tagASSEMBLY ASSEMBLY
;
39 extern HRESULT
assembly_create(ASSEMBLY
**out
, LPCWSTR file
) DECLSPEC_HIDDEN
;
40 extern HRESULT
assembly_from_hmodule(ASSEMBLY
**out
, HMODULE hmodule
) DECLSPEC_HIDDEN
;
41 extern HRESULT
assembly_release(ASSEMBLY
*assembly
) DECLSPEC_HIDDEN
;
42 extern HRESULT
assembly_get_runtime_version(ASSEMBLY
*assembly
, LPSTR
*version
) DECLSPEC_HIDDEN
;
43 extern HRESULT
assembly_get_vtable_fixups(ASSEMBLY
*assembly
, VTableFixup
**fixups
, DWORD
*count
) DECLSPEC_HIDDEN
;
46 typedef struct _MonoDomain MonoDomain
;
47 typedef struct _MonoAssembly MonoAssembly
;
48 typedef struct _MonoAssemblyName MonoAssemblyName
;
49 typedef struct _MonoType MonoType
;
50 typedef struct _MonoImage MonoImage
;
51 typedef struct _MonoClass MonoClass
;
52 typedef struct _MonoObject MonoObject
;
53 typedef struct _MonoString MonoString
;
54 typedef struct _MonoMethod MonoMethod
;
55 typedef struct _MonoProfiler MonoProfiler
;
56 typedef struct _MonoThread MonoThread
;
58 typedef struct RuntimeHost RuntimeHost
;
60 typedef struct CLRRuntimeInfo
62 ICLRRuntimeInfo ICLRRuntimeInfo_iface
;
66 struct RuntimeHost
*loaded_runtime
;
71 ICorRuntimeHost ICorRuntimeHost_iface
;
72 ICLRRuntimeHost ICLRRuntimeHost_iface
;
73 const CLRRuntimeInfo
*version
;
75 MonoDomain
*default_domain
;
76 CRITICAL_SECTION lock
;
80 typedef struct CorProcess
83 ICorDebugProcess
*pProcess
;
86 typedef struct CorDebug
88 ICorDebug ICorDebug_iface
;
89 ICorDebugProcessEnum ICorDebugProcessEnum_iface
;
92 ICLRRuntimeHost
*runtimehost
;
94 /* ICorDebug Callback */
95 ICorDebugManagedCallback
*pCallback
;
96 ICorDebugManagedCallback2
*pCallback2
;
99 struct list processes
;
102 extern HRESULT
get_runtime_info(LPCWSTR exefile
, LPCWSTR version
, LPCWSTR config_file
,
103 DWORD startup_flags
, DWORD runtimeinfo_flags
, BOOL legacy
, ICLRRuntimeInfo
**result
) DECLSPEC_HIDDEN
;
105 extern HRESULT
ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo
*iface
, RuntimeHost
**result
) DECLSPEC_HIDDEN
;
107 extern HRESULT
MetaDataDispenser_CreateInstance(IUnknown
**ppUnk
) DECLSPEC_HIDDEN
;
109 typedef struct parsed_config_file
111 struct list supported_runtimes
;
112 } parsed_config_file
;
114 typedef struct supported_runtime
120 extern HRESULT
parse_config_file(LPCWSTR filename
, parsed_config_file
*result
) DECLSPEC_HIDDEN
;
122 extern void free_parsed_config_file(parsed_config_file
*file
) DECLSPEC_HIDDEN
;
126 MONO_IMAGE_ERROR_ERRNO
,
127 MONO_IMAGE_MISSING_ASSEMBLYREF
,
128 MONO_IMAGE_IMAGE_INVALID
129 } MonoImageOpenStatus
;
131 typedef MonoAssembly
* (*MonoAssemblyPreLoadFunc
)(MonoAssemblyName
*aname
, char **assemblies_path
, void *user_data
);
133 typedef void (*MonoProfileFunc
)(MonoProfiler
*prof
);
135 typedef void (*MonoPrintCallback
) (const char *string
, INT is_stdout
);
137 extern BOOL is_mono_started DECLSPEC_HIDDEN
;
139 extern MonoImage
* (CDECL
*mono_assembly_get_image
)(MonoAssembly
*assembly
) DECLSPEC_HIDDEN
;
140 extern MonoAssembly
* (CDECL
*mono_assembly_load_from
)(MonoImage
*image
, const char *fname
, MonoImageOpenStatus
*status
) DECLSPEC_HIDDEN
;
141 extern MonoAssembly
* (CDECL
*mono_assembly_open
)(const char *filename
, MonoImageOpenStatus
*status
) DECLSPEC_HIDDEN
;
142 extern MonoClass
* (CDECL
*mono_class_from_mono_type
)(MonoType
*type
) DECLSPEC_HIDDEN
;
143 extern MonoClass
* (CDECL
*mono_class_from_name
)(MonoImage
*image
, const char* name_space
, const char *name
) DECLSPEC_HIDDEN
;
144 extern MonoMethod
* (CDECL
*mono_class_get_method_from_name
)(MonoClass
*klass
, const char *name
, int param_count
) DECLSPEC_HIDDEN
;
145 extern MonoAssembly
* (CDECL
*mono_domain_assembly_open
)(MonoDomain
*domain
, const char *name
) DECLSPEC_HIDDEN
;
146 extern int (CDECL
*mono_jit_exec
)(MonoDomain
*domain
, MonoAssembly
*assembly
, int argc
, char *argv
[]) DECLSPEC_HIDDEN
;
147 extern MonoDomain
* (CDECL
*mono_jit_init_version
)(const char *domain_name
, const char *runtime_version
) DECLSPEC_HIDDEN
;
148 extern MonoImage
* (CDECL
*mono_image_open_from_module_handle
)(HMODULE module_handle
, char* fname
, UINT has_entry_point
, MonoImageOpenStatus
* status
) DECLSPEC_HIDDEN
;
149 extern void* (CDECL
*mono_marshal_get_vtfixup_ftnptr
)(MonoImage
*image
, DWORD token
, WORD type
) DECLSPEC_HIDDEN
;
150 extern MonoDomain
* (CDECL
*mono_object_get_domain
)(MonoObject
*obj
) DECLSPEC_HIDDEN
;
151 extern MonoObject
* (CDECL
*mono_object_new
)(MonoDomain
*domain
, MonoClass
*klass
) DECLSPEC_HIDDEN
;
152 extern void* (CDECL
*mono_object_unbox
)(MonoObject
*obj
) DECLSPEC_HIDDEN
;
153 extern MonoType
* (CDECL
*mono_reflection_type_from_name
)(char *name
, MonoImage
*image
) DECLSPEC_HIDDEN
;
154 extern MonoObject
* (CDECL
*mono_runtime_invoke
)(MonoMethod
*method
, void *obj
, void **params
, MonoObject
**exc
) DECLSPEC_HIDDEN
;
155 extern void (CDECL
*mono_runtime_object_init
)(MonoObject
*this_obj
) DECLSPEC_HIDDEN
;
156 extern void (CDECL
*mono_runtime_quit
)(void) DECLSPEC_HIDDEN
;
157 extern MonoString
* (CDECL
*mono_string_new
)(MonoDomain
*domain
, const char *str
) DECLSPEC_HIDDEN
;
158 extern MonoThread
* (CDECL
*mono_thread_attach
)(MonoDomain
*domain
) DECLSPEC_HIDDEN
;
159 extern void (CDECL
*mono_thread_manage
)(void) DECLSPEC_HIDDEN
;
160 extern void (CDECL
*mono_trace_set_assembly
)(MonoAssembly
*assembly
) DECLSPEC_HIDDEN
;
161 extern void (CDECL
*mono_trace_set_print_handler
)(MonoPrintCallback callback
) DECLSPEC_HIDDEN
;
162 extern void (CDECL
*mono_trace_set_printerr_handler
)(MonoPrintCallback callback
) DECLSPEC_HIDDEN
;
164 /* loaded runtime interfaces */
165 extern void expect_no_runtimes(void) DECLSPEC_HIDDEN
;
167 extern HRESULT
RuntimeHost_Construct(const CLRRuntimeInfo
*runtime_version
, RuntimeHost
** result
) DECLSPEC_HIDDEN
;
169 extern void RuntimeHost_ExitProcess(RuntimeHost
*This
, INT exitcode
) DECLSPEC_HIDDEN
;
171 extern HRESULT
RuntimeHost_GetInterface(RuntimeHost
*This
, REFCLSID clsid
, REFIID riid
, void **ppv
) DECLSPEC_HIDDEN
;
173 extern HRESULT
RuntimeHost_GetIUnknownForObject(RuntimeHost
*This
, MonoObject
*obj
, IUnknown
**ppUnk
) DECLSPEC_HIDDEN
;
175 extern HRESULT
RuntimeHost_CreateManagedInstance(RuntimeHost
*This
, LPCWSTR name
,
176 MonoDomain
*domain
, MonoObject
**result
) DECLSPEC_HIDDEN
;
178 HRESULT WINAPI
CLRMetaHost_ExitProcess(ICLRMetaHost
* iface
, INT32 iExitCode
) DECLSPEC_HIDDEN
;
180 HRESULT WINAPI
CLRMetaHost_GetRuntime(ICLRMetaHost
* iface
, LPCWSTR pwzVersion
, REFIID iid
, LPVOID
*ppRuntime
) DECLSPEC_HIDDEN
;
182 extern HRESULT
CorDebug_Create(ICLRRuntimeHost
*runtimehost
, IUnknown
** ppUnk
) DECLSPEC_HIDDEN
;
184 extern HRESULT
create_monodata(REFIID riid
, LPVOID
*ppObj
) DECLSPEC_HIDDEN
;
186 extern HRESULT
get_file_from_strongname(WCHAR
* stringnameW
, WCHAR
* assemblies_path
, int path_length
) DECLSPEC_HIDDEN
;
188 extern void runtimehost_init(void) DECLSPEC_HIDDEN
;
189 extern void runtimehost_uninit(void) DECLSPEC_HIDDEN
;
191 #endif /* __MSCOREE_PRIVATE__ */