다음을 통해 공유


XXX_IOControl (Device Manager) (Windows Embedded CE 6.0)

1/6/2010

This function sends a command to a device.

Syntax

BOOL XXX_IOControl(
  DWORD hOpenContext,
  DWORD dwCode,
  PBYTE pBufIn,
  DWORD dwLenIn,
  PBYTE pBufOut,
  DWORD dwLenOut,
  PDWORD pdwActualOut 
);

Parameters

  • hOpenContext
    [in] Handle to the open context of the device. The XXX_Open (Device Manager) function creates and returns this identifier.
  • dwCode
    [in] I/O control operation to perform. These codes are device-specific and are usually exposed to developers through a header file.
  • pBufIn
    [in] Pointer to the buffer containing data to transfer to the device.
  • dwLenIn
    [in] Number of bytes of data in the buffer specified for pBufIn.
  • pBufOut
    [out] Pointer to the buffer used to transfer the output data from the device.
  • dwLenOut
    [in] Maximum number of bytes in the buffer specified by pBufOut.
  • pdwActualOut
    [out] Pointer to the DWORD buffer that this function uses to return the actual number of bytes received from the device.

Return Value

TRUE indicates success. FALSE indicates failure.

Remarks

An application uses the DeviceIoControl function to specify an operation to perform. The operating system, in turn, invokes the XXX_IOControl function. The dwCode parameter contains the input or output operation to perform; these codes are usually specific to each device driver and are exposed to application programmers through a header file that the device driver developer makes available.

If you define the HKEY_LOCAL_MACHINE\Drivers\BuiltIn\MyDevice\Ioctl registry key for your device driver, Device Manager invokes the XXX_IOControl function when it loads and initializes your device driver. It uses the Ioctl registry value for the dwCode parameter and NULL for the pBufIn and pBufOut parameters. Your device might use this option to load other modules that require the installation of the basic device driver, or as a trigger to perform any other actions that are not suited to being part of the XXX_Init (Device Manager) function. The actual sequence of calls made to a device driver in this scenario is XXX_Init, XXX_Open, XXX_IOControl, and XXX_Close (Device Manager). The XXX_Open function call is necessary for Device Manager to retrieve a valid context handle, and the XXX_Close function is necessary to leave the device driver available to serve applications.

Device Manager uses the XXX prefix. When implementing the stream interface, replace XXX with a prefix appropriate for your specific implementation or use undecorated entry point names in conjunction with DEVFLAGS_NAKEDENTRIES. For more information about other valid Flags values, see ActivateDeviceEx.

If possible, implement all power management IOCTLs in your driver.

Requirements

Header Developer Implemented
Library Developer Implemented
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Stream Interface Driver Functions
ActivateDeviceEx
DeviceIoControl
XXX_Close (Device Manager)
XXX_Init (Device Manager)
XXX_Open (Device Manager)

Other Resources

Device Manager
Power Management I/O Controls
IOCTL_PSL_NOTIFY