summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Chen <jochen@microsoft.com>2017-01-09 22:15:50 -0800
committerGitHub <noreply@github.com>2017-01-09 22:15:50 -0800
commit0fa2c31d2b65a266e016180e785c37febaa45fca (patch)
treeb9ea084633cb1534d02c21d129c2f14cd9b0065d
parent163983ecf59c70d7c286e740f7cd3230f12a0f3c (diff)
parentb2c6ab752c7a71b726695f783a5a0381196cc1fe (diff)
downloadcoreclr-0fa2c31d2b65a266e016180e785c37febaa45fca.tar.gz
coreclr-0fa2c31d2b65a266e016180e785c37febaa45fca.tar.bz2
coreclr-0fa2c31d2b65a266e016180e785c37febaa45fca.zip
Merge pull request #8859 from JohnChen0/pinvoke
Enable PInvoke analyzer for S.P.CoreLib.dll
-rw-r--r--BuildToolsVersion.txt2
-rw-r--r--src/mscorlib/System.Private.CoreLib.csproj9
-rw-r--r--src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs71
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.CancelIoEx.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.CloseHandle.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.CreateFile.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileOperations.cs)2
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileTypes.cs)2
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.FlushFileBuffers.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.FormatMessage.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileInformationByHandleEx.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileType_SafeHandle.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFullPathNameW.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetLongPathNameW.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetTempFileNameW.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetTempPathW.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.LockFile.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.ReadFile_SafeHandle_IntPtr.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.ReadFile_SafeHandle_NativeOverlapped.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SECURITY_ATTRIBUTES.cs)2
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs)8
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SecurityOptions.cs)2
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetEndOfFile.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetErrorMode.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFileInformationByHandle.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFilePointerEx.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.WideCharToMultiByte.cs)4
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.WriteFile_SafeHandle_IntPtr.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs (renamed from src/mscorlib/corefx/Interop/Windows/mincore/Interop.WriteFile_SafeHandle_NativeOverlapped.cs)6
-rw-r--r--src/mscorlib/corefx/Interop/Windows/mincore/Interop.Errors.cs74
-rw-r--r--src/mscorlib/corefx/Interop/Windows/mincore/Interop.Idna.cs37
-rw-r--r--src/mscorlib/corefx/Interop/Windows/mincore/Interop.ThreadPoolIO.cs27
-rw-r--r--src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs2
-rw-r--r--src/mscorlib/corefx/System/IO/FileStream.Win32.cs72
-rw-r--r--src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs6
-rw-r--r--src/mscorlib/corefx/System/IO/Path.Windows.cs4
-rw-r--r--src/mscorlib/corefx/System/IO/PathHelper.Windows.cs10
-rw-r--r--src/mscorlib/corefx/System/IO/Win32Marshal.cs20
-rw-r--r--src/mscorlib/corefx/System/Security/SecureString.Windows.cs8
-rw-r--r--src/mscorlib/mscorlib.shared.sources.props56
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs2
42 files changed, 229 insertions, 289 deletions
diff --git a/BuildToolsVersion.txt b/BuildToolsVersion.txt
index 4c6fcde204..49acdc6889 100644
--- a/BuildToolsVersion.txt
+++ b/BuildToolsVersion.txt
@@ -1 +1 @@
-1.0.27-prerelease-01205-03 \ No newline at end of file
+1.0.27-prerelease-01209-01
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj
index 2d3d3fdb66..d24d0dae09 100644
--- a/src/mscorlib/System.Private.CoreLib.csproj
+++ b/src/mscorlib/System.Private.CoreLib.csproj
@@ -205,7 +205,14 @@
</EmbeddedResource>
</ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
+ <PropertyGroup Condition="'$(BuildOS)' == 'Windows_NT'">
+ <EnableDotnetAnalyzers Condition="'$(EnableDotnetAnalyzers)'==''">true</EnableDotnetAnalyzers>
+ <UseWin32Apis>true</UseWin32Apis>
+ <OSGroup>Windows_NT</OSGroup>
+ </PropertyGroup>
+ <Import Project="$(ToolsDir)\codeAnalysis.targets" />
+
+ <Import Project="$(ToolsDir)\Microsoft.CSharp.Targets" />
<PropertyGroup>
<StrongNameSig>Silverlight</StrongNameSig>
diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs b/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs
new file mode 100644
index 0000000000..7eeb18de01
--- /dev/null
+++ b/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs
@@ -0,0 +1,71 @@
+// 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/mincore/Interop.CancelIoEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs
index 868d409321..fc99e3052f 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.CancelIoEx.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs
@@ -8,9 +8,9 @@ using System.Threading;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.IO, SetLastError = true)]
- internal static unsafe extern bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped);
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped);
}
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.CloseHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs
index 029937b6d5..96ed922a84 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.CloseHandle.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.Handle, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CloseHandle(IntPtr handle);
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.CreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs
index 670037d52e..5f6f6115ab 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.CreateFile.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs
@@ -9,12 +9,12 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CreateFile.
/// </summary>
- [DllImport(Libraries.CoreFile_L1, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
+ [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
private static extern SafeFileHandle CreateFilePrivate(
string lpFileName,
int dwDesiredAccess,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileOperations.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs
index 4369760042..a24a0ba069 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileOperations.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs
@@ -4,7 +4,7 @@
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
internal partial class IOReparseOptions
{
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileTypes.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs
index a24813e8d6..1d306665b1 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FileTypes.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs
@@ -4,7 +4,7 @@
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
internal partial class FileTypes
{
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FlushFileBuffers.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs
index 69f4fe07ce..e10a2279cf 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FlushFileBuffers.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool FlushFileBuffers(SafeHandle hHandle);
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FormatMessage.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs
index 02ecbb8a63..94722b6c8b 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.FormatMessage.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800;
@@ -18,7 +18,7 @@ internal partial class Interop
private const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
- [DllImport(Libraries.Localization, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)]
+ [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)]
private static extern int FormatMessage(
int dwFlags,
IntPtr lpSource,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileInformationByHandleEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs
index c4739a5ddc..146c4638ee 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileInformationByHandleEx.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L2, SetLastError = true)]
+ [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
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileType_SafeHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs
index 3e2567b6bf..c07a1683a5 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFileType_SafeHandle.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
internal extern static int GetFileType(SafeHandle hFile);
}
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFullPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs
index 6feee4cfc6..15dd581113 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetFullPathNameW.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs
@@ -7,12 +7,12 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper.
/// </summary>
- [DllImport(Libraries.CoreFile_L1, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+ [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/mincore/Interop.GetLongPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs
index 0b6326f1a3..a58d1013ca 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetLongPathNameW.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs
@@ -7,12 +7,12 @@ using System.Runtime.InteropServices;
partial class Interop
{
- partial class mincore
+ partial class Kernel32
{
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper.
/// </summary>
- [DllImport(Libraries.CoreFile_L1, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+ [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/mincore/Interop.GetTempFileNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs
index f06d11be52..d157a29c92 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetTempFileNameW.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
partial class Interop
{
- partial class mincore
+ partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
+ [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/mincore/Interop.GetTempPathW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs
index 0ccc27c9ec..25ffcd55b0 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.GetTempPathW.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
partial class Interop
{
- partial class mincore
+ partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1_2, CharSet = CharSet.Unicode, BestFitMapping = false)]
+ [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/mincore/Interop.LockFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs
index ee9a98ecce..a21d00f4f6 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.LockFile.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs
@@ -9,12 +9,12 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [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/mincore/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
index 093a993c10..076f7f136f 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ReadFile_SafeHandle_IntPtr.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
@@ -8,10 +8,10 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
- unsafe internal static extern int ReadFile(
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static extern unsafe int ReadFile(
SafeHandle handle,
byte* bytes,
int numBytesToRead,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
index ac238cb802..3ae65a8806 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
@@ -9,10 +9,10 @@ using System.Threading;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
- unsafe internal static extern int ReadFile(
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static extern unsafe int ReadFile(
SafeHandle handle,
byte* bytes,
int numBytesToRead,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SECURITY_ATTRIBUTES.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs
index 0f5c224022..8d31f8622f 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SECURITY_ATTRIBUTES.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
[StructLayout(LayoutKind.Sequential)]
internal struct SECURITY_ATTRIBUTES
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs
index edfc66d2c9..4192f569e0 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SafeCreateFile.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs
@@ -9,7 +9,7 @@ using Microsoft.Win32.SafeHandles;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // WinBase.h
@@ -22,7 +22,7 @@ internal partial class Interop
String lpFileName,
int dwDesiredAccess,
System.IO.FileShare dwShareMode,
- ref Interop.mincore.SECURITY_ATTRIBUTES securityAttrs,
+ ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs,
FileMode dwCreationDisposition,
int dwFlagsAndAttributes,
IntPtr hTemplateFile)
@@ -31,8 +31,8 @@ internal partial class Interop
if (!handle.IsInvalid)
{
- int fileType = Interop.mincore.GetFileType(handle);
- if (fileType != Interop.mincore.FileTypes.FILE_TYPE_DISK)
+ int fileType = Interop.Kernel32.GetFileType(handle);
+ if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
{
handle.Dispose();
throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SecurityOptions.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs
index 767d7f528f..4a4402484f 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SecurityOptions.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs
@@ -4,7 +4,7 @@
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
internal partial class SecurityOptions
{
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetEndOfFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs
index ee0d3b4bc8..e5d60041a8 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetEndOfFile.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern bool SetEndOfFile(SafeFileHandle hFile);
}
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetErrorMode.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs
index a845990ded..caa2ce5bfa 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetErrorMode.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs
@@ -6,9 +6,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.ErrorHandling, SetLastError = false, EntryPoint = "SetErrorMode", ExactSpelling = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = false, EntryPoint = "SetErrorMode", ExactSpelling = true)]
internal static extern uint SetErrorMode(uint newMode);
}
}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFileInformationByHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs
index 0519219132..e7e0ef0d9b 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFileInformationByHandle.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs
@@ -8,13 +8,13 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern bool SetFileInformationByHandle(SafeFileHandle hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, ref FILE_BASIC_INFO lpFileInformation, uint dwBufferSize);
// Default values indicate "no change". Use defaults so that we don't force callsites to be aware of the default values
- internal unsafe static bool SetFileTime(
+ internal static unsafe bool SetFileTime(
SafeFileHandle hFile,
long creationTime = -1,
long lastAccessTime = -1,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFilePointerEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs
index 09f8e1feb3..c0e5247a52 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.SetFilePointerEx.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
+ [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/mincore/Interop.UnsafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs
index e7e4f0513a..9a5cd2834d 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.UnsafeCreateFile.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs
@@ -8,13 +8,13 @@ using Microsoft.Win32.SafeHandles;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
internal static SafeFileHandle UnsafeCreateFile(
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
- ref Interop.mincore.SECURITY_ATTRIBUTES securityAttrs,
+ ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs,
FileMode dwCreationDisposition,
int dwFlagsAndAttributes,
IntPtr hTemplateFile)
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.WideCharToMultiByte.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs
index b1a2975696..07271cae33 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.WideCharToMultiByte.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ internal partial class Kernel32
{
- [DllImport(Libraries.String_L1)]
+ [DllImport(Libraries.Kernel32)]
internal static extern unsafe int WideCharToMultiByte(
uint CodePage, uint dwFlags,
char* lpWideCharStr, int cchWideChar,
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
index 052ba3ce7d..e7e868e142 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.WriteFile_SafeHandle_IntPtr.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
internal partial class Interop
{
- internal partial class mincore
+ 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
@@ -17,8 +17,8 @@ internal partial class Interop
// struct in a callback (or an EndWrite method called by that callback),
// and pass in an address for the numBytesRead parameter.
- [DllImport(Libraries.CoreFile_L1, SetLastError = true)]
- internal static unsafe extern int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero);
+ [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/mincore/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
index e9d2953045..dc1e97555b 100644
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
+++ b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
using System.Threading;
internal partial class Interop
{
- internal partial class mincore
+ 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
@@ -16,7 +16,7 @@ internal partial class Interop
// 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.CoreFile_L1, SetLastError = true)]
- internal static unsafe extern int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped);
+ [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/mincore/Interop.Errors.cs b/src/mscorlib/corefx/Interop/Windows/mincore/Interop.Errors.cs
deleted file mode 100644
index 05b2250830..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.Errors.cs
+++ /dev/null
@@ -1,74 +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 mincore
- {
- 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/mincore/Interop.Idna.cs b/src/mscorlib/corefx/Interop/Windows/mincore/Interop.Idna.cs
deleted file mode 100644
index e14f16b048..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.Idna.cs
+++ /dev/null
@@ -1,37 +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 mincore
- {
- //
- // Idn APIs
- //
-
- [DllImport("api-ms-win-core-localization-l1-2-0.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern int IdnToAscii(
- uint dwFlags,
- IntPtr lpUnicodeCharStr,
- int cchUnicodeChar,
- [System.Runtime.InteropServices.OutAttribute()]
- IntPtr lpASCIICharStr,
- int cchASCIIChar);
-
- [DllImport("api-ms-win-core-localization-l1-2-0.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern int IdnToUnicode(
- uint dwFlags,
- IntPtr lpASCIICharStr,
- int cchASCIIChar,
- [System.Runtime.InteropServices.OutAttribute()]
- IntPtr lpUnicodeCharStr,
- int cchUnicodeChar);
-
- internal const int IDN_ALLOW_UNASSIGNED = 0x1;
- internal const int IDN_USE_STD3_ASCII_RULES = 0x2;
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ThreadPoolIO.cs b/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ThreadPoolIO.cs
deleted file mode 100644
index a0afed5d1a..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/mincore/Interop.ThreadPoolIO.cs
+++ /dev/null
@@ -1,27 +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 Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class mincore
- {
- [DllImport(Libraries.ThreadPool, SetLastError = true)]
- internal static unsafe extern SafeThreadPoolIOHandle CreateThreadpoolIo(SafeHandle fl, [MarshalAs(UnmanagedType.FunctionPtr)] NativeIoCompletionCallback pfnio, IntPtr context, IntPtr pcbe);
-
- [DllImport(Libraries.ThreadPool)]
- internal static unsafe extern void CloseThreadpoolIo(IntPtr pio);
-
- [DllImport(Libraries.ThreadPool)]
- internal static unsafe extern void StartThreadpoolIo(SafeThreadPoolIOHandle pio);
-
- [DllImport(Libraries.ThreadPool)]
- internal static unsafe extern void CancelThreadpoolIo(SafeThreadPoolIOHandle pio);
- }
-
- internal delegate void NativeIoCompletionCallback(IntPtr instance, IntPtr context, IntPtr overlapped, uint ioResult, UIntPtr numberOfBytesTransferred, IntPtr io);
-}
diff --git a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
index 7d4dd444c7..4eabe8f08c 100644
--- a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
+++ b/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
@@ -43,7 +43,7 @@ namespace Microsoft.Win32.SafeHandles
override protected bool ReleaseHandle()
{
- return Interop.mincore.CloseHandle(handle);
+ return Interop.Kernel32.CloseHandle(handle);
}
}
}
diff --git a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs b/src/mscorlib/corefx/System/IO/FileStream.Win32.cs
index 350d948b00..f6896be7ac 100644
--- a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs
+++ b/src/mscorlib/corefx/System/IO/FileStream.Win32.cs
@@ -55,7 +55,7 @@ namespace System.IO
private SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options)
{
- Interop.mincore.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share);
+ Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share);
int fAccess =
((_access & FileAccess.Read) == FileAccess.Read ? GENERIC_READ : 0) |
@@ -74,13 +74,13 @@ namespace System.IO
// For mitigating local elevation of privilege attack through named pipes
// make sure we always call CreateFile with SECURITY_ANONYMOUS so that the
// named pipe server can't impersonate a high privileged client security context
- flagsAndAttributes |= (Interop.mincore.SecurityOptions.SECURITY_SQOS_PRESENT | Interop.mincore.SecurityOptions.SECURITY_ANONYMOUS);
+ flagsAndAttributes |= (Interop.Kernel32.SecurityOptions.SECURITY_SQOS_PRESENT | Interop.Kernel32.SecurityOptions.SECURITY_ANONYMOUS);
// Don't pop up a dialog for reading from an empty floppy drive
- uint oldMode = Interop.mincore.SetErrorMode(Interop.mincore.SEM_FAILCRITICALERRORS);
+ uint oldMode = Interop.Kernel32.SetErrorMode(Interop.Kernel32.SEM_FAILCRITICALERRORS);
try
{
- SafeFileHandle fileHandle = Interop.mincore.SafeCreateFile(_path, fAccess, share, ref secAttrs, mode, flagsAndAttributes, IntPtr.Zero);
+ SafeFileHandle fileHandle = Interop.Kernel32.SafeCreateFile(_path, fAccess, share, ref secAttrs, mode, flagsAndAttributes, IntPtr.Zero);
fileHandle.IsAsync = _useAsyncIO;
if (fileHandle.IsInvalid)
@@ -92,8 +92,8 @@ namespace System.IO
// probably be consistent w/ every other directory.
int errorCode = Marshal.GetLastWin32Error();
- if (errorCode == Interop.mincore.Errors.ERROR_PATH_NOT_FOUND && _path.Equals(Directory.InternalGetDirectoryRoot(_path)))
- errorCode = Interop.mincore.Errors.ERROR_ACCESS_DENIED;
+ if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && _path.Equals(Directory.InternalGetDirectoryRoot(_path)))
+ errorCode = Interop.Errors.ERROR_ACCESS_DENIED;
throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
}
@@ -102,7 +102,7 @@ namespace System.IO
}
finally
{
- Interop.mincore.SetErrorMode(oldMode);
+ Interop.Kernel32.SetErrorMode(oldMode);
}
}
@@ -112,8 +112,8 @@ namespace System.IO
// constructors that take a String. Everyone else can call
// CreateFile themselves then use the constructor that takes an
// IntPtr. Disallows "con:", "com1:", "lpt1:", etc.
- int fileType = Interop.mincore.GetFileType(_fileHandle);
- if (fileType != Interop.mincore.FileTypes.FILE_TYPE_DISK)
+ int fileType = Interop.Kernel32.GetFileType(_fileHandle);
+ if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
{
_fileHandle.Dispose();
throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
@@ -163,11 +163,11 @@ namespace System.IO
private void InitFromHandle(SafeFileHandle handle)
{
- int handleType = Interop.mincore.GetFileType(_fileHandle);
- Debug.Assert(handleType == Interop.mincore.FileTypes.FILE_TYPE_DISK || handleType == Interop.mincore.FileTypes.FILE_TYPE_PIPE || handleType == Interop.mincore.FileTypes.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!");
+ int handleType = Interop.Kernel32.GetFileType(_fileHandle);
+ Debug.Assert(handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!");
- _canSeek = handleType == Interop.mincore.FileTypes.FILE_TYPE_DISK;
- _isPipe = handleType == Interop.mincore.FileTypes.FILE_TYPE_PIPE;
+ _canSeek = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK;
+ _isPipe = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE;
// This is necessary for async IO using IO Completion ports via our
// managed Threadpool API's. This calls the OS's
@@ -196,7 +196,7 @@ namespace System.IO
}
else if (!_useAsyncIO)
{
- if (handleType != Interop.mincore.FileTypes.FILE_TYPE_PIPE)
+ if (handleType != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE)
VerifyHandleIsSync();
}
@@ -211,13 +211,13 @@ namespace System.IO
return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
}
- private unsafe static Interop.mincore.SECURITY_ATTRIBUTES GetSecAttrs(FileShare share)
+ private unsafe static Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(FileShare share)
{
- Interop.mincore.SECURITY_ATTRIBUTES secAttrs = default(Interop.mincore.SECURITY_ATTRIBUTES);
+ Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
if ((share & FileShare.Inheritable) != 0)
{
- secAttrs = new Interop.mincore.SECURITY_ATTRIBUTES();
- secAttrs.nLength = (uint)sizeof(Interop.mincore.SECURITY_ATTRIBUTES);
+ secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES();
+ secAttrs.nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES);
secAttrs.bInheritHandle = Interop.BOOL.TRUE;
}
@@ -234,7 +234,7 @@ namespace System.IO
// cause an app to block incorrectly, introducing a deadlock (depending
// on whether a write will wake up an already-blocked thread or this
// Win32FileStream's thread).
- Debug.Assert(Interop.mincore.GetFileType(_fileHandle) != Interop.mincore.FileTypes.FILE_TYPE_PIPE);
+ Debug.Assert(Interop.Kernel32.GetFileType(_fileHandle) != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE);
byte* bytes = stackalloc byte[1];
int numBytesReadWritten;
@@ -246,11 +246,11 @@ namespace System.IO
// accidentally read synchronously from an async pipe.
if ((_access & FileAccess.Read) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
{
- r = Interop.mincore.ReadFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
+ r = Interop.Kernel32.ReadFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
}
else if ((_access & FileAccess.Write) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
{
- r = Interop.mincore.WriteFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
+ r = Interop.Kernel32.WriteFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
}
if (r == 0)
@@ -273,9 +273,9 @@ namespace System.IO
private long GetLengthInternal()
{
- Interop.mincore.FILE_STANDARD_INFO info = new Interop.mincore.FILE_STANDARD_INFO();
+ Interop.Kernel32.FILE_STANDARD_INFO info = new Interop.Kernel32.FILE_STANDARD_INFO();
- if (!Interop.mincore.GetFileInformationByHandleEx(_fileHandle, Interop.mincore.FILE_INFO_BY_HANDLE_CLASS.FileStandardInfo, out info, (uint)Marshal.SizeOf<Interop.mincore.FILE_STANDARD_INFO>()))
+ if (!Interop.Kernel32.GetFileInformationByHandleEx(_fileHandle, Interop.Kernel32.FILE_INFO_BY_HANDLE_CLASS.FileStandardInfo, out info, (uint)Marshal.SizeOf<Interop.Kernel32.FILE_STANDARD_INFO>()))
throw Win32Marshal.GetExceptionForLastWin32Error();
long len = info.EndOfFile;
// If we're writing near the end of the file, we must include our
@@ -334,7 +334,7 @@ namespace System.IO
private void FlushOSBuffer()
{
- if (!Interop.mincore.FlushFileBuffers(_fileHandle))
+ if (!Interop.Kernel32.FlushFileBuffers(_fileHandle))
{
throw Win32Marshal.GetExceptionForLastWin32Error();
}
@@ -426,10 +426,10 @@ namespace System.IO
VerifyOSHandlePosition();
if (_filePosition != value)
SeekCore(value, SeekOrigin.Begin);
- if (!Interop.mincore.SetEndOfFile(_fileHandle))
+ if (!Interop.Kernel32.SetEndOfFile(_fileHandle))
{
int errorCode = Marshal.GetLastWin32Error();
- if (errorCode == Interop.mincore.Errors.ERROR_INVALID_PARAMETER)
+ if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER)
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_FileLengthTooBig);
throw Win32Marshal.GetExceptionForWin32Error(errorCode);
}
@@ -658,7 +658,7 @@ namespace System.IO
Debug.Assert(origin >= SeekOrigin.Begin && origin <= SeekOrigin.End, "origin>=SeekOrigin.Begin && origin<=SeekOrigin.End");
long ret = 0;
- if (!Interop.mincore.SetFilePointerEx(_fileHandle, offset, out ret, (uint)origin))
+ if (!Interop.Kernel32.SetFilePointerEx(_fileHandle, offset, out ret, (uint)origin))
{
int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
throw Win32Marshal.GetExceptionForWin32Error(errorCode);
@@ -1280,9 +1280,9 @@ namespace System.IO
fixed (byte* p = bytes)
{
if (_useAsyncIO)
- r = Interop.mincore.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped);
+ r = Interop.Kernel32.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped);
else
- r = Interop.mincore.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero);
+ r = Interop.Kernel32.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero);
}
if (r == 0)
@@ -1325,9 +1325,9 @@ namespace System.IO
fixed (byte* p = bytes)
{
if (_useAsyncIO)
- r = Interop.mincore.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped);
+ r = Interop.Kernel32.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped);
else
- r = Interop.mincore.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero);
+ r = Interop.Kernel32.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero);
}
if (r == 0)
@@ -1363,7 +1363,7 @@ namespace System.IO
// Note that _parent.Dispose doesn't throw so we don't need to special case.
// SetHandleAsInvalid only sets _closed field to true (without
// actually closing handle) so we don't need to call that as well.
- if (errorCode == Interop.mincore.Errors.ERROR_INVALID_HANDLE)
+ if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE)
{
_fileHandle.Dispose();
@@ -1473,7 +1473,7 @@ namespace System.IO
{
// Try to cancel the I/O. We ignore the return value, as cancellation is opportunistic and we
// don't want to fail the operation because we couldn't cancel it.
- Interop.mincore.CancelIoEx(innerAwaitable._fileStream._fileHandle, innerAwaitable._nativeOverlapped);
+ Interop.Kernel32.CancelIoEx(innerAwaitable._fileStream._fileHandle, innerAwaitable._nativeOverlapped);
}
}
}
@@ -1538,7 +1538,7 @@ namespace System.IO
case ERROR_HANDLE_EOF: // logically success with 0 bytes read (read at end of file)
Debug.Assert(readAwaitable._numBytes == 0, $"Expected 0 bytes read, got {readAwaitable._numBytes}");
break;
- case Interop.mincore.Errors.ERROR_OPERATION_ABORTED: // canceled
+ case Interop.Errors.ERROR_OPERATION_ABORTED: // canceled
throw new OperationCanceledException(cancellationToken.IsCancellationRequested ? cancellationToken : new CancellationToken(true));
default: // error
throw Win32Marshal.GetExceptionForWin32Error((int)readAwaitable._errorCode);
@@ -1748,7 +1748,7 @@ namespace System.IO
int lengthLow = unchecked((int)(length));
int lengthHigh = unchecked((int)(length >> 32));
- if (!Interop.mincore.LockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
+ if (!Interop.Kernel32.LockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
{
throw Win32Marshal.GetExceptionForLastWin32Error();
}
@@ -1761,7 +1761,7 @@ namespace System.IO
int lengthLow = unchecked((int)(length));
int lengthHigh = unchecked((int)(length >> 32));
- if (!Interop.mincore.UnlockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
+ if (!Interop.Kernel32.UnlockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
{
throw Win32Marshal.GetExceptionForLastWin32Error();
}
diff --git a/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs b/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs
index 532dbb0615..159e416e63 100644
--- a/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs
+++ b/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs
@@ -178,7 +178,7 @@ namespace System.IO
if (result == ResultError)
{
int errorCode = unchecked((int)(packedResult & uint.MaxValue));
- if (errorCode == Interop.mincore.Errors.ERROR_OPERATION_ABORTED)
+ if (errorCode == Interop.Errors.ERROR_OPERATION_ABORTED)
{
TrySetCanceled(_cancellationToken.IsCancellationRequested ? _cancellationToken : new CancellationToken(true));
}
@@ -204,13 +204,13 @@ namespace System.IO
// If the handle is still valid, attempt to cancel the IO
if (!completionSource._stream._fileHandle.IsInvalid &&
- !Interop.mincore.CancelIoEx(completionSource._stream._fileHandle, completionSource._overlapped))
+ !Interop.Kernel32.CancelIoEx(completionSource._stream._fileHandle, completionSource._overlapped))
{
int errorCode = Marshal.GetLastWin32Error();
// ERROR_NOT_FOUND is returned if CancelIoEx cannot find the request to cancel.
// This probably means that the IO operation has completed.
- if (errorCode != Interop.mincore.Errors.ERROR_NOT_FOUND)
+ if (errorCode != Interop.Errors.ERROR_NOT_FOUND)
{
throw Win32Marshal.GetExceptionForWin32Error(errorCode);
}
diff --git a/src/mscorlib/corefx/System/IO/Path.Windows.cs b/src/mscorlib/corefx/System/IO/Path.Windows.cs
index 0c96769bf2..ce867efd2c 100644
--- a/src/mscorlib/corefx/System/IO/Path.Windows.cs
+++ b/src/mscorlib/corefx/System/IO/Path.Windows.cs
@@ -94,7 +94,7 @@ namespace System.IO
public static string GetTempPath()
{
StringBuilder sb = StringBuilderCache.Acquire(MaxPath);
- uint r = Interop.mincore.GetTempPathW(MaxPath, sb);
+ uint r = Interop.Kernel32.GetTempPathW(MaxPath, sb);
if (r == 0)
throw Win32Marshal.GetExceptionForLastWin32Error();
return GetFullPath(StringBuilderCache.GetStringAndRelease(sb));
@@ -107,7 +107,7 @@ namespace System.IO
string path = GetTempPath();
StringBuilder sb = StringBuilderCache.Acquire(MaxPath);
- uint r = Interop.mincore.GetTempFileNameW(path, "tmp", 0, sb);
+ uint r = Interop.Kernel32.GetTempFileNameW(path, "tmp", 0, sb);
if (r == 0)
throw Win32Marshal.GetExceptionForLastWin32Error();
return StringBuilderCache.GetStringAndRelease(sb);
diff --git a/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs b/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs
index 7df435f934..e2ead93185 100644
--- a/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs
+++ b/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs
@@ -198,7 +198,7 @@ namespace System.IO
fixed (char* pathStart = path)
{
uint result = 0;
- while ((result = Interop.mincore.GetFullPathNameW(pathStart + startIndex, (uint)fullPath.Capacity, fullPath.UnderlyingArray, IntPtr.Zero)) > fullPath.Capacity)
+ while ((result = Interop.Kernel32.GetFullPathNameW(pathStart + startIndex, (uint)fullPath.Capacity, fullPath.UnderlyingArray, IntPtr.Zero)) > fullPath.Capacity)
{
// Reported size is greater than the buffer size. Increase the capacity.
fullPath.EnsureCapacity(checked((int)result));
@@ -209,7 +209,7 @@ namespace System.IO
// Failure, get the error and throw
int errorCode = Marshal.GetLastWin32Error();
if (errorCode == 0)
- errorCode = Interop.mincore.Errors.ERROR_BAD_PATHNAME;
+ errorCode = Interop.Errors.ERROR_BAD_PATHNAME;
throw Win32Marshal.GetExceptionForWin32Error(errorCode, path);
}
@@ -304,7 +304,7 @@ namespace System.IO
while (!success)
{
- uint result = Interop.mincore.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
+ uint result = Interop.Kernel32.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
// Replace any temporary null we added
if (inputBuffer[foundIndex] == '\0') inputBuffer[foundIndex] = '\\';
@@ -313,7 +313,7 @@ namespace System.IO
{
// Look to see if we couldn't find the file
int error = Marshal.GetLastWin32Error();
- if (error != Interop.mincore.Errors.ERROR_FILE_NOT_FOUND && error != Interop.mincore.Errors.ERROR_PATH_NOT_FOUND)
+ if (error != Interop.Errors.ERROR_FILE_NOT_FOUND && error != Interop.Errors.ERROR_PATH_NOT_FOUND)
{
// Some other failure, give up
break;
@@ -338,7 +338,7 @@ namespace System.IO
{
// Not enough space. The result count for this API does not include the null terminator.
outputBuffer.EnsureCapacity(checked((int)result));
- result = Interop.mincore.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
+ result = Interop.Kernel32.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
}
else
{
diff --git a/src/mscorlib/corefx/System/IO/Win32Marshal.cs b/src/mscorlib/corefx/System/IO/Win32Marshal.cs
index b4dfa04468..8bdab0b049 100644
--- a/src/mscorlib/corefx/System/IO/Win32Marshal.cs
+++ b/src/mscorlib/corefx/System/IO/Win32Marshal.cs
@@ -48,49 +48,49 @@ namespace System.IO
{
switch (errorCode)
{
- case Interop.mincore.Errors.ERROR_FILE_NOT_FOUND:
+ case Interop.Errors.ERROR_FILE_NOT_FOUND:
if (path.Length == 0)
return new FileNotFoundException(SR.IO_FileNotFound);
else
return new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path);
- case Interop.mincore.Errors.ERROR_PATH_NOT_FOUND:
+ case Interop.Errors.ERROR_PATH_NOT_FOUND:
if (path.Length == 0)
return new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName);
else
return new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path));
- case Interop.mincore.Errors.ERROR_ACCESS_DENIED:
+ case Interop.Errors.ERROR_ACCESS_DENIED:
if (path.Length == 0)
return new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName);
else
return new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path));
- case Interop.mincore.Errors.ERROR_ALREADY_EXISTS:
+ case Interop.Errors.ERROR_ALREADY_EXISTS:
if (path.Length == 0)
goto default;
return new IOException(SR.Format(SR.IO_AlreadyExists_Name, path), MakeHRFromErrorCode(errorCode));
- case Interop.mincore.Errors.ERROR_FILENAME_EXCED_RANGE:
+ case Interop.Errors.ERROR_FILENAME_EXCED_RANGE:
return new PathTooLongException(SR.IO_PathTooLong);
- case Interop.mincore.Errors.ERROR_INVALID_PARAMETER:
+ case Interop.Errors.ERROR_INVALID_PARAMETER:
return new IOException(GetMessage(errorCode), MakeHRFromErrorCode(errorCode));
- case Interop.mincore.Errors.ERROR_SHARING_VIOLATION:
+ case Interop.Errors.ERROR_SHARING_VIOLATION:
if (path.Length == 0)
return new IOException(SR.IO_SharingViolation_NoFileName, MakeHRFromErrorCode(errorCode));
else
return new IOException(SR.Format(SR.IO_SharingViolation_File, path), MakeHRFromErrorCode(errorCode));
- case Interop.mincore.Errors.ERROR_FILE_EXISTS:
+ case Interop.Errors.ERROR_FILE_EXISTS:
if (path.Length == 0)
goto default;
return new IOException(SR.Format(SR.IO_FileExists_Name, path), MakeHRFromErrorCode(errorCode));
- case Interop.mincore.Errors.ERROR_OPERATION_ABORTED:
+ case Interop.Errors.ERROR_OPERATION_ABORTED:
return new OperationCanceledException();
default:
@@ -128,7 +128,7 @@ namespace System.IO
/// </summary>
internal static string GetMessage(int errorCode)
{
- return Interop.mincore.GetMessage(errorCode);
+ return Interop.Kernel32.GetMessage(errorCode);
}
}
}
diff --git a/src/mscorlib/corefx/System/Security/SecureString.Windows.cs b/src/mscorlib/corefx/System/Security/SecureString.Windows.cs
index 5f56353647..7ed0c6a15b 100644
--- a/src/mscorlib/corefx/System/Security/SecureString.Windows.cs
+++ b/src/mscorlib/corefx/System/Security/SecureString.Windows.cs
@@ -206,11 +206,11 @@ namespace System.Security
else
{
uint defaultChar = '?';
- int resultByteLength = 1 + Interop.mincore.WideCharToMultiByte(
- Interop.mincore.CP_ACP, Interop.mincore.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, null, 0, (IntPtr)(&defaultChar), IntPtr.Zero);
+ int resultByteLength = 1 + Interop.Kernel32.WideCharToMultiByte(
+ Interop.Kernel32.CP_ACP, Interop.Kernel32.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, null, 0, (IntPtr)(&defaultChar), IntPtr.Zero);
ptr = globalAlloc ? Marshal.AllocHGlobal(resultByteLength) : Marshal.AllocCoTaskMem(resultByteLength);
- Interop.mincore.WideCharToMultiByte(
- Interop.mincore.CP_ACP, Interop.mincore.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, (byte*)ptr, resultByteLength - 1, (IntPtr)(&defaultChar), IntPtr.Zero);
+ Interop.Kernel32.WideCharToMultiByte(
+ Interop.Kernel32.CP_ACP, Interop.Kernel32.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, (byte*)ptr, resultByteLength - 1, (IntPtr)(&defaultChar), IntPtr.Zero);
*(resultByteLength - 1 + (byte*)ptr) = 0;
}
result = ptr;
diff --git a/src/mscorlib/mscorlib.shared.sources.props b/src/mscorlib/mscorlib.shared.sources.props
index c81b4fa7c8..9877112457 100644
--- a/src/mscorlib/mscorlib.shared.sources.props
+++ b/src/mscorlib/mscorlib.shared.sources.props
@@ -1126,36 +1126,36 @@
<ItemGroup Condition="'$(TargetsUnix)' != 'true'">
<WindowsInteropSources Include="$(CoreFxSourcesRoot)\System\HResults.cs" />
<WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\Interop.BOOL.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\Interop.Errors.cs" />
<WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\Interop.Libraries.cs" />
<WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs" />
<WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\BCrypt\Interop.NTSTATUS.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.CancelIoEx.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.CloseHandle.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.CreateFile.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.Errors.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.FileTypes.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.FileOperations.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.FlushFileBuffers.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.FormatMessage.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetFileInformationByHandleEx.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetFileType_SafeHandle.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetFullPathNameW.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetLongPathNameW.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetTempFileNameW.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.GetTempPathW.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.LockFile.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.ReadFile_SafeHandle_IntPtr.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.ReadFile_SafeHandle_NativeOverlapped.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SafeCreateFile.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SECURITY_ATTRIBUTES.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SecurityOptions.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SetEndOfFile.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SetErrorMode.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SetFileInformationByHandle.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.SetFilePointerEx.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.UnsafeCreateFile.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.WriteFile_SafeHandle_IntPtr.cs" />
- <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.WriteFile_SafeHandle_NativeOverlapped.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.CancelIoEx.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.CloseHandle.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.CreateFile.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.FileTypes.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.FileOperations.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.FlushFileBuffers.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.FormatMessage.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetFileInformationByHandleEx.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetFileType_SafeHandle.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetFullPathNameW.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetLongPathNameW.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetTempFileNameW.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.GetTempPathW.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.LockFile.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SafeCreateFile.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SecurityOptions.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SetEndOfFile.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SetErrorMode.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SetFileInformationByHandle.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.SetFilePointerEx.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.UnsafeCreateFile.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs" />
+ <WindowsInteropSources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs" />
</ItemGroup>
<ItemGroup>
@@ -1168,7 +1168,7 @@
<!-- Interop sources -->
<SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\Crypt32\Interop.CryptProtectMemory.cs" />
<SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\NtDll\Interop.ZeroMemory.cs" />
- <SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\mincore\Interop.WideCharToMultiByte.cs" />
+ <SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\kernel32\Interop.WideCharToMultiByte.cs" />
<SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\oleaut32\Interop.SysAllocStringLen.cs" />
<SecuritySources Include="$(CoreFxSourcesRoot)\Interop\Windows\oleaut32\Interop.SysStringLen.cs" />
</ItemGroup>
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs
index 4380369754..627de8d400 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs
@@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
internal static class UnsafeNativeMethods
{
- [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll", PreserveSig = false)]
+ [DllImport("api-ms-win-core-winrt-error-l1-1-0.dll", PreserveSig = false)]
[SuppressUnmanagedCodeSecurity]
internal static extern IRestrictedErrorInfo GetRestrictedErrorInfo();