コード例 #1
0
 internal static extern bool DeviceIoControl(SafeFileHandle hDevice,
                                             WindowsIoctl ioControlCode, IntPtr inBuffer,
                                             uint nInBufferSize,
                                             ref SffdiskQueryDeviceProtocolData outBuffer,
                                             uint nOutBufferSize,
                                             out uint pBytesReturned,
                                             IntPtr overlapped);
コード例 #2
0
        /// <summary>
        ///     Returns true if the specified handle is controlled by a SFFDISK (aka SDHCI) driver
        /// </summary>
        /// <param name="fd">Device handle</param>
        /// <returns><c>true</c> if SDHCI, false otherwise</returns>
        internal static bool IsSdhci(SafeFileHandle fd)
        {
            SffdiskQueryDeviceProtocolData queryData1 = new SffdiskQueryDeviceProtocolData();

            queryData1.size = (ushort)Marshal.SizeOf(queryData1);
            Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskQueryDeviceProtocol, IntPtr.Zero, 0, ref queryData1,
                                   queryData1.size, out _, IntPtr.Zero);
            return(queryData1.protocolGuid.Equals(Consts.GuidSffProtocolSd));
        }