Erik van Pienbroek erik@vanpienbroek.nl writes:
+#if defined(HAVE_FORK) && defined(HAVE_WAITPID) +static UINT_PTR SHELL_try_native_execute ( const char *openCmd, const char *unixName ) +{
- UINT_PTR retval = SE_ERR_NOASSOC;
- pid_t cpid;
- struct stat st;
- if (stat(openCmd, &st) == -1)
- {
TRACE("stat() %s failed: %s\n", openCmd, strerror(errno));return retval;- }
- cpid = fork();
- if (!cpid)
- {
/* Prevent the situation where the native file association database* tries to run wine to execute a program and we trigger this fallback* path again and end up in a recursive loop */if (getenv("WINE_INSIDE_SHELLEXECUTE")){TRACE("recursive loop detected, not continuing with ShellExecute call\n");exit(EXIT_SUCCESS);}setenv("WINE_INSIDE_SHELLEXECUTE", "1", 0);TRACE("running %s %s\n", openCmd, unixName);execlp(openCmd, openCmd, unixName, (char*) NULL);/* execlp replaces the current process image with a new process image,* so no code below here should get executed by the forked child */- } else {
int status;waitpid(cpid, &status, 0);TRACE("status %x\n", status);if(!WEXITSTATUS(status))retval = 33;- }
- return retval;
+}
You want spawnvp(), but that sort of thing should probably go in winebrowser or something like that, and be configurable.