home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / EDMI5.ZIP / IFSR3.ZIP / FSATT.C next >
C/C++ Source or Header  |  1993-07-01  |  1KB  |  38 lines

  1. #define INCL_DOSFILEMGR
  2. #define INCL_DOSERRORS
  3. #include <os2.h>
  4. #include <stdio.h>
  5.  
  6. #pragma argsused
  7. int main(int argc, char **argv, char **envp) {
  8.    int rc;
  9.    char buf[100];
  10.    FSQBUFFER2 buf2[2];
  11.    char drive;
  12.    char drivename[] = "a:";
  13.    ULONG buflen;
  14.  
  15.    if (argc == 1 || argc > 2) {
  16.       printf("Usage: FSATT { A | Q }\n");
  17.       return 1;
  18.    }
  19.  
  20.    if (argv[1][0] == 'a' || argv[1][0] == 'A') {
  21.       rc = DosFSAttach("q:", "EXR0R3", &buf, sizeof(buf), FS_ATTACH);
  22.       printf("ret = 0x%x %d\n", rc, rc);
  23.    } else {
  24.       for (drive = 'c'; drive <= 'z'; drive++) {
  25.          drivename[0] = drive;
  26.          buflen = sizeof(buf2);
  27.          rc = DosQueryFSAttach(drivename, 0, FSAIL_QUERYNAME, &buf2[0], &buflen);
  28.          if (rc != ERROR_INVALID_DRIVE && rc != ERROR_NOT_READY) {
  29.             printf("%s rc: %d type:%d item data:'%s' FSD name:'%s'\n",
  30.                    drivename, rc, buf2[0].iType, buf2[0].szName,
  31.                    buf2[0].szFSDName+buf2[0].cbName);
  32.          }
  33.       }
  34.    }
  35.  
  36.    return 0;
  37. }
  38.