#BUGFIX by Maren
authormatilk
Tue, 15 Nov 2016 16:52:33 +0100
changeset 20968 d67d3d5eec60
parent 20967 ba69e999a1d6
child 20969 c6f6a1630c1c
#BUGFIX by Maren class: Win32OperatingSystem changed: #isProcessIdPresent: return false instead of an error for processHandle == 0
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Tue Nov 15 16:43:29 2016 +0100
+++ b/Win32OperatingSystem.st	Tue Nov 15 16:52:33 2016 +0100
@@ -9349,44 +9349,45 @@
     DWORD exitCode;
 
     if (__isExternalAddressLike(processHandleOrPid) ) {
-	processHandle = _HANDLEVal(processHandleOrPid);
-	if (processHandle == 0) {
-	    error = @symbol(invalidParameter);
-	    goto out;
-	}
+        processHandle = _HANDLEVal(processHandleOrPid);
+        if (processHandle == 0) {
+            RETURN(false);
+            // error = @symbol(invalidParameter);
+            // goto out;
+        }
     } else if( __isSmallInteger(processHandleOrPid) ) {
-	// assume, that synchronize needs less privilege...
-	processHandle = processHandleToClose = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
-	if (!processHandle) {
-	    goto checkError;
-	}
+        // assume, that synchronize needs less privilege...
+        processHandle = processHandleToClose = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
+        if (!processHandle) {
+            goto checkError;
+        }
     } else {
-	error = @symbol(invalidParameter);
-	goto out;
+        error = @symbol(invalidParameter);
+        goto out;
     }
 
     /* check if the handle still refers to a running process */
     if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
-	if (processHandleToClose)
-	    CloseHandle(processHandleToClose);
-	if (exitCode == STILL_ACTIVE) {
-	    RETURN(true);
-	} else {
-	    RETURN(false);
-	}
-    } else if (processHandleToClose) {
-	CloseHandle(processHandleToClose);
+        if (processHandleToClose != 0)
+            CloseHandle(processHandleToClose);
+        if (exitCode == STILL_ACTIVE) {
+            RETURN(true);
+        } else {
+            RETURN(false);
+        }
+    } else if (processHandleToClose != 0) {
+        CloseHandle(processHandleToClose);
     }
 
 checkError:
     err = GetLastError();
     // we do not have access to the process (so pid does exist ;-))
     if (err == ERROR_ACCESS_DENIED) {
-	RETURN(true);
+        RETURN(true);
     }
     // pid does not exist
     if (err == ERROR_INVALID_PARAMETER) {
-	RETURN(false);
+        RETURN(false);
     }
 
     // any other error - raise signal