From 44d0d1907e6768261d3716981baa8587815b6894 Mon Sep 17 00:00:00 2001
From: Peter Ganten <peter@ganten.org>
Date: Tue, 1 Aug 2000 20:55:22 +0000
Subject: [PATCH] WinExec16 should not split quoted filenames with spaces.

---
 loader/module.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/loader/module.c b/loader/module.c
index 44ceac5c58b..264b7f00771 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -712,13 +712,17 @@ BOOL WINAPI GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType )
  */
 HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
 {
-    LPCSTR p;
+    LPCSTR p = NULL;
     LPSTR name, cmdline;
     int len;
     HINSTANCE16 ret;
     char buffer[MAX_PATH];
 
-    if ((p = strchr( lpCmdLine, ' ' )))
+    if ( ( *lpCmdLine == '"' )  &&  ( p = strchr ( lpCmdLine+1, '"' ) ) )
+      p = strchr ( p, ' ' );
+    else 
+      p = strchr( lpCmdLine, ' ' );
+    if ( p )
     {
         if (!(name = HeapAlloc( GetProcessHeap(), 0, p - lpCmdLine + 1 )))
             return ERROR_NOT_ENOUGH_MEMORY;
-- 
GitLab