Commit a824e8f6 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

mscoree: Use the main HMODULE in _CorExeMain instead of loading a new exe.

parent d2d1c6d8
...@@ -829,7 +829,9 @@ __int32 WINAPI _CorExeMain(void) ...@@ -829,7 +829,9 @@ __int32 WINAPI _CorExeMain(void)
int argc; int argc;
char **argv; char **argv;
MonoDomain *domain; MonoDomain *domain;
MonoAssembly *assembly; MonoImage *image;
MonoImageOpenStatus status;
MonoAssembly *assembly=NULL;
WCHAR filename[MAX_PATH]; WCHAR filename[MAX_PATH];
char *filenameA; char *filenameA;
ICLRRuntimeInfo *info; ICLRRuntimeInfo *info;
...@@ -863,9 +865,21 @@ __int32 WINAPI _CorExeMain(void) ...@@ -863,9 +865,21 @@ __int32 WINAPI _CorExeMain(void)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
assembly = host->mono->mono_domain_assembly_open(domain, filenameA); image = host->mono->mono_image_open_from_module_handle(GetModuleHandleW(NULL),
filenameA, 1, &status);
exit_code = host->mono->mono_jit_exec(domain, assembly, argc, argv); if (image)
assembly = host->mono->mono_assembly_load_from(image, filenameA, &status);
if (assembly)
{
exit_code = host->mono->mono_jit_exec(domain, assembly, argc, argv);
}
else
{
ERR("couldn't load %s, status=%d\n", debugstr_w(filename), status);
exit_code = -1;
}
RuntimeHost_DeleteDomain(host, domain); RuntimeHost_DeleteDomain(host, domain);
} }
......
...@@ -165,12 +165,14 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result) ...@@ -165,12 +165,14 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
} while (0); } while (0);
LOAD_MONO_FUNCTION(mono_assembly_get_image); LOAD_MONO_FUNCTION(mono_assembly_get_image);
LOAD_MONO_FUNCTION(mono_assembly_load_from);
LOAD_MONO_FUNCTION(mono_assembly_open); LOAD_MONO_FUNCTION(mono_assembly_open);
LOAD_MONO_FUNCTION(mono_config_parse); LOAD_MONO_FUNCTION(mono_config_parse);
LOAD_MONO_FUNCTION(mono_class_from_mono_type); LOAD_MONO_FUNCTION(mono_class_from_mono_type);
LOAD_MONO_FUNCTION(mono_class_from_name); LOAD_MONO_FUNCTION(mono_class_from_name);
LOAD_MONO_FUNCTION(mono_class_get_method_from_name); LOAD_MONO_FUNCTION(mono_class_get_method_from_name);
LOAD_MONO_FUNCTION(mono_domain_assembly_open); LOAD_MONO_FUNCTION(mono_domain_assembly_open);
LOAD_MONO_FUNCTION(mono_image_open_from_module_handle);
LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook); LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook);
LOAD_MONO_FUNCTION(mono_jit_exec); LOAD_MONO_FUNCTION(mono_jit_exec);
LOAD_MONO_FUNCTION(mono_jit_init); LOAD_MONO_FUNCTION(mono_jit_init);
......
...@@ -147,6 +147,7 @@ struct loaded_mono ...@@ -147,6 +147,7 @@ struct loaded_mono
BOOL is_shutdown; BOOL is_shutdown;
MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly); MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly);
MonoAssembly* (CDECL *mono_assembly_load_from)(MonoImage *image, const char *fname, MonoImageOpenStatus *status);
MonoAssembly* (CDECL *mono_assembly_open)(const char *filename, MonoImageOpenStatus *status); MonoAssembly* (CDECL *mono_assembly_open)(const char *filename, MonoImageOpenStatus *status);
MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type); MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name); MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
...@@ -154,6 +155,7 @@ struct loaded_mono ...@@ -154,6 +155,7 @@ struct loaded_mono
void (CDECL *mono_config_parse)(const char *filename); void (CDECL *mono_config_parse)(const char *filename);
MonoAssembly* (CDECL *mono_domain_assembly_open) (MonoDomain *domain, const char *name); MonoAssembly* (CDECL *mono_domain_assembly_open) (MonoDomain *domain, const char *name);
void (CDECL *mono_free)(void *); void (CDECL *mono_free)(void *);
MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status);
void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data); void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data);
int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
MonoDomain* (CDECL *mono_jit_init)(const char *file); MonoDomain* (CDECL *mono_jit_init)(const char *file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment