Windows API 第20篇 SetVolumeMountPoint 设置卷挂载点参数错误
函数原型:
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 设置卷挂载点参数错误的更多相关文章
- Windows API 第20篇 GetVolumeNameForVolumeMountPoint
函数原型: BOOL GetVolumeNameForVolumeMountPoint( ...
- Windows API 第21篇 DeleteVolumeMountPoint 删除挂载点
函数原型:BOOL DeleteVolumeMountPoint( LPCTSTR lpszV ...
- Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息
先看定义:BOOL GetVolumeInformation( [IN] LPCTSTR lpRootPathName, // root directory 卷所在的根目 ...
- Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint
相关函数:HANDLE FindFirstVolumeMountPoint( ...
- windows API 第13篇 MoveFileEx
上一篇介绍了MoveFile,这次分析MoveFileEx,它是MoveFile的扩展函数,功能还要更加强大些.先看定义: BOOL WINAPI MoveFileEx( _In_ LPCTS ...
- windows API 第22篇 WTSGetActiveConsoleSessionId
函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...
- windows API 第 18篇 FindFirstVolume FindNextVolume
函数定义:Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the vol ...
- windows API 第 11 篇 GetCurrentDirectory SetCurrentDirectory
GetCurrentDirectory函数获得当前文件所在的目录,并不是进程的目录(debug 和 release),它和GetCommandLine不同这里只讲 GetCurrentDirector ...
- Windows API 第六篇 GetLocalTime
GetLocalTime获取系统时间信息.函数原型:VOID WINAPI GetLocalTime( __out LPSYSTEMTIME lpSystemTime ); 先来看S ...
随机推荐
- soj114 中位数
题意:给你一个长度为2n-1的数组A,设Bi是A的1~2i-1的中位数.问打乱A,有多少种不同的B序列? 标程: #include<bits/stdc++.h> using namespa ...
- 【JZOJ6342】Tiny Counting
description analysis 首先不管\(a,b,c,d\)重复的情况方案数是正逆序对之积 如果考虑\(a,b,c,d\)有重复,只有四种情况,下面括号括起来表示该位置重复 比如\(\{a ...
- 使用java Graphics 绘图工具生成顺丰快递电子面单
最近公司需要开发一个公司内部使用的快递下单系统,给我的开发任务中有一个生成电子面单功能,为了下单时更方便,利用此功能使用快递公司给我们的打印机直接打印出电子面单,刚接到这个任务时我想这应该很简单,不就 ...
- iOS UIWebView获取403/404
问题描述 与WindowsPhone不同,iOS UIWebView并不认为403/404这种情况下页面访问是失败的,这也情有可原,但有时候,我们需要对WebView所遇到的403/404进行处理. ...
- 扩展gcd求逆元
当模数为素数时可以用费马小定理求逆元. 模数为合数时,费马小定理大部分情况下失效,此时,只有与模数互质的数才有逆元(满足费马小定理的合数叫伪素数,讨论这个问题就需要新开一个博客了). (对于一个数n, ...
- VS2010-MFC(常用控件:标签控件Tab Control 上)
转自:http://www.jizhuomi.com/software/205.html 前面两节讲了树形控件Tree Control,本节开始讲解标签控件Tab Control,也可以称为选项卡控件 ...
- hexo next中遇到的bug,引发出的关于jquery中click()函数和on("click",function())的区别
个人博客:https://mmmmmm.me 源码:https://github.com/dataiyangu/dataiyangu.github.io 背景: 本人在维护博客的时候加入了aplaye ...
- mavlink 笔记1
Packet Anatomy This is the anatomy of one packet. It is inspired by the CAN and SAE AS-4 standards. ...
- [kuangbin带你飞]专题一 简单搜索 - B - Dungeon Master
#include<iostream> #include<cstdio> #include<string> #include<vector> #inclu ...
- Vue .sync修饰符与$emit(update:xxx)写法问题
在学习vue自定义事件的.sync修饰符实现改变数值时发现一个问题如下由于props的大小写命名:fatherNum,对应不同的$emit()会有不同的效果,具体如下: 使用.sync修饰符,即 // ...