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



The information in this article applies to:

  • Microsoft LAN Manager 2.0
  • Microsoft LAN Manager 2.1
  • Microsoft LAN Manager 2.1a
  • Microsoft LAN Manager 2.2

This article was previously published under Q64750

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);
}
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 
				

Modification Type:MajorLast Reviewed:9/30/2003
Keywords:KB64750