Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / mscoree / mscoree_private.h
blob36a4a867fde1949f8c15cc89233a7eb92201e448
1 /*
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 LONG dll_refs;
24 static inline void MSCOREE_LockModule(void) { InterlockedIncrement(&dll_refs); }
25 static inline void MSCOREE_UnlockModule(void) { InterlockedDecrement(&dll_refs); }
27 extern char *WtoA(LPCWSTR wstr);
29 extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
31 typedef struct tagASSEMBLY ASSEMBLY;
33 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file);
34 HRESULT assembly_release(ASSEMBLY *assembly);
35 HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version);
37 typedef struct RuntimeHost RuntimeHost;
39 typedef struct CLRRuntimeInfo
41 const struct ICLRRuntimeInfoVtbl *ICLRRuntimeInfo_vtbl;
42 LPCWSTR mono_libdir;
43 DWORD major;
44 DWORD minor;
45 DWORD build;
46 int mono_abi_version;
47 WCHAR mono_path[MAX_PATH];
48 WCHAR mscorlib_path[MAX_PATH];
49 struct RuntimeHost *loaded_runtime;
50 } CLRRuntimeInfo;
52 extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
53 DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result);
55 extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
57 extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result);
59 extern HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk);
61 typedef struct parsed_config_file
63 struct list supported_runtimes;
64 } parsed_config_file;
66 typedef struct supported_runtime
68 struct list entry;
69 LPWSTR version;
70 } supported_runtime;
72 extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result);
74 extern void free_parsed_config_file(parsed_config_file *file);
76 /* Mono embedding */
77 typedef struct _MonoDomain MonoDomain;
78 typedef struct _MonoAssembly MonoAssembly;
79 typedef struct _MonoAssemblyName MonoAssemblyName;
80 typedef struct _MonoType MonoType;
81 typedef struct _MonoImage MonoImage;
82 typedef struct _MonoClass MonoClass;
83 typedef struct _MonoObject MonoObject;
84 typedef struct _MonoMethod MonoMethod;
86 typedef enum {
87 MONO_IMAGE_OK,
88 MONO_IMAGE_ERROR_ERRNO,
89 MONO_IMAGE_MISSING_ASSEMBLYREF,
90 MONO_IMAGE_IMAGE_INVALID
91 } MonoImageOpenStatus;
93 typedef MonoAssembly* (*MonoAssemblyPreLoadFunc)(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
95 typedef struct loaded_mono
97 HMODULE mono_handle;
98 HMODULE glib_handle;
100 MonoImage* (*mono_assembly_get_image)(MonoAssembly *assembly);
101 MonoAssembly* (*mono_assembly_open)(const char *filename, MonoImageOpenStatus *status);
102 MonoClass* (*mono_class_from_mono_type)(MonoType *type);
103 MonoClass* (*mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
104 MonoMethod* (*mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count);
105 void (*mono_config_parse)(const char *filename);
106 MonoAssembly* (*mono_domain_assembly_open) (MonoDomain *domain, const char *name);
107 void (*mono_free)(void *);
108 void (*mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data);
109 void (*mono_jit_cleanup)(MonoDomain *domain);
110 int (*mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
111 MonoDomain* (*mono_jit_init)(const char *file);
112 int (*mono_jit_set_trace_options)(const char* options);
113 MonoDomain* (*mono_object_get_domain)(MonoObject *obj);
114 MonoObject* (*mono_object_new)(MonoDomain *domain, MonoClass *klass);
115 void* (*mono_object_unbox)(MonoObject *obj);
116 MonoType* (*mono_reflection_type_from_name)(char *name, MonoImage *image);
117 MonoObject* (*mono_runtime_invoke)(MonoMethod *method, void *obj, void **params, MonoObject **exc);
118 void (*mono_runtime_object_init)(MonoObject *this_obj);
119 void (*mono_set_dirs)(const char *assembly_dir, const char *config_dir);
120 char* (*mono_stringify_assembly_name)(MonoAssemblyName *aname);
121 } loaded_mono;
123 /* loaded runtime interfaces */
124 extern void unload_all_runtimes(void);
126 extern HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
127 const loaded_mono *loaded_mono, RuntimeHost** result);
129 extern HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv);
131 extern HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk);
133 extern HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name,
134 MonoDomain *domain, MonoObject **result);
136 extern HRESULT RuntimeHost_Destroy(RuntimeHost *This);
138 #endif /* __MSCOREE_PRIVATE__ */