[comp.os.msdos.programmer] Novell mapped drives

stevew@tureen.Berkeley.EDU (Stephen Williams) (03/19/91)

I've written a DOS shell/file manager in C that needs to search all of a
computer's hard drives for common applications to install.  I've been using
the Turbo C 2.0 setdisk() function to find out how many drives are in use,
but this only works in a standalone environment.

Recently, I've tried using my program in a Novell network environment,
which causes trouble because of Novell's mapped drives.  My program sees
multiple copies of many applications because of mapped drives.  For example,
WordPerfect is actually on drive D:\WP, but is also mapped to W:.  Thus, my
program finds two copies of WordPerfect when looking for programs to install.

How then, can I differentiate between actual physical drives and Novell's
mapped drives?  I'd like to be able to do this from Turbo C, of course.  Will
I need some kind of Novell library, or can I figure it out some other way?

__________________________________________________________________________
Stephen Williams				stevew@tureen.Berkeley.EDU
						uunet!ucbvax!tureen!stevew
__________________________________________________________________________

valley@uchicago (Doug Dougherty) (03/19/91)

stevew@tureen.Berkeley.EDU (Stephen Williams) writes:

>Recently, I've tried using my program in a Novell network environment,
>which causes trouble because of Novell's mapped drives.  My program sees
>multiple copies of many applications because of mapped drives.  For example,
>WordPerfect is actually on drive D:\WP, but is also mapped to W:.  Thus, my
>program finds two copies of WordPerfect when looking for programs to install.

>How then, can I differentiate between actual physical drives and Novell's
>mapped drives?  I'd like to be able to do this from Turbo C, of course.  Will

Use DOS function 60h (Convert Filename to Cannonical Form) and look at
the string returned.  If it starts with \\, it is a network drive.
Admittedly, this method is Novell specific; I have no experience with
non-Novell-like networks, and hence don't know for sure what they would
return.  You might also say that if it doesn't start with "X:", it can't
be a physical drive...

E.g.,	(This is A86 syntax)
(.RADIX 16)
	mov ah,60
	lea si,drive		; (Assume CS = DS = ES)
	lea di,outbuff
	int 21
	cmp word [di],"\\"
	jz net
	...
drive	db "X:",0
outbuff	db 50 dup 0		; 50 hex = 80 dec = MAXPATH

jamesp@world.std.com (james M peterson) (03/23/91)

You can use a series of novell calls to get a listing of drives that are
mapped, what they are mapped to, and whether they were originally local drives.
Local drives is defined as all drives inclusive in the lastdrive statement
in config.sys.

More generically you can use ioctl calls.

jamesp@world.std.com

fisher@sc2a.unige.ch (03/23/91)

In article <12106@pasteur.Berkeley.EDU>, stevew@tureen.Berkeley.EDU (Stephen Williams) writes:
> [...]
> How then, can I differentiate between actual physical drives and Novell's
> mapped drives?  I'd like to be able to do this from Turbo C, of course.  Will
> I need some kind of Novell library, or can I figure it out some other way?

This is a function taken from "write.c" in "mfwrite.zoo" posted in cbip this
year and archived in Simtel20 (don't know exact location, it's a batch utility):


void getpath(void)
/*
 * Stores the current path into `path' and the true path into `true_path'.
 * The true path is obtaind by the dos function call 0x60.
 * DS:SI is input path; ES:DI is output path.
 */
{
        union REGS r;
        struct SREGS s;

        if (*path != '\0')   /* i.e. second call */
                return;
        getcwd (path, MAXPATH);
        r.x.ax = 0x6000;
        /* assuming near pointers: */
        r.x.si = (unsigned)path;
        r.x.di = (unsigned)true_path;
        segread(&s);
        s.es = s.ds;
        intdosx(&r,&r,&s);
}


If the string in "true_path" starts with "\\" ("\\\\" in c-notation), then
you are dealing with a (novell) network path.  If not, different strings
mean either joined or subst'ed drives.

Good luck,

Markus Fischer, Dpt of Anthropology, Geneva CH