X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fcoree.c;h=4436229376e10101b1d16f827601c72f466d2328;hb=1aa82aca7fdd1cc1f9da78625ef21dffa2699498;hp=6c7ff4a1f27d3e9370c05d760f5fdebfc867b2ad;hpb=3fd4901a235bda0019f03317f4ee083744195758;p=mono.git
diff --git a/mono/metadata/coree.c b/mono/metadata/coree.c
index 6c7ff4a1f27..4436229376e 100644
--- a/mono/metadata/coree.c
+++ b/mono/metadata/coree.c
@@ -5,6 +5,7 @@
* Kornel Pal
*
* Copyright (C) 2008 Kornel Pal
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include
@@ -22,11 +23,14 @@
#include "domain-internals.h"
#include "appdomain.h"
#include "object.h"
+#include "object-internals.h"
#include "loader.h"
#include "threads.h"
#include "environment.h"
#include "coree.h"
+#include
+
HMODULE coree_module_handle = NULL;
static gboolean init_from_coree = FALSE;
@@ -134,13 +138,14 @@ BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpRes
/* Called by ntdll.dll reagardless of entry point after _CorValidateImage. */
__int32 STDMETHODCALLTYPE _CorExeMain(void)
{
+ MonoError error;
MonoDomain* domain;
MonoAssembly* assembly;
MonoImage* image;
MonoMethod* method;
guint32 entry;
gchar* file_name;
- gchar* error;
+ gchar* corlib_version_error;
int argc;
gunichar2** argvw;
gchar** argv;
@@ -150,9 +155,9 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
init_from_coree = TRUE;
domain = mono_runtime_load (file_name, NULL);
- error = (gchar*) mono_check_corlib_version ();
- if (error) {
- g_free (error);
+ corlib_version_error = (gchar*) mono_check_corlib_version ();
+ if (corlib_version_error) {
+ g_free (corlib_version_error);
g_free (file_name);
MessageBox (NULL, L"Corlib not in sync with this runtime.", NULL, MB_ICONERROR);
mono_runtime_quit ();
@@ -177,9 +182,10 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
ExitProcess (1);
}
- method = mono_get_method (image, entry, NULL);
+ method = mono_get_method_checked (image, entry, NULL, NULL, &error);
if (method == NULL) {
g_free (file_name);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
MessageBox (NULL, L"The entry point method could not be loaded.", NULL, MB_ICONERROR);
mono_runtime_quit ();
ExitProcess (1);
@@ -192,7 +198,8 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
argv [i] = g_utf16_to_utf8 (argvw [i], -1, NULL, NULL, NULL);
LocalFree (argvw);
- mono_runtime_run_main (method, argc, argv, NULL);
+ mono_runtime_run_main_checked (method, argc, argv, &error);
+ mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
mono_thread_manage ();
mono_runtime_quit ();