Windows API 第20篇 GetVolumeNameForVolumeMountPoint
函数原型:
BOOL GetVolumeNameForVolumeMountPoint(
IN LPCTSTR lpszVolumeMountPoint, // volume mount point or directory
OUT LPTSTR lpszVolumeName, // volume name buffer
IN DWORD cchBufferLength // size of volume name buffer);
\\?\Volume{fe04a016-a8fc-11e4-824b-806e6f6e6963}\ 这样的字符
The GetVolumeNameForVolumeMountPoint function takes a volume mount point
or root directory and returns the corresponding unique volume name.
举例:
1)传入更目录
CHAR szVolumeName[MAX_PATH] = { 0 };
BOOL bRet = GetVolumeNameForVolumeMountPointA("C:\\", szVolumeName, MAX_PATH);
2)传入一个已存在的卷的挂载点,假设设置了D盘的挂载点为 C:\test\
CHAR szVolumeName[MAX_PATH] = { 0 };
BOOL bRet = GetVolumeNameForVolumePountPointA("C:\\test\\, szVolumeName, MAX_PATH");
标注:
The lpszVolumeMountPoint input string may be a drive letter with
appended backslash (\), such as "D:\". Alternatively, it may be a path to a
volume mount point, again with appended backslash (\), such as
"c:\mnt\edrive\".
关于Unique Volume Name介绍:
Two factors can make it hard to reliably mount a specific volume at a
specified volume mount point across operating system restarts. One factor is
that two different volumes can have the same label, which makes them
indistinguishable except by drive letter. The other factor is that drive letters
do not necessarily remain the same. If a computer's administrator does not use
the Disk Administrator to enforce drive letters, then drive letters can change
as drives are removed from or added to the system.
To solve this problem, the system refers to volumes to be mounted with unique
volume names. These are strings of this form:
"\\?\Volume{GUID}\"
where GUID is a globally unique identifier (GUID) that identifies the
volume. The \\?\ turns off path parsing and is ignored as part of the
path, as discussed in Path Lengths. Note the
trailing backslash. All volume mount point functions that take a unique volume
name as a parameter require the trailing backslash; all volume mount point
functions that return a unique volume name provide the trailing backslash. You
can use CreateFile to open a volume by
referring to its unique volume name, but without a trailing backslash. When
using CreateFile, a unique volume name with a backslash refers to the
root directory of the volume.
The operating system assigns a unique volume name to a volume when the
computer first encounters it, for example during formatting or installation. The
volume mount point functions use unique volume names to refer to volumes. To
learn the unique volume name of any drive, use the GetVolumeNameForVolumeMountPoint function.
Windows API 第20篇 GetVolumeNameForVolumeMountPoint的更多相关文章
- Windows API 第20篇 SetVolumeMountPoint 设置卷挂载点参数错误
函数原型:BOOL SetVolumeMountPoint( IN LPCTSTR lpszVo ...
- windows API 第22篇 WTSGetActiveConsoleSessionId
函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...
- windows API 第13篇 MoveFileEx
上一篇介绍了MoveFile,这次分析MoveFileEx,它是MoveFile的扩展函数,功能还要更加强大些.先看定义: BOOL WINAPI MoveFileEx( _In_ LPCTS ...
- Windows API 第六篇 GetLocalTime
GetLocalTime获取系统时间信息.函数原型:VOID WINAPI GetLocalTime( __out LPSYSTEMTIME lpSystemTime ); 先来看S ...
- Windows API 第三篇
1.获得程序自身的路径: DWORD GetModuleFileName( HMODULE hModule, // handle to module LPTSTR lpFilename, // pat ...
- Windows API 第21篇 DeleteVolumeMountPoint 删除挂载点
函数原型:BOOL DeleteVolumeMountPoint( LPCTSTR lpszV ...
- Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint
相关函数:HANDLE FindFirstVolumeMountPoint( ...
- windows API 第 18篇 FindFirstVolume FindNextVolume
函数定义:Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the vol ...
- Windows API 第17篇 GetLogicalDriveStrings 获取本机所有逻辑驱动器,以根目录的形式表示
函数原型:DWORD GetLogicalDriveStrings( DWORD nBufferLength, // size of buffer ...
随机推荐
- chrome的驱动安装
首先找到对应的chromedriver,百度搜索,http://npm.taobao.org/mirrors/chromedriver/ 将下载好的chrome驱动解压,放在/usr/loacl/bi ...
- MySQL语句基本操作增删改查
select * from 表名; --------->效率低
- CF Round #427 (Div. 2) C. Star sky [dp]
题目链接就长这样子? time limit per test 2 seconds memory limit per test 256 megabytes Description The Carte ...
- 0920CSP-S模拟测试赛后总结
依旧挂了. 这次出题人十分良心.白送了180分……于是我没有拿到.130分rank43滚粗了. T1是道sbdp.然而我死想哈希.然后就死在哈希上了. 我简直是个傻子.之前考了几次字符串的题可以用哈希 ...
- 计算几何——点线关系(叉积)poj2318
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #i ...
- windows安装vscode,配置golang环境
出现的问题: 进行如下命令进行目录切换:cd %GOPATH%\src\github.com\golang我这里的GOPATH是在D:\GoPath,大家这里一定要注意些如果src目录下面没有gith ...
- Git远程仓库版本回退
1.首先将本地仓库版本回退到自己想要的版本. git reset commit_id 2.将回退后的版本强制推送到远程仓库. git push -f origin master
- Vue基础(1)
目录 Vue基础 基础 导入 1. 挂载 2. 插值表达式 3. 事件 4. 创建对象 5. v-text和v-html 6. vue的过滤器 7. 属性指令 Vue基础 基础 首先我们要知道Vue是 ...
- Python第二课-输入输出
name = input() 输入的字符串已经赋值给变量name print() 输出内容 print(,) print中,连接字符串相当于空格
- 查出当前操作数据库的登入名SUSER_NAME()
select SUSER_NAME() 一般和触发器一起用来监控是谁对表做了操作