Remove unused DeviceIoControl P/Invoke declaration (#38877)
authorFrederik Carlier <frederik.carlier@quamotion.mobi>
Sun, 12 Jul 2020 03:09:37 +0000 (05:09 +0200)
committerGitHub <noreply@github.com>
Sun, 12 Jul 2020 03:09:37 +0000 (20:09 -0700)
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CTL_CODE.cs [deleted file]
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.DeviceIoControl.cs [deleted file]
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.IoControlTransferType.cs [deleted file]

diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CTL_CODE.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CTL_CODE.cs
deleted file mode 100644 (file)
index 2137f07..0000000
+++ /dev/null
@@ -1,31 +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.Data.Common;
-
-internal partial class Interop
-{
-    internal partial class Kernel32
-    {
-        /// <summary> <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/defining-i-o-control-codes">CTL_CODE</a> method.</summary>
-        /// <param name="deviceType">Identifies the device type. This value must match the value that is set in the DeviceType member of the driver's DEVICE_OBJECT structure.</param>
-        /// <param name="function">Identifies the function to be performed by the driver. Values of less than 0x800 are reserved for Microsoft. Values of 0x800 and higher can be used by vendors.</param>
-        /// <param name="method">Indicates how the system will pass data between the caller of DeviceIoControl (or IoBuildDeviceIoControlRequest) and the driver that handles the IRP.</param>
-        /// <param name="access">Indicates the type of access that a caller must request when opening the file object that represents the device (see IRP_MJ_CREATE).</param>
-        internal static unsafe uint CTL_CODE(
-            ushort deviceType,
-            ushort function,
-            byte method,
-            byte access)
-        {
-            // MaxFunctionCode specifies the maximum value of the FunctionCode field in the FSCTLs (or IOCTLs for IOCTL tests). The maximum possible value is 4095.
-            // See https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/how-to-select-and-configure-the-device-fundamental-tests
-            if (function > 4095)
-                throw ADP.ArgumentOutOfRange("function");
-
-            return (uint)((deviceType << 16) | (access << 14) | (function << 2) | method);
-        }
-    }
-}
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.DeviceIoControl.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.DeviceIoControl.cs
deleted file mode 100644 (file)
index f1a8df9..0000000
+++ /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.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
-    internal partial class Kernel32
-    {
-        [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool DeviceIoControl
-        (
-            SafeFileHandle fileHandle,
-            uint ioControlCode,
-            IntPtr inBuffer,
-            uint cbInBuffer,
-            IntPtr outBuffer,
-            uint cbOutBuffer,
-            out uint cbBytesReturned,
-            IntPtr overlapped
-        );
-    }
-}
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.IoControlTransferType.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.IoControlTransferType.cs
deleted file mode 100644 (file)
index fd3372b..0000000
+++ /dev/null
@@ -1,42 +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 Kernel32
-    {
-        /// <summary>
-        /// <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/buffer-descriptions-for-i-o-control-codes">TransferType</a>.
-        /// Indicates how the system will pass data between the caller of DeviceIoControl (or IoBuildDeviceIoControlRequest) and the driver that handles the IRP.
-        /// </summary>
-        public enum IoControlTransferType
-        {
-            /// <summary>
-            /// Specifies the buffered I/O method, which is typically used for transferring small amounts of data per request.
-            /// Most I/O control codes for device and intermediate drivers use this TransferType value.
-            /// </summary>
-            METHOD_BUFFERED,
-
-            /// <summary>
-            /// Specifies the direct I/O method, which is typically used for reading or writing large amounts of data, using DMA or PIO, that must be transferred quickly.
-            /// Specify METHOD_IN_DIRECT if the caller of DeviceIoControl or IoBuildDeviceIoControlRequest will pass data to the driver.
-            /// </summary>
-            METHOD_IN_DIRECT,
-
-            /// <summary>
-            /// Specifies the direct I/O method, which is typically used for reading or writing large amounts of data, using DMA or PIO, that must be transferred quickly.
-            /// Specify METHOD_OUT_DIRECT if the caller of DeviceIoControl or IoBuildDeviceIoControlRequest will receive data from the driver.
-            /// </summary>
-            METHOD_OUT_DIRECT,
-
-            /// <summary>
-            /// Specifies neither buffered nor direct I/O. The I/O manager does not provide any system buffers or MDLs. The IRP supplies the user-mode virtual addresses
-            /// of the input and output buffers that were specified to DeviceIoControl or IoBuildDeviceIoControlRequest, without validating or mapping them.
-            /// </summary>
-            METHOD_NEITHER
-        }
-    }
-}