From f2d98a50d486e0f1714c811365e909bde9ab643f Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 10:34:23 -0700 Subject: [PATCH 1/6] Remove GetRestructedErrorInfo P/Invoke --- .../src/Interop/Windows/Interop.Libraries.cs | 1 - .../Mincore/Interop.GetRestrictedErrorInfo.cs | 15 --------------- 2 files changed, 16 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetRestrictedErrorInfo.cs diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index 692cdd783f2f5f..00668febb6dd6a 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -11,7 +11,6 @@ internal static partial class Libraries internal const string CoreComm_L1_1_2 = "api-ms-win-core-comm-l1-1-2.dll"; internal const string Crypt32 = "crypt32.dll"; internal const string CryptUI = "cryptui.dll"; - internal const string Error_L1 = "api-ms-win-core-winrt-error-l1-1-0.dll"; internal const string Gdi32 = "gdi32.dll"; internal const string HttpApi = "httpapi.dll"; internal const string IpHlpApi = "iphlpapi.dll"; diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetRestrictedErrorInfo.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetRestrictedErrorInfo.cs deleted file mode 100644 index 8bfeebb4f3a30e..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetRestrictedErrorInfo.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. - -using System; -using System.Runtime.InteropServices; -using System.Runtime.InteropServices.WindowsRuntime; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.Error_L1, PreserveSig = false)] - internal static extern IRestrictedErrorInfo GetRestrictedErrorInfo(); - } -} From 8903e99420aa5d1f529ea5e1cef24a1d99fc6952 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 10:36:52 -0700 Subject: [PATCH 2/6] Remove win32 core memory P/Invokes --- .../src/Interop/Windows/Interop.Libraries.cs | 1 - .../Mincore/Interop.OpenFileMappingFromApp.cs | 18 ------------------ .../Mincore/Interop.VirtualAllocFromApp.cs | 19 ------------------- 3 files changed, 38 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenFileMappingFromApp.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.VirtualAllocFromApp.cs diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index 00668febb6dd6a..cddacfcb898a08 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -15,7 +15,6 @@ internal static partial class Libraries internal const string HttpApi = "httpapi.dll"; internal const string IpHlpApi = "iphlpapi.dll"; internal const string Kernel32 = "kernel32.dll"; - internal const string Memory_L1_3 = "api-ms-win-core-memory-l1-1-3.dll"; internal const string Mswsock = "mswsock.dll"; internal const string NCrypt = "ncrypt.dll"; internal const string NtDll = "ntdll.dll"; diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenFileMappingFromApp.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenFileMappingFromApp.cs deleted file mode 100644 index 01448ecf285319..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenFileMappingFromApp.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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.Memory_L1_3, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern SafeMemoryMappedFileHandle OpenFileMappingFromApp( - int DesiredAccess, - [MarshalAs(UnmanagedType.Bool)] bool InheritHandle, - string Name); - } -} diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.VirtualAllocFromApp.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.VirtualAllocFromApp.cs deleted file mode 100644 index 179e6263ab254d..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.VirtualAllocFromApp.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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.Memory_L1_3, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern IntPtr VirtualAllocFromApp( - SafeHandle BaseAddress, - UIntPtr Size, - int AllocationType, - int Protection); - } -} From c2c0ad821109a62f1581c3e52cd9ac79359af9ad Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 10:39:19 -0700 Subject: [PATCH 3/6] Remove RoGetBufferMarshaler P/Invoke --- .../src/Interop/Windows/Interop.Libraries.cs | 1 - .../Mincore/Interop.RoGetBufferMarshaler.cs | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetBufferMarshaler.cs diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index cddacfcb898a08..f806dd8adca751 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -22,7 +22,6 @@ internal static partial class Libraries internal const string Ole32 = "ole32.dll"; internal const string OleAut32 = "oleaut32.dll"; internal const string PerfCounter = "perfcounter.dll"; - internal const string RoBuffer = "api-ms-win-core-winrt-robuffer-l1-1-0.dll"; internal const string Secur32 = "secur32.dll"; internal const string Shell32 = "shell32.dll"; internal const string SspiCli = "sspicli.dll"; diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetBufferMarshaler.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetBufferMarshaler.cs deleted file mode 100644 index 08ba5406387323..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetBufferMarshaler.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. - -using System; -using System.Collections.Generic; -using System.Collections; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.RoBuffer, CallingConvention = CallingConvention.StdCall, PreserveSig = true)] - internal static extern int RoGetBufferMarshaler(out IMarshal bufferMarshalerPtr); - } -} From 685f08d462e3b02400e8d4f003e5b69e240df610 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 10:40:22 -0700 Subject: [PATCH 4/6] Remove RoGetActivationFactory P/Invoke --- .../src/Interop/Windows/Interop.Libraries.cs | 1 - .../Mincore/Interop.RoGetActivationFactory.cs | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetActivationFactory.cs diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index f806dd8adca751..5eb41009681b4a 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -34,7 +34,6 @@ internal static partial class Libraries internal const string Ws2_32 = "ws2_32.dll"; internal const string Wtsapi32 = "wtsapi32.dll"; internal const string CompressionNative = "clrcompression.dll"; - internal const string CoreWinRT = "api-ms-win-core-winrt-l1-1-0.dll"; internal const string MsQuic = "msquic.dll"; internal const string HostPolicy = "hostpolicy.dll"; } diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetActivationFactory.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetActivationFactory.cs deleted file mode 100644 index a8c9a93d592059..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.RoGetActivationFactory.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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.CoreWinRT, PreserveSig = true)] - internal static extern int RoGetActivationFactory( - [MarshalAs(UnmanagedType.HString)] string activatableClassId, - [In] ref Guid iid, - [Out, MarshalAs(UnmanagedType.IInspectable)] out object factory); - } -} From 6313bfedd730da5abb7c9520783ba7b7d88a476f Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 10:43:08 -0700 Subject: [PATCH 5/6] Remove CoreComm P/Invokes --- .../src/Interop/Windows/Interop.Libraries.cs | 2 -- .../Windows/Mincore/Interop.GetCommPorts.cs | 27 ------------------- .../Windows/Mincore/Interop.OpenCommPort.cs | 19 ------------- 3 files changed, 48 deletions(-) delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetCommPorts.cs delete mode 100644 src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenCommPort.cs diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index 5eb41009681b4a..74c014c7179935 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -7,8 +7,6 @@ internal static partial class Libraries { internal const string Advapi32 = "advapi32.dll"; internal const string BCrypt = "BCrypt.dll"; - internal const string CoreComm_L1_1_1 = "api-ms-win-core-comm-l1-1-1.dll"; - internal const string CoreComm_L1_1_2 = "api-ms-win-core-comm-l1-1-2.dll"; internal const string Crypt32 = "crypt32.dll"; internal const string CryptUI = "cryptui.dll"; internal const string Gdi32 = "gdi32.dll"; diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetCommPorts.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetCommPorts.cs deleted file mode 100644 index 1ed2e964b7d4cb..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.GetCommPorts.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. - -using System; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.CoreComm_L1_1_2, SetLastError = true)] - private static extern unsafe int GetCommPorts( - uint* lpPortNumbers, - uint uPortNumbersCount, - out uint puPortNumbersFound); - - internal static unsafe int GetCommPorts( - Span portNumbers, - out uint portNumbersFound) - { - fixed (uint* portNumbersBuffer = &MemoryMarshal.GetReference(portNumbers)) - { - return GetCommPorts(portNumbersBuffer, (uint)portNumbers.Length, out portNumbersFound); - } - } - } -} diff --git a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenCommPort.cs b/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenCommPort.cs deleted file mode 100644 index 60a3408b3631a4..00000000000000 --- a/src/libraries/Common/src/Interop/Windows/Mincore/Interop.OpenCommPort.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. - -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class mincore - { - [DllImport(Libraries.CoreComm_L1_1_1, SetLastError = true)] - internal static extern SafeFileHandle OpenCommPort( - uint uPortNumber, - int dwDesiredAccess, - int dwFlagsAndAttributes); - } -} From 30265d07046db957a5767099ae7b03d3536af855 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 23 Jul 2020 12:38:47 -0700 Subject: [PATCH 6/6] Remove IRestrictedErrorInfo definition. --- .../WindowsRuntime/IRestrictedErrorInfo.cs | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/libraries/Common/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs b/src/libraries/Common/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs deleted file mode 100644 index 1cf4566c761647..00000000000000 --- a/src/libraries/Common/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.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. - -using System; - -namespace System.Runtime.InteropServices.WindowsRuntime -{ - [ComImport] - [Guid("82BA7092-4C88-427D-A7BC-16DD93FEB67E")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IRestrictedErrorInfo - { - void GetErrorDetails([MarshalAs(UnmanagedType.BStr)] out string description, - out int error, - [MarshalAs(UnmanagedType.BStr)] out string restrictedDescription, - [MarshalAs(UnmanagedType.BStr)] out string capabilitySid); - - void GetReference([MarshalAs(UnmanagedType.BStr)] out string reference); - } -}