函数原型:
BOOL SetVolumeMountPoint
                                                 IN   LPCTSTR lpszVolumeMountPoint, // mount point
                                                 IN   LPCTSTR lpszVolumeName        // volume to be mounted
                                               );
参数:
lpszVolumeMountPoint:要设置的挂载点,如:“C:\\MyDrive\\DDrive\\”,  必须以反斜杠'\'结尾
lpszVolumeName  :指定的卷名,这个卷名必须为全局标志符(GUID),像
   \\?\Volume{fe04a016-a8fc-11e4-824b-806e6f6e6963}\      这种形式。得到GUID的方法有很多,调用GetVolumeName
GetVolumeNameForVolumeMountPoint 都可以得到。
下面为我的F盘设置一个挂载点:

int _tmain(int argc, _TCHAR* argv[])
{
CHAR szVolumeName[MAX_PATH] = { 0 };
BOOL bRet = GetVolumeNameForVolumeMountPointA("F:\\", szVolumeName, MAX_PATH);
//这里要注意了,"C:\\share\\"目录一定要存在,而且必须为空的,否则会返回nErr = 0x57错误,为参数错误
bRet = SetVolumeMountPointA("C:\\Share\\", szVolumeName);
int nErr = GetLastError();
return 0;
}

就是这些话:

It is an error to attempt to mount a volume on a directory that has any files
or subdirectories in it. This error occurs for system and hidden directories as
well as other directories, and it occurs for system and hidden files.

Windows API 第20篇 SetVolumeMountPoint 设置卷挂载点参数错误的更多相关文章

  1. Windows API 第20篇 GetVolumeNameForVolumeMountPoint

    函数原型: BOOL GetVolumeNameForVolumeMountPoint(                                                        ...

  2. Windows API 第21篇 DeleteVolumeMountPoint 删除挂载点

    函数原型:BOOL DeleteVolumeMountPoint(                                                      LPCTSTR lpszV ...

  3. Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息

    先看定义:BOOL GetVolumeInformation(    [IN]  LPCTSTR lpRootPathName,           // root directory  卷所在的根目 ...

  4. Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint

    相关函数:HANDLE FindFirstVolumeMountPoint(                                                               ...

  5. windows API 第13篇 MoveFileEx

    上一篇介绍了MoveFile,这次分析MoveFileEx,它是MoveFile的扩展函数,功能还要更加强大些.先看定义: BOOL WINAPI MoveFileEx( _In_     LPCTS ...

  6. windows API 第22篇 WTSGetActiveConsoleSessionId

    函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...

  7. windows API 第 18篇 FindFirstVolume FindNextVolume

    函数定义:Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the vol ...

  8. windows API 第 11 篇 GetCurrentDirectory SetCurrentDirectory

    GetCurrentDirectory函数获得当前文件所在的目录,并不是进程的目录(debug 和 release),它和GetCommandLine不同这里只讲 GetCurrentDirector ...

  9. Windows API 第六篇 GetLocalTime

    GetLocalTime获取系统时间信息.函数原型:VOID   WINAPI  GetLocalTime(    __out LPSYSTEMTIME lpSystemTime    ); 先来看S ...

随机推荐

  1. [JZOJ4331] 【清华集训模拟】树

    题目 题目大意 给你一棵带点权的树,求将树变成一堆不相交的链,而且这些链的权值和非负的方案数. 正解 显然这道题是个\(DP\). 首先求个前缀和\(sum\). 为了后面讲述方便,我这样设:\(f_ ...

  2. Jupyter NoteBook输出的图表太小看不清怎么办?

    如果使用的是matplotlib绘图,可以通过以下命令更改图片的大小: %matplotlib linline 如果是 plt.figure(figsize=(5,3)) #其中(5, 3)用于控制图 ...

  3. python2与python3编码

    #coding:utf8#一#1.在python2中,默认以ASCII编码chcp 936import sysprint sys.getdefaultencoding()# ascii#str:byt ...

  4. Windows 虚拟机 VM

    VMware是全球台式电脑及资料中心虚拟化解决方案的领导厂商.VMWare Workstation是该公司出品的“虚拟 PC”软件(即:大家常说的“虚拟机”),通过它可在一台电脑上同时运行更多的Mic ...

  5. Java笔记 - GUI编程

    一.图形界面开发 1.AWT开发 AWT(Abstract Window Toolkit)在Windows.Linux提供的图形窗口之上,再次进行了抽象,为不同语言开发的程序提供统一定义的图形接口,可 ...

  6. Spring MVC(十五)--SpringMVC国际化配置项

    Spring MVC中,当DispatcherServlet初始化的时候,会解析一个LocaleResolver接口的实现类,这个实现类就是用来解析国际化的. 一.国际化解析器 Spring MVC中 ...

  7. POJ 1873 /// 状压+凸包

    题目大意: 国王有一片森林,巫师需要从所有树中选出一些做成围栏把其他树围起来, 每棵树都有其对应的价值 v 和能作为围栏的长度 l 要求最小价值,若存在多种最小价值的方案则选择余下长度更少的 树木较少 ...

  8. docker上安装ActiveMQ

    1.查看是否已经存在镜像 docker images 2.搜索镜像 docker search activemq 3.拉取镜像 docker pull webcenter/activemq 4.构建容 ...

  9. C开发系列-字符串

    C语言字符串 C语言字符串本质是使用字符数组来存储的. #include <stdio.h> int main() { "jake"; // "jake&qu ...

  10. Ubuntu环境下使用Maven编译并打包Java项目

    一.安装Maven 打开终端输入以下指令: $ mvn -v Apache Maven Maven home: /usr/share/maven Java version: 1.8.0_181, ve ...