Win32OperatingSystem.st
changeset 16279 1addd0eeec26
parent 15983 294a6922be11
child 16285 d8b8eb36dbed
--- a/Win32OperatingSystem.st	Mon Mar 24 23:24:33 2014 +0100
+++ b/Win32OperatingSystem.st	Tue Mar 25 14:56:47 2014 +0100
@@ -7085,18 +7085,18 @@
     spaceForTargetHandle := ExternalLong unprotectedNew.
     hMe := self getCurrentProcess.
     rslt := self
-		primDuplicateHandle_hSourcProcessHandle:hMe
-		hSourceHandle:aHandle
-		hTargetProcesshandle:targetProcessHandle
-		lpTargetHandle:spaceForTargetHandle
-		dwDesiredAccess:0
-		bInheritHandle:false
-		dwOptions:2 "DUPLICATE_SAME_ACCESS".
+                primDuplicateHandle_hSourcProcessHandle:hMe
+                hSourceHandle:aHandle
+                hTargetProcesshandle:targetProcessHandle ? hMe
+                lpTargetHandle:spaceForTargetHandle
+                dwDesiredAccess:0
+                bInheritHandle:false
+                dwOptions:2 "DUPLICATE_SAME_ACCESS".
 
     rslt ifFalse:[
-	spaceForTargetHandle free.
-	self primitiveFailed.
-	^ nil
+        spaceForTargetHandle free.
+        self primitiveFailed:self primGetLastError.
+        ^ nil
     ].
 
     addr := spaceForTargetHandle value.
@@ -7300,6 +7300,17 @@
     "
 !
 
+isValidHandle:anExternalAddress
+    |newHandle|
+
+    newHandle := self duplicateHandle:anExternalAddress to:nil.
+    newHandle isNil ifTrue:[
+        ^ false.
+    ].
+"/    self closeHandle:newHandle.
+    ^ true.
+!
+
 playSound:fileName
     self playSound:fileName mode:1
 
@@ -17499,15 +17510,15 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.490 2014-02-11 20:18:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.491 2014-03-25 13:56:47 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.490 2014-02-11 20:18:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.491 2014-03-25 13:56:47 stefan Exp $'
 !
 
 version_SVN
-    ^ '$Id: Win32OperatingSystem.st,v 1.490 2014-02-11 20:18:49 cg Exp $'
+    ^ '$Id: Win32OperatingSystem.st,v 1.491 2014-03-25 13:56:47 stefan Exp $'
 
 ! !