请问windows 的 磁盘格式化里的 文件系统 和 分配单元大小是怎么取得的?
有没有这样的函数可以直接取得某个磁盘支持的 文件系统和分配单元大小呢?
如果没有的话,自己判断要怎么写呢谢谢了。

解决方案 »

  1.   

    FAT,FAT32,NTFS 直接指定选择项
      

  2.   

    如果磁盘不支持呢 不是会出错吗这个函数是不是呢
    HRESULT QueryFileSystemFormatSupport(
      [out]  VDS_FILE_SYSTEM_FORMAT_SUPPORT_PROP** ppFileSystemSupportProps,
      [out]  LONG* plNumberOfFileSystems
    );
      

  3.   

    unsigned _getdiskfree(
       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; 
    };
     
      

  4.   

    这个也不是我想要的,我是想自己写一个格式化的窗体
    上面这个得到的结果是这样的
    |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 |
      

  5.   

    不需要那样的东西把,具体文件系统的限制都是在编写规范时已知固定的,不会有针对特定磁盘支持的问题。
    直接按这个关系来就可以了。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
      

  6.   

    我是要自己写窗体,所以需要向 combobox里面加允许格式化的文件系统,我就是想问问有没有这样的函数
      

  7.   

    查看 GetDiskFreeSpaceEx和 GetVolumeInformation
      

  8.   

    HRESULT QueryPartitionFileSystemFormatSupport(
      [in] ULONGLONG ullOffset,
      [out, size_is(,*plNumberOfFileSystems)] 
        VDS_FILE_SYSTEM_FORMAT_SUPPORT_PROP** ppFileSystemSupportProps,
      [out] long* plNumberOfFileSystems
    );谁用过啊 给解释一下,这个函数应该可以取的 RAW 的容量,看样子是直接指定分区的Offset吧
      

  9.   

    不过这个函数需要vista win7
      

  10.   

    想写一个在windowsPE下用的格式化程序,就剩这一点没想好是自己写,还是找找MS有没有固定的函数。