From 61660438d7a6a8014281253becbc2b105935d442 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Wed, 8 May 2024 11:41:46 -0400 Subject: [PATCH] Widen the error message string when invoking the entrypoint --- src/bootstrap.c | 6 +++++- src/runtimes/mono.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bootstrap.c b/src/bootstrap.c index 6cc60e4..c140b8f 100644 --- a/src/bootstrap.c +++ b/src/bootstrap.c @@ -114,8 +114,12 @@ void mono_doorstop_bootstrap(void *mono_domain) { LOG("Error invoking code!"); if (mono.object_to_string) { void *str = mono.object_to_string(exc, NULL); - char *exc_str = mono.string_to_utf8(str); + char *exc_str_n = mono.string_to_utf8(str); + char_t *exc_str = widen(exc_str_n); LOG("Error message: %s", exc_str); + LOG("\n"); + free(exc_str); + mono.free(exc_str_n); } } LOG("Done"); diff --git a/src/runtimes/mono.h b/src/runtimes/mono.h index 2a55f7d..3f4f04e 100644 --- a/src/runtimes/mono.h +++ b/src/runtimes/mono.h @@ -27,6 +27,7 @@ DEF_CALL(void, config_parse, const char *filename) DEF_CALL(void, set_assemblies_path, const char *path) DEF_CALL(void *, object_to_string, void *obj, void **exc) DEF_CALL(char *, string_to_utf8, void *s) +DEF_CALL(void, free, void *ptr) DEF_CALL(void *, image_open_from_data_with_name, void *data, unsigned long data_len, int need_copy, MonoImageOpenStatus *status, int refonly, const char *name)