-2010-04-23 Jb Evain <jbevain@novell.com>
-
- * domain.c (get_runtime_by_version): renamed to
- mono_get_runtime_by_version.
-
- * domain-internals.h: expose mono_get_runtime_by_version as
- an internal function.
-
- * assembly.c (mono_assembly_load_from_full): check if the image
- references a newer runtime than the current executing one, and
- mark it as invalid if it's the case.
-
2010-04-23 Gonzalo Paniagua Javier <gonzalo@novell.com>
* threadpool.c: patch from Robert Nagy that fixes a nullref and
return mono_assembly_open_full (filename, status, FALSE);
}
-static gboolean
-image_references_newer_runtime (MonoImage *image)
-{
- const MonoRuntimeInfo *image_runtime;
- const char *image_version, *current_version;
- gint i, cmp;
-
- image_runtime = mono_get_runtime_by_version (image->version);
- if (!image_runtime)
- return FALSE;
-
- image_version = image_runtime->framework_version;
- current_version = mono_get_runtime_info ()->framework_version;
-
- for (i = 0; i < 4; i++) {
- cmp = (image_version [i] - '0') - (current_version [0] - '0');
- if (cmp > 0)
- return TRUE;
- else if (cmp < 0)
- return FALSE;
- }
-
- return FALSE;
-}
-
MonoAssembly *
mono_assembly_load_from_full (MonoImage *image, const char*fname,
MonoImageOpenStatus *status, gboolean refonly)
return NULL;
}
- if (image_references_newer_runtime (image)) {
- *status = MONO_IMAGE_IMAGE_INVALID;
- return NULL;
- }
-
#if defined (HOST_WIN32)
{
gchar *tmp_fn;
static void
get_runtimes_from_exe (const char *exe_file, MonoImage **exe_image, const MonoRuntimeInfo** runtimes);
+static const MonoRuntimeInfo*
+get_runtime_by_version (const char *version);
+
static MonoImage*
mono_jit_info_find_aot_module (guint8* addr);
mono_fixup_exe_image (exe_image);
#endif
} else if (runtime_version != NULL) {
- runtimes [0] = mono_get_runtime_by_version (runtime_version);
+ runtimes [0] = get_runtime_by_version (runtime_version);
runtimes [1] = NULL;
}
if (runtimes [0] == NULL) {
- const MonoRuntimeInfo *default_runtime = mono_get_runtime_by_version (DEFAULT_RUNTIME_VERSION);
+ const MonoRuntimeInfo *default_runtime = get_runtime_by_version (DEFAULT_RUNTIME_VERSION);
runtimes [0] = default_runtime;
runtimes [1] = NULL;
g_print ("WARNING: The runtime version supported by this application is unavailable.\n");
g_free (app_config);
}
-/**
- * mono_get_runtime_by_version:
- *
- * Returns: the runtime info for the specified version.
- */
-const MonoRuntimeInfo*
-mono_get_runtime_by_version (const char *version)
+
+static const MonoRuntimeInfo*
+get_runtime_by_version (const char *version)
{
int n;
int max = G_N_ELEMENTS (supported_runtimes);
GSList *list = app_config->supported_runtimes;
while (list != NULL) {
version = (char*) list->data;
- runtime = mono_get_runtime_by_version (version);
+ runtime = get_runtime_by_version (version);
if (runtime != NULL)
runtimes [n++] = runtime;
list = g_slist_next (list);
/* Check the requiredRuntime element. This is for 1.0 apps only. */
if (app_config->required_runtime != NULL) {
- runtimes [0] = mono_get_runtime_by_version (app_config->required_runtime);
+ runtimes [0] = get_runtime_by_version (app_config->required_runtime);
runtimes [1] = NULL;
app_config_free (app_config);
return;
* a default runtime and leave to the initialization method the work of
* reporting the error.
*/
- runtimes [0] = mono_get_runtime_by_version (DEFAULT_RUNTIME_VERSION);
+ runtimes [0] = get_runtime_by_version (DEFAULT_RUNTIME_VERSION);
runtimes [1] = NULL;
return;
}
*exe_image = image;
- runtimes [0] = mono_get_runtime_by_version (image->version);
+ runtimes [0] = get_runtime_by_version (image->version);
runtimes [1] = NULL;
}