函数原型:
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. 删除除了特指的某几个文件外的所有文件的Linux指令

    栗子: 不删除 logs文件夹和credential文件夹 1.  rm -rf  !(logs|credential) 2.  ls | grep -v logs |grep -v credenti ...

  2. Android_Gallery(画廊)

    转:http://blog.csdn.net/tianjf0514/article/details/7521398 Gallery是画廊的意思,可以实现图片的浏览功能. 主要内容 Gallery控件的 ...

  3. System.Web.Mvc.HttpPatchAttribute.cs

    ylbtech-System.Web.Mvc.HttpPatchAttribute.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, ...

  4. 一篇关于Matcher find方法深刻理解的文章

    文章目录 知识点 find find(int var1) reset group(int var1) 源码 故事是这样的 探索 问题解决 方法一: 方法二: 方法三: 总结 知识点 find 首先fi ...

  5. play framework 从环境搭建到简单运行

    download 官网:https://www.playframework.com/ 将zip下载至本地,进行unzip. 环境变量 检测是否安装成功:解压成功后进入解压的目录,运行 play 终端显 ...

  6. ps快速将白底图片变为透明图片

    方法一: 如果图层有锁图标,则要点击它,然它消失.然后选中魔棒工具,然后点击图片上要透明的区域,按下backspace键即可. 方法二: 转载自:https://blog.csdn.net/sunyi ...

  7. day 56 Django基础五之django模型层(二)多表操作

    Django基础五之django模型层(二)多表操作   本节目录 一 创建模型 二 添加表记录 三 基于对象的跨表查询 四 基于双下划线的跨表查询 五 聚合查询.分组查询.F查询和Q查询 六 ORM ...

  8. 设置Hadoop+Hbase集群pid文件存储位置

    有时候,我们对运行几天或者几个月的hadoop或者hbase集群做停止操作,会发现,停止命令不管用了,为什么呢? 因为基于java开发的程序,想要停止程序,必须通过进程pid来确定,而hadoop和h ...

  9. C++自己用模板减少工作量

    今天写代码,遇到这样一个类似如下的需求: auto componentClassSavedByPLC = std::make_shared<ComponentClassSavedByPLC> ...

  10. JS流程控制语句 多重判断满足你各种需求 要在多组语句中选择一组来执行,使用if..else嵌套语句。

    多重判断(if..else嵌套语句) 要在多组语句中选择一组来执行,使用if..else嵌套语句. 语法: if(条件1) { 条件1成立时执行的代码} else if(条件2) { 条件2成立时执行 ...