Greg Ercolano wrote:
Greg Ercolano wrote:
Hmm, I'm not sure 'net use' is showing us mapped drives for "all"
users. I think maybe it only shows the mapped drives for the
'current user'.
I decided this is pretty weird, so I posted a question on
microsoft.public.win32.programmer.networks , just to see if there's
an alternative command.
Two replies so far.
No DOS commands, but..
# 1
------------------------------------------------------------------------
Look at http://support.microsoft.com/default.aspx?scid=kb;en-us;Q180362
for details ( each user has it's own set )
Arkady
# 2
------------------------------------------------------------------------
Most likely GetLogicalDriveStrings + GetDriveType will help you.
-- Vladimir
#1 tells us what we already seem to know; avoid drive letters
because they aren't well implemented for multiuser environments.
Though I'm actually impressed/sickened to see that in writing from Microsoft.
#2 refers to some C++ WIN32 calls (which also appear to be available
from ActiveState perl.) I wrote a small test program using these two calls,
and sure enough it shows the drive letter allocations to both users:
#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
..it does indeed show both the X: and Z: drives,
X: mapped to \\meade\vartmp (created by a telnet user)
Z: mapped to \\meade\net (created by the interactive user).
I'm not sure what the E through H are about -- I only have one
hard disk on this system.
Also not sure what the '0' prefix is on all the UNC paths to \meade.
I guess you're supposed to replace the '0' with a '\', or something.
|