Help Please and Thanks ALOT!
I am developing a record management system to run in either
User of Kernel Mode (and other non-Windows systems also).
For the User mode version I need to be able to figure out if a
disk file is on is on a remote share and what the name of the
remote system is for Win9X and WinNT 4.0+.
I can figure out from GetDriveType that the disk is a REMOTE disk.
How can I get the name of the Remote System for this Share?
GetFullPathName doesn’t seem to translate the drive name part to the
share mapping.
QueryDosDevice seems like a possibility, but it doesn’t seem to work
as I expect under Win98. The code at the end of this messagge ALWAYS
yields a “the parameter in incorrect” error on Win98 when run as follows:
D:\test>test_QueryDosDevice C: Drive type = 3
the parameter in incorrect
D:\test>test_QueryDosDevice F: Drive type = 4
the parameter in incorrect
Mapped shares (F: is one) get the same results except the Drive
type ends up as 4 instead of 3 (just as I expect it to).
On Win2K I get the expected results. On Win98 I don’t
even get the list of devices that I would expect when the
first parameter is NULL.
I would like the solution to work on Win95+, but Win98+ will work.
I know tit has to be possible because the Explorer in Win9x displays
the share name.
Can someone point me to a way to get the info I need?
thanks,
Rick Cadruvi…
xxxxx@rdperf.com
============================================================================
#include <windows.h>
#include <string.h>
#include <stdio.h>
void print_error ();
long main (int argc, char **argv)
{
char
*curname,
*devname;
char
fullname[2048];
long
curlen,
devnamelen,
i,
rembytes,
status;
devname = 0;
if (argc >= 2)
{
devname = argv[1];
status = GetDriveType (devname);
printf (“Drive type = %d\n”, status);
}
devnamelen = strlen (devname);
if (devname[devnamelen-1] == ‘\’) devname[devnamelen-1] = 0;
status = QueryDosDevice (devname, fullname, 2048);
if (status == 0)
{
print_error ();
return 0;
}
rembytes = status;
curname = fullname;
while (rembytes != 0)
{
printf (“Dos Device Name = %s\n”, curname);
curlen = strlen (curname);
curname = curname + curlen + 1;
rembytes = rembytes - (curlen + 1);
}
return 0;
}
void print_error ()
{
char errbuf[1024];
FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM,
0, GetLastError (), 0, errbuf, 1024, 0);
printf (“%s\n”, errbuf);
}
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</stdio.h></string.h></windows.h>