判断两个文件是否属于同一个卷 [英] Determine if two files belongs to the same volume

查看:31
本文介绍了判断两个文件是否属于同一个卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一些 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:

  1. 找到这两个文件的根路径,并使用GetVolumeInformation 以查找卷名.
  2. 打开文件句柄并将其传递给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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆