IOCTL_DISK_GET_LENGTH_INFO - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntdddisk.h

// CTL_CODE(0x0007, 0x017, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_LENGTH_INFO 0x0007405C

View the official Windows Driver Kit DDI reference
// winioctl.h

// CTL_CODE(0x0007, 0x017, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_LENGTH_INFO 0x0007405C

View the official Win32 API reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ni-ntdddisk-ioctl_disk_get_length_info)

IOCTL_DISK_GET_LENGTH_INFO IOCTL

Description

Returns the length, in bytes, of the disk, partition, or volume associated with the device object that is the target of the request.

Parameters

Major code

Input buffer

None.

Input buffer length

None.

Output buffer

The driver returns the GET_LENGTH_INFORMATION data in the buffer at Irp->AssociatedIrp.SystemBuffer.

Output buffer length

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the buffer, which must be >= sizeof(GET_LENGTH_INFORMATION).

Input/output buffer

Input/output buffer length

Status block

The Information field is set to the size, in bytes, of the returned data. The Status field can be set to STATUS_SUCCESS, or to STATUS_BUFFER_TOO_SMALL if the buffer supplied by the caller is inadequate.

See also

GET_LENGTH_INFORMATION


Win32 API reference (ni-winioctl-ioctl_disk_get_length_info)

IOCTL_DISK_GET_LENGTH_INFO IOCTL

Description

Retrieves the length of the specified disk, volume, or partition.

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

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  IOCTL_DISK_GET_LENGTH_INFO,   // dwIoControlCode
  NULL,                         // lpInBuffer
  0,                            // nInBufferSize
  (LPVOID) lpOutBuffer,         // output buffer
  (DWORD) nOutBufferSize,       // size of output buffer
  (LPDWORD) lpBytesReturned,    // number of bytes returned
  (LPOVERLAPPED) lpOverlapped   // OVERLAPPED structure
);

Parameters

Input buffer

Input buffer length

Output buffer

Output buffer length

Input/output buffer

Input/output buffer length

Status block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.

Otherwise, Status to the appropriate error condition as a NTSTATUS code.

For more information, see NTSTATUS Values.

Remarks

Volume handles do not have access to the full volume. To read or write to the last few sectors of a volume, you must call FSCTL_ALLOW_EXTENDED_DASD_IO, which instructs the file system to not perform any boundary checks.

This operation should be used instead of IOCTL_DISK_GET_PARTITION_INFO_EX for volumes that do not have partition info—such as partition type or number of hidden sectors.

See also