Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息
先看定义:
BOOL GetVolumeInformation(
[IN] LPCTSTR lpRootPathName, // root directory 卷所在的根目录,如:"C:\\", 如果为NULL,表示当前目录
[OUT] LPTSTR lpVolumeNameBuffer, // volume name buffer ,输出参数,存放卷名缓冲区
[IN] DWORD nVolumeNameSize, // length of name buffer,卷名缓冲区长度
[OUT] LPDWORD lpVolumeSerialNumber, // volume serial number, 卷序列号
[OUT] LPDWORD lpMaximumComponentLength, // maximum file name length,最大文件文件名组件长度,随文件系而变化
[OUT] LPDWORD lpFileSystemFlags, // file system options ,文件系统的一些属性,通常为一些宏的组合
[OUT] LPTSTR lpFileSystemNameBuffer, // file system name buffer,说明何种文件系统,例如NTFS, FAT等
[IN] DWORD nFileSystemNameSize // length of file system name buffer,文件系统缓冲区长度
);
举例说明,拿自己的C盘举例:
char szVolumeNameBuf[MAX_PATH] = {0};
DWORD dwVolumeSerialNum;
DWORD dwMaxComponentLength;
DWORD dwSysFlags;
char szFileSystemBuf[MAX_PATH] = {0};
DWORD dwFileSystemBuf = MAX_PATH;
BOOL bGet = GetVolumeInformationA("C:\\",
szVolumeNameBuf,
MAX_PATH,
&dwVolumeSerialNum,
&dwMaxComponentLength,
&dwSysFlags,
szFileSystemBuf,
MAX_PATH);
printf("%s, %s",szVolumeNameBuf, szFileSystemBuf);
//最后结果: Windwos, NTFS
Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息的更多相关文章
- Windows API 第17篇 GetLogicalDriveStrings 获取本机所有逻辑驱动器,以根目录的形式表示
函数原型:DWORD GetLogicalDriveStrings( DWORD nBufferLength, // size of buffer ...
- Windows API 第16篇 GetLogicalDrivers 获取驱动器位掩码
函数原型:DWORD GetLogicalDrives(VOID);The GetLogicalDrives function retrieves a bitmask representing the ...
- windows API 第22篇 WTSGetActiveConsoleSessionId
函数原型:DWORD WTSGetActiveConsoleSessionId (VOID)先看一下原文介绍: The WTSGetActiveConsoleSessionId function re ...
- C#获取磁盘列表与信息
方法1:使用Environment //获取当前计算机逻辑磁盘名称列表 String[] drives = Environment.GetLogicalDrives(); Console.WriteL ...
- Windows API 第六篇 GetLocalTime
GetLocalTime获取系统时间信息.函数原型:VOID WINAPI GetLocalTime( __out LPSYSTEMTIME lpSystemTime ); 先来看S ...
- Windows API 第三篇
1.获得程序自身的路径: DWORD GetModuleFileName( HMODULE hModule, // handle to module LPTSTR lpFilename, // pat ...
- Windows API 第20篇 GetVolumeNameForVolumeMountPoint
函数原型: BOOL GetVolumeNameForVolumeMountPoint( ...
- Windows API 第19篇 FindFirstVolumeMountPoint FindNextVolumeMountPoint
相关函数:HANDLE FindFirstVolumeMountPoint( ...
- windows API 第13篇 MoveFileEx
上一篇介绍了MoveFile,这次分析MoveFileEx,它是MoveFile的扩展函数,功能还要更加强大些.先看定义: BOOL WINAPI MoveFileEx( _In_ LPCTS ...
随机推荐
- linux 下使用scp命令传输文件
scp -P 1234 /home/wakasann/test.txt wakasann@192.168.1.30:/var/www/html/ 使用 1234端口,将 test.txt文件传输到服务 ...
- Delphi屏幕截图的实现
首先要获得设备环境的句柄,可以通过GetDC函数来获得,对于这个函数,MSDN上是这样说明的 The GetDC function retrieves a handle to a device con ...
- 使用SharpZipLib实现zip压缩
使用国外开源加压解压库ICSharpCode.SharpZipLib实现加压,该库的官方网站为http://www.icsharpcode.net/OpenSource/SharpZipLib/D ...
- System.Web.Mvc.HttpHeadAttribute.cs
ylbtech-System.Web.Mvc.HttpHeadAttribute.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, ...
- C#实现语音
.net 4.0开始 Type type = Type.GetTypeFromProgID("SAPI.SpVoice"); dynamic spVoice = Activator ...
- typedef void (*funcptr)(void) typedef void (*PFV)(); typedef int32_t (*PFI)();
看到以下代码,不明白查了一下: /** Pointer to Function returning Void (any number of parameters) */ typedef void (* ...
- SpringBoot项目中处理返回json的null值
在后端数据接口项目开发中,经常遇到返回的数据中有null值,导致前端需要进行判断处理,否则容易出现undefined的情况,如何便捷的将null值转换为空字符串? 以SpringBoot项目为例,SS ...
- Bubble Cup 12 - Finals Online Mirror, unrated, Div. 1
Bubble Cup 12 - Finals Online Mirror, unrated, Div. 1 C. Jumping Transformers 我会状压 DP! 用 \(dp[x][y][ ...
- C# IP正则表达式
public static bool IsValidIp(string strIn) { bool b = Regex.IsMatch(strIn, @"^[0-9]{1,3}\.[0-9] ...
- java_递归
递归:方法在有结束条件的情况下调用自己本身 public static void main(String[] args) { int i = shu01(5); System.out.println( ...