Share via


ForwardDeviceIoControl (Windows Embedded CE 6.0)

1/6/2010

This function enables a driver to forward I/O controls to other drivers when the driver does not know anything about the I/O control, so no validation is performed. The driver that is called into still has the correct direct caller information to perform parameter validation.

Syntax

BOOL ForwardDeviceIoControl (
  HANDLE hDevice,
  DWORD dwIoControlCode,
  LPVOID lpInBuf,
  DWORD nInBufSize,
  LPVOID lpOutBuf,
  DWORD nOutBufSize,
  LPDWORD lpBytesReturned,
  LPOVERLAPPED lpOverlapped
);

Parameters

  • hDevice
    [in] Handle to the device that is to perform the operation. To obtain a device handle, call the CreateFile function.
  • dwIoControlCode
    [in] I/O control for the operation. This value identifies the operation to perform and the type of device on which to perform it. There are no specific values defined for the dwIoControlCode parameter. However, you can define custom IOCTL_XXX IOCTLs with the CTL_CODE macro. You can then advertise these I/O controls, and applications can use them with DeviceIoControl to perform driver-specific operations.
  • lpInBuf
    [in] Long pointer to a buffer that contains the data required to perform the operation. Set to NULL if the dwIoControlCode parameter specifies an operation that input data is not required.
  • nInBufSize
    [in] Size, in bytes, of the buffer pointed to by lpInBuffer.
  • lpOutBuf
    [out] Long pointer to a buffer that receives the output data for the operation. Set to NULL if the dwIoControlCode parameter specifies an operation that does not produce output data.
  • nOutBufSize
    [out] Size, in bytes, of the buffer pointed to by lpOutBuffer.
  • lpBytesReturned
    [out] Long pointer to a variable that receives the size, in bytes, of the data stored in lpOutBuffer. The DeviceIoControl function may unnecessarily use this parameter. For example, if an operation does not produce data for lpOutBuffer and lpOutBuffer is NULL, the value of lpBytesReturned is meaningless.
  • lpOverlapped
    [in] Ignored; set to NULL.

Return Value

Nonzero indicates success. Zero indicates failure. To obtain extended error information, call the GetLastError function.

Remarks

This is the same as the DeviceIoControl function, with one exception. When called from kernel mode, this function does not change the direct caller to the kernel, whereas DeviceIoControl changes the direct caller. That is, it remains the same direct caller as the caller of this function.

Requirements

Header pkfuncs.h
Library coredll.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

Kernel Functions
GetCallerVMProcessId
GetDirectCallerProcessId

Concepts

New Kernel APIs

Other Resources

CreateFile
CTL_CODE
DeviceIoControl