判断两个文件是否属于同一个卷 [英] Determine if two files belongs to the same volume
本文介绍了判断两个文件是否属于同一个卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一些 ntfs 硬链接项目中工作.我想知道如何确定两个文件(带完整路径)是否属于同一个卷.
I am working in the some ntfs hardlinks projects. I want to known how to determine if two files (with full path) belongs to the same volume.
推荐答案
用于查找与文件关联的卷信息的几个选项:
A couple of options to find the volume information associated with a file:
- 找到这两个文件的根路径,并使用
GetVolumeInformation
以查找卷名. - 打开文件句柄并将其传递给
GetVolumeInformationByHandleW
.
请注意,GetVolumeInformationByHandleW
需要 Vista,即 XP 不可用.
Note that GetVolumeInformationByHandleW
requires Vista, that is it is not available on XP.
通过比较卷序列号来检查是否相等.
Check for equality by comparing the volume serial number.
这篇关于判断两个文件是否属于同一个卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文