函数原型:
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. leetcode-第10周双周赛-5079-三个有序数组的交集

    题目描述: 自己的提交: class Solution: def arraysIntersection(self, arr1: List[int], arr2: List[int], arr3: Li ...

  2. thinkphp Trace方法

    页面Trace只能用于有页面输出的情况,但是trace方法可以用在任何情况,而且trace方法可以用于AJAX等操作. Trace方法的格式: trace('变量','标签','级别','是否记录日志 ...

  3. thinkphp DEFINE标签

    DEFINE标签用于中模板中定义常量,用法如下: 直线电机厂家 <define name="MY_DEFINE_NAME" value="3" /> ...

  4. 「题解」:$d$

    问题 A: $d$ 时间限制: 1 Sec  内存限制: 512 MB 题面 题面谢绝公开. 题解 赛时切掉了然而过程十分曲折. 贪心思路很好想.然而一开始错误以为是单峰.其实几个峰都有可能. 开场写 ...

  5. LOJ#6437. 「PKUSC2018」PKUSC

    题面 题意转化为: 判断每个点所在的圆有多长的弧度角位于多边形内部. 然后就很暴力了. 每个点P,直接找到多边形和这个圆的所有交点,按照距离P的角度排序. 找交点,直接联立二元二次方程组.... 需要 ...

  6. 修改Chrome的UserAgent

    修改Chrome的UserAgent 直接在chrome商店中搜索user-agent switcher 打开chrome 商店,搜索 user-agent switcher   点击免费, 然后执行 ...

  7. HTTP协议请求篇

    http协议的基本概念 超文本传输协议(HTTP,HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议.是工作在tcp/ip协议基础上的,所有的WWW文件都必须 ...

  8. QT之QComboBox

    1.addItems需要注意的事项: 1.在QT中设置maxVisibleItems的值,设置Items的最大可显示的值.(一般默认为10) 2.在每次需要清除已经添加的tems的时候需要注意,ui. ...

  9. maven配置步骤

    仅做操作手册使用,一些操作频率较高的步骤已省略 第一步:度娘下载maven并解压 此处使用了apache-maven-3.2.5-bin.zip, 解压后复制到了D盘的D:\maven\apache- ...

  10. POJ 2074 /// 判断直线与线段相交 视野盲区

    题目大意: 将所有物体抽象成一段横向的线段 给定房子的位置和人行道的位置 接下来给定n个障碍物的位置 位置信息为(x1,x2,y) 即x1-x2的线段 y相同因为是横向的 求最长的能看到整个房子的一段 ...