Damjan Jovanovic : shell32: Deal better with spaces in ASSOCSTR_COMMAND values.

Alexandre Julliard julliard at winehq.org
Tue Nov 24 12:40:22 CST 2009


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

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Mon Nov 23 21:43:42 2009 +0200

shell32: Deal better with spaces in ASSOCSTR_COMMAND values.

---

 dlls/shell32/assoc.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index bf9ccb9..85efa07 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -320,16 +320,25 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
   {
     pszStart = pszCommand + 1;
     pszEnd = strchrW(pszStart, '"');
+    if (pszEnd)
+      *pszEnd = 0;
+    *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
   }
   else
   {
     pszStart = pszCommand;
-    pszEnd = strchrW(pszStart, ' ');
+    for (pszEnd = pszStart; (pszEnd = strchrW(pszEnd, ' ')); pszEnd++)
+    {
+      WCHAR c = *pszEnd;
+      *pszEnd = 0;
+      if ((*len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL)))
+        break;
+      *pszEnd = c;
+    }
+    if (!pszEnd)
+      *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
   }
-  if (pszEnd)
-    *pszEnd = 0;
 
-  *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
   HeapFree(GetProcessHeap(), 0, pszCommand);
   if (!*len)
     return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);




More information about the wine-cvs mailing list