NtDeviceIoControlFile function

Deprecated. Builds descriptors for the supplied buffer(s) and passes the untyped data to the device driver associated with the file handle. NtDeviceIoControlFile is superseded by DeviceIoControl.

Syntax

__kernel_entry NTSTATUS NtDeviceIoControlFile(
  IN HANDLE                     FileHandle,
  IN HANDLE Event               OPTIONAL,
  IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
  IN PVOID ApcContext           OPTIONAL,
  OUT PIO_STATUS_BLOCK          IoStatusBlock,
  IN ULONG                      IoControlCode,
  IN PVOID InputBuffer          OPTIONAL,
  IN ULONG                      InputBufferLength,
  OUT PVOID OutputBuffer        OPTIONAL,
  IN ULONG                      OutputBufferLength
);

Parameters

FileHandle

Open file handle to the file or device to which the control information should be given.

OPTIONAL

TBD

OPTIONAL

TBD

OPTIONAL

TBD

IoStatusBlock

Variable to receive the final completion status and information about the operation. Service calls that return information return the length of the data that is written to the output buffer in the Information field of this variable.

IoControlCode

Code that indicates which device I/O control function is to be executed.

OPTIONAL

TBD

InputBufferLength

Length of the InputBuffer in bytes. If the buffer is not supplied, then this value is ignored.

OPTIONAL

TBD

OutputBufferLength

Length of the OutputBuffer in bytes. If the buffer is not supplied, then this value is ignored.

Return Value

The various NTSTATUS values are defined in NTSTATUS.H, which is distributed with the Windows DDK.

Return code Description
STATUS_SUCCESS
The control operation was properly queued to the I/O system. Once the operation completes, the status can be determined by examining the Status field of the I/O status block.

Remarks

The NtDeviceIoControlFile service is a device-dependent interface that extends the control that applications have over various devices within the system. This API provides a consistent view of the input and output data to the system while still providing the application and the driver a device-dependent method of specifying a communications interface.

The type of access to the file that the caller needs is dependent on the actual operation being performed.

Once the service is complete the Event, if specified, is set to the signaled state. If no Event parameter is specified, then the file object specified by the FileHandle is set to the signaled state. If an ApcRoutine is specified, it is invoked with the ApcContext and the IoStatusBlock as its arguments.

Because there is no import library for this function, you must use GetProcAddress.

Requirements

   
Windows version Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winternl.h
DLL Ntdll.dll

See Also

Asynchronous Procedure Calls