ICALL_TYPE(DEFAULTC, "System.Configuration.DefaultConfig", DEFAULTC_1)
HANDLES(ICALL(DEFAULTC_1, "get_bundled_machine_config", ves_icall_System_Configuration_DefaultConfig_get_bundled_machine_config))
-ICALL(DEFAULTC_2, "get_machine_config_path", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path)
+HANDLES(ICALL(DEFAULTC_2, "get_machine_config_path", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path))
/* Note that the below icall shares the same function as DefaultConfig uses */
ICALL_TYPE(INTCFGHOST, "System.Configuration.InternalConfigurationHost", INTCFGHOST_1)
-ICALL(INTCFGHOST_1, "get_bundled_app_config", get_bundled_app_config)
+HANDLES(ICALL(INTCFGHOST_1, "get_bundled_app_config", ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_app_config))
HANDLES(ICALL(INTCFGHOST_2, "get_bundled_machine_config", ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_machine_config))
ICALL_TYPE(CONSOLE, "System.ConsoleDriver", CONSOLE_1)
ICALL(ENV_3, "GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames)
ICALL(ENV_31, "GetIs64BitOperatingSystem", ves_icall_System_Environment_GetIs64BitOperatingSystem)
ICALL(ENV_4, "GetLogicalDrivesInternal", ves_icall_System_Environment_GetLogicalDrives )
-ICALL(ENV_5, "GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path)
+HANDLES(ICALL(ENV_5, "GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path))
HANDLES(ICALL(ENV_51, "GetNewLine", ves_icall_System_Environment_get_NewLine))
HANDLES(ICALL(ENV_6, "GetOSVersionString", ves_icall_System_Environment_GetOSVersionString))
ICALL(ENV_6a, "GetPageSize", mono_pagesize)
ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf)
ICALL(MARSHAL_13, "Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink)
ICALL(MARSHAL_14, "PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll)
-ICALL(MARSHAL_15, "PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi)
+HANDLES(ICALL(MARSHAL_15, "PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi))
ICALL(MARSHAL_16, "PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len)
ICALL(MARSHAL_17, "PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR)
ICALL(MARSHAL_18, "PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni)
ICALL(STRING_11, "InternalIsInterned", ves_icall_System_String_InternalIsInterned)
ICALL_TYPE(TENC, "System.Text.EncodingHelper", TENC_1)
-ICALL(TENC_1, "InternalCodePage", ves_icall_System_Text_EncodingHelper_InternalCodePage)
+HANDLES(ICALL(TENC_1, "InternalCodePage", ves_icall_System_Text_EncodingHelper_InternalCodePage))
ICALL_TYPE(UNORM, "System.Text.Normalization", UNORM_1)
ICALL(UNORM_1, "load_normalization_resource", ves_icall_System_Text_Normalization_load_normalization_resource)
ICALL(VALUET_2, "InternalGetHashCode", ves_icall_System_ValueType_InternalGetHashCode)
ICALL_TYPE(WEBIC, "System.Web.Util.ICalls", WEBIC_1)
-ICALL(WEBIC_1, "GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path)
-ICALL(WEBIC_2, "GetMachineInstallDirectory", ves_icall_System_Web_Util_ICalls_get_machine_install_dir)
+HANDLES(ICALL(WEBIC_1, "GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path))
+HANDLES(ICALL(WEBIC_2, "GetMachineInstallDirectory", ves_icall_System_Web_Util_ICalls_get_machine_install_dir))
HANDLES(ICALL(WEBIC_3, "GetUnmanagedResourcesPtr", ves_icall_get_resources_ptr))
#ifndef DISABLE_COM
* 1 at entry, and we can not compute a suitable code page number,
* returns the code page as a string
*/
-ICALL_EXPORT MonoString*
-ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page, MonoError *error)
{
+ error_init (error);
const char *cset;
const char *p;
char *c;
g_free (codepage);
if (want_name && *int_code_page == -1)
- return mono_string_new (mono_domain_get (), cset);
+ return mono_string_new_handle (mono_domain_get (), cset, error);
else
- return NULL;
+ return MONO_HANDLE_CAST (MonoString, NULL_HANDLE);
}
ICALL_EXPORT MonoBoolean
return result;
}
-ICALL_EXPORT MonoString *
-ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (MonoError *error)
{
- MonoString *mcpath;
+ error_init (error);
gchar *path;
path = g_build_path (G_DIR_SEPARATOR_S, mono_get_config_dir (), "mono", mono_get_runtime_info ()->framework_version, "machine.config", NULL);
mono_icall_make_platform_path (path);
- mcpath = mono_string_new (mono_domain_get (), path);
+ MonoStringHandle mcpath = mono_string_new_handle (mono_domain_get (), path, error);
g_free (path);
- g_assert (mcpath);
+ mono_error_assert_ok (error);
return mcpath;
}
-/* this is an icall */
-static MonoString *
-get_bundled_app_config (void)
+static MonoStringHandle
+ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_app_config (MonoError *error)
{
- MonoError error;
+ error_init (error);
const gchar *app_config;
MonoDomain *domain;
- MonoString *file;
gchar *config_file_name, *config_file_path;
gsize len, config_file_path_length, config_ext_length;
gchar *module;
domain = mono_domain_get ();
- file = domain->setup->configuration_file;
- if (!file || file->length == 0)
+ MonoStringHandle file = MONO_HANDLE_NEW (MonoString, domain->setup->configuration_file);
+ if (MONO_HANDLE_IS_NULL (file) || MONO_HANDLE_GETVAL (file, length) == 0)
return NULL;
// Retrieve config file and remove the extension
- config_file_name = mono_string_to_utf8_checked (file, &error);
- if (mono_error_set_pending_exception (&error))
- return NULL;
+ config_file_name = mono_string_handle_to_utf8 (file, error);
+ return_val_if_nok (error, MONO_HANDLE_CAST (MonoString, NULL_HANDLE));
+
config_file_path = mono_portability_find_file (config_file_name, TRUE);
if (!config_file_path)
config_file_path = config_file_name;
config_file_path_length = strlen (config_file_path);
config_ext_length = strlen (".config");
- if (config_file_path_length <= config_ext_length)
- return NULL;
+ if (config_file_path_length <= config_ext_length) {
+ if (config_file_name != config_file_path)
+ g_free (config_file_name);
+ return MONO_HANDLE_CAST (MonoString, NULL_HANDLE);
+ }
len = config_file_path_length - config_ext_length;
module = (gchar *)g_malloc0 (len + 1);
g_free (config_file_path);
if (!app_config)
- return NULL;
+ return MONO_HANDLE_CAST (MonoString, NULL_HANDLE);
- return mono_string_new (mono_domain_get (), app_config);
+ return mono_string_new_handle (mono_domain_get (), app_config, error);
}
static MonoStringHandle
}
-ICALL_EXPORT MonoString *
-ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_Web_Util_ICalls_get_machine_install_dir (MonoError *error)
{
- MonoString *ipath;
+ error_init (error);
gchar *path;
path = g_path_get_dirname (mono_get_config_dir ());
mono_icall_make_platform_path (path);
- ipath = mono_string_new (mono_domain_get (), path);
+ MonoStringHandle ipath = mono_string_new_handle (mono_domain_get (), path, error);
g_free (path);
return ipath;
memcpy (dest_addr, src, length * element_size);
}
-MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr)
+MonoStringHandle
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr, MonoError *error)
{
+ error_init (error);
if (ptr == NULL)
- return NULL;
+ return MONO_HANDLE_CAST (MonoString, NULL_HANDLE);
else
- return mono_string_new (mono_domain_get (), ptr);
+ return mono_string_new_handle (mono_domain_get (), ptr, error);
}
MonoString *
ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
MonoArray *dest, gint32 length);
-MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr);
+MonoStringHandle
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr, MonoError *error);
MonoString *
ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len);