// 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
No description available.
Returns the length, in bytes, of the disk, partition, or volume associated with the device object that is the target of the request.
None.
None.
The driver returns the GET_LENGTH_INFORMATION data in the buffer at Irp->AssociatedIrp.SystemBuffer.
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).
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.
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
);
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.
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.