Parameters [in] drive The disk drive for which you want information.[out] driveinfo A _diskfree_t structure that will be populated with information about the drive.Return Value If the function succeeds, the return value is zero. If the function fails, the return value is the error code. The value errno is set for any errors returned by the operating system. For more information about error conditions indicated by errno, see errno.Res The _diskfree_t structure is defined in Direct.h. Copy Code struct _diskfree_t { unsigned total_clusters; unsigned avail_clusters; unsigned sectors_per_cluster; unsigned bytes_per_sector; };
HRESULT QueryFileSystemFormatSupport(
[out] VDS_FILE_SYSTEM_FORMAT_SUPPORT_PROP** ppFileSystemSupportProps,
[out] LONG* plNumberOfFileSystems
);
unsigned drive,
struct _diskfree_t * driveinfo
);
Parameters
[in] drive
The disk drive for which you want information.[out] driveinfo
A _diskfree_t structure that will be populated with information about the drive.Return Value
If the function succeeds, the return value is zero. If the function fails, the return value is the error code. The value errno is set for any errors returned by the operating system. For more information about error conditions indicated by errno, see errno.Res
The _diskfree_t structure is defined in Direct.h. Copy Code
struct _diskfree_t {
unsigned total_clusters;
unsigned avail_clusters;
unsigned sectors_per_cluster;
unsigned bytes_per_sector;
};
上面这个得到的结果是这样的
|DRIVE|TOTAL CLUSTERS|AVAIL CLUSTERS|SECTORS / CLUSTER|BYTES / SECTOR|
|=====|==============|==============|=================|==============|
| C: | 4,721,093 | 3,778,303 | 8 | 512 |
| D: | 1,956,097 | 1,800,761 | 8 | 512 |
直接按这个关系来就可以了。FAT32最小32MiB,理论最大8TiB(使用32KiB的簇),NTFS最小8MiB(一般Windows不会在小于512MiB分区创建),理论最大2^64 - 1个簇,如果用64KiB,就是16EiB - 64KiB,不过目前版本的Windows只能支持到256TiB - 64KiB。而且如果你使用MBR分区表,分区最大都只能是2TiB,要用更大分区必须用GPT。
此外考虑到向下兼容性,Windows安装程序只能创建小于127GiB的分区。
http://www.siqiboke.com/post/110.html
[in] ULONGLONG ullOffset,
[out, size_is(,*plNumberOfFileSystems)]
VDS_FILE_SYSTEM_FORMAT_SUPPORT_PROP** ppFileSystemSupportProps,
[out] long* plNumberOfFileSystems
);谁用过啊 给解释一下,这个函数应该可以取的 RAW 的容量,看样子是直接指定分区的Offset吧