Platform SDK: Hardware

FSCTL_ALLOW_EXTENDED_DASD_IO

Using the FSCTL_ALLOW_EXTENDED_DASD_IO control code 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
  FSCTL_ALLOW_EXTENDED_DASD_IO,  // dwIoControlCode operation
  NULL,                          // lpInBuffer; must be NULL
  0,                             // nInBufferSize; must be zero
  NULL,                          // lpOutBuffer; must be NULL
  0,                             // nOutBufferSize; must be zero
  (LPDWORD) lpBytesReturned,     // number of bytes returned
  (LPOVERLAPPED) lpOverlapped    // OVERLAPPED structure
);

Parameters

hDevice
[in] Handle to the logical volume (partition) on which extended read or write operations are to be allowed. To obtain 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.
dwIoControlCode
[in] Control code for the operation. This value identifies the specific operation to be performed and the type of device on which to perform it. Use FSCTL_ALLOW_EXTENDED_DASD_IO for this operation.
lpInBuffer
[in] Pointer to the input buffer. Not used; must be NULL.
nInBufferSize
[in] Size, in bytes, of the input buffer. Not used; must be zero.
lpOutBuffer
[out] Pointer to the output buffer. Not used; must be NULL.
nOutBuffer
[in] Size, in bytes, of the output buffer. Not used; must be zero.
lpBytesReturned
[out] Pointer to a variable that receives the actual count of bytes returned by the function in the output buffer.

If lpOverlapped is NULL (nonoverlapped I/O), lpBytesReturned is used internally and cannot be NULL.

If lpOverlapped is not NULL (overlapped I/O), lpBytesReturned can be NULL.

lpOverlapped
[in] Pointer to an OVERLAPPED structure.

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, lpOverlapped must point to a valid OVERLAPPED structure. In this case, the operation is performed as an overlapped (asynchronous) operation. If the device was opened with the FILE_FLAG_OVERLAPPED flag and lpOverlapped is NULL, the function fails in unpredictable ways.

If hDevice was opened without specifying the FILE_FLAG_OVERLAPPED flag, lpOverlapped is ignored and DeviceIoControl does not return until the operation has been completed, or until an error occurs.

Return Values

If the operation succeeds, DeviceIoControl returns a nonzero value.

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

Remarks

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 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 obtain a handle to a partition, pass in the CreateFile parameter lpFileName a value of the following form:

\\.\X:

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 control code. For similar information on a single partition, use the IOCTL_DISK_GET_PARTITION_INFO control code. To determine the size of a cluster, use the GetDiskFreeSpaceEx or GetDiskFreeSpace function, as appropriate.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winioctl.h.

See Also

Device Input and Output Overview, Device Input and Output Control Codes, CreateFile, DeviceIoControl, GetDiskFreeSpace, GetDiskFreeSpaceEx, IOCTL_DISK_GET_DRIVE_LAYOUT, IOCTL_DISK_GET_PARTITION_INFO, OVERLAPPED