[PATCH 1/3] cmd.exe: Fix running programs from root of drive

Jason Edmeades jason.edmeades at googlemail.com
Mon Mar 3 17:14:28 CST 2008


Supports c:\a.bat and c:\windows\a.bat by leaving the path with the
trailing '\'. When it was removed, the search path for c:\a.bat was
effectively the work directory on 'C:' and it fails to locate the program

Should fix bug 11724
---
 programs/cmd/wcmdmain.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 2966bcc..d73e9a0 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -962,8 +962,11 @@ void WCMD_run_program (WCHAR *command, int called) {
     GetFullPathName(param1, sizeof(pathtosearch)/sizeof(WCHAR), pathtosearch, NULL);
     lastSlash = strrchrW(pathtosearch, '\\');
     if (lastSlash && strchrW(lastSlash, '.') != NULL) extensionsupplied = TRUE;
-    if (lastSlash) *lastSlash = 0x00;
     strcpyW(stemofsearch, lastSlash+1);
+
+    /* Reduce pathtosearch to a path with trailing '\' to support c:\a.bat and 
+       c:\windows\a.bat syntax                                                 */
+    if (lastSlash) *(lastSlash + 1) = 0x00; 
   }
 
   /* Now extract PATHEXT */
-- 
1.5.3.2




More information about the wine-patches mailing list