dlls/shell32 execution of shell link files

Ge van Geldorp gvg at reactos.com
Sun Aug 15 16:23:22 CDT 2004


Changelog:
  Ge van Geldorp <gvg at reactos.com>
  Handle shell link files contained in double quotes

Index: dlls/shell32/shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.52
diff -u -r1.52 shlexec.c
--- dlls/shell32/shlexec.c	15 Jun 2004 18:27:50 -0000	1.52
+++ dlls/shell32/shlexec.c	15 Aug 2004 21:22:20 -0000
@@ -1048,20 +1048,45 @@
     /* resolve shell shortcuts */
     ext = PathFindExtensionW(sei_tmp.lpFile);
 
-    if (ext && !strcmpiW(ext, wExtLnk))	/* or check for: shell_attribs & SFGAO_LINK */
+    if (ext && !strncmpiW(ext, wExtLnk, sizeof(wExtLnk) / sizeof(WCHAR) - 1) &&
+        (ext[sizeof(wExtLnk) / sizeof(WCHAR) - 1] == '\0' ||
+         (sei_tmp.lpFile[0] == '"' && ext[sizeof(wExtLnk) / sizeof(WCHAR) - 1] == '"')))	/* or check for: shell_attribs & SFGAO_LINK */
     {
 	HRESULT hr;
+	BOOL Quoted;
 
+	if (wszApplicationName[0] == '"')
+	{
+	    if (wszApplicationName[strlenW(wszApplicationName) - 1] == '"')
+	    {
+		wszApplicationName[strlenW(wszApplicationName) - 1] = '\0';
+		Quoted = TRUE;
+	    }
+	    else
+	    {
+		Quoted = FALSE;
+	    }
+	}
+	else
+	{
+	    Quoted = FALSE;
+	}
 	/* expand paths before reading shell link */
-	if (ExpandEnvironmentStringsW(sei_tmp.lpFile, buffer, MAX_PATH))
-	    lstrcpyW(wszApplicationName/*sei_tmp.lpFile*/, buffer);
+	if (ExpandEnvironmentStringsW(Quoted ? sei_tmp.lpFile + 1 : sei_tmp.lpFile, buffer, MAX_PATH))
+	    lstrcpyW(Quoted ? wszApplicationName + 1 : wszApplicationName/*sei_tmp.lpFile*/, buffer);
 
 	if (*sei_tmp.lpParameters)
 	    if (ExpandEnvironmentStringsW(sei_tmp.lpParameters, buffer, MAX_PATH))
 		lstrcpyW(wszParameters/*sei_tmp.lpParameters*/, buffer);
 
-	hr = SHELL_ResolveShortCutW((LPWSTR)sei_tmp.lpFile, (LPWSTR)sei_tmp.lpParameters, (LPWSTR)sei_tmp.lpDirectory,
-					    sei_tmp.hwnd, sei_tmp.lpVerb?sei_tmp.lpVerb:wszEmpty, &sei_tmp.nShow, (LPITEMIDLIST*)&sei_tmp.lpIDList);
+	hr = SHELL_ResolveShortCutW((LPWSTR)(Quoted ? sei_tmp.lpFile + 1 : sei_tmp.lpFile),
+	                            (LPWSTR)sei_tmp.lpParameters, (LPWSTR)sei_tmp.lpDirectory,
+				    sei_tmp.hwnd, sei_tmp.lpVerb?sei_tmp.lpVerb:wszEmpty, &sei_tmp.nShow, (LPITEMIDLIST*)&sei_tmp.lpIDList);
+	if (Quoted)
+	{
+	    wszApplicationName[strlenW(wszApplicationName) + 1] = '\0';
+	    wszApplicationName[strlenW(wszApplicationName)] = '"';
+	}
 
 	if (sei->lpIDList)
 	    sei->fMask |= SEE_MASK_IDLIST;



More information about the wine-patches mailing list