- wchar_t *whelper = g_utf8_to_utf16 (HELPER_PROCESS, -1, NULL, NULL, NULL);
- wchar_t **wargv, **wenvp;
-
- if (!utf8_charv_to_wcharv (new_argv, &wargv, &conv_error_index, &conv_error))
- {
- if (conv_error_index == ARG_WORKING_DIRECTORY)
- g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_CHDIR,
- _("Invalid working directory: %s"),
- conv_error->message);
- else
- g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
- _("Invalid string in argument vector at %d: %s"),
- conv_error_index - ARG_PROGRAM, conv_error->message);
- g_error_free (conv_error);
- g_strfreev (protected_argv);
- g_free (new_argv[ARG_WORKING_DIRECTORY]);
- g_free (new_argv);
- g_free (whelper);
-
- return FALSE;
- }
-
- if (!utf8_charv_to_wcharv (envp, &wenvp, NULL, &conv_error))
- {
- g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
- _("Invalid string in environment: %s"),
- conv_error->message);
- g_error_free (conv_error);
- g_strfreev (protected_argv);
- g_free (new_argv[ARG_WORKING_DIRECTORY]);
- g_free (new_argv);
- g_free (whelper);
- g_strfreev ((gchar **) wargv);
-
- return FALSE;
- }
-
- if (child_setup)
- (* child_setup) (user_data);
-
- if (wenvp != NULL)
- /* Let's hope envp hasn't mucked with PATH so that
- * gspawn-win32-helper.exe isn't found.
- */
- rc = _wspawnvpe (P_NOWAIT, whelper, (const wchar_t **) wargv, (const wchar_t **) wenvp);