函数原型:
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. soj考试2

    T1:子图 给你一棵带点权的树,对于所有i∈[1,m],问树上是否存在连通子图的权值和=i? n<=3000,m<=100000. 朴素的背包树形dp有nm的复杂度,bitset也无处优化 ...

  2. drop database出现1010

    > drop database glc; ERROR (HY000): Error dropping database (can't rmdir './glc/', errno: 17) Fri ...

  3. MySQL Download

    { http://www.wampserver.com/#wampserver-64-bits-php-5-6-25-php-7 }

  4. SpringCloud网关无法加载权限及IP黑名单白名单

    启动springcloud服务注册中心base,再启动网关远程调用base的接口读取权限等数据,控制台出现加载null权限ERROR提示.在远程调用处打断点,先进入代理,找到抛出异常的原因是reque ...

  5. VS2010-MFC(图形图像:GDI对象之画笔CPen)

    转自:http://www.jizhuomi.com/software/246.html 上一节讲了CDC类及其屏幕绘图函数,本节的主要内容是GDI对象之画笔CPen. GDI对象 在MFC中,CGd ...

  6. 从零开始学习jQuery (六) jquery中的AJAX使用

    本篇文章讲解如何使用jQuery方便快捷的实现Ajax功能.统一所有开发人员使用Ajax的方式. 一.摘要 本系列文章将带您进入jQuery的精彩世界, 其中有很多作者具体的使用经验和解决方案,  即 ...

  7. 《DSP using MATLAB》Problem 8.41

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  8. TortoiseGit可能遇到Permission denied (publickey).

    1.检测是不是没设置公钥和私钥 2.公钥有没有添加到git账户里面去 3.检测如下图路径正确不正确

  9. WPF 实现 TextBox 只能输入数字并且不能使用拷贝功能

    1.代码页需要在键盘按下事件中对输入文字进行筛选,代码如下: private void tbxGoToPage_PreviewKeyDown(object sender, KeyEventArgs e ...

  10. opencv3 使用glob遍历并修改文件名

    1.函数说明 string::find()函数:是一个字符或字符串查找函数,该函数有唯一的返回类型,即string::size_type,即一个无符号整形类型,可能是整数也可能是长整数.如果查找成功, ...