diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
commit | a56e30c8d33048216567753d9d3fefc2152af8ac (patch) | |
tree | 7e5d979695fc4a431740982eb1cfecc2898b23a5 /src/mscorlib/corefx/Interop/Windows | |
parent | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (diff) | |
download | coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.gz coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.bz2 coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.zip |
Imported Upstream version 2.0.0.11353upstream/2.0.0.11353
Diffstat (limited to 'src/mscorlib/corefx/Interop/Windows')
36 files changed, 0 insertions, 890 deletions
diff --git a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs deleted file mode 100644 index d2ce4131b0..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs +++ /dev/null @@ -1,26 +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. - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class BCrypt - { - internal static unsafe NTSTATUS BCryptGenRandom(byte* pbBuffer, int count) - { - Debug.Assert(pbBuffer != null); - Debug.Assert(count >= 0); - - return BCryptGenRandom(IntPtr.Zero, pbBuffer, count, BCRYPT_USE_SYSTEM_PREFERRED_RNG); - } - - private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002; - - [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)] - private static unsafe extern NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs b/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs deleted file mode 100644 index 49d674f399..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs +++ /dev/null @@ -1,19 +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. - -using System; - -internal partial class Interop -{ - internal partial class BCrypt - { - internal enum NTSTATUS : uint - { - STATUS_SUCCESS = 0x0, - STATUS_NOT_FOUND = 0xc0000225, - STATUS_INVALID_PARAMETER = 0xc000000d, - STATUS_NO_MEMORY = 0xc0000017, - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs b/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs deleted file mode 100644 index b10cb6a041..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs +++ /dev/null @@ -1,22 +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. - -using System; -using System.Runtime.InteropServices; -using System.Security; - -internal partial class Interop -{ - internal partial class Crypt32 - { - internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16; - internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0; - - [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool CryptProtectMemory(SafeBSTRHandle pData, uint cbData, uint dwFlags); - - [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool CryptUnprotectMemory(SafeBSTRHandle pData, uint cbData, uint dwFlags); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs b/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs deleted file mode 100644 index 9f4dab8935..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs +++ /dev/null @@ -1,21 +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. - -internal partial class Interop -{ - /// <summary> - /// Blittable version of Windows BOOL type. It is convenient in situations where - /// manual marshalling is required, or to avoid overhead of regular bool marshalling. - /// </summary> - /// <remarks> - /// Some Windows APIs return arbitrary integer values although the return type is defined - /// as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE - /// or bResult == BOOL.FALSE . - /// </remarks> - internal enum BOOL : int - { - FALSE = 0, - TRUE = 1, - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs b/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs deleted file mode 100644 index 7eeb18de01..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs +++ /dev/null @@ -1,71 +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. - -internal partial class Interop -{ - internal partial class Errors - { - internal const int ERROR_SUCCESS = 0x0; - internal const int ERROR_INVALID_FUNCTION = 0x1; - internal const int ERROR_FILE_NOT_FOUND = 0x2; - internal const int ERROR_PATH_NOT_FOUND = 0x3; - internal const int ERROR_ACCESS_DENIED = 0x5; - internal const int ERROR_INVALID_HANDLE = 0x6; - internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8; - internal const int ERROR_INVALID_DATA = 0xD; - internal const int ERROR_INVALID_DRIVE = 0xF; - internal const int ERROR_NO_MORE_FILES = 0x12; - internal const int ERROR_NOT_READY = 0x15; - internal const int ERROR_BAD_LENGTH = 0x18; - internal const int ERROR_SHARING_VIOLATION = 0x20; - internal const int ERROR_LOCK_VIOLATION = 0x21; - internal const int ERROR_HANDLE_EOF = 0x26; - internal const int ERROR_FILE_EXISTS = 0x50; - internal const int ERROR_INVALID_PARAMETER = 0x57; - internal const int ERROR_BROKEN_PIPE = 0x6D; - internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A; - internal const int ERROR_INVALID_NAME = 0x7B; - internal const int ERROR_NEGATIVE_SEEK = 0x83; - internal const int ERROR_DIR_NOT_EMPTY = 0x91; - internal const int ERROR_BAD_PATHNAME = 0xA1; - internal const int ERROR_LOCK_FAILED = 0xA7; - internal const int ERROR_BUSY = 0xAA; - internal const int ERROR_ALREADY_EXISTS = 0xB7; - internal const int ERROR_BAD_EXE_FORMAT = 0xC1; - internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB; - internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; - internal const int ERROR_EXE_MACHINE_TYPE_MISMATCH = 0xD8; - internal const int ERROR_PIPE_BUSY = 0xE7; - internal const int ERROR_NO_DATA = 0xE8; - internal const int ERROR_PIPE_NOT_CONNECTED = 0xE9; - internal const int ERROR_MORE_DATA = 0xEA; - internal const int ERROR_NO_MORE_ITEMS = 0x103; - internal const int ERROR_PARTIAL_COPY = 0x12B; - internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216; - internal const int ERROR_PIPE_CONNECTED = 0x217; - internal const int ERROR_PIPE_LISTENING = 0x218; - internal const int ERROR_OPERATION_ABORTED = 0x3E3; - internal const int ERROR_IO_PENDING = 0x3E5; - internal const int ERROR_NO_TOKEN = 0x3f0; - internal const int ERROR_DLL_INIT_FAILED = 0x45A; - internal const int ERROR_NOT_FOUND = 0x490; - internal const int ERROR_NON_ACCOUNT_SID = 0x4E9; - internal const int ERROR_NOT_ALL_ASSIGNED = 0x514; - internal const int ERROR_UNKNOWN_REVISION = 0x519; - internal const int ERROR_INVALID_OWNER = 0x51B; - internal const int ERROR_INVALID_PRIMARY_GROUP = 0x51C; - internal const int ERROR_NO_SUCH_PRIVILEGE = 0x521; - internal const int ERROR_PRIVILEGE_NOT_HELD = 0x522; - internal const int ERROR_INVALID_ACL = 0x538; - internal const int ERROR_INVALID_SECURITY_DESCR = 0x53A; - internal const int ERROR_INVALID_SID = 0x539; - internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542; - internal const int ERROR_CANT_OPEN_ANONYMOUS = 0x543; - internal const int ERROR_NO_SECURITY_ON_OBJECT = 0x546; - internal const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 0x6FD; - internal const int ERROR_RESOURCE_LANG_NOT_FOUND = 0x717; - internal const int EFail = unchecked((int)0x80004005); - internal const int E_FILENOTFOUND = unchecked((int)0x80070002); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs b/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs deleted file mode 100644 index f19f9dcf52..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs +++ /dev/null @@ -1,15 +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. - -internal static partial class Interop -{ - internal static class Libraries - { - internal const string BCrypt = "BCrypt.dll"; - internal const string Crypt32 = "crypt32.dll"; - internal const string Kernel32 = "kernel32.dll"; - internal const string NtDll = "ntdll.dll"; - internal const string OleAut32 = "oleaut32.dll"; - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs b/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs deleted file mode 100644 index bd2a64cf14..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs +++ /dev/null @@ -1,17 +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. - -using System; -using System.Runtime.InteropServices; -using System.Security; - -internal partial class Interop -{ - internal partial class NtDll - { - - [DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, EntryPoint = "RtlZeroMemory")] - internal static extern void ZeroMemory(IntPtr address, UIntPtr length); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs deleted file mode 100644 index fc99e3052f..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs +++ /dev/null @@ -1,16 +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. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; -using System.Threading; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs deleted file mode 100644 index 96ed922a84..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs +++ /dev/null @@ -1,16 +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. - -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CloseHandle(IntPtr handle); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs deleted file mode 100644 index 5f6f6115ab..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs +++ /dev/null @@ -1,40 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use CreateFile. - /// </summary> - [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - private static extern SafeFileHandle CreateFilePrivate( - string lpFileName, - int dwDesiredAccess, - System.IO.FileShare dwShareMode, - [In] ref SECURITY_ATTRIBUTES securityAttrs, - System.IO.FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile); - - internal static SafeFileHandle CreateFile( - string lpFileName, - int dwDesiredAccess, - System.IO.FileShare dwShareMode, - [In] ref SECURITY_ATTRIBUTES securityAttrs, - System.IO.FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile) - { - lpFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(lpFileName); - return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs deleted file mode 100644 index 6e3ebb9ae9..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs +++ /dev/null @@ -1,12 +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. - -internal partial class Interop -{ - internal partial class Kernel32 - { - - internal const uint SEM_FAILCRITICALERRORS = 1; - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs deleted file mode 100644 index 1d306665b1..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs +++ /dev/null @@ -1,16 +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. - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal partial class FileTypes - { - internal const int FILE_TYPE_DISK = 0x0001; - internal const int FILE_TYPE_CHAR = 0x0002; - internal const int FILE_TYPE_PIPE = 0x0003; - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs deleted file mode 100644 index e10a2279cf..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs +++ /dev/null @@ -1,17 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool FlushFileBuffers(SafeHandle hHandle); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs deleted file mode 100644 index 94722b6c8b..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs +++ /dev/null @@ -1,112 +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. - -using System; -using System.Text; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200; - private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800; - private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; - private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000; - - - private const int ERROR_INSUFFICIENT_BUFFER = 0x7A; - - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)] - private static extern int FormatMessage( - int dwFlags, - IntPtr lpSource, - uint dwMessageId, - int dwLanguageId, - [Out] StringBuilder lpBuffer, - int nSize, - IntPtr[] arguments); - - /// <summary> - /// Returns a string message for the specified Win32 error code. - /// </summary> - internal static string GetMessage(int errorCode) - { - return GetMessage(IntPtr.Zero, errorCode); - } - - internal static string GetMessage(IntPtr moduleHandle, int errorCode) - { - var sb = new StringBuilder(InitialBufferSize); - do - { - string errorMsg; - if (TryGetErrorMessage(moduleHandle, errorCode, sb, out errorMsg)) - { - return errorMsg; - } - else - { - // increase the capacity of the StringBuilder. - sb.Capacity *= BufferSizeIncreaseFactor; - } - } - while (sb.Capacity < MaxAllowedBufferSize); - - // If you come here then a size as large as 65K is also not sufficient and so we give the generic errorMsg. - return string.Format("Unknown error (0x{0:x})", errorCode); - } - - private static bool TryGetErrorMessage(IntPtr moduleHandle, int errorCode, StringBuilder sb, out string errorMsg) - { - errorMsg = ""; - - int flags = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY; - if (moduleHandle != IntPtr.Zero) - { - flags |= FORMAT_MESSAGE_FROM_HMODULE; - } - - int result = FormatMessage(flags, moduleHandle, (uint)errorCode, 0, sb, sb.Capacity, null); - if (result != 0) - { - int i = sb.Length; - while (i > 0) - { - char ch = sb[i - 1]; - if (ch > 32 && ch != '.') break; - i--; - } - errorMsg = sb.ToString(0, i); - } - else if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) - { - return false; - } - else - { - errorMsg = string.Format("Unknown error (0x{0:x})", errorCode); - } - - return true; - } - - // Windows API FormatMessage lets you format a message string given an errorcode. - // Unlike other APIs this API does not support a way to query it for the total message size. - // - // So the API can only be used in one of these two ways. - // a. You pass a buffer of appropriate size and get the resource. - // b. Windows creates a buffer and passes the address back and the onus of releasing the buffer lies on the caller. - // - // Since the error code is coming from the user, it is not possible to know the size in advance. - // Unfortunately we can't use option b. since the buffer can only be freed using LocalFree and it is a private API on onecore. - // Also, using option b is ugly for the managed code and could cause memory leak in situations where freeing is unsuccessful. - // - // As a result we use the following approach. - // We initially call the API with a buffer size of 256 and then gradually increase the size in case of failure until we reach the maximum allowed limit of 65K. - private const int InitialBufferSize = 256; - private const int BufferSizeIncreaseFactor = 4; - private const int MaxAllowedBufferSize = 65 * 1024; - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs deleted file mode 100644 index 146c4638ee..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs +++ /dev/null @@ -1,26 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool GetFileInformationByHandleEx(SafeFileHandle hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, out FILE_STANDARD_INFO lpFileInformation, uint dwBufferSize); - - internal partial struct FILE_STANDARD_INFO - { - internal long AllocationSize; - internal long EndOfFile; - internal uint NumberOfLinks; - internal BOOL DeletePending; - internal BOOL Directory; - } - - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs deleted file mode 100644 index c07a1683a5..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs +++ /dev/null @@ -1,15 +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. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal extern static int GetFileType(SafeHandle hFile); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs deleted file mode 100644 index 15dd581113..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs +++ /dev/null @@ -1,18 +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. - -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper. - /// </summary> - [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] - unsafe internal static extern uint GetFullPathNameW(char* path, uint numBufferChars, char[] buffer, IntPtr mustBeZero); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs deleted file mode 100644 index a58d1013ca..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs +++ /dev/null @@ -1,18 +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. - -using System; -using System.Runtime.InteropServices; - -partial class Interop -{ - partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper. - /// </summary> - [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] - internal static extern uint GetLongPathNameW(char[] lpszShortPath, char[] lpszLongPath, uint cchBuffer); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs deleted file mode 100644 index d157a29c92..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs +++ /dev/null @@ -1,16 +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. - -using System; -using System.Text; -using System.Runtime.InteropServices; - -partial class Interop -{ - partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)] - internal static extern uint GetTempFileNameW(string tmpPath, string prefix, uint uniqueIdOrZero, [Out]StringBuilder tmpFileName); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs deleted file mode 100644 index 25ffcd55b0..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs +++ /dev/null @@ -1,16 +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. - -using System.IO; -using System.Text; -using System.Runtime.InteropServices; - -partial class Interop -{ - partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern uint GetTempPathW(int bufferLen, [Out]StringBuilder buffer); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs deleted file mode 100644 index a21d00f4f6..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs +++ /dev/null @@ -1,20 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs deleted file mode 100644 index 076f7f136f..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,21 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - out int numBytesRead, - IntPtr mustBeZero); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index 3ae65a8806..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,22 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; -using System.Threading; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - IntPtr numBytesRead_mustBeZero, - NativeOverlapped* overlapped); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs deleted file mode 100644 index 8d31f8622f..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs +++ /dev/null @@ -1,21 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct SECURITY_ATTRIBUTES - { - internal uint nLength; - internal IntPtr lpSecurityDescriptor; - internal BOOL bInheritHandle; - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs deleted file mode 100644 index 4192f569e0..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs +++ /dev/null @@ -1,45 +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. - -using System; -using System.IO; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // WinBase.h - - /// <summary> - /// Does not allow access to non-file devices. This disallows DOS devices like "con:", "com1:", - /// "lpt1:", etc. Use this to avoid security problems, like allowing a web client asking a server - /// for "http://server/com1.aspx" and then causing a worker process to hang. - /// </summary> - internal static SafeFileHandle SafeCreateFile( - String lpFileName, - int dwDesiredAccess, - System.IO.FileShare dwShareMode, - ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs, - FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile) - { - SafeFileHandle handle = UnsafeCreateFile(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); - - if (!handle.IsInvalid) - { - int fileType = Interop.Kernel32.GetFileType(handle); - if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK) - { - handle.Dispose(); - throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles); - } - } - - return handle; - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs deleted file mode 100644 index 4a4402484f..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs +++ /dev/null @@ -1,18 +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. - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal partial class SecurityOptions - { - internal const int SECURITY_SQOS_PRESENT = 0x00100000; - internal const int SECURITY_ANONYMOUS = 0 << 16; - internal const int SECURITY_IDENTIFICATION = 1 << 16; - internal const int SECURITY_IMPERSONATION = 2 << 16; - internal const int SECURITY_DELEGATION = 3 << 16; - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs deleted file mode 100644 index e5d60041a8..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs +++ /dev/null @@ -1,15 +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. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetEndOfFile(SafeFileHandle hFile); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs deleted file mode 100644 index caa2ce5bfa..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs +++ /dev/null @@ -1,14 +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. - -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = false, EntryPoint = "SetErrorMode", ExactSpelling = true)] - internal static extern uint SetErrorMode(uint newMode); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs deleted file mode 100644 index e31a453ba9..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal enum FILE_INFO_BY_HANDLE_CLASS : uint - { - FileBasicInfo = 0x0u, - FileStandardInfo = 0x1u, - FileNameInfo = 0x2u, - FileRenameInfo = 0x3u, - FileDispositionInfo = 0x4u, - FileAllocationInfo = 0x5u, - FileEndOfFileInfo = 0x6u, - FileStreamInfo = 0x7u, - FileCompressionInfo = 0x8u, - FileAttributeTagInfo = 0x9u, - FileIdBothDirectoryInfo = 0xAu, - FileIdBothDirectoryRestartInfo = 0xBu, - FileIoPriorityHintInfo = 0xCu, - FileRemoteProtocolInfo = 0xDu, - FileFullDirectoryInfo = 0xEu, - FileFullDirectoryRestartInfo = 0xFu, - FileStorageInfo = 0x10u, - FileAlignmentInfo = 0x11u, - FileIdInfo = 0x12u, - FileIdExtdDirectoryInfo = 0x13u, - FileIdExtdDirectoryRestartInfo = 0x14u, - MaximumFileInfoByHandleClass = 0x15u, - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs deleted file mode 100644 index c0e5247a52..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs +++ /dev/null @@ -1,15 +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. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs deleted file mode 100644 index 9a5cd2834d..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs +++ /dev/null @@ -1,25 +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. - -using System; -using System.IO; -using Microsoft.Win32.SafeHandles; - -internal partial class Interop -{ - internal partial class Kernel32 - { - internal static SafeFileHandle UnsafeCreateFile( - string lpFileName, - int dwDesiredAccess, - FileShare dwShareMode, - ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs, - FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile) - { - return CreateFile(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); - } - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs deleted file mode 100644 index 07271cae33..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs +++ /dev/null @@ -1,22 +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. - -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe int WideCharToMultiByte( - uint CodePage, uint dwFlags, - char* lpWideCharStr, int cchWideChar, - byte* lpMultiByteStr, int cbMultiByte, - IntPtr lpDefaultChar, IntPtr lpUsedDefaultChar); - - internal const uint CP_ACP = 0; - internal const uint WC_NO_BEST_FIT_CHARS = 0x00000400; - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs deleted file mode 100644 index e7e868e142..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,24 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero); - - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index dc1e97555b..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,22 +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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; -using System.Threading; -internal partial class Interop -{ - internal partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped); - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs b/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs deleted file mode 100644 index 65da4eaaea..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs +++ /dev/null @@ -1,16 +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. - -using System; -using System.Runtime.InteropServices; -using System.Security; - -internal partial class Interop -{ - internal partial class OleAut32 - { - [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)] - internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len); // BSTR - } -} diff --git a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs b/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs deleted file mode 100644 index 027d8eece9..0000000000 --- a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs +++ /dev/null @@ -1,22 +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. - -using System; -using System.Runtime.InteropServices; -using System.Security; - -internal partial class Interop -{ - internal partial class OleAut32 - { - [DllImport(Libraries.OleAut32)] - internal static extern uint SysStringLen(SafeBSTRHandle bstr); - - [DllImport(Libraries.OleAut32)] - internal static extern uint SysStringLen(IntPtr bstr); - - [DllImport(Libraries.OleAut32)] - internal static extern void SysFreeString(IntPtr bstr); - } -} |