惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
小众软件
小众软件
GbyAI
GbyAI
B
Blog RSS Feed
月光博客
月光博客
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
博客园_首页
G
Google Developers Blog

博客园 - 龙巢NET刀

Windows位图文件格式[转] Windows堆栈区别[转] 聚焦3D地形编程第五章GeomipMapping for the CLOD 聚焦3D地形编程第四章光照化地形 聚焦3D地形编程第三章纹理化地形 聚焦3D地形编程第一章 The Journey into the great Outdoors 聚焦3D地形编程第二章Terrain 101 文件遍历目录 和InjectFile配套InjectDLL - 龙巢NET刀 - 博客园 和InjectFile配套TestOne 激动的InjectFile 通过GUI方式打印信息 PE文件加区块 PE文件 我的简历 进度 我的经历我的历史 内嵌Lua问题 BGET内存分配器
枚举驱动器 - 龙巢NET刀 - 博客园
龙巢NET刀 · 2007-05-24 · via 博客园 - 龙巢NET刀

//测试 含有空格的文件名, 检测, 文件名内是否有空格。 //另外就是使用 SEH异常处理 #include

#include #include using namespace std; int RetDriveTypeStr(char* szTypeStr, int nType) { char szNoType[] = "未知类型"; char szLogical[] = "硬盘驱动器"; char szCDROM[] = "光盘驱动器"; char szRemovable[] = "移动设备"; //是否是软驱 U盘也属于 switch(nType) { case DRIVE_UNKNOWN: lstrcpyn(szTypeStr, szNoType, lstrlen(szNoType)+1); break; case DRIVE_FIXED: lstrcpyn(szTypeStr, szLogical, lstrlen(szLogical)+1); break; case DRIVE_CDROM: lstrcpyn(szTypeStr, szCDROM, lstrlen(szCDROM)+1); break; case DRIVE_REMOVABLE: lstrcpyn(szTypeStr, szRemovable, lstrlen(szRemovable)+1); break; default: lstrcpyn(szTypeStr, szNoType, lstrlen(szNoType)+1); break; } HANDLE hDisk = CreateFile("\\\\.\\D:", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if(hDisk != INVALID_HANDLE_VALUE) { DISK_GEOMETRY dgDisk; DWORD dwNotUsed = 0; if(DeviceIoControl(hDisk, 0, 0, 0, &dgDisk, sizeof(dgDisk), &dwNotUsed, NULL)) { if(dgDisk.MediaType == RemovableMedia) { cout<<"你的是移动磁盘"<