mscoree: Use the main HMODULE in _CorExeMain instead of loading a new exe.
This commit is contained in:
parent
d2d1c6d824
commit
a824e8f659
|
@ -829,7 +829,9 @@ __int32 WINAPI _CorExeMain(void)
|
|||
int argc;
|
||||
char **argv;
|
||||
MonoDomain *domain;
|
||||
MonoAssembly *assembly;
|
||||
MonoImage *image;
|
||||
MonoImageOpenStatus status;
|
||||
MonoAssembly *assembly=NULL;
|
||||
WCHAR filename[MAX_PATH];
|
||||
char *filenameA;
|
||||
ICLRRuntimeInfo *info;
|
||||
|
@ -863,9 +865,21 @@ __int32 WINAPI _CorExeMain(void)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -165,12 +165,14 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
|
|||
} while (0);
|
||||
|
||||
LOAD_MONO_FUNCTION(mono_assembly_get_image);
|
||||
LOAD_MONO_FUNCTION(mono_assembly_load_from);
|
||||
LOAD_MONO_FUNCTION(mono_assembly_open);
|
||||
LOAD_MONO_FUNCTION(mono_config_parse);
|
||||
LOAD_MONO_FUNCTION(mono_class_from_mono_type);
|
||||
LOAD_MONO_FUNCTION(mono_class_from_name);
|
||||
LOAD_MONO_FUNCTION(mono_class_get_method_from_name);
|
||||
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_jit_exec);
|
||||
LOAD_MONO_FUNCTION(mono_jit_init);
|
||||
|
|
|
@ -147,6 +147,7 @@ struct loaded_mono
|
|||
BOOL is_shutdown;
|
||||
|
||||
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);
|
||||
MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
|
||||
MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
|
||||
|
@ -154,6 +155,7 @@ struct loaded_mono
|
|||
void (CDECL *mono_config_parse)(const char *filename);
|
||||
MonoAssembly* (CDECL *mono_domain_assembly_open) (MonoDomain *domain, const char *name);
|
||||
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);
|
||||
int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
|
||||
MonoDomain* (CDECL *mono_jit_init)(const char *file);
|
||||
|
|
Loading…
Reference in New Issue