标签归档:VC

VC获取硬盘物理扇区与逻辑扇区大小

 

Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the storage access alignment descriptor data for a device.

Syntax

Members

Version

Contains the size of this structure, in bytes. The value of this member will change as members are added to the structure.

Size

Specifies the total size of the data returned, in bytes. This may include data that follows this structure.

BytesPerCacheLine

The number of bytes in a cache line of the device.

BytesOffsetForCacheAlignment

The address offset necessary for proper cache access alignment, in bytes.

BytesPerLogicalSector

The number of bytes in a logical sector of the device.

BytesPerPhysicalSector

The number of bytes in a physical sector of the device.

BytesOffsetForSectorAlignment

The logical sector offset within the first physical sector where the first logical sector is placed, in bytes.

Example: Offset = 3 Logical sectors

In this example, BytesOffsetForSectorAlignment = 3 * BytesPerLogicalSector.

Examples

The following sample code retrieves a STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR structure and displays the physical sector size and the logical sector size if it differs from the physical sector size.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinIoCtl.h (include Windows.h)