Using the code below in order to get names of my drives:
const DWORD buffer_length = sizeof(DWORD)*CHAR_BIT;
WCHAR buffer[buffer_length] = {0};
GetLogicalDriveStrings(buffer_length,buffer);
std::set<wchar_t> drives_letters;
for(auto e : buffer)
{
drives_letters.insert(e);
}
• 跟踪产出结果(绕过驱动力-字母):
: //what on earth is this?
C
D
E
F
G
I
//and what on earth is this?