Fix #executeCommand:
authorStefan Vogel <sv@exept.de>
Tue, 04 Aug 2009 00:28:49 +0200
changeset 11831 71349fc71208
parent 11830 3ecc9e639f0b
child 11832 e0979391bb94
Fix #executeCommand:
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Mon Aug 03 14:24:41 2009 +0200
+++ b/Win32OperatingSystem.st	Tue Aug 04 00:28:49 2009 +0200
@@ -3199,7 +3199,7 @@
 commandAndArgsForOSCommand:aCommandString
     "get a shell and shell arguments for command execution"
 
-    |shell args wDir cmdName path words hasRedirection|
+    |shell args wDir cmdName path hasRedirection|
 
     "/
     "/ 'x:\WINNT\System32\cmd /c <command>'
@@ -3221,102 +3221,70 @@
     "/ I know: this is a kludge but should work for now...
     "/ ...this will change in an upcoming version to include
     "/ command.com command-line parsing here (sigh).
-    hasRedirection := false.
-    (aCommandString isNil or:[aCommandString includesAny:'<>|']) ifTrue:[
-	hasRedirection := true
-    ].
-
-    self isMSWINDOWSNTlike ifTrue:[
-	hasRedirection ifFalse:[
-	    "/ test whether the commandString is an executable;
-	    "/ then, no shell is required
-	    cmdName := aCommandString withoutSeparators.
-	    (cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
-		|index file suffix|
-
-		index := cmdName indexOfSeparatorStartingAt:1.
-		index ~~ 0 ifTrue:[
-		    cmdName := cmdName copyFrom:1 to:(index -1).
-		].
-
-		file   := cmdName asFilename.
-		suffix := file suffix.
-
-		suffix isEmptyOrNil ifTrue:[
-		    suffix := 'exe'.
-		    file := file withSuffix:suffix.
-		].
-
-		(file exists and:[suffix = 'exe']) ifTrue:[
-		    "/ is an executable, no shell required
-		    ^ Array with:nil with:aCommandString.
-		].
-		(self pathOfCommand:cmdName) notNil ifTrue:[
-		    "/ is an executable, no shell required
-		    ^ Array with:nil with:aCommandString.
-		].
-	    ].
-	].
-	shell := self getEnvironment:'COMSPEC'.
-	shell isNil ifTrue:[
-	    wDir := self getWindowsSystemDirectory asFilename.
-	    shell := (wDir construct:'cmd.exe').
-	    shell exists ifFalse:[
-		shell := (wDir construct:'command.com').
-		shell exists ifFalse:[
-		    self error:'no command.com available'.
-		]
-	    ].
-	    shell := shell pathName.
-	].
-	aCommandString isNil ifTrue:[
-	    ^ Array with:nil with:shell
-	].
-
-	^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
-    ].
-
-    "/ I/O redirection is not yet handled directly
-    "/ fallBack to command.com (below) to do it.
+
+    hasRedirection := (aCommandString isNil or:[aCommandString includesAny:'<>|']).
 
     hasRedirection ifFalse:[
-	words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
-	args := ' '.
-	words from:2 to:(words size) do:[:s |
-	    args := args , (s , ' ').
-	].
-
-	path := self pathOfCommand:(words at:1).
-	path notNil ifTrue:[
-	    "/ execute the command directly -
-	    "/ without going through command.com
-
-	    self isMSWINDOWSNTlike ifTrue:[
-		args := path , args.
-	    ].
-
-	    ^ Array with:path with:args
-	].
-    ].
-
-    "/ I/O redirection or no executable was found
+        "/ test whether the commandString is an executable;
+        "/ then, no shell is required
+        cmdName := aCommandString withoutSeparators.
+        (cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
+            |index file suffix|
+
+            index := cmdName indexOfSeparatorStartingAt:1.
+            index ~~ 0 ifTrue:[
+                args := cmdName copyFrom:(index+1).
+                cmdName := cmdName copyFrom:1 to:(index-1).
+            ] ifFalse:[
+                args := ''.
+            ].
+
+            file   := cmdName asFilename.
+            suffix := file suffix.
+
+            suffix isEmptyOrNil ifTrue:[
+                suffix := 'exe'.
+                file := file withSuffix:suffix.
+            ].
+
+            (file exists and:[suffix = 'exe' or:[suffix = 'com']]) ifTrue:[
+                "/ is an executable, no shell required
+                path := file fullAlternativePathName.
+                ^ Array with:path with:aCommandString.
+"/                ^ Array with:path with:(path, ' ', args).
+            ].
+            path := self pathOfCommand:cmdName.
+            path notNil ifTrue:[
+                "/ is an executable, no shell required
+                ^ Array with:path with:aCommandString.
+"/                ^ Array with:path with:(path, ' ', args).
+            ].
+        ].
+    ].
 
     shell := self getEnvironment:'COMSPEC'.
     shell isNil ifTrue:[
-	wDir := self getWindowsSystemDirectory asFilename.
-	shell := (wDir construct:'cmd.exe').
-	shell exists ifFalse:[
-	    shell := (wDir construct:'command.com').
-	    shell exists ifFalse:[
-		self error:'no command.com available'.
-	    ]
-	].
-	shell := shell pathName.
+        wDir := self getWindowsSystemDirectory asFilename.
+        shell := (wDir construct:'cmd.exe').
+        shell isExecutable ifFalse:[
+            shell := (wDir construct:'command.com').
+            shell isExecutable ifFalse:[
+                self error:'no command.com available'.
+            ]
+        ].
+        shell := shell pathName.
     ].
     aCommandString isNil ifTrue:[
-	^ Array with:shell with:shell
-    ].
-    ^ Array with:shell with:(shell , ' /c ' , aCommandString)
+        ^ Array with:shell with:nil
+    ].
+
+    ^ Array with:shell with:('/c "' , aCommandString , '"' )
+
+   "
+     self commandAndArgsForOSCommand:'diff'
+     self commandAndArgsForOSCommand:'dir/w'
+     self executeCommand:'dir >nul:'
+   "
 
     "Modified: / 20-01-1998 / 16:57:19 / md"
     "Modified: / 11-02-2007 / 20:51:08 / cg"
@@ -3326,56 +3294,48 @@
     "Internal lowLevel entry for combined fork & exec for WIN32
 
      If fork is false (chain a command):
-	 execute the OS command specified by the argument, aCommandPath, with
-	 arguments in argArray (no arguments, if nil).
-	 If successful, this method does not return and smalltalk is gone.
-	 If not successful, it does return.
-	 Normal use is with forkForCommand.
+         execute the OS command specified by the argument, aCommandPath, with
+         arguments in argArray (no arguments, if nil).
+         If successful, this method does not return and smalltalk is gone.
+         If not successful, it does return.
+         Normal use is with forkForCommand.
 
      If fork is true (subprocess command execution):
-	fork a child to do the above.
-	The process id of the child process is returned; nil if the fork failed.
+        fork a child to do the above.
+        The process id of the child process is returned; nil if the fork failed.
 
      fdArray contains the filedescriptors, to be used for the child (if fork is true).
-	fdArray[1] = 15 -> use fd 15 as stdin.
-	If an element of the array is set to nil, the corresponding filedescriptor
-	will be closed for the child.
-	fdArray[0] == StdIn for child
-	fdArray[1] == StdOut for child
-	fdArray[2] == StdErr for child
-	on VMS, these must be channels as returned by createMailBox.
+        fdArray[1] = 15 -> use fd 15 as stdin.
+        If an element of the array is set to nil, the corresponding filedescriptor
+        will be closed for the child.
+        fdArray[0] == StdIn for child
+        fdArray[1] == StdOut for child
+        fdArray[2] == StdErr for child
+        on VMS, these must be channels as returned by createMailBox.
 
      NOTE that in WIN32 the fds are HANDLES.
 
      If newPgrp is true, the subprocess will be established in a new process group.
-	The processgroup will be equal to id.
-	newPgrp is not used on WIN32 and VMS systems."
-
-    |dirPath cmdPath cmdLine rslt|
+        The processgroup will be equal to id.
+        newPgrp is not used on WIN32 and VMS systems."
+
+    |dirPath rslt|
 
     aDirectory notNil ifTrue:[
-	dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
-	(dirPath endsWith:':') ifTrue:[
-	    dirPath := dirPath , '\'.
-	].
-    ].
-
-    self isMSWINDOWSNTlike ifTrue:[
-	cmdPath := aCommandPath.
-	cmdLine := argString
-    ] ifFalse:[
-	cmdPath := 'stxspawn.exe'.
-	cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString
+        dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
+        (dirPath endsWith:':') ifTrue:[
+            dirPath := dirPath , '\'.
+        ].
     ].
 
     rslt := self
-	primExec:cmdPath
-	commandLine:cmdLine
-	fileDescriptors:fdArray
-	fork:doFork
-	newPgrp:newPgrp
-	inPath:dirPath
-	createFlags:nil.
+        primExec:aCommandPath
+        commandLine:argString
+        fileDescriptors:fdArray
+        fork:doFork
+        newPgrp:newPgrp
+        inPath:dirPath
+        createFlags:nil.
 
 "/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
     ^ rslt
@@ -3577,15 +3537,8 @@
      * otherwise, spawn a subprocess and let it execute the command.
      * Currently, only the forking version is supported (who chains anyway ?)
      */
-#if 0
-    char fullCmdPathBuffer[1024];
-    char fullCmdLine[1024];
-    char fullDirName[1024];
-    char *fullCmdPath = fullCmdPathBuffer;
-#else
     char *cmdPath = 0;
     char *cmdLine = 0;
-#endif
     char *dir = 0;
     DWORD               fdwCreate = 0;
     STARTUPINFO         lpsiStartInfo;
@@ -3593,182 +3546,137 @@
     SECURITY_ATTRIBUTES sa;
     SECURITY_DESCRIPTOR sd;
 
-    if (__isString(dirName)) {
-	dir = __stringVal(dirName);
-    }
-    if ((__isString(commandPath) || (commandPath == nil))
-     && __isString(commandLine)) {
-#if 0
-	/*
-	 * generate command line (cmd plus args)
-	 */
-	if (__isWinNT) {
-	    char *d;
-
-	    strcpy(fullCmdPath, __stringVal(aCommandPath));
-	    d = strchr(fullCmdPath,' ');
-	    if (d) {
-		*d++ = 0;
-		strcpy(fullCmdLine, d);
-	    } else {
-		fullCmdLine[0] = '\0';
-	    }
-	} else {
-	    //fullCmdPath = 0;
-	    strcpy(fullCmdPath,"stxspawn.exe");
-	    strcpy(fullCmdLine,"stxspawn.exe ");
-	    strcat(fullCmdLine, __stringVal(aCommandPath));
-	}
-
-	if (__isString(argArray)) {
-	    if (strlen(fullCmdLine) > 0) {
-		strcat(fullCmdLine, " ");
-	    }
-	    strcat(fullCmdLine, __stringVal(argArray));
-	} else {
-	    int i;
-
-	    for (i=0; i<__arraySize(argArray); i++) {
-		OBJ arg = __ArrayInstPtr(argArray)->a_element[i];
-
-		if (__isString(arg)) {
-		    strcat(fullCmdLine, " ");
-		    strcat(fullCmdLine, __stringVal(arg));
-		} else {
-		    /* ignore */
-		    console_fprintf(stderr, "bad (non-string) arg\n");
-		}
-	    }
-	}
-#endif
-	if (commandPath != nil) {
-	    cmdPath = __stringVal(commandPath);
-	}
-	cmdLine = __stringVal(commandLine);
-
-	/*
-	 * create descriptors as req'd
-	 */
-	memset(&sa, 0, sizeof (sa));
-	sa.nLength = sizeof( sa );
-	sa.lpSecurityDescriptor = NULL;
-	sa.bInheritHandle = TRUE;
-	if (__isWinNT) {
-	    InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
-	    SetSecurityDescriptorDacl(&sd, -1, 0, 0);
-
-	    sa.lpSecurityDescriptor = &sd;
-	}
-	memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
-
-	memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
-	lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
-	lpsiStartInfo.lpReserved        = NULL;
-	lpsiStartInfo.lpDesktop         = NULL;
-	lpsiStartInfo.lpTitle           = NULL;
-	lpsiStartInfo.dwX               = 0;
-	lpsiStartInfo.dwY               = 0;
-	lpsiStartInfo.dwXSize           = 100;
-	lpsiStartInfo.dwYSize           = 100;
-	lpsiStartInfo.dwXCountChars     = 0;
-	lpsiStartInfo.dwYCountChars     = 0;
-	lpsiStartInfo.dwFillAttribute   = 0;
-	if (0 /*__isWinNT*/) {
-	    lpsiStartInfo.dwFlags           = STARTF_USESTDHANDLES;
-	    lpsiStartInfo.wShowWindow       = SW_SHOWDEFAULT;
-	} else {
-	    lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
-	    lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
-	}
-	lpsiStartInfo.cbReserved2       = 0;
-	lpsiStartInfo.lpReserved2       = NULL;
-	lpsiStartInfo.hStdInput         = NULL;
-	lpsiStartInfo.hStdOutput        = NULL;
-	lpsiStartInfo.hStdError         = NULL;
-
-	/*
-	 * set create process flags
-	 * if the flags arg is nil, use common defaults;
-	 * if non-nil, it must be a positive integer containing the fdwCreate bits.
-	 */
-	if (flagsOrNil != nil) {
-	    fdwCreate = __longIntVal(flagsOrNil);
-	} else {
-	    if (0 /* __isWinNT */)
-		fdwCreate = 0; //IDLE_PRIORITY_CLASS;
-	    else
-		fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
-
-	    if (newPgrp == true) {
-		fdwCreate |= CREATE_NEW_PROCESS_GROUP;
-	    }
-	    fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
-	}
-
-	if (fdArray == nil) {
-	    lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
-	    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
-	    lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
-	} else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
-	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
-		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
-		    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
-		} else {
-		    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
-		}
-	    }
-	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
-		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
-		    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
-		} else {
-		    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
-		}
-	    }
-	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
-		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
-		    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
-		} else {
-		    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
-		}
-	    }
+    if ((__isString(commandPath) || (commandPath == nil)) && __isString(commandLine)) {
+        if (commandPath != nil) {
+            cmdPath = __stringVal(commandPath);
+        }
+        cmdLine = __stringVal(commandLine);
+
+        if (__isString(dirName)) {
+            dir = __stringVal(dirName);
+        }
+
+        /*
+         * create descriptors as req'd
+         */
+        memset(&sa, 0, sizeof (sa));
+        sa.nLength = sizeof( sa );
+        sa.lpSecurityDescriptor = NULL;
+        sa.bInheritHandle = TRUE;
+        InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
+        SetSecurityDescriptorDacl(&sd, -1, 0, 0);
+
+        sa.lpSecurityDescriptor = &sd;
+        memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
+
+        memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
+        lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
+        lpsiStartInfo.lpReserved        = NULL;
+        lpsiStartInfo.lpDesktop         = NULL;
+        lpsiStartInfo.lpTitle           = NULL;
+        lpsiStartInfo.dwX               = 0;
+        lpsiStartInfo.dwY               = 0;
+        lpsiStartInfo.dwXSize           = 100;
+        lpsiStartInfo.dwYSize           = 100;
+        lpsiStartInfo.dwXCountChars     = 0;
+        lpsiStartInfo.dwYCountChars     = 0;
+        lpsiStartInfo.dwFillAttribute   = 0;
+        if (0 /*__isWinNT*/) {
+            lpsiStartInfo.dwFlags           = STARTF_USESTDHANDLES;
+            lpsiStartInfo.wShowWindow       = SW_SHOWDEFAULT;
+        } else {
+            lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
+            lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
+        }
+        lpsiStartInfo.cbReserved2       = 0;
+        lpsiStartInfo.lpReserved2       = NULL;
+        lpsiStartInfo.hStdInput         = NULL;
+        lpsiStartInfo.hStdOutput        = NULL;
+        lpsiStartInfo.hStdError         = NULL;
+
+        /*
+         * set create process flags
+         * if the flags arg is nil, use common defaults;
+         * if non-nil, it must be a positive integer containing the fdwCreate bits.
+         */
+        if (flagsOrNil != nil) {
+            fdwCreate = __longIntVal(flagsOrNil);
+        } else {
+            if (0 /* __isWinNT */)
+                fdwCreate = 0; //IDLE_PRIORITY_CLASS;
+            else
+                fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
+
+            if (newPgrp == true) {
+                fdwCreate |= CREATE_NEW_PROCESS_GROUP;
+            }
+            fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
+        }
+
+        if (fdArray == nil) {
+            lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
+            lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
+            lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
+        } else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
+            if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
+                if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
+                    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
+                } else {
+                    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
+                }
+            }
+            if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
+                if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
+                    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
+                } else {
+                    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
+                }
+            }
+            if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
+                if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
+                    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
+                } else {
+                    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
+                }
+            }
 #ifdef PROCESSDEBUGWIN32
-	    console_fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
-	    console_fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
-	    console_fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
-#endif
-	} else {
-	    console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
-	}
-
-	if (doFork == true) {
+            console_fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
+            console_fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
+            console_fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
+#endif
+        } else {
+            console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
+        }
+
+        if (doFork == true) {
 #ifdef PROCESSDEBUGWIN32
-	    console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
-#endif
-	    if (CreateProcess(  cmdPath,
-				cmdLine,
-				&sa, NULL /* &sa */,           /* sec-attribs */
-				sa.bInheritHandle,  /* inherit handles */
-				fdwCreate,
-				NULL,               /* env */
-				dir,
-				&lpsiStartInfo,
-				&lppiProcInfo ))
-	    {
-		CloseHandle(lppiProcInfo.hThread);
+            console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
+#endif
+            if (CreateProcess(  cmdPath,
+                                cmdLine,
+                                &sa, NULL /* &sa */,           /* sec-attribs */
+                                sa.bInheritHandle,  /* inherit handles */
+                                fdwCreate,
+                                NULL,               /* env */
+                                dir,
+                                &lpsiStartInfo,
+                                &lppiProcInfo ))
+            {
+                CloseHandle(lppiProcInfo.hThread);
 #ifdef PROCESSDEBUGWIN32
-		console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
-#endif
-		__externalAddressVal(handle) = lppiProcInfo.hProcess;
-		((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
-		RETURN (handle);
-	    }
+                console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
+#endif
+                __externalAddressVal(handle) = lppiProcInfo.hProcess;
+                ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
+                RETURN (handle);
+            }
 #ifdef PROCESSDEBUGWIN32
-	    console_fprintf(stderr, "created process error %d\n", GetLastError());
-#endif
-	    RETURN (nil);
-	} else {
-	    ; /* should never be called that way */
-	}
+            console_fprintf(stderr, "created process error %d\n", GetLastError());
+#endif
+            RETURN (nil);
+        } else {
+            ; /* should never be called that way */
+        }
     }
 %}.
     "
@@ -11144,7 +11052,7 @@
 
     "/ access lazily...
     alternativePathName isNil ifTrue:[
-        alternativePathName := OperatingSystem getShortPathName:sourcePath.
+        alternativePathName := (OperatingSystem getShortPathName:sourcePath) asSingleByteString.
     ].
 
     ^ alternativePathName
@@ -11196,7 +11104,7 @@
 
     "/ access lazily...
     fullPathName isNil ifTrue:[
-        fullPathName := OperatingSystem getLongPathName:sourcePath.
+        fullPathName := (OperatingSystem getLongPathName:sourcePath) asSingleByteStringIfPossible.
     ].
 
     ^ fullPathName
@@ -16235,7 +16143,7 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.373 2009-07-28 10:32:54 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.374 2009-08-03 22:28:49 stefan Exp $'
 ! !
 
 Win32OperatingSystem initialize!