Skip to main content

Signals the file system driver not to perform any I/O boundary checks on partition read or write calls. Instead, boundary checks are performed by the device driver.

To perform this operation, call the DeviceIoControl function with the following parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,              // handle to device
  NULL,                          // lpInBuffer
  0,                             // nInBufferSize
  NULL,                          // lpOutBuffer
  0,                             // nOutBufferSize
  (LPDWORD) lpBytesReturned,     // number of bytes returned
  (LPOVERLAPPED) lpOverlapped    // OVERLAPPED structure



A handle to the logical volume (partition) on which extended read or write operations are to be allowed. To retrieve a device handle, call the CreateFile function with the FILE_SHARE_READ and FILE_SHARE_WRITE flags in the dwShareMode parameter. The process must have Administrator privileges to read from or write to the partition.


The control code for the operation. Use FSCTL_ALLOW_EXTENDED_DASD_IO for this operation.


Not used with this operation; set to NULL.


Not used with this operation; set to zero.


Not used with this operation; set to NULL.


Not used with this operation; set to zero.


A pointer to a variable that receives the size of the data stored in the output buffer, in bytes.

If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation returns no output data and lpOutBuffer is NULL, DeviceIoControl makes use of lpBytesReturned. After such an operation, the value of lpBytesReturned is meaningless.

If lpOverlapped is not NULL, lpBytesReturned can be NULL. If this parameter is not NULL and the operation returns data, lpBytesReturned is meaningless until the overlapped operation has completed. To retrieve the number of bytes returned, call GetOverlappedResult. If hDevice is associated with an I/O completion port, you can retrieve the number of bytes returned by calling GetQueuedCompletionStatus.


A pointer to an OVERLAPPED structure.

If hDevice was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored.

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways.

For overlapped operations, DeviceIoControl returns immediately, and the event object is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or an error occurs.

Return value

If the operation completes successfully, DeviceIoControl returns a nonzero value.

If the operation fails or is pending, DeviceIoControl returns zero. To get extended error information, call GetLastError.


A call using the FSCTL_ALLOW_EXTENDED_DASD_IO control code should only be used with great caution by programmers familiar with the underlying structure of a hard disk drive and file system. Improper use or inaccurate checking in subsequent write operations to the partition can result in damage to data on the partition, or destruction of the entire partition.

The FSCTL_ALLOW_EXTENDED_DASD_IO control code is used to signal the file system driver not to perform any I/O boundary checks on read or write calls made with the specified handle. FSCTL_ALLOW_EXTENDED_DASD_IO allows access to hidden sectors, a part of the partition that might exist between the first sector of the partition (the boot parameter block) and the first useful sector of the partition. FSCTL_ALLOW_EXTENDED_DASD_IO also allows access to lost clusters, which might exist between the last useful cluster and the end of the partition.

I/O requests issued after this operation are passed directly to the device driver. If these subsequent calls request data beyond the partition boundary, the driver causes them to fail.

For the implications of overlapped I/O on this operation, see the Remarks section of DeviceIoControl.

To retrieve a handle to a partition, call CreateFile with the lpFileName parameter set to a string of the following form:


where X is the drive letter.

The application calling CreateFile must also specify the FILE_SHARE_READ and FILE_SHARE_WRITE flags in the dwShareMode parameter of CreateFile. For more information, see the Disk Devices section in CreateFile.

To determine the partition structure of the drive and to determine if the system recognizes the partition, use the IOCTL_DISK_GET_DRIVE_LAYOUT_EX or IOCTL_DISK_GET_DRIVE_LAYOUT control code, as appropriate. For similar information on a single partition, use the IOCTL_DISK_GET_PARTITION_INFO_EX or IOCTL_DISK_GET_PARTITION_INFO control code, as appropriate. To determine the size of a cluster, use the GetDiskFreeSpaceEx or GetDiskFreeSpace function, as appropriate.

In Windows Server 2012, this function is supported by the following technologies.


Server Message Block (SMB) 3.0 protocol


SMB 3.0 Transparent Failover (TFO)


SMB 3.0 with Scale-out File Shares (SO)


Cluster Shared Volume File System (CsvFS)


Resilient File System (ReFS)




Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]


WinIoCtl.h (include Windows.h)

See also

File Management Control Codes