|#include <stdio.h>
|#include <windows.h>
|#include <memory.h>
|// Show all drive maps
|int main() {
| char s[4096];
| char *ss = s;
| memset(s,0,sizeof(s));
| if ( GetLogicalDriveStrings(sizeof(s)-1, s) == 0 ) {
| fprintf(stderr, "GetLogicalDriveStrings() failed:
|%d\n", GetLastError());
| return(1);
| }
| while ( *ss )
| {
| char uncpath[4096];
| memset(uncpath, 0, sizeof(uncpath));
| char drivename[10];
| sprintf(drivename, "%.2s", ss);
| if ( QueryDosDevice(drivename, uncpath,
|sizeof(uncpath)-1) == 0 ) {
| fprintf(stderr, "QueryDosDevice(%s) failed: %d\n",
|drivename, GetLastError());
| continue;
| }
| fprintf(stderr, "%s -- %s\n", drivename, uncpath);
| ss += strlen(s) + 1;
| }
| return(0);
|}
|
| ..here's the output of that program when I run it on my system:
|
|C: -- \Device\HarddiskVolume1
|D: -- \Device\CdRom0
|E: -- \Device\Harddisk1\DP(1)0-0+6
|F: -- \Device\Harddisk2\DP(1)0-0+7
|G: -- \Device\Harddisk3\DP(1)0-0+8
|H: -- \Device\Harddisk4\DP(1)0-0+9
|X: -- \Device\LanmanRedirector\;X:0\meade\vartmp
|Z: -- \Device\LanmanRedirector\;Z:0\meade\net
|
This is certainly useful to know. Shame it can't be run from the command
line, but now I feel slightly better in knowing I wasn't going insane.
Thanks for your help.
Dylan
|