FSCTL_ALLOW_EXTENDED_DASD_IO

[This is preliminary documentation and subject to change.]

The FSCTL_ALLOW_EXTENDED_DASD_IO operation 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 of interest
  FSCTL_ALLOW_EXTENDED_DASD_IO,  // dwIoControlCode, control code of
                           // operation to perform
  NULL,                    // lpInBuffer is not used; must be NULL
  0,                       // nInBufferSize is not used; must be zero
  NULL,                    // lpOutBuffer is not used; must be NULL
  0,                       // nOutBufferSize is not used;
                           // must be zero
  (LPDWORD) lpBytesReturned,   // pointer to variable to receive
                           // output byte count
  (LPOVERLAPPED) lpOverlapped  // pointer to OVERLAPPED structure
                           // for asynchronous operation
);

Parameters

hDevice
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
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
Pointer to the input buffer. Not used; must be NULL.
nInBufferSize
Size, in bytes, of the input buffer. Not used; must be zero.
lpOutBuffer
Pointer to the output buffer. Not used; must be NULL.
nOutBuffer
Size, in bytes, of the output buffer. Not used; must be zero.
lpBytesReturned
Pointer to a DWORD variable.

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
Pointer to an OVERLAPPED structure.

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, this parameter must point to a valid OVERLAPPED structure. In this case, DeviceIoControl 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, this parameter is ignored and the DeviceIoControl function 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 operation, an extended Direct Access to Storage Device (DASD) operation, 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 after a FSCTL_ALLOW_EXTENDED_DASD_IO 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 an FSCTL_ALLOW_EXTENDED_DASD_IO 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 Windows NT recognizes the partition, use the IOCTL_DISK_GET_DRIVE_LAYOUT operation. For similar information on a single partition, use the IOCTL_DISK_GET_PARTITION_INFO operation. To determine the size of a cluster, use the GetDiskFreeSpaceEx or GetDiskFreeSpace function, as appropriate.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winioctl.h.

See Also

CreateFile, DeviceIoControl, GetDiskFreeSpace, GetDiskFreeSpaceEx, IOCTL_DISK_GET_DRIVE_LAYOUT, IOCTL_DISK_GET_PARTITION_INFO, OVERLAPPED