Only use the Folder class handler if we're actually executing a folder.
authorGé van Geldorp <ge@gse.nl>
Wed, 4 Jan 2006 23:28:10 +0000 (23:28 +0000)
committerGé van Geldorp <ge@gse.nl>
Wed, 4 Jan 2006 23:28:10 +0000 (23:28 +0000)
Fixes bug 1235.

svn path=/trunk/; revision=20564

reactos/lib/shell32/shlexec.c

index 350ad7d..2a9b12a 100644 (file)
@@ -1200,7 +1200,9 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
     UINT_PTR retval = 31;
     WCHAR wcmd[1024];
     WCHAR buffer[MAX_PATH];
     UINT_PTR retval = 31;
     WCHAR wcmd[1024];
     WCHAR buffer[MAX_PATH];
+    WCHAR target[MAX_PATH];
     BOOL done;
     BOOL done;
+    DWORD attribs;
 
     /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
     memcpy(&sei_tmp, sei, sizeof(sei_tmp));
 
     /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
     memcpy(&sei_tmp, sei, sizeof(sei_tmp));
@@ -1315,9 +1317,20 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
                strcpyW(wszApplicationName, wExplorer);
 
                sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
                strcpyW(wszApplicationName, wExplorer);
 
                sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
-           } else if (HCR_GetExecuteCommandW(0, wszFolder, sei_tmp.lpVerb?sei_tmp.lpVerb:wszOpen, buffer, sizeof(buffer))) {
-               SHELL_ArgifyW(wszApplicationName, sizeof(wszApplicationName)/sizeof(WCHAR), buffer, NULL, sei_tmp.lpIDList, NULL);
-
+           } else {
+               /* Check if we're executing a directory and if so use the
+                  handler for the Folder class */
+               strcpyW(target, buffer);
+               attribs = GetFileAttributesW(buffer);
+               if (attribs != INVALID_FILE_ATTRIBUTES &&
+                   0 != (attribs & FILE_ATTRIBUTE_DIRECTORY) &&
+                   HCR_GetExecuteCommandW(0, wszFolder,
+                                          sei_tmp.lpVerb?sei_tmp.lpVerb:wszOpen,
+                                          buffer, sizeof(buffer))) {
+                   SHELL_ArgifyW(wszApplicationName,
+                                 sizeof(wszApplicationName)/sizeof(WCHAR),
+                                 buffer, target, sei_tmp.lpIDList, NULL);
+               }
                sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
            }
        }
                sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
            }
        }