;       SCCSID = @(#)d_qfsat.asm	6.1 91/02/15
;       SCCSID = @(#)d_qfsat.asm	1.4 90/01/22
; ****************************************************************************
; *									     *
; *			  IBM/Microsoft Confidential			     *
; *									     *
; *		    Copyright (c) IBM Corporation  1987, 1990		     *
; *		    Copyright (c) Microsoft Corp.  1987, 1990		     *
; *			      All Rights Reserved			     *
; *									     *
; ****************************************************************************
include basemaca.inc
include dos2equ.inc
include api.inc
include error.inc
include ordinals.inc

	EXTRN	api_get_extended:far	;@@ added support for DOSErrorClass
	EXTRN	__api_begin:near
	EXTRN	__api_end:near
	EXTRN	_api_getvrsn:near
	EXTRN	name_check:far		;@@ added support for 8.3 filename

;/********************** START OF SPECIFICATIONS *********************/
;/*								     */
;/* SUBROUTINE NAME: DosQFSAttach				     */
;/*								     */
;/* DESCRIPTIVE NAME: Dos Query File System Attach		     */
;/*								     */
;/* FUNCTION: Returns information for a specific file system	     */
;/*								     */
;/* NOTES:    Real Mode Only					     */
;/*	      Simulates OS/2 call from DOS 2.x,3.x environment	     */
;/*								     */
;/* ENTRY POINT: DosQFSAttach					     */
;/*								     */
;/*    LINKAGE: Call Far					     */
;/*								     */
;/*								     */
;/* INPUT: Stack Frame in form of:				     */
;/*								     */
;/*								     */
;/*  PUSH@  ASCIIZ DeviceName - Device Name or d:		     */
;/*  PUSH   WORD   Ordinal - Ordinal of entry in Name List	     */
;/*  PUSH   WORD   FSAInfoLevel - Type of attached FSD data required */
;/*  PUSH@  OTHER  DataBuffer - Returned Data Buffer		     */
;/*  PUSH@  WORD   DataBufferLen - Buffer length		     */
;/*  PUSH   DWORD  Reserved - must be 0 			     */
;/*								     */
;/*								     */
;/* EXIT-NORMAL:   AX = 0					     */
;/*								     */
;/* EXIT-ERROR:    AX = Errorcode				     */
;/*	  may return error code from Dos 2.x, 3.x, OS/2 	     */
;/*								     */
;/* EFFECTS:  AX, all other registers preserved 		     */
;/*								     */
;/* INTERNAL REFERENCES: none					     */
;/*								     */
;/*    ROUTINES:						     */
;/*								     */
;/* EXTERNAL REFERENCES:					     */
;/*								     */
;/*    ROUTINES: __api_begin					     */
;/*		 __api_end					     */
;/*		 api_get_extended				     */
;/*		 _api_get_version				     */
;/*		 Int 21h - Generic				     */
;/*								     */
;/*********************** END OF SPECIFICATIONS **********************/


_TEXT	segment byte public 'CODE'

	assume	CS:_TEXT, DS:nothing

	public	DOSQFSATTACH


DeviceName	equ	[BP+22]
Ordinal 	equ	[BP+20]
FSAInfoLevel	equ	[BP+18]
DataBuffer	equ	[BP+14]
DataBufferLen	equ	[BP+10]
Reserved	equ	[BP+6]
DOSQFSATTACH	proc	far

	call	__api_begin	; init bp and save bp,ds,bx,cx,dx,si,di,es
				; required to save: bp,es,bx,cx,dx,si,di
	call	_api_getvrsn	; get the DOS version
	cmp	ax,0A14h	;
	jge	version_ok	; Version >= 10.2
	mov	ax,ERROR_BAD_COMMAND
	jmp	qfsaExit

version_ok:
	xor	ax,ax
	mov	ah,D2_Generic
	mov	bx,ORD_DOSQFSATTACH
	mov	cx,'cl'
	push	ss
	pop	es
	mov	di,bp
	add	di,6
	int	21h
	jc	ErrorExit
	xor	ax,ax
	jmp	short qfsaExit
ErrorExit:
	call	api_get_extended
qfsaExit:
	call	__api_end	; check sigs & restore es,di,si,dx,cx,bx,ds,bp

	ret	20	; clear stack of entry parameters (bytes)

DOSQFSATTACH	endp

_TEXT	ends

	end
