Hans Leidekker : msvcrt: Implement _wspawnl{, e, p, pe}.

Alexandre Julliard julliard at winehq.org
Tue Jan 8 10:21:45 CST 2008


Module: wine
Branch: master
Commit: 054132f931748cd4732a625678746c9facb10c98
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=054132f931748cd4732a625678746c9facb10c98

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Mon Jan  7 14:23:32 2008 +0100

msvcrt: Implement _wspawnl{, e, p, pe}.

---

 dlls/msvcrt/msvcrt.spec |    8 ++--
 dlls/msvcrt/process.c   |  105 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index cff8ecd..c4113aa 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -556,10 +556,10 @@
 @ cdecl _wsearchenv(wstr wstr ptr)
 @ cdecl _wsetlocale(long wstr) MSVCRT__wsetlocale
 @ varargs _wsopen (wstr long long) MSVCRT__wsopen
-@ stub _wspawnl #(long wstr wstr) varargs
-@ stub _wspawnle #(long wstr wstr) varargs
-@ stub _wspawnlp #(long wstr wstr) varargs
-@ stub _wspawnlpe #(long wstr wstr) varargs
+@ varargs _wspawnl(long wstr wstr)
+@ varargs _wspawnle(long wstr wstr)
+@ varargs _wspawnlp(long wstr wstr)
+@ varargs _wspawnlpe(long wstr wstr)
 @ cdecl _wspawnv(long wstr ptr)
 @ cdecl _wspawnve(long wstr ptr ptr)
 @ cdecl _wspawnvp(long wstr ptr)
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index fa8f52a..d764eaf 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -590,6 +590,27 @@ MSVCRT_intptr_t CDECL _execvp(const char* name, char* const* argv)
 }
 
 /*********************************************************************
+ *      _wspawnl (MSVCRT.@)
+ *
+ * Unicode version of _spawnl
+ */
+MSVCRT_intptr_t CDECL _wspawnl(int flags, const MSVCRT_wchar_t* name, const MSVCRT_wchar_t* arg0, ...)
+{
+  va_list ap;
+  MSVCRT_wchar_t *args;
+  MSVCRT_intptr_t ret;
+
+  va_start(ap, arg0);
+  args = msvcrt_valisttos(arg0, ap, ' ');
+  va_end(ap);
+
+  ret = msvcrt_spawn(flags, name, args, NULL);
+
+  MSVCRT_free(args);
+  return ret;
+}
+
+/*********************************************************************
  *		_spawnl (MSVCRT.@)
  *
  * Like on Windows, this function does not handle arguments with spaces
@@ -615,6 +636,35 @@ MSVCRT_intptr_t CDECL _spawnl(int flags, const char* name, const char* arg0, ...
 }
 
 /*********************************************************************
+ *      _wspawnle (MSVCRT.@)
+ *
+ * Unicode version of _spawnle
+ */
+MSVCRT_intptr_t CDECL _wspawnle(int flags, const MSVCRT_wchar_t* name, const MSVCRT_wchar_t* arg0, ...)
+{
+  va_list ap;
+  MSVCRT_wchar_t *args, *envs = NULL;
+  const MSVCRT_wchar_t * const *envp;
+  MSVCRT_intptr_t ret;
+
+  va_start(ap, arg0);
+  args = msvcrt_valisttos(arg0, ap, ' ');
+  va_end(ap);
+
+  va_start(ap, arg0);
+  while (va_arg( ap, MSVCRT_wchar_t * ) != NULL) /*nothing*/;
+  envp = va_arg( ap, const MSVCRT_wchar_t * const * );
+  if (envp) envs = msvcrt_argvtos(envp, 0);
+  va_end(ap);
+
+  ret = msvcrt_spawn(flags, name, args, envs);
+
+  MSVCRT_free(args);
+  MSVCRT_free(envs);
+  return ret;
+}
+
+/*********************************************************************
  *		_spawnle (MSVCRT.@)
  */
 MSVCRT_intptr_t CDECL _spawnle(int flags, const char* name, const char* arg0, ...)
@@ -644,6 +694,29 @@ MSVCRT_intptr_t CDECL _spawnle(int flags, const char* name, const char* arg0, ..
   return ret;
 }
 
+/*********************************************************************
+ *      _wspawnlp (MSVCRT.@)
+ *
+ * Unicode version of _spawnlp
+ */
+MSVCRT_intptr_t CDECL _wspawnlp(int flags, const MSVCRT_wchar_t* name, const MSVCRT_wchar_t* arg0, ...)
+{
+  static const MSVCRT_wchar_t path[] = {'P','A','T','H',0};
+  va_list ap;
+  MSVCRT_wchar_t *args, fullname[MAX_PATH];
+  MSVCRT_intptr_t ret;
+
+  _wsearchenv(name, path, fullname);
+
+  va_start(ap, arg0);
+  args = msvcrt_valisttos(arg0, ap, ' ');
+  va_end(ap);
+
+  ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, NULL);
+
+  MSVCRT_free(args);
+  return ret;
+}
 
 /*********************************************************************
  *		_spawnlp (MSVCRT.@)
@@ -673,6 +746,38 @@ MSVCRT_intptr_t CDECL _spawnlp(int flags, const char* name, const char* arg0, ..
 }
 
 /*********************************************************************
+ *      _wspawnlpe (MSVCRT.@)
+ *
+ * Unicode version of _spawnlpe
+ */
+MSVCRT_intptr_t CDECL _wspawnlpe(int flags, const MSVCRT_wchar_t* name, const MSVCRT_wchar_t* arg0, ...)
+{
+  static const MSVCRT_wchar_t path[] = {'P','A','T','H',0};
+  va_list ap;
+  MSVCRT_wchar_t *args, *envs = NULL, fullname[MAX_PATH];
+  const MSVCRT_wchar_t * const *envp;
+  MSVCRT_intptr_t ret;
+
+  _wsearchenv(name, path, fullname);
+
+  va_start(ap, arg0);
+  args = msvcrt_valisttos(arg0, ap, ' ');
+  va_end(ap);
+
+  va_start(ap, arg0);
+  while (va_arg( ap, MSVCRT_wchar_t * ) != NULL) /*nothing*/;
+  envp = va_arg( ap, const MSVCRT_wchar_t * const * );
+  if (envp) envs = msvcrt_argvtos(envp, 0);
+  va_end(ap);
+
+  ret = msvcrt_spawn(flags, fullname[0] ? fullname : name, args, envs);
+
+  MSVCRT_free(args);
+  MSVCRT_free(envs);
+  return ret;
+}
+
+/*********************************************************************
  *		_spawnlpe (MSVCRT.@)
  */
 MSVCRT_intptr_t CDECL _spawnlpe(int flags, const char* name, const char* arg0, ...)




More information about the wine-cvs mailing list