mscoree: Implement config file parsing.
[wine] / dlls / mscoree / mscoree_private.h
1 /*
2  *
3  * Copyright 2008 Alistair Leslie-Hughes
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #ifndef __MSCOREE_PRIVATE__
21 #define __MSCOREE_PRIVATE__
22
23 extern LONG dll_refs;
24 static inline void MSCOREE_LockModule(void) { InterlockedIncrement(&dll_refs); }
25 static inline void MSCOREE_UnlockModule(void) { InterlockedDecrement(&dll_refs); }
26
27 extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
28
29 typedef struct tagASSEMBLY ASSEMBLY;
30
31 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file);
32 HRESULT assembly_release(ASSEMBLY *assembly);
33 HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version);
34
35 typedef struct RuntimeHost RuntimeHost;
36
37 typedef struct CLRRuntimeInfo
38 {
39     const struct ICLRRuntimeInfoVtbl *ICLRRuntimeInfo_vtbl;
40     LPCWSTR mono_libdir;
41     DWORD major;
42     DWORD minor;
43     DWORD build;
44     int mono_abi_version;
45     WCHAR mono_path[MAX_PATH];
46     WCHAR mscorlib_path[MAX_PATH];
47     struct RuntimeHost *loaded_runtime;
48 } CLRRuntimeInfo;
49
50 extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
51     DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result);
52
53 extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
54
55 extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result);
56
57 typedef struct parsed_config_file
58 {
59     struct list supported_runtimes;
60 } parsed_config_file;
61
62 typedef struct supported_runtime
63 {
64     struct list entry;
65     LPWSTR version;
66 } supported_runtime;
67
68 extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result);
69
70 extern void free_parsed_config_file(parsed_config_file *file);
71
72 /* Mono 2.6 embedding */
73 typedef struct _MonoDomain MonoDomain;
74 typedef struct _MonoAssembly MonoAssembly;
75
76 typedef struct loaded_mono
77 {
78     HMODULE mono_handle;
79
80     void (*mono_config_parse)(const char *filename);
81     MonoAssembly* (*mono_domain_assembly_open) (MonoDomain *domain, const char *name);
82     void (*mono_jit_cleanup)(MonoDomain *domain);
83     int (*mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
84     MonoDomain* (*mono_jit_init)(const char *file);
85     int (*mono_jit_set_trace_options)(const char* options);
86     void (*mono_set_dirs)(const char *assembly_dir, const char *config_dir);
87 } loaded_mono;
88
89 /* loaded runtime interfaces */
90 extern void unload_all_runtimes(void);
91
92 extern HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
93     const loaded_mono *loaded_mono, RuntimeHost** result);
94
95 extern HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv);
96
97 extern HRESULT RuntimeHost_Destroy(RuntimeHost *This);
98
99 #endif   /* __MSCOREE_PRIVATE__ */