#include <mono/io-layer/io-layer.h>
/* FIXME: fix this code to not depend so much on the internals */
#include <mono/metadata/class-internals.h>
+#include <mono/utils/w32handle.h>
#define LOGDEBUG(...)
/* define LOGDEBUG(...) g_message(__VA_ARGS__) */
guint32 count = 0, module_count = 0, assembly_count = 0;
guint32 i, num_added = 0;
GPtrArray *assemblies = NULL;
- static HANDLE current_process = 0;
-
- if (current_process == 0) {
- int pid = mono_process_current_pid ();
- current_process = ves_icall_System_Diagnostics_Process_GetProcess_internal (pid);
- }
stash_system_assembly (this_obj);
- if (process == current_process) {
+ if (GetProcessId (process) == mono_process_current_pid ()) {
assemblies = get_domain_assemblies (mono_domain_get ());
assembly_count = assemblies->len;
}
MonoBoolean
ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoProcessStartInfo *proc_start_info, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_info)
{
+ MonoError error G_GNUC_UNUSED;
gboolean ret;
gunichar2 *dir;
STARTUPINFO startinfo={0};
free_shell_path = FALSE;
if (cmd) {
gchar *newcmd, *tmp;
- tmp = mono_string_to_utf8 (cmd);
+ tmp = mono_string_to_utf8_checked (cmd, &error);
+ if (mono_error_set_pending_exception (&error)) {
+ g_free (spath);
+ return NULL;
+ }
newcmd = g_strdup_printf ("%s %s", spath, tmp);
cmd = mono_string_new_wrapper (newcmd);
g_free (tmp);