#include <string.h>
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
int _tmain (int argc, _TCHAR * argv[])
{
TCHAR drv = 0;
TCHAR cDiskSymbol [] = _T( "C:");
for(drv =_T( 'C'); drv <= _T( 'Z'); drv ++)
{
cDiskSymbol[0] = drv ;
{
TCHAR szBuf [MAX_PATH] = { 0 };
QueryDosDevice(cDiskSymbol , szBuf, MAX_PATH);
_tprintf(_T ("==== %s === %s ===\n"), cDiskSymbol , szBuf);
}
}
getchar();
return 0;
}
--------------------------------------------------------------------------------------------
输出结果
==== C: === \Device\HarddiskVolume1 ===
==== D: === \Device\HarddiskVolume2 ===
==== E: === \Device\HarddiskVolume3 ===
==== F: === \Device\CdRom0 ===
==== G: === \Device\HarddiskVolume4 ===
==== H: === ===
==== I: === \Device\HarddiskVolume5 ===
==== J: === ===
==== K: === ===
==== L: === ===
==== M: === ===
==== N: === ===
==== O: === ===
==== P: === ===
==== Q: === ===
==== R: === ===
==== S: === ===
==== T: === ===
==== U: === ===
==== V: === ===
==== W: === ===
==== X: === ===
==== Y: === ===
==== Z: === ===
==== D: === \Device\HarddiskVolume2 ===
==== E: === \Device\HarddiskVolume3 ===
==== F: === \Device\CdRom0 ===
==== G: === \Device\HarddiskVolume4 ===
==== H: === ===
==== I: === \Device\HarddiskVolume5 ===
==== J: === ===
==== K: === ===
==== L: === ===
==== M: === ===
==== N: === ===
==== O: === ===
==== P: === ===
==== Q: === ===
==== R: === ===
==== S: === ===
==== T: === ===
==== U: === ===
==== V: === ===
==== W: === ===
==== X: === ===
==== Y: === ===
==== Z: === ===