Use DosQFSAttach() API to Find Device's File System Type

ID: Q64750


The information in this article applies to:
  • Microsoft LAN Manager, versions 2.0, 2.1, 2.1a, 2.2


SUMMARY

Use the DosQFSAttach() API to programmatically determine the file system type for a specified device. The following code segment demonstrates how. If the specified device is redirected to a network device, the program returns the file system name of "LAN."

You need to link and compile the program. Then, to run it, enter:

<program_name> <device_name>
For example, enter the following if the program is named FS.EXE:
"fs c:"


MORE INFORMATION

Example


#define INCL_DOSPROCESS
#define INCL_DOSMEMMGR
#define INCL_DOSFILEMGR
#include<os2.h>
#include<stdio.h>
#include<process.h>
#include<stdlib.h>

main(int argc, char **argv)
{

  PSZ psz;
  PUSHORT pcb;
  USHORT cb;
  SEL sel;

  DosAllocSeg(1024, &sel, SEG_NONSHARED); /* Allocates buffer.       */ 

  if (!DosQFSAttach(argv[1], 0, FSAIL_QUERYNAME, MAKEP(sel, 0), &cb,
       0L)) {
    pcb = MAKEP(sel, 2);  /* Points to length of device name.        */ 
    psz = MAKEP(sel, 4);  /* Points to device name.                  */ 
    psz += *pcb + 3;      /* Points to file system name: Points to
                             first character of device name, adds
                             device name length, then adds three
                             (1 null, plus 2 for file system name
                              length variable). */ 

    printf("Device %s file system is %Fs\n",argv[1],psz);
  }
exit(0);
}
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\  

Additional query words: O_OS2SDK HPFS FAT 2.00 2.10 2.10a 2.20

Keywords :
Version : :2.0,2.1,2.1a,2.2
Platform :
Issue type :


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.