home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / SNIP9404.ZIP / DRVS.C < prev    next >
C/C++ Source or Header  |  1994-04-03  |  1KB  |  44 lines

  1. /*
  2. **  DRVS.C - public domain by David Gersic, DeKalb, Il 1993
  3. **
  4. **  Routine checks how many valid disk drives are available on machine,
  5. **  both physical and logical drives.
  6. **
  7. **  Includes drive letters assigned with DOS SUBST command and network
  8. **  drives for Novell Netware (and probably other networks).
  9. **
  10. **  Compiled Under MSC 6 LARGE memory Model
  11. **  Should be compatible with other DOS compilers
  12. **
  13. */
  14.  
  15. #include <stdio.h>
  16. #include <dos.h>
  17. #include <stdlib.h>
  18.  
  19. main()
  20. {
  21.       union REGS in, out;
  22.       int i;
  23.  
  24.       /* Novell's shell TSRs allow up to 32 drive 'letters' to be created */
  25.  
  26.       char drives[]={' ','a','b','c','d','e','f','g','h','i','j',
  27.                      'k','l','m','n','o','p','q','r','s','t','u',
  28.                      'v','w','x','y','z','[','\\',']','^','_','`'};
  29.  
  30.       in.x.ax=0x4409;   /* IOCTL function - Check if block device remote  */
  31.       for(i = 1; i < 32; i++)
  32.       {
  33.             in.h.bl=(unsigned char)i;     /* 1==a:, 2==b:, etc.           */
  34.             intdos(&in,&out);
  35.             if(!out.x.cflag)        /* carry flag set on error            */
  36.             {                       /* bit 15 == subst, bit 12 == 'remote'*/
  37.                   printf("drive %c: is %s\n",
  38.                         drives[i],out.x.dx & 1<<15 ? "subst" :
  39.                         out.x.dx & 1<<12 ? "network" : "local");
  40.             }
  41.       }
  42.       return(0);
  43. }
  44.