解决方法
正如其他人所说,你需要使用GetFileInformationByHandleEx,但看起来你需要使用
FILE_ID_BOTH_DIR_INFO.你想要的信息在AllocationSize成员中返回.根据上面的链接,
AllocationSize
Contains the value that specifies how much space is allocated for the file,in bytes. This value is usually a multiple of the sector or cluster size of the underlying physical device.
这似乎为您提供磁盘大小信息.
我还没有找到FILE_ID_BOTH_DIR_INFO结构的Delphi转换.难度似乎是最终成员,WCHAR FileName [1],其描述如下:
FileName[07001]
Contains the first character of the file name string. This is followed in memory by the remainder of the string.
我不确定如何在Delphi中处理这个问题.