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 ...
随机推荐
- 关于 argc 和 argv
https://stackoverflow.com/questions/3898021/regarding-mainint-argc-char-argv 当使用命令行启动程序,或者给程序传输参数时,可 ...
- input、textarea等输入框输入中文时,拼音在输入框内会触发input事件的问题
监听文本输入框的input事件,在拼写汉字(输入法)但汉字并未实际填充到文本框中(选词)时会触发input事件,如图: 但是在很多情况下,只需要输入到输入框的中文字符. 解决办法: 通过查阅资料得知在 ...
- Windows tasklist
TASKLIST [/S system [/U username [/P [password]]]] [/M [module] | /SVC | /V] [/FI filter] [/ ...
- 最大流——hdu4292(类似poj3281 带间隔的流)
#include<bits/stdc++.h> using namespace std; #define maxn 100005 #define inf 0x3f3f3f3f ]; int ...
- 学习js和jQuery总结
数据类型的转换:1.字符串必须放在引号内2.字符串的转换有两个标签,string和tostring这两个函数.3.变量必须使用驼峰形式,把一个变量转换成字符串:console.log(isChild. ...
- SpringCloud学习笔记(七):Hystrix断路器
概述 什么时候需要断路器?熔断? 举个简单的例子:小明喜欢小美,可是小美没有电话,小美给了小明家里的座机,小明打给座机,这个时候小美的妈妈接到了,小明怕妈妈知道自己喜欢小美,就跟小美妈妈说让小美哥接电 ...
- zookeeper 选举白话理解
- JVM系列(三)— Java内存模型
我们已经了解了Java虚拟机的运行时数据区,垃圾收集相关知识,接下来学习虚拟机非常重要的部分 这就是Java内存模型与线程(第12章),这一篇,将主要讲讲内存模型 了解Java内存模型之前,先了解下计 ...
- 侧滑关闭Activity的解决方案——SwipeBackLayout
项目地址:ikew0ng/SwipeBackLayout: An Android library that help you to build app with swipe back gesture. ...
- 2019-11-12-浅谈-Windows-桌面端触摸架构演进
title author date CreateTime categories 浅谈 Windows 桌面端触摸架构演进 lindexi 2019-11-12 14:37:31 +0800 2019- ...