diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-02-10 20:35:12 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-02-10 20:35:12 +0900 |
commit | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch) | |
tree | b48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/Microsoft/Win32/SafeHandles | |
parent | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff) | |
download | coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2 coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip |
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/Microsoft/Win32/SafeHandles')
8 files changed, 1 insertions, 126 deletions
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs deleted file mode 100644 index cb915fe7c3..0000000000 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** -** -** A wrapper for file handles -** -** -===========================================================*/ -using System; -using System.Security; -using System.Security.Permissions; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.ConstrainedExecution; -using System.Runtime.Versioning; - -namespace Microsoft.Win32.SafeHandles -{ - internal sealed class SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid - { - internal SafeFileMappingHandle() : base(true) {} - - // 0 is an Invalid Handle - internal SafeFileMappingHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) - { - SetHandle(handle); - } - - override protected bool ReleaseHandle() - { - return Win32Native.CloseHandle(handle); - } - } -} - diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs index 219fb77001..89ea22b855 100644 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs +++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs @@ -13,7 +13,6 @@ using System; using System.Security; -using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs index 23631987a5..603558c51a 100644 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs +++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs @@ -4,7 +4,6 @@ namespace Microsoft.Win32 { using Microsoft.Win32.SafeHandles; - using System.Security.Permissions; sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeLibraryHandle() : base(true) {} diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs deleted file mode 100644 index d6c1577eeb..0000000000 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Win32.SafeHandles -{ - using System; - using System.Runtime.CompilerServices; - using System.Runtime.InteropServices; - using System.Runtime.ConstrainedExecution; - - internal sealed class SafeLocalAllocHandle : SafeBuffer { - private SafeLocalAllocHandle () : base(true) {} - - // 0 is an Invalid Handle - internal SafeLocalAllocHandle (IntPtr handle) : base (true) { - SetHandle(handle); - } - - internal static SafeLocalAllocHandle InvalidHandle { - get { return new SafeLocalAllocHandle(IntPtr.Zero); } - } - - override protected bool ReleaseHandle() - { - return Win32Native.LocalFree(handle) == IntPtr.Zero; - } - } -} diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs index 4f96b81e72..a1e5bc4263 100644 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs +++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs @@ -11,13 +11,12 @@ namespace Microsoft.Win32.SafeHandles { using System; using System.Security; - using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; - public sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid { + internal sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid { internal SafeRegistryHandle() : base(true) {} public SafeRegistryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) { @@ -30,7 +29,6 @@ namespace Microsoft.Win32.SafeHandles { [DllImport(Win32Native.ADVAPI32)] [SuppressUnmanagedCodeSecurity] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static extern int RegCloseKey(IntPtr hKey); } } diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs deleted file mode 100644 index 38a9323c0b..0000000000 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** -** -** A wrapper for file handles -** -** -===========================================================*/ -using System; -using System.Security; -using System.Security.Permissions; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.ConstrainedExecution; -using System.Runtime.Versioning; -using Microsoft.Win32; -using Microsoft.Win32.SafeHandles; - -namespace Microsoft.Win32.SafeHandles -{ - internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid - { - internal SafeViewOfFileHandle() : base(true) {} - - // 0 is an Invalid Handle - internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { - SetHandle(handle); - } - - override protected bool ReleaseHandle() - { - if (Win32Native.UnmapViewOfFile(handle)) - { - handle = IntPtr.Zero; - return true; - } - - return false; - } - } -} - diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs index 0e57136952..0ebcd5c09e 100644 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs +++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs @@ -14,7 +14,6 @@ using System; using System.Security; -using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; @@ -31,7 +30,6 @@ namespace Microsoft.Win32.SafeHandles { { } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public SafeWaitHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(existingHandle); diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs index 08ae0955a8..62418131f3 100644 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs +++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs @@ -18,13 +18,11 @@ namespace Microsoft.Win32.SafeHandles using System; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; - using System.Security.Permissions; using System.Runtime.ConstrainedExecution; // Class of safe handle which uses 0 or -1 as an invalid handle. public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle) { } @@ -43,7 +41,6 @@ namespace Microsoft.Win32.SafeHandles // Class of safe handle which uses only -1 as an invalid handle. public abstract class SafeHandleMinusOneIsInvalid : SafeHandle { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle) { } @@ -62,7 +59,6 @@ namespace Microsoft.Win32.SafeHandles // Class of critical handle which uses 0 or -1 as an invalid handle. public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected CriticalHandleZeroOrMinusOneIsInvalid() : base(IntPtr.Zero) { } @@ -75,7 +71,6 @@ namespace Microsoft.Win32.SafeHandles // Class of critical handle which uses only -1 as an invalid handle. public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] protected CriticalHandleMinusOneIsInvalid() : base(new IntPtr(-1)) { } |