Author: tfaber
Date: Sat Nov  9 14:31:08 2013
New Revision: 60895

URL: http://svn.reactos.org/svn/reactos?rev=60895&view=rev
Log:
[SHELL32]
- Quote paths containing spaces when executing shell commands. Patch by Huw 
Campbell.
CORE-7542 #resolve

Modified:
    trunk/reactos/dll/win32/shell32/openwithmenu.cpp

Modified: trunk/reactos/dll/win32/shell32/openwithmenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/openwithmenu.cpp?rev=60895&r1=60894&r2=60895&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/openwithmenu.cpp    [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/openwithmenu.cpp    [iso-8859-1] Sat Nov  9 
14:31:08 2013
@@ -238,7 +238,12 @@
             --cchRemaining;
         }
         else if (pApp->wszCmd[++i] == '1')
-            StringCchCopyExW(pszEnd, cchRemaining, pwszFilePath, &pszEnd, 
&cchRemaining, 0);
+        {
+            if (StrChrW(pwszFilePath, L' ') && cchRemaining > 3)
+                StringCchPrintfExW(pszEnd, cchRemaining, &pszEnd, 
&cchRemaining, 0, L"\"%ls\"", pwszFilePath);
+            else
+                StringCchCopyExW(pszEnd, cchRemaining, pwszFilePath, &pszEnd, 
&cchRemaining, 0);
+        }
     }
     /* NULL-terminate the command string */
     if (cchRemaining > 0)
@@ -1182,7 +1187,7 @@
         /* Load applications list */
         m_pAppList->Load();
         m_pAppList->LoadRecommended(m_wszPath);
-        
+
         /* Create submenu only if there is more than one application and menu 
has a default item */
         if (m_pAppList->GetRecommendedCount() > 1)
         {


Reply via email to