[comp.os.msdos.programmer] How to detect network drive?

tr@samadams.princeton.edu (Tom Reingold) (04/07/91)

I know how to read the boot sector of a disk.  If the first byte is
0xf8, it's supposed to be a hard disk.  But my networked disks (AT&T
Stargroup) have the same ID.  How do I detect if a disk is a network
disk?
--
        Tom Reingold
        tr@samadams.princeton.edu  OR  ...!princeton!samadams!tr
        "Warning: Do not drive with Auto-Shade in place.  Remove
        from windshield before starting ignition."

tcs@mailer.jhuapl.edu (Carl Schelin) (04/09/91)

In article <1991Apr6.231902.5436@newross.Princeton.EDU>, tr@samadams.princeton.edu (Tom Reingold) says:
>
>
>I know how to read the boot sector of a disk.  If the first byte is
>0xf8, it's supposed to be a hard disk.  But my networked disks (AT&T
>Stargroup) have the same ID.  How do I detect if a disk is a network
>disk?
>--

This was information taken from a few previous messages. Someone 
posted a routine from a program (called getpath I think) and someone
else mentioned int 44. Since I couldn't get the int86 function to work
nor could I get the getpath function to work, I combined them and
called int 44 from the GetDiskInfo routine. The #define'd statements 
are just the codes for ?, n, <space>, and s. 

This routine is from Free v1.3 which is coming on c.b.i.p in the next
week or two.

int GetDiskInfo(int drive)
{
        union REGS r;
        struct SREGS s;
        int remote = 0;

        r.x.ax = 0x4409;
        r.x.bx = 0x0000 + drive;
        /* assuming near pointers: */
        segread(&s);
        s.es = s.ds;
        intdosx(&r,&r,&s);
        remote = UNKNOWN;
        if (r.x.dx == 0x1756) remote = NETWORK;
        if (r.x.dx == 0x0840) remote = LOCAL;
        if (r.x.dx == 0x8840) remote = SUBST;
        return remote;
}

Carl Schelin
tcs@mailer.jhuapl.edu