;       SCCSID = @(#)argframe.inc	6.3 92/03/06
;      SCCSID = @(#)argframe.inc	6.3 92/03/06
; **** ARGFRAME.INC
;
; Contains structures that map to API argument stack frames to utilize
; the thop "ld_parampkt_bx" to have BX point to the argument frame, and
; enable the use of named referencing to point to the arguments.  Necessary
; due to some APIs using more arguments than available registers.
; Any changes to the parameters of these APIs will have to be reflected in
; these structures. (alphabetical by API name)


; This structure is used to map the parameters that will be pushed onto
; the stack for the DOSENUMATTRIBUTE API.

EnumEAStruc	 STRUC			    ; Enumerate Attribute Structure
		 dd	 ?		    ; reserved dword
EEA_iInfoLevel	 dd	 ?		    ; info level
EEA_pEnumCnt	 dd	 ?		    ; num entries to return
EEA_cbEnumBuf	 dd	 ?		    ; length of buffer
EEA_pEnumBuf	 dd	 ?		    ; buffer
EEA_iEntryNum	 dd	 ?		    ; starting entry to return
EEA_pFileRef	 dd	 ?		    ; file handle or pathname
EEA_iRefType	 dw	 ?		    ; whether prev arg is handle or name
EnumEAStruc	 ENDS

EEA_ArgWords   equ	15		    ; ArgWords for DOSENUMATTRIBUTE

.erre ((size EnumEAStruc) EQ (EEA_ArgWords * 2))

; This structure is used to map the parameters that will be pushed onto
; the stack for the DOSPROTECTENUMATTRIBUTE API.

PEnumEAStruc	 STRUC			    ; Enumerate Attribute Structure
		 dd	 ?		    ; reserved dword
PEEA_fHandleLockID dd	 ?		    ; file handle lock ID
PEEA_iInfoLevel	 dd	 ?		    ; info level
PEEA_pEnumCnt	 dd	 ?		    ; num entries to return
PEEA_cbEnumBuf	 dd	 ?		    ; length of buffer
PEEA_pEnumBuf	 dd	 ?		    ; buffer
PEEA_iEntryNum	 dd	 ?		    ; starting entry to return
PEEA_pFileRef	 dd	 ?		    ; file handle or pathname
PEEA_iRefType	 dw	 ?		    ; whether prev arg is handle or name
PEnumEAStruc	 ENDS

PEEA_ArgWords   equ	17		    ; ArgWords for DOSENUMATTRIBUTE

.erre ((size PEnumEAStruc) EQ (PEEA_ArgWords * 2))



; This structure is used to map the parameters that will be pushed onto
; the stack for the DOSFSATTACH API.

FSAttachStruc	   STRUC		    ; File System Attach Structure
		 dd	 ?		    ; reserved dword
FSA_iOpFlag	 dw	 ?		    ; type of operation
FSA_cbDataLength dw	 ?		    ; data buffer length
FSA_pDataBuffer	 dd	 ?		    ; data buffer
FSA_szFSDName	 dd	 ?		    ; FSD name
FSA_szDeviceName dd	 ?		    ; device name pointer
FSAttachStruc	   ENDS

FSA_ArgWords   equ	10		    ; ArgWords for DOSFSATTACH

.erre ((size FSAttachStruc) EQ (FSA_ArgWords * 2))

; This structure is used to map the parameters that will be pushed onto
; the stack for the DOSFSCTL API.

FileSysCtlStruc	      STRUC		     ; File System Control Structure
		 dd	 ?		    ; reserved
FSC_iRouteMethod dw	 ?		    ; routing method
FSC_iFileHandle	 dw	 ?		    ; file handle
FSC_szRouteName	 dd	 ?		    ; FSD name
FSC_iFunction	 dw	 ?		    ; function code
FSC_pParmLenOut	 dd	 ?		    ; ptr to output param length out
FSC_cbParmLength dw	 ?		    ; parameter area length
FSC_pParmList	 dd	 ?		    ; parameter area
FSC_pDataLenOut	 dd	 ?		    ; ptr to output data length
FSC_cbDataLength dw	 ?		    ; data area length
FSC_pDataArea	 dd	 ?		    ; data area
FileSysCtlStruc		ENDS

FSC_ArgWords   equ     17		    ; ArgWords for DOSFSCTL

.erre ((size FileSysCtlStruc) EQ (FSC_ArgWords * 2))

; This structure is used to map the parameters that will be pushed onto
; the stack for the DOSQFSATTACH API.

FSQAttachStruc	     STRUC		     ; File System Q Attach Structure
		  dd	  ?		     ; reserved dword
FSQA_cbDataLength dd	  ?		     ; data buffer length
FSQA_pDataBuffer  dd	  ?		     ; data buffer
FSQA_iFSAInfoLevl dw	  ?		     ; FSA info level
FSQA_iOrdinal	  dw	  ?		     ; ordinal index into table
FSQA_szDeviceName dd	  ?		     ; device name pointer
FSQAttachStruc	       ENDS

FSQA_ArgWords	equ	 10		     ; ArgWords for DOSQFSATTACH

.erre ((size FSQAttachStruc) EQ (FSQA_ArgWords * 2))

;**	These two structures are used to define the parameter structure for
;	DOSFINDFIRST and DOSFINDFIRST2 (and used by w_FindFirst).
;
;   WARNING:
;
;	These structures map the parameters as they are pushed on the stack
;	for API calls.  Any API interface for DOSFINDFIRST or DOSFINDFIRST2
;	will require that these structures be kept in sync.
;
;	They must match the size of the ArgWords for the respective DosCall.

FindFirstStruc	struc		; FindFirst parm structure (interface level 0)
FFS_Reserved	    dd	    ?	    ; reserved dword
FFS_SearchCountPtr  dd	    ?
FFS_RsltBufLen	    dw	    ?
FFS_RsltBufPtr	    dd	    ?
FFS_Attribute	    dw	    ?
FFS_HandlePtr	    dd	    ?
FFS_FileNamePtr	    dd	    ?
FindFirstStruc	ends

FF_ArgWords	    equ	    12	; ArgWords for DOSFINDFIRST

.erre ((size FindFirstStruc) EQ (FF_ArgWords * 2))

FindFirst2Struc struc		; FindFirst parm structure (interface level 1)
		    dd	    ?	    ; reserved dword
FF2S_InfoLevel	    dw	    ?	    ; File Info Level (new parameter)
FF2S_SearchCountPtr dd	    ?
FF2S_RsltBufLen	    dw	    ?
FF2S_RsltBufPtr	    dd	    ?
FF2S_Attribute	    dw	    ?
FF2S_HandlePtr	    dd	    ?
FF2S_FileNamePtr    dd	    ?
FindFirst2Struc ends

FF2_ArgWords	    equ	    13	; ArgWords for DOSFINDFIRST

.erre ((size FindFirst2Struc) EQ (FF2_ArgWords * 2))

FindFirst32Struc struc
FF32S_FlatSrchCountPtr	dd	?
FF32S_FlatRsltBufPtr	dd	?
FF32S_FlatRetDataPtr	dd	?
FF32S_InfoLevel		dw	?
FF32S_SearchCountPtr	dd	?
FF32S_RsltBufLen	dw	?
FF32S_RsltBufPtr	dd	?
FF32S_Attribute		dw	?
FF32S_HandlePtr		dd	?
FF32S_FileNamePtr	dd	?
FindFirst32Struc ends

FF32_ArgWords	    equ	    (SIZE FindFirst32Struc)/2	; ArgWords for DOS32FINDFIRST
; FF32_ArgWords	    equ	    19			; ArgWords for DOSIFINDFIRST

.erre ((size FindFirst32Struc) EQ (FF32_ArgWords * 2))

;
; FindFirstStruc and FindFirst2Struc are very similar. They overlap except
; for the FF2S_InfoLevel WORD. For most intents and purposes, we can just
; use the fields in FindFirstStruc to access the fields in either structure
; so long as we ADVANCE the pointer that we had for FindFirst2Struc by 2
; so that is now points to the second word of the reserved field. We can
; set the value in FFS_InfoLevel (see below) to be 1, which is what will
; cause FindFirst2 to return the same information as FindFirst, and then
; our code can be "generic".
;
FFS_InfoLevel	    equ	    FFS_Reserved+2  ; See "tricky" code in w_FindFirst

FindNext32Struc struc
FN32S_FlatSrchCountPtr	dd	?
FN32S_FlatRsltBufPtr	dd	?
FN32S_FlatRetDataPtr	dd	?
FN32S_SearchCountPtr	dd	?
FN32S_RsltBufLen	dw	?
FN32S_RsltBufPtr	dd	?
FN32S_Handle		dw	?
FindNext32Struc ends

FN32_ArgWords	    equ	    (SIZE FindNext32Struc)/2	; ArgWords for DOS32FINDNEXT

;**	This structure is used to define the parameter structure for
;	DOSFINDFROMNAME (and used by w_FindFromName).
;
;	It must match the size of the ArgWords for DOSFINDFROMNAME.

FFNameStruc	struc		    ; FindFromName parm structure
FFN_FileNamePtr	    dd	    ?
FFN_Position	    dd	    ?
FFN_SearchCountPtr  dd	    ?
FFN_RsltBufLen	    dw	    ?
FFN_RsltBufPtr	    dd	    ?
FFN_DirHandle	    dw	    ?
FFNameStruc	ends

FFNM_ArgWords	    equ	    10	    ; ArgWords for DOSFINDFROMNAME



;**	These three structures are used to define the parameter structure for
;       DOSOPEN, DOSOPEN2, and DOSPROTECTOPEN (i.e. DOSOPEN3)
;       (and used by w_OpenCreate).
;
;   WARNING:
;
;	These structures map the parameters as they are pushed on the stack
;	for API calls.  Any API interface for DOSOPEN, DOSOPEN2, or DOSPROTECTOPEN
;	(i.e. DOSOPEN3 in comments) will require that these structures be
;	kept in sync.
;
;	Also, any change in the layout of the structures should only be
;	done AFTER examining the code in api_OpenCreate.
;
;	They must match the size of the ArgWords for the respective DosCall.
;
OpenStruc   struc		; DOSOPEN parm structure
opns_Reserved	    dd	    ?	    ; reserved dword
opns_Mode	    dw	    ?	    ; Open mode for file
opns_Flag	    dw	    ?	    ; Flags for open
opns_Attrs	    dw	    ?	    ; File attribute
opns_Size	    dd	    ?	    ; Size of file
opns_ActionPtr	    dd	    ?	    ; Pointer to location for returned action
opns_HandlePtr	    dd	    ?	    ; Pointer to location for returned handle
opns_NamePtr	    dd	    ?	    ; Pointer to file name
OpenStruc   ends

OPN_ArgWords	=	(size OpenStruc) / 2	; ArgWords for DosOpen


Open2Struc  struc	    ; Open2 parm structure
opn2s_Reserved	    dd	    ?	    ; reserved dword
opn2s_EABufPtr	    dd	    ?	    ; Pointer to EA buffer
opn2s_Mode	    dw	    ?	    ; Open mode for file
opn2s_Mode2	    dw	    ?	    ; high word of OpenMode
opn2s_Flag	    dw	    ?	    ; Flags for open
opn2s_Attrs	    dw	    ?	    ; File attribute
opn2s_Size	    dd	    ?	    ; Size of file
opn2s_ActionPtr	    dd	    ?	    ; Pointer to location for returned action
opn2s_HandlePtr	    dd	    ?	    ; Pointer to location for returned handle
opn2s_NamePtr	    dd	    ?	    ; Pointer to file name
Open2Struc  ends

OPN2_ArgWords	=	(size Open2Struc) / 2	; ArgWords for DosOpen2

Open3Struc  struc	    ; Open3 parm structure
opn3s_Reserved	    dd	    ?	    ; reserved dword
opn3s_FileHandleLockIDPtr   dd	   ?    ; Pointer to FileHandleLockID buffer
opn3s_EABufPtr	    dd	    ?	    ; Pointer to EA buffer
opn3s_Mode	    dw	    ?	    ; Open mode for file
opn3s_Mode2	    dw	    ?	    ; high word of OpenMode
opn3s_Flag	    dw	    ?	    ; Flags for open
opn3s_Attrs	    dw	    ?	    ; File attribute
opn3s_Size	    dd	    ?	    ; Size of file
opn3s_ActionPtr	    dd	    ?	    ; Pointer to location for returned action
opn3s_HandlePtr	    dd	    ?	    ; Pointer to location for returned handle
opn3s_NamePtr	    dd	    ?	    ; Pointer to file name
Open3Struc  ends

OPN3_ArgWords	=	(size Open3Struc) / 2	; ArgWords for DosOpen3

; The following structures used by ChangeNotify
;
CNPATH	struc
  CNPATH_oNextEntryOffset	dd	?
  CNPATH_wFlags	dd	?
  CNPATH_cbName	db	?
  CNPATH_szName	db	1 DUP (?)
CNPATH	ends

CNINFO	struc
  CNINFO_oNextEntryOffset	dd	?
  CNINFO_bAction	db	?
  CNINFO_cbName	dw	?
  CNINFO_szName	db	1 DUP (?)
CNINFO	ends


; The following structures used by FindNotify
;
FindNotifyFirstStruc struc	   ; FindNotifyFirst parm structure
		       dd      ?   ; reserved dword
   FNYF_TimeOut	       dd      ?   ; TimeOut for search
   FNYF_InfoLevel      dw      ?   ; File Info Level (new parameter)
   FNYF_ChangeCountPtr dd      ?   ; search count pointer
   FNYF_RsltBufLen     dw      ?   ; result buffer len
   FNYF_RsltBufPtr     dd      ?   ; result buffer ptr
   FNYF_Attribute      dw      ?   ; attribute for search
   FNYF_DirHandlePtr   dd      ?   ; DirHandle pointer
   FNYF_FileNamePtr    dd      ?   ; path name pointer
FindNotifyFirstStruc ends

FNY_ArgWords	    equ	    15	; ArgWords for DOSFINDNOTIFYFIRST

.erre (size FindNotifyFirstStruc) EQ (FNY_ArgWords * 2)

; Argument frame for DosFileIO.  Used to avoid passing user selectors
; as pointers to the worker routine.

DosFileIOStruc struc
   fio_ErrorOffset	dd	?	; pointer to command error offset
   fio_CommandListLen	dw	?	; length of command list
   fio_CommandList	dd	?	; pointer to command list
   fio_FileHandle	dw	?	; file handle for operations
DosFileIOStruc ends

FIO_ArgWords = (size DosFileIOStruc) / 2
PFIO_ArgWords = ((size DosFileIOStruc) / 2) + 2


DosPhysDiskStruc	struc
	dpd_UsrInfoLen	dw	?	; length of user-supplied info
	dpd_UsrInfoPtr	dd	?	; ptr to user-supplied info
	dpd_RetBufLen	dw	?	; length of the return buffer
	dpd_RetBufPtr	dd	?	; ptr to return buffer
	dpd_PDRCatg	dw	?	; 1 = no of part.disks
					; 2 = get a handle for cat 9 ioctls
					; 3 = release that handle
DosPhysDiskStruc	ends

DPD_ArgWords = (size DosPhysDiskStruc) / 2

DIOCTL_Struc	struc
	DIOC_pDataLenInOut	dd	? ; ptr to DataLen inout
	DIOC_DataLenMax		dw	? ; max datapkt length
	DIOC_pData		dd	? ; ptr to Data Packet
	DIOC_pParmLenInOut	dd	? ; ptr to Param Pkt Len In Out
	DIOC_ParmLenMax		dw	? ; max parmpkt length
	DIOC_pParm		dd	? ; ptr to parm pkt
	DIOC_Function		dw	? ; IOCTL function code
	DIOC_Category		dw	? ; IOCTL category code
	DIOC_DevHandle		dw	? ; IOCTL handle
DIOCTL_Struc	ends

DIOCTL_ArgWords	= (size DIOCTL_Struc) /2

;******* Named pipe API argument frame structures.
;*******
;******* Keep in sync with named pipe code.
;
;******* NOTE:	only named pipe APIs that take pointers to buffers in user
;		space need use argument frames.

; DosQNmPipeInfo
DosQNmPipeInfoStruc struc
   qnpi_InfoBufSize	dw	?	; Pipe data buffer size
   qnpi_InfoBuf		dd	?	; pointer to data buffer
   qnpi_InfoLevel	dw	?	; query level
   qnpi_Handle		dw	?	; pipe handle
DosQNmPipeInfoStruc ends

QNPI_ArgWords =	 (size DosQNmPipeInfoStruc) / 2

; DosPeekNmPipe
DosPeekNmPipeStruc struc
   pnmp_PipeState	dd	?	; pipe state (returned)
   pnmp_BytesAvail	dd	?	; bytes available (returned)
   pnmp_BytesRead	dd	?	; bytes read (returned)
   pnmp_BufferLen	dw	?	; buffer length
   pnmp_Buffer		dd	?	; pointer to read buffer
   pnmp_Handle		dw	?	; pipe file handle
DosPeekNmPipeStruc ends

PNMP_ArgWords = (size DosPeekNmPipeStruc) / 2

;DosRawReadNmPipe
DosRawReadNmPipeStruc struc
   rrnp_BytesRead	dd	?	; bytes read (returned)
   rrnp_BufferLen	dw	?	; buffer length
   rrnp_Buffer		dd	?	; pointer to buffer
   rrnp_Handle		dw	?	; pipe file handle
DosRawReadNmPipeStruc ends

RRNP_ArgWords = (size DosRawReadNmPipeStruc) / 2

;DosRawWriteNmPipe
DosRawWriteNmPipeStruc struc
   rwnp_BytesWritten	dd	?	; bytes written (returned)
   rwnp_BufferLen	dw	?	; buffer length
   rwnp_Buffer		dd	?	; pointer to buffer
   rwnp_Handle		dw	?	; pipe file handle
DosRawWriteNmPipeStruc ends

RWNP_ArgWords = (size DosRawWriteNmPipeStruc) / 2

;DosTransactNmPipe
DosTransactNmPipeStruc struc
   tnmp_BytesOut	dd	?	; bytes read (returned)
   tnmp_OutBufferLen	dw	?	; length of read buffer
   tnmp_OutBuffer	dd	?	; pointer to read buffer
   tnmp_InBufferLen	dw	?	; length of write buffer
   tnmp_InBuffer	dd	?	; pointer to write buffer
   tnmp_Handle		dw	?	; pipe file handle
DosTransactNmPipeStruc ends

TNMP_ArgWords = (size DosTransactNmPipeStruc) /2

;DosCallNmPipe
DosCallNmPipeStruc struc
   cnmp_TimeOut		dd	?	; maximum wait time
   cnmp_BytesOut	dd	?	; bytes read (returned)
   cnmp_OutBufferLen	dw	?	; length of read buffer
   cnmp_OutBuffer	dd	?	; pointer to read buffer
   cnmp_InBufferLen	dw	?	; write buffer length
   cnmp_InBuffer	dd	?	; pointer to write buffer
   cnmp_FileName	dd	?	; pointer to file name for pipe
DosCallNmPipeStruc ends

CNMP_ArgWords = (size DosCallNmPipeStruc) / 2

;DosQNmPipeSemState
DosQNmPipeSemStateStruc struc
   qnps_InfoBufSize	dw	?	; length of info buffer
   qnps_InfoBuf		dd	?	; pointer to info buffer
   qnps_SemHandle	dd	?	; semaphore handle
DosQNmPipeSemStateStruc ends

QNPS_ArgWords = (size DosQNmPipeSemStateStruc) / 2
