Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function provides the kernel with a generic I/O control for carrying out I/O operations.

Syntax

BOOL KernelIoControl(
  DWORD 
dwIoControlCode,
  LPVOID 
lpInBuf,
  DWORD 
nInBufSize,
  LPVOID 
lpOutBuf,
  DWORD 
nOutBufSize,
  LPDWORD 
lpBytesReturned
);

Parameters

dwIoControlCode

[in] I/O control code, which should support the OAL I/O controls

lpInBuf

[in] Pointer to a buffer that contains the data required to perform the operation.

Set to NULL if the dwIoControlCodeparameter specifies an operation that does not require input data.

nInBufSize

[in] Size, in bytes, of the buffer pointed to by lpInBuf.

lpOutBuf

[out] Pointer to a buffer that receives the output data for the operation.

Set to NULL if the dwIoControlCodeparameter specifies an operation that does not produce output data.

nOutBufSize

[in] Size, in bytes, of the buffer pointed to by lpOutBuf.

lpBytesReturned

[in] Long pointer to a variable that receives the size, in bytes, of the data stored in the buffer pointed to by lpOutBuf. Even when an operation produces no output data, and lpOutBufis NULL, the KernelIoControlfunction uses the variable pointed to by lpBytesReturned. After such an operation, the value of the variable has no meaning.

Return Value

TRUE indicates success. FALSE indicates failure.

Remarks

This function is also called when the SystemParametersInfofunction is called with SPI_GETOEMINFO or SPI_GETPLATFORMINFO. The system is fully preemptible when this function is called. The kernel does no processing, but it passes all parameters directly to the function supplied by you. This function is provided solely to allow your device driver or application to communicate with an OAL and its specific functionality.

An IOCTL call has this prototype:

BOOL KernelIOControl(UINT32 code, VOID* pInpBuffer, UINT32 inpSize, VOID* pOutBuffer, UINT32 outSize, UINT32 * pOutSize);

Assuming the caller passes a valid pOutSizepointer:

  1. If an IOCTL will never return data in * pOutBuffer, then set * pOutSize= 0 regardless of success or failure.

  2. If an IOCTL caller passes in otherwise correct parameters with a buffer that is too small (as determined by examining nOutSize), we will fail with ERROR_INSUFFICIENT_BUFFER and return * pOutSize= minimum buffer size necessary for success.

  3. If an IOCTL caller passes in correct parameters with a sufficient buffer ( nOutSize>= necessary size), we will return * pOutSize= # of bytes in the buffer that we actually filled upon completion (regardless of success or failure).

Requirements

Header pkfuncs.h
Library coredll.lib
Windows Embedded CE Windows CE 2.10 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also