Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IOCTL_DISK_GET_LENGTH_INFO IOCTL (winioctl.h)

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
);

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.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header winioctl.h (include Windows.h)

See also


Feedback

Was this page helpful?

Additional resources