diff options
Diffstat (limited to 'src/mscorlib/src/Microsoft/Win32')
-rw-r--r-- | src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs | 60 | ||||
-rw-r--r-- | src/mscorlib/src/Microsoft/Win32/Win32Native.cs | 24 |
2 files changed, 0 insertions, 84 deletions
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs deleted file mode 100644 index 8a7f591dfc..0000000000 --- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs +++ /dev/null @@ -1,60 +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. - -// -// Abstract derivations of SafeHandle designed to provide the common -// functionality supporting Win32 handles. More specifically, they describe how -// an invalid handle looks (for instance, some handles use -1 as an invalid -// handle value, others use 0). -// -// Further derivations of these classes can specialise this even further (e.g. -// file or registry handles). -// -// - -using System; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.ConstrainedExecution; - -namespace Microsoft.Win32.SafeHandles -{ - // Class of safe handle which uses 0 or -1 as an invalid handle. - public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle - { - protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle) - { - } - - // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime - protected SafeHandleZeroOrMinusOneIsInvalid() - { - throw new NotImplementedException(); - } - - public override bool IsInvalid - { - get { return handle.IsNull() || handle == new IntPtr(-1); } - } - } - - // Class of safe handle which uses only -1 as an invalid handle. - public abstract class SafeHandleMinusOneIsInvalid : SafeHandle - { - protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle) - { - } - - // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime - protected SafeHandleMinusOneIsInvalid() - { - throw new NotImplementedException(); - } - - public override bool IsInvalid - { - get { return handle == new IntPtr(-1); } - } - } -} diff --git a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs index 8543bc8a99..b05445961d 100644 --- a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs +++ b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs @@ -93,7 +93,6 @@ namespace Microsoft.Win32 using System.Security; using System.Text; using System.Configuration.Assemblies; - using System.Runtime.Remoting; using System.Runtime.InteropServices; using System.Threading; using Microsoft.Win32.SafeHandles; @@ -400,7 +399,6 @@ namespace Microsoft.Win32 internal int bInheritHandle = 0; } - [Serializable] [StructLayout(LayoutKind.Sequential)] internal struct WIN32_FILE_ATTRIBUTE_DATA { @@ -461,13 +459,11 @@ namespace Microsoft.Win32 internal const String USER32 = "user32.dll"; internal const String OLE32 = "ole32.dll"; internal const String OLEAUT32 = "oleaut32.dll"; - internal const String NTDLL = "ntdll.dll"; #else //FEATURE_PAL internal const String KERNEL32 = "libcoreclr"; internal const String USER32 = "libcoreclr"; internal const String OLE32 = "libcoreclr"; internal const String OLEAUT32 = "libcoreclr"; - internal const String NTDLL = "libcoreclr"; #endif //FEATURE_PAL internal const String ADVAPI32 = "advapi32.dll"; internal const String SHELL32 = "shell32.dll"; @@ -476,9 +472,6 @@ namespace Microsoft.Win32 internal const String SECUR32 = "secur32.dll"; internal const String MSCORWKS = "coreclr.dll"; - // From WinBase.h - internal const int SEM_FAILCRITICALERRORS = 1; - [DllImport(KERNEL32, CharSet = CharSet.Auto, BestFitMapping = true)] internal static extern int FormatMessage(int dwFlags, IntPtr lpSource, int dwMessageId, int dwLanguageId, [Out]StringBuilder lpBuffer, @@ -509,10 +502,6 @@ namespace Microsoft.Win32 [DllImport(KERNEL32, SetLastError = true)] internal static extern IntPtr LocalFree(IntPtr handle); - // MSDN says the length is a SIZE_T. - [DllImport(NTDLL, EntryPoint = "RtlZeroMemory")] - internal static extern void ZeroMemory(IntPtr address, UIntPtr length); - internal static bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer) { buffer.length = Marshal.SizeOf(typeof(MEMORYSTATUSEX)); @@ -733,7 +722,6 @@ namespace Microsoft.Win32 } // Win32 Structs in N/Direct style - [Serializable] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] [BestFitMapping(false)] internal class WIN32_FIND_DATA @@ -783,18 +771,6 @@ namespace Microsoft.Win32 [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)] internal static extern bool SetCurrentDirectory(String path); - [DllImport(KERNEL32, SetLastError = false, EntryPoint = "SetErrorMode", ExactSpelling = true)] - private static extern int SetErrorMode_VistaAndOlder(int newMode); - - // RTM versions of Win7 and Windows Server 2008 R2 - private static readonly Version ThreadErrorModeMinOsVersion = new Version(6, 1, 7600); - - // this method uses the thread-safe version of SetErrorMode on Windows 7 / Windows Server 2008 R2 operating systems. - internal static int SetErrorMode(int newMode) - { - return SetErrorMode_VistaAndOlder(newMode); - } - internal const int LCID_SUPPORTED = 0x00000002; // supported locale ids [DllImport(KERNEL32)] |