You can use QueryDosDevice. Based on the description, you expect it to list things like C:and D:, but also things like PhysicalDrive0, PhysicalDrive1etc.
The main disadvantage is that it will also list many other device names that you probably do not need, so (for example) on my machine, I get a list of almost 600 device names, of which only a relatively small percentage is related to what you care about.
, , () :
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <iostream>
int main(int argc, char **argv) {
char physical[65536];
char logical[65536];
if ( argc > 1) {
for (int i=1; i<argc; i++) {
QueryDosDevice(argv[i],logical, sizeof(logical));
std::cout << argv[i] << " : \t" << logical << std::endl << std::endl;
}
return 0;
}
QueryDosDevice(NULL, physical, sizeof(physical));
std::cout << "devices: " << std::endl;
for (char *pos = physical; *pos; pos+=strlen(pos)+1) {
QueryDosDevice(pos, logical, sizeof(logical));
std::cout << pos << " : \t" << logical << std::endl << std::endl;
}
return 0;
}
, `devlist | grep "^ Physical", .