diff --git a/configure b/configure
index f57035c7b5aee2227dc2b8335dadff6dc70e3639..0aac3491608a38255c826ac095364b37c9b749dd 100755
--- a/configure
+++ b/configure
@@ -13246,6 +13246,7 @@ fi
 
 
 
+
 
 
 for ac_func in \
@@ -13253,6 +13254,7 @@ for ac_func in \
 	_pclose \
 	_popen \
 	_snprintf \
+	_spawnvp \
 	_stricmp \
 	_strnicmp \
 	_vsnprintf \
diff --git a/configure.ac b/configure.ac
index b505500d36dd7bd1d2b4dae6fc623783ba88fec0..8eb46ee03e4cdde47bcc4ba6de999c62c4b50697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -946,6 +946,7 @@ AC_CHECK_FUNCS(\
 	_pclose \
 	_popen \
 	_snprintf \
+	_spawnvp \
 	_stricmp \
 	_strnicmp \
 	_vsnprintf \
diff --git a/include/config.h.in b/include/config.h.in
index aae9d7b4db6fdf6db5dacb2c4afbffe7be115549..65062d828adef1bbcde60b065eab855004d73460 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -686,6 +686,9 @@
 /* Define to 1 if you have the `_snprintf' function. */
 #undef HAVE__SNPRINTF
 
+/* Define to 1 if you have the `_spawnvp' function. */
+#undef HAVE__SPAWNVP
+
 /* Define to 1 if you have the `_stricmp' function. */
 #undef HAVE__STRICMP
 
diff --git a/tools/winegcc.c b/tools/winegcc.c
index 0e076799f828834695eb7c5a184891386bbadc93..f51533a62ff77552639de772610f31c55e318ba7 100644
--- a/tools/winegcc.c
+++ b/tools/winegcc.c
@@ -75,6 +75,9 @@ char *strmake(const char *fmt, ...)
 
 void spawn(char *const argv[])
 {
+#ifdef HAVE__SPAWNVP
+    if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
+#else
     int pid, status, wret, i;
 
     if (verbose)
@@ -92,6 +95,8 @@ void spawn(char *const argv[])
         if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
         error("%s failed.", argv[0]);
     }
+#endif  /* HAVE__SPAWNVP */
+
     perror("Error:");
     exit(3);
 }
diff --git a/tools/winewrap.c b/tools/winewrap.c
index 1b6b26e3fc91312c565a721cb98268880ff8032f..c6ff67c2914b565a0425c0e7b17de09096530e1d 100644
--- a/tools/winewrap.c
+++ b/tools/winewrap.c
@@ -296,6 +296,9 @@ void create_file(const char *name, const char *fmt, ...)
 
 void spawn(char *const argv[])
 {
+#ifdef HAVE__SPAWNVP
+    if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
+#else
     int pid, status, wret, i;
 
     if (verbose)
@@ -313,6 +316,8 @@ void spawn(char *const argv[])
         if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
         error("%s failed.", argv[0]);
     }
+#endif  /* HAVE__SPAWNVP */
+
     perror("Error:");
     exit(3);
 }
@@ -675,7 +680,7 @@ int main(int argc, char **argv)
 
     /* create the loader script */
     create_file(base_file, app_loader_script, base_name);
-    chmod(base_file, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+    chmod(base_file, 0755);
 
     return 0;    
 }