Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "DeviceIOControl" in [All]

kernel32

.
Summary
.

static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode,

.

public static extern bool DeviceIoControl(

.

    public static extern bool DeviceIoControl(

.

    Shared Function DeviceIoControl(ByVal hDevice As IntPtr, ByVal dwIoControlCode As UInteger, ByVal lpInBuffer As IntPtr, ByVal nInBufferSize As UInteger, ByVal lpOutBuffer As IntPtr, ByVal nOutBufferSize As UInteger, ByRef lpBytesReturned As UInteger, ByVal lpOverlapped As IntPtr) As Boolean

.

    Public Shared Function DeviceIoControl(ByVal hDevice As IntPtr, _

.

    Public Shared Function DeviceIoControl( _

.

lpOverlapped - Main use in asynchronous deviceIoControl. NativeOverlapped is the managed version of the structure and use is the same. The difference between NativeOverlapped and Overlapped is managed Struct vs managed Class respectively. NativeOverlapped was more condusive for one-way device driver communication. Convert from Overlapped to NativeOverlapped to make the call, since NativeOverlapped is explicitly defined to mimic the unmanaged Overlapped structure.

.

Pin your NativeOverlapped structure, DeviceIoControl is asynchronous and will write into the overlapped structure upon completion of IO requested. If you NativeOverlapped structure has been moved by garbage collection it will write into the wrong area causing heap corruption.

.

If you want x64 proccessor support, you CANNOT use the System.Threading.NativeOverlapped structure as a ref parameter described above. The overlap structure must be allocated in global memory space. See the section "DeviceIoControl w/x64 support":

.

   If DeviceIoControl(hDriver, IOCTL_FARC_GET_CARDID, Nothing, 0, ip, 13, dwBytesReceived, Nothing) Then

.

public bool DeviceIoControl( IntPtr hDevice, uint dwIoControlCode, ref long buffer, int bufferSize, ref NativeOverlapped pOverlapped)

.

    return DeviceIoControl( hDevice, dwIoControlCode, ref buffer, bufferSize, ref buffer, bufferSize, ref NoReturn, ref pOverlapped );

.

    Status = DeviceIoControl( handle, Control, ref DeviceBuffer, 8, ref AdcOverlapData );

.

   Win32.DeviceIoControl(handle, IOCTL.DISK_GET_DRIVE_GEOMETRY,

.

   Win32.DeviceIoControl(handle, IOCTL.DISK_GET_PARTITION_INFO,

.

public static extern bool DeviceIoControl(

.

DeviceIoControl w/x64 support

.

    /// Pass this into the DeviceIoControl and GetOverlappedResult APIs

.

  DeviceIoControl(hDevice, iCtlCode, inBuffer, inSize, outBuffer, outSize, out ret, deviceIoOverlapped.GlobalOverlapped)

.

The DeviceIoControl API must declare an IntPtr for the OVERLAPPED parameter. All other deviations are OK.

.
Documentation
[DeviceIoControl] on MSDN
.

   Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr,   ByVal nInBufferSize As Integer, ByRef lpOutBuffer As IntPtr, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer

.

   Private Declare Ansi Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByVal lpInBuffer As Integer, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As Integer, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As Integer) As Integer

.

   Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As DISK_GEOMETRY, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer

.

   Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As GETVERSIONOUTPARAMS, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer

.

   Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As SENDCMDINPARAMS, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As IntPtr, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer

.

       result = DeviceIoControl(hdrive, DFP_GET_VERSION, IntPtr.Zero, 0, VersionParams, 24, bytesReturned, IntPtr.Zero)

.

       If DeviceIoControl(hdrive, DFP_RECEIVE_DRIVE_DATA, SCIP, 32, buffer, OUTPUT_DATA_SIZE, lpcbBytesReturned, IntPtr.Zero) Then

.

   int result=DeviceIoControl(fileHandle,(int)EIOControlCode.FsctlSetSparse,ref shTemp,0,IntPtr.Zero,0,ref dwTemp,IntPtr.Zero);

Constants

.
Summary
Used with DeviceIoControl and DRIVE_LAYOUT_INFORMATION_EX to retetrieve extended information for each entry in the partition tables for a disk.
.
Summary
Used with DeviceIoControl and USB_HCD_DRIVERKEY_NAME to get the "Driver Key Name" of a USB Hub Controller
.
Summary
Used with DeviceIoControl and STORAGE_DEVICE_NUMBER to get a unique device number for a storage device
.
Summary
.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_DRIVERKEY_NAME to get the "Driver Key Name" from a device on a USB Hub
.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_INFORMATION to get information from a port on a USB Hub
.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_INFORMATION_EX to get information from a port on a USB Hub
.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_NAME to get the Device Path of a device on a USB Hub
.
Summary
Used with DeviceIoControl and USB_NODE_INFORMATION to get information about ports on a USB Hub
.
Summary
Used with DeviceIoControl and USB_ROOT_HUB_NAME to get the Device Path to the USB Root Hub on a USB Controller

Structures

.
Summary
.

    // See the PInvoke definition of DeviceIoControl for EIOControlCode

.

    internal static extern bool DeviceIoControl(

.

        bool rc = DeviceIoControl(hMP

.

//IntPtr resultPtr is obtained from Kernel32.DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY control code

.

public extern static bool DeviceIoControl(IntPtr hDevice, uint IoControlCode,

.

     if (DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out requiredSize, IntPtr.Zero))

.

Used with DeviceIoControl with control flag IOCTL_STORAGE_QUERY_PROPERTY.

.
Summary
.

   if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))

.
Summary
Used by DeviceIoControl and IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION to get the Device Descriptor of a device on a port on a USB Hub
.
Summary
Used with DeviceIoControl and IOCTL_GET_HCD_DRIVERKEY_NAME to get the "DriverKeyName" of a USB Root hub
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.

   if (DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out nBytesReturned, IntPtr.Zero))

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME to get the "Driver Key Name" of a device on a USB Hub
.

   if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero))

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX to retrieve information about a port connection on a USB Hub
.

     if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero))

.

   if (DeviceIoControl(hHub, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptr_connection, size, ptr_connection, size, out bytes_returned, IntPtr.Zero))

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_NAME to get the Device Path of a downstream Hub
.

   if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out nBytesReturned, IntPtr.Zero))

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get connection-related information about a port on a USB Hub
.

   if (DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out nBytesReturned, IntPtr.Zero))

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_ROOT_HUB_NAME to return the "Symbolic Name" of a downstream USB Hub
.

   if (DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, out nBytesReturned, IntPtr.Zero))

.

   if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))

coredll

.

[DllImport("coredll.dll", EntryPoint="DeviceIoControl", SetLastError=true)]

.

        internal static extern int DeviceIoControlCE(

.

<DllImport("CoreDll.dll")> Function DeviceIoControl(ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, _

.

DeviceIoControlCE(m_hPort, 0x1003, PosX, PosX.Length, outDataX, outDataX.Length, ref xfer, IntPtr.Zero)

.

static void DeviceIoControl(int controlCode, int[] inBuffer, int[] outBuffer)

.

        if (!NativeMethods.DeviceIoControl(file, controlCode, inBuffer, inSize, outBuffer, outSize, ref bytesReturned, IntPtr.Zero))

.
Documentation
[DeviceIOControl] on MSDN

 
Access PInvoke.net directly from VS: