Example #1
0
 public static extern bool DeviceIoControl(SafeFileHandle hDevice,
                                           EIOControlCode IoControlCode,
                                           IntPtr InBuffer,
                                           uint nInBufferSize,
                                           IntPtr OutBuffer,
                                           uint nOutBufferSize,
                                           ref uint pBytesReturned,
                                           [In] ref System.Threading.NativeOverlapped Overlapped);
Example #2
0
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     IntPtr InBuffer,
     uint nInBufferSize,
     ref DISK_GEOMETRY OutBuffer,
     uint nOutBufferSize,
     out uint pBytesReturned,
     IntPtr Overlapped
     );
 internal static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     ref INJECT_MOUSE_MOVEMENT_INPUT_REQUEST InBuffer,
     int nInBufferSize,
     ref INJECT_MOUSE_MOVEMENT_INPUT_REQUEST OutBuffer,
     int nOutBufferSize,
     out uint pBytesReturned,
     IntPtr Overlapped
     );
 internal static extern bool DeviceIoControl(
     Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
     EIOControlCode ioControlCode,
     [In] IntPtr inBuffer,
     uint nInBufferSize,
     [Out] IntPtr outBuffer,
     uint nOutBufferSize,
     out uint pBytesReturned,
     [In] IntPtr overlapped
     );
 internal static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     ref MOUSE_DEVICE_STACK_INFORMATION InBuffer,
     int nInBufferSize,
     ref MOUSE_DEVICE_STACK_INFORMATION OutBuffer,
     int nOutBufferSize,
     out uint pBytesReturned,
     IntPtr Overlapped
     );
Example #6
0
 internal static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode dwIoControlCode,
     IntPtr inBuffer,
     int nInBufferSize,
     IntPtr outBuffer,
     int nOutBufferSize,
     ref int pBytesReturned,
     IntPtr lpOverlapped
 );
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode dwIoControlCode,
     IntPtr InBuffer,
     int nInBufferSize,
     IntPtr OutBuffer,
     int nOutBufferSize,
     ref int pBytesReturned,
     [In] ref NativeOverlapped lpOverlapped
     );
Example #8
0
 private static extern bool DeviceIoControl(
     IntPtr hDevice,
     EIOControlCode IoControlCode,
     IntPtr InBuffer,
     int nInBufferSize,
     IntPtr OutBuffer,
     int nOutBufferSize,
     out int pBytesReturned,
     IntPtr Overlapped
     );
Example #9
0
 private static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode ioControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object inBuffer,
     uint nInBufferSize,
     [MarshalAs(UnmanagedType.AsAny)]
     [Out] object outBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] IntPtr /*NativeOverlapped*/ overlapped);
Example #10
0
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [Out] out USN_JOURNAL_DATA OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] IntPtr overlapped //[In] ref System.Threading.NativeOverlapped Overlapped
     );
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [MarshalAs(UnmanagedType.AsAny)]
     [Out] object OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] ref NativeOverlapped Overlapped
     );
 internal static extern bool DeviceIoControl(
     Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [MarshalAs(UnmanagedType.AsAny)]
     [Out] object OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] IntPtr Overlapped
     );
 public static extern bool DeviceIoControl(
     Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [MarshalAs(UnmanagedType.AsAny)]
     [Out] object OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] ref System.Threading.NativeOverlapped Overlapped
     );
Example #14
0
        public static unsafe bool DeviceIoControl(
            SafeFileHandle hDevice,
            EIOControlCode dwIoControlCode,
            ref byte[] InBuffer,
            ref byte[] OutBuffer,
            ref int pBytesReturned)
        {
            bool ret;

            //We need this helper in case that the byte-Array has zero length
            byte[] _InBuffer, _OutBuffer;

            if (InBuffer.Length == 0)
            {
                _InBuffer = new byte[1];
            }
            else
            {
                _InBuffer = InBuffer;
            }
            if (OutBuffer.Length == 0)
            {
                _OutBuffer = new byte[4];
            }
            else
                _OutBuffer = OutBuffer;

            // Now we fix the arrays so that the DeviceIO function always have fixed
            fixed(byte *inp = &_InBuffer[0])
            {
                fixed(byte *outp = &_OutBuffer[0])
                {
                    ret = DeviceIO_Unmanaged.DeviceIoControl(hDevice, dwIoControlCode, (IntPtr)inp, InBuffer.Length, (IntPtr)outp, OutBuffer.Length, ref pBytesReturned, IntPtr.Zero);
                }
            }

            if (pBytesReturned > OutBuffer.Length)
            {
                return(false);
            }

            return(ret);
        }
Example #15
0
        internal static extern bool DeviceIoControl(
            SafeFileHandle hDevice,

            EIOControlCode dwIoControlCode,

            [MarshalAs(UnmanagedType.AsAny)]
            [In] object InBuffer,

            int nInBufferSize,

            [MarshalAs(UnmanagedType.AsAny)]
            [Out] object OutBuffer,

            int nOutBufferSize,

            ref int pBytesReturned,

            IntPtr lpOverlapped
            );
Example #16
0
 private static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode dwIoControlCode,
     IntPtr InBuffer,
     int nInBufferSize,
     IntPtr OutBuffer,
     int nOutBufferSize,
     ref int pBytesReturned,
     IntPtr lpOverlapped //[In] ref NativeOverlapped lpOverlapped
     );
Example #17
0
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [Out] out USN_JOURNAL_DATA OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] IntPtr overlapped //[In] ref System.Threading.NativeOverlapped Overlapped
     );
Example #18
0
 public static extern bool DeviceIoControl(
     SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [In] ref MFT_ENUM_DATA InBuffer,
     uint nInBufferSize,
     [In] IntPtr OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] IntPtr overlapped //[In] ref System.Threading.NativeOverlapped Overlapped
     );
Example #19
0
        internal static extern bool DeviceIoControl(
            SafeFileHandle hDevice,

            EIOControlCode dwIoControlCode,

            [MarshalAs(UnmanagedType.AsAny)]
            [In] object InBuffer,

            int nInBufferSize,

            [MarshalAs(UnmanagedType.AsAny)]
            [Out] object OutBuffer,

            int nOutBufferSize,

            ref int pBytesReturned,

            IntPtr lpOverlapped
            );
 public static extern bool DeviceIoControl(
     Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
     EIOControlCode IoControlCode,
     [MarshalAs(UnmanagedType.AsAny)]
     [In] object InBuffer,
     uint nInBufferSize,
     [MarshalAs(UnmanagedType.AsAny)]
     [Out] object OutBuffer,
     uint nOutBufferSize,
     ref uint pBytesReturned,
     [In] ref System.Threading.NativeOverlapped Overlapped
 );
Example #21
0
        public static unsafe bool DeviceIoControl(
            SafeFileHandle hDevice,
            EIOControlCode dwIoControlCode,
            ref byte[] InBuffer,
            ref byte[] OutBuffer,
            ref int pBytesReturned)
        {
            bool ret;

            //We need this helper in case that the byte-Array has zero length
            byte[] _InBuffer, _OutBuffer;

            if (InBuffer.Length == 0)
                _InBuffer = new byte[1];
            else
                _InBuffer = InBuffer;
            if (OutBuffer.Length == 0)
                _OutBuffer = new byte[4];
            else
                _OutBuffer = OutBuffer;

            // Now we fix the arrays so that the DeviceIO function always have fixed
            fixed (byte* inp = &_InBuffer[0])
            {
                fixed (byte* outp = &_OutBuffer[0])
                {
                    ret = DeviceIO_Unmanaged.DeviceIoControl(hDevice, dwIoControlCode, (IntPtr)inp, InBuffer.Length, (IntPtr)outp, OutBuffer.Length, ref pBytesReturned, IntPtr.Zero);
                }
            }

            if (pBytesReturned > OutBuffer.Length)
                return false;

            return ret;
        }
		public static extern bool DeviceIoControl(
				SafeFileHandle hDevice,
				EIOControlCode IoControlCode,
				IntPtr InBuffer,
				uint nInBufferSize,
				ref DISK_GEOMETRY OutBuffer,
				uint nOutBufferSize,
				out uint pBytesReturned,
				IntPtr Overlapped
				);