ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
MonoString *path_with_pattern,
gint attrs, gint mask,
ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
MonoString *path_with_pattern,
gint attrs, gint mask,
- MONO_PREPARE_BLOCKING;
- names = get_filesystem_entries (mono_string_chars (path), mono_string_chars (path_with_pattern), attrs, mask, error);
- MONO_FINISH_BLOCKING;
+ MONO_ENTER_GC_SAFE;
+ names = get_filesystem_entries (mono_string_chars (path), mono_string_chars (path_with_pattern), attrs, mask, ioerror);
+ MONO_EXIT_GC_SAFE;
- if (*error == ERROR_SUCCESS)
- return mono_array_new (domain, mono_defaults.string_class, 0);
+ if (*ioerror == ERROR_SUCCESS) {
+ MonoArray *arr = mono_array_new_checked (domain, mono_defaults.string_class, 0, &error);
+ mono_error_set_pending_exception (&error);
+ return arr;
+ }
- result = mono_array_new (domain, mono_defaults.string_class, names->len);
+ result = mono_array_new_checked (domain, mono_defaults.string_class, names->len, &error);
+ if (mono_error_set_pending_exception (&error))
+ goto leave;
for (i = 0; i < names->len; i++) {
mono_array_setref (result, i, mono_string_new (domain, (const char *)g_ptr_array_index (names, i)));
g_free (g_ptr_array_index (names, i));
}
for (i = 0; i < names->len; i++) {
mono_array_setref (result, i, mono_string_new (domain, (const char *)g_ptr_array_index (names, i)));
g_free (g_ptr_array_index (names, i));
}
MonoString *
ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
MonoString *path_with_pattern,
MonoString *
ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
MonoString *path_with_pattern,
return NULL;
}
ifh = g_new (IncrementalFind, 1);
ifh->find_handle = find_handle;
return NULL;
}
ifh = g_new (IncrementalFind, 1);
ifh->find_handle = find_handle;
if (FindNextFile (find_handle, &data) == FALSE){
int e = GetLastError ();
if (e != ERROR_NO_MORE_FILES)
if (FindNextFile (find_handle, &data) == FALSE){
int e = GetLastError ();
if (e != ERROR_NO_MORE_FILES)
gboolean ret;
gunichar2 *utf16_sourceFileName = NULL, *utf16_destinationFileName = NULL, *utf16_destinationBackupFileName = NULL;
guint32 replaceFlags = REPLACEFILE_WRITE_THROUGH;
gboolean ret;
gunichar2 *utf16_sourceFileName = NULL, *utf16_destinationFileName = NULL, *utf16_destinationBackupFileName = NULL;
guint32 replaceFlags = REPLACEFILE_WRITE_THROUGH;
result = ReadFile (handle, buffer, count, &n, NULL);
result = ReadFile (handle, buffer, count, &n, NULL);
result = WriteFile (handle, buffer, count, &n, NULL);
result = WriteFile (handle, buffer, count, &n, NULL);
const FILETIME *creation_filetime;
const FILETIME *last_access_filetime;
const FILETIME *last_write_filetime;
const FILETIME *creation_filetime;
const FILETIME *last_access_filetime;
const FILETIME *last_write_filetime;
ret=CreatePipe (read_handle, write_handle, &attr, 0);
ret=CreatePipe (read_handle, write_handle, &attr, 0);
ret=DuplicateHandle (source_process_handle, source_handle, target_process_handle, target_handle, access, inherit, options);
ret=DuplicateHandle (source_process_handle, source_handle, target_process_handle, target_handle, access, inherit, options);
- chars = mono_array_new (domain, mono_defaults.char_class, n);
+ chars = mono_array_new_checked (domain, mono_defaults.char_class, n, &error);
+ if (mono_error_set_pending_exception (&error))
+ return NULL;
for (i = 0; i < n; ++ i)
mono_array_set (chars, gunichar2, i, invalid_path_chars [i]);
for (i = 0; i < n; ++ i)
mono_array_set (chars, gunichar2, i, invalid_path_chars [i]);
}
void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
gint64 length, gint32 *error)
{
gboolean ret;
}
void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
gint64 length, gint32 *error)
{
gboolean ret;
- char *path = mono_string_to_utf8 (string);
+ char *path = mono_string_to_utf8_checked (string, &error);
+ mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */