Fix null sessions in HttpContextWrapper.Session
[mono.git] / mcs / class / corlib / Microsoft.Win32.SafeHandles / SafeFileHandle.cs
index 5457ba1ca34b1ce10feceeef42339a786d2e2511..3f6da357e2fce359878175dffe2d29c2e49d7843 100644 (file)
@@ -1,10 +1,11 @@
 //
 // Microsoft.Win32.SafeHandles.SafeFileHandle
 //
-// Author
+// Authors:
 //     Sebastien Pouliot  <sebastien@ximian.com>
+//      Miguel de Icaza    <miguel@novell.com>
 //
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005, 2006 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System;
+using System.IO;
 
 namespace Microsoft.Win32.SafeHandles {
 
-       [MonoTODO]
        public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid {
-
                public SafeFileHandle (IntPtr preexistingHandle, bool ownsHandle) : base (ownsHandle)
                {
                        SetHandle (preexistingHandle);
                }
 
-               [MonoTODO]
-               public override bool IsInvalid {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               // This is just for marshalling
+               internal SafeFileHandle () : base (true)
+               {
                }
 
-               [MonoTODO]
                protected override bool ReleaseHandle ()
                {
-                       throw new NotImplementedException ();
+                       MonoIOError error;
+                       
+                       MonoIO.Close (handle, out error);
+
+                       return error == MonoIOError.ERROR_SUCCESS;
                }
 
        }
 }
 
-#endif