;      SCCSID = @(#)apifs.asm   6.19 92/03/11
PAGE ,132
;***    apifs.asm
;
;       IBM/Microsoft Confidential
;
;       Copyright (c) IBM Corporation 1987, 1989
;       Copyright (c) Microsoft Corporation 1987, 1989
;
;       All Rights Reserved
;
;       Applications Program Interface, in particular, the protected mode,
;       dynamic link, PLM calling convention used in OS/2.
;
;       This file contains those which are File I/O Function Calls
;
;       PLEASE ADD NEW ENTRIES IN ALPHABETICAL ORDER!  THANKS
;
;       MLM     11/27/95        72417
;               reduce fscrit serialization

.xlist
include dosseg.inc
include basemaca.inc
include osmaca.inc
include error.inc
include protmode.inc
include seldesc.inc
include mi.inc
include kmode.inc
include sysentry.inc
include ordinals.inc
include dirent.inc
include argframe.inc
include infoseg.inc
include mmpha.inc
.list


        FARCODE HIGH3
HIGH3CODE SEGMENT

;***    DOS32ISETFHSTATE - Set file handle state ( 32 bit)
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    DWORD   FileHandleState (2 word)
;               call    DOS32ISETFHSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOS32ISETFHSTATE, ORD_DOS32ISETFHSTATE, 3, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; new file handle state (low word)
        ld_dx                           ; file handle state (high word)
        ld_bx                           ; handle
        ld_imm_ax       1               ; to indicate 32 bit call

        ld_di_0                         ; fake filehandlelockID lowword
        ld_si_0                         ; fake filehandlelockID highword


;***DT preDOS32ISETFHSTATE - Dos32ISetFHState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOS32ISETFHSTATE>,
;          TP    = .preDOS32ISETFHSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32ISetFHState Pre-Invocation",
;          <LOG_BX>,
;          <LOG_CX>,
;          <LOG_DX>,
;          FMT   = "File Handle = <FMT_BX>  State = <FMT_DX> <FMT_CX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFHandState, ORD_DOS32ISETFHSTATE ; call the worker   ;@SEC


;***DT postDOS32ISETFHSTATE - Dos32ISetFHState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOS32ISETFHSTATE>,
;          TP    = .postDOS32ISETFHSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32ISetFHState Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOS32ISETFHSTATE

;***    DOS32IQUERYFHSTATE - Query file handle state
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH@   WORD    FileHandleState (2 words)
;               call    DOS32IQUERYFHSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOS32IQUERYFHSTATE, ORD_DOS32IQUERYFHSTATE, 3, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_ptr                        ; skip over pointer for now
        ld_bx                           ; handle
        ld_imm_ax       1               ; to indicate 32 bit call
        ld_di_0                         ; fake filehandlelockID lowword
        ld_si_0                         ; fake filehandlelockID highword

;***DT preDOS32IQUERYFHSTATE - Dos32IQUERYFHSTATE pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOS32IQUERYFHSTATE>,
;          TP    = .preDOS32IQUERYFHSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IQUERYFHSTATE Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "File Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFHandState, ORD_DOS32IQUERYFHSTATE   ; call the worker ;@SEC
        st_dxcx                         ; store file handle state

;***DT postDOS32IQUERYFHSTATE - Dos32IQUERYFHSTATE post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOS32IQUERYFHSTATE>,
;          TP    = .postDOS32IQUERYFHSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IQUERYFHSTATE Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Handle State = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOS32IQUERYFHSTATE


;***    DOS32IPROTECTSETFHSTATE - Set file handle state ( 32 bit)
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH    DWORD   FileHandleState  (2 word)
;               PUSH    DWORD   FileHandleLockID (2 word)
;               call    DOS32IPROTECTSETFHSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOS32IPROTECTSETFHSTATE, ORD_DOS32IPROTECTSETFHSTATE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_di                           ; filehandlelockID lowword
        ld_si                           ; filehandlelockID highword
        ld_cx                           ; new file handle state (low word)
        ld_dx                           ; file handle state (high word)
        ld_bx                           ; handle
        ld_imm_ax       1               ; to indicate 32 bit call

;***DT preDOS32IPROTECTSETFHSTATE - Dos32IProtectSetFHState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOS32IPROTECTSETFHSTATE>,
;          TP    = .preDOS32IPROTECTSETFHSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IProtectSetFHState Pre-Invocation",
;          <LOG_BX>,
;          <LOG_CX>,
;          <LOG_DX>,
;          FMT   = "File Handle = <FMT_BX>  State = <FMT_DX> <FMT_CX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFHandState, ORD_DOS32IPROTECTSETFHSTATE              ;@SEC

;***DT postDOS32IPROTECTSETFHSTATE - Dos32IProtectSetFHState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOS32IPROTECTSETFHSTATE>,
;          TP    = .postDOS32IPROTECTSETFHSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IProtectSetFHState Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOS32IPROTECTSETFHSTATE

;***    DOS32IPROTECTQUERYFHSTATE - Query file handle state
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH@   WORD    FileHandleState  (2 words)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOS32IPROTECTQUERYFHSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOS32IPROTECTQUERYFHSTATE, ORD_DOS32IPROTECTQUERYFHSTATE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_di                           ; filehandlelockID lowword
        ld_si                           ; filehandlelockID highword
        skip_ptr                        ; skip over pointer for now
        ld_bx                           ; handle
        ld_imm_ax       1               ; to indicate 32 bit call

;***DT preDOS32IPROTECTQUERYFHSTATE - Dos32IPROTECTQUERYFHSTATE pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOS32IPROTECTQUERYFHSTATE>,
;          TP    = .preDOS32IPROTECTQUERYFHSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IPROTECTQUERYFHSTATE Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "File Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFHandState, ORD_DOS32IPROTECTQUERYFHSTATE              ;@SEC
        skip_2word                      ; skip over file handle lockID
        st_dxcx                         ; store file handle state

;***DT postDOS32IPROTECTQUERYFHSTATE - Dos32IPROTECTQUERYFHSTATE post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOS32IPROTECTQUERYFHSTATE>,
;          TP    = .postDOS32IPROTECTQUERYFHSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) Dos32IPROTECTQUERYFHSTATE Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Handle State = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOS32IPROTECTQUERYFHSTATE


;***    DOSBUFRESET - Flush all file buffers
;
;       INVOKE  push    WORD FileHandle     (1 word)
;               call    DOSBUFRESET
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSBUFRESET, ORD_DOSBUFRESET, 1

        ld_bx                           ; file handle into bx

;***DT  preDOSBUFRESET - DosBufReset pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSBUFRESET>,
;          TP    = .preDOSBUFRESET,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosBufReset Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_BufReset, ORD_DOSBUFRESET                               ;@SEC

;***DT  postDOSBUFRESET - DosBufReset post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSBUFRESET>,
;          TP    = .postDOSBUFRESET,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosBufReset Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSBUFRESET


;***    DOSCHDIR - Change the current directory
;
;       INVOKE  push@   ASCIIZ DataArea         (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSCHDIR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSCHDIR, ORD_DOSCHDIR, 4

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

;***DT  preDOSCHDIR - DosChDir pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSCHDIR>,
;          TP    = .preDOSCHDIR,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosChDir Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_PTR>,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_ChDir, ORD_DOSCHDIR                                     ;@SEC

;***DT  postDOSCHDIR - DosChDir post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSCHDIR>,
;          TP    = .postDOSCHDIR,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosChDir Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSCHDIR


;***    DOSCHGFILEPTR - Set/report position of a handle
;
;       INVOKE  push    word handle             (1 word)
;               push    dword distance          (2 words)
;               push    word movetype           (1 word)
;               push    @dword newpointer       (2 words)
;               call    DOSCHGFILEPTR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSCHGFILEPTR, ORD_DOSCHGFILEPTR, 6, GDT_DOSCHGFILEPTR
;
;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_ptr                        ; skip over address of new pointer
        ld_ax                           ; put type of move into AL
        ld_dx                           ; low word of distance
        ld_cx                           ; high word of distance
        ld_bx                           ; put file handle in BX
        ld_di_0                         ; fake filehandlelockID lowword
        ld_si_0                         ; fake filehandlelockID highword

;***DT  preDOSCHGFILEPTR - DosChgFilePtr pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSCHGFILEPTR>,
;          TP    = .preDOSCHGFILEPTR,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosChgFilePtr Pre-Invocation",
;          <LOG_AX>,
;          <LOG_CX>,
;          <LOG_DX>,
;          <LOG_BX>,
;          FMT   = "Type = <FMT_AX>  Distance = <FMT_CX><FMT_DX>"
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_LSeek, ORD_DOSCHGFILEPTR                                ;@SEC
        st_dxax                         ; new read/write pointer location

;***DT  postDOSCHGFILEPTR - DosChgFilePtr post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSCHGFILEPTR>,
;          TP    = .postDOSCHGFILEPTR,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosChgFilePtr Post-Invocation",
;          <LOG_DX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Location = <FMT_DX><FMT_AX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSCHGFILEPTR


;***    DOSPROTECTCHGFILEPTR - Set/report position of a handle
;
;       INVOKE  push    word handle             (1 word)
;               push    dword distance          (2 words)
;               push    word movetype           (1 word)
;               push    @dword newpointer       (2 words)
;               push    dword filehandlelockid  (2 words)
;               call    DOSPROTECTCHGFILEPTR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSPROTECTCHGFILEPTR, ORD_DOSPROTECTCHGFILEPTR, 8, GDT_DOSPROTECTCHGFILEPTR

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_di                           ; low word of filehandlelockID
        ld_si                           ; high word of filehandlelockID
        skip_ptr                        ; skip over address of new pointer
        ld_ax                           ; put type of move into AL
        ld_dx                           ; low word of distance
        ld_cx                           ; high word of distance
        ld_bx                           ; put file handle in BX

;***DT  preDOSPROTECTCHGFILEPTR - DosProtectChgFilePtr pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTCHGFILEPTR>,
;          TP    = .preDOSPROTECTCHGFILEPTR,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectChgFilePtr Pre-Invocation",
;          <LOG_AX>,
;          <LOG_CX>,
;          <LOG_DX>,
;          <LOG_BX>,
;          FMT   = "Type = <FMT_AX>  Distance = <FMT_CX><FMT_DX>"
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_LSeek, ORD_DOSPROTECTCHGFILEPTR                         ;@SEC
        skip_2word                      ; skip over filehandlelockID
        st_dxax                         ; new read/write pointer location

;***DT  postDOSPROTECTCHGFILEPTR - DosProtectChgFilePtr post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTCHGFILEPTR>,
;          TP    = .postDOSPROTECTCHGFILEPTR,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectChgFilePtr Post-Invocation",
;          <LOG_DX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Location = <FMT_DX><FMT_AX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTCHGFILEPTR


;***    DOSCLOSE - Close a file, named pipe or device handle
;
;       INVOKE  push    word Handle             (1 word)
;               call    DOSCLOSE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSCLOSE, ORD_DOSCLOSE, 1, GDT_DOSCLOSE

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_imm_cx       0               ; fake filehandlelockID lowword
        ld_imm_dx       0               ; fake filehandlelockID highword
        ld_bx                           ; put handle in BX

;***DT  preDOSCLOSE - DosClose pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSCLOSE>,
;          TP    = .preDOSCLOSE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosClose Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall api_Close, ORD_DOSCLOSE   ; call the worker (@PhysDisk)   ;@SEC

;***DT  postDOSCLOSE - DosClose post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSCLOSE>,
;          TP    = .postDOSCLOSE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosClose Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSCLOSE


;***    DOSPROTECTCLOSE - Close a file, named pipe or device handle
;
;       INVOKE  push    word Handle             (1 word)
;               push    dword FileHandleLockID  (2 words)
;               call    DOSPROTECTCLOSE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSPROTECTCLOSE, ORD_DOSPROTECTCLOSE, 3, GDT_DOSPROTECTCLOSE

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; filehandlelockID lowword
        ld_dx                           ; filehandlelockID highword
        ld_bx                           ; put handle in BX

;***DT  preDOSPROTECTCLOSE - DosProtectClose pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTCLOSE>,
;          TP    = .preDOSPROTECTCLOSE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectClose Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall api_Close, ORD_DOSPROTECTCLOSE  ; call the worker (@PhysDisk) @SEC

;***DT  postDOSPROTECTCLOSE - DosProtectClose post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTCLOSE>,
;          TP    = .postDOSPROTECTCLOSE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectClose Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTCLOSE


;***    DOSCLOSECHANGENOTIFY - Close a CHANGENOTIFY handle
;
;       INVOKE  push    word Handle             (1 word)
;               call    DOSCLOSECHANGENOTIFY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSCLOSECHANGENOTIFY, ORD_DOSCLOSECHANGENOTIFY, 1

        ld_bx                           ; put handle in BX

;***DT  preDOSCLOSECHANGENOTIFY - DosCloseChangeNotify invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSCLOSECHANGENOTIFY>,
;          TP    = .preDOSCLOSECHANGENOTIFY,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosCloseChangeNotify Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_CloseChangeNotify, ORD_DOSCLOSECHANGENOTIFY             ;@SEC

;***DT  postDOSCLOSECHANGENOTIFY - DosCloseChangeNotify post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSCLOSECHANGENOTIFY>,
;          TP    = .postDOSCLOSECHANGENOTIFY,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosCloseChangeNotify Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSCLOSECHANGENOTIFY


;***    DOSDELETE - Store a file in the delete directory
;
;       INVOKE  push@   ASCIIZ Name             (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSDELETE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSDELETE, ORD_DOSDELETE, 4, GDT_DOSDELETE

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

;***DT  preDOSDELETE - DosDelete pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSDELETE>,
;          TP    = .preDOSDELETE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDelete Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_PTR>,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_StoreFile, ORD_DOSDELETE                                ;@SEC

;***DT  postDOSDELETE - DosDelete post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSDELETE>,
;          TP    = .postDOSDELETE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDelete Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSDELETE


;***    DOSDEVIOCTL - perform control functions directly on device, version 1
;
;       See also DOSDEVIOCTL2, below
;
;  DOSDEVIOCTL performs control functions on the device specifed by
;  the opened device handle.
;
;       INVOKE  push@   OTHER Data      (2 words)
;               push@   OTHER ParmList  (2 words)
;               push    WORD Function   (1 word)    (limited to 1 byte)
;               push    WORD Category   (1 word)    (limited to 1 byte)
;               push    WORD DevHandle  (1 word)
;               call    DOSDEVIOCTL
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;

SysEntry DOSDEVIOCTL, ORD_DOSDEVIOCTL, 7, GDT_DOSDEVIOCTL,    ;D90474

        ld_bx                                   ; BX = handle
        ld_al                                   ; AL = category code (1 byte)
        ld_ah                                   ; AH = function code (1 byte)
        ld_di                                   ; ES:DI -> parameter packet
        ld_es
        ld_dsdx                                 ; DS:DX -> data packet
        ld_si_0                                 ; SI = 0 (unknown length)
        ld_cx_0                                 ; CX = 0 (unknown length)

;***DT  preDOSDEVIOCTL - DosDevIoctl pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSDEVIOCTL>,
;          TP    = .preDOSDEVIOCTL,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDevIoctl Pre-Invocation",
;          <LOG_BX>,
;          MEM   = (<KSTK_ARGS>+<SKIP_WORD>,DIRECT,2),
;          MEM   = (<KSTK_ARGS>+<SKIP_WORD>+<SKIP_WORD>,DIRECT,2),
;          FMT   = "Handle = <FMT_BX>  Category = %P %W  Function = %P %W"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_16DevIOCtl, ORD_DOSDEVIOCTL    ; call the worker        ;@SEC

;***DT  postDOSDEVIOCTL - DosDevIoctl post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSDEVIOCTL>,
;          TP    = .postDOSDEVIOCTL,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDevIoctl Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSDEVIOCTL


;***    DOSDEVIOCTL2 - perform control functions directly on device, version 2
;
;       See also DOSDEVIOCTL, above
;
;  DOSDEVIOCTL2 performs control functions on the device specifed by
;  the opened device handle.  It handles length parameters for both data and
;  the parameter list.
;
;       INVOKE  push@   OTHER Data      (2 words)
;               push    DataLength      (1 word)
;               push@   OTHER ParmList  (2 words)
;               push    ParmListLength  (1 word)
;               push    WORD Function   (1 word)
;               push    WORD Category   (1 word)
;               push    WORD DevHandle  (1 word)
;               call    DOSDEVIOCTL2
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;
;
SysEntry DOSDEVIOCTL2, ORD_DOSDEVIOCTL2, 9, GDT_DOSDEVIOCTL2,

        ld_bx                                   ; BX = handle
        ld_al                                   ; AL = category code
        ld_ah                                   ; AH = function code
        ld_cx                                   ; CX = length of param packet
        ld_di                                   ; ES:DI -> parameter packet
        ld_es
        ld_si                                   ; SI = length of data packet
        ld_dsdx                                 ; DS:DX -> data packet

        chk_devioctl    ddi2        ; validate pointer/length conventions.
                                    ; length=0 and non-NULL pointer is invalid
                                    ; (sets AX and jumps to label if either set
                                    ;  is invalid)

;***DT  preDOSDEVIOCTL2 - DosDevIoctl2 pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSDEVIOCTL2>,
;          TP    = .preDOSDEVIOCTL2,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDevIoctl2 Pre-Invocation",
;          <LOG_BX>,
;          MEM   = (<KSTK_ARGS>+<SKIP_WORD>,DIRECT,2),
;          MEM   = (<KSTK_ARGS>+<SKIP_WORD>+<SKIP_WORD>,DIRECT,2),
;          FMT   = "Handle = <FMT_BX> Category = %P %W Function = %P %W"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_16DevIOCtl, ORD_DOSDEVIOCTL2     ; call the worker      ;@SEC

;***DT  postDOSDEVIOCTL2 - DosDevIoctl2 post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSDEVIOCTL2>,
;          TP    = .postDOSDEVIOCTL2,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDevIoctl2 Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

ddi2:   RASposttrace                    ; RAS post-invocation trace

EndEntry DOSDEVIOCTL2

;***    DOSDUPHANDLE - Duplicate a handle
;
;       INVOKE  push    word handle             (1 word)
;               push    @newhandle              (2 words)
;               call    DOSDUPHANDLE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       ERROR_INVALID_HANDLE
;                       error_invalid_target_handle
;                       error_too_many_open_files
;
SysEntry DOSDUPHANDLE, ORD_DOSDUPHANDLE, 3, GDT_DOSDUPHANDLE

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_ind_cx                       ; target handle or FFFFh
        ld_bx                           ; put handle in bx

;***DT  preDOSDUPHANDLE - DosDupHandle pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSDUPHANDLE>,
;          TP    = .preDOSDUPHANDLE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDupHandle Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall api_Dup, ORD_DOSDUPHANDLE   ; get back new handle in AX   ;@SEC
        st_ax                           ; put new handle in location specified by user

;***DT  postDOSDUPHANDLE - DosDupHandle post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSDUPHANDLE>,
;          TP    = .postDOSDUPHANDLE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosDupHandle Post-Invocation",
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "New handle = <FMT_AX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSDUPHANDLE


;***    DOSEDITNAME - tranform source string using editing string
;
;       INVOKE  push    WORD EditLevel          (1 word)
;               push@   ASCIIZ SourceString     (2 words)
;               push@   ASCIIZ EditString       (2 words)
;               push@   OTHER TargetBuf         (2 words)
;               push    WORD TargetBufLen       (1 word)
;               call    DOSEDITNAME
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSEDITNAME, ORD_DOSEDITNAME, 8

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; load result buffer length
        ld_dx                           ; load pointer to result buffer
        rplstampsel                     ; rpl-stamp selector
        ld_ax                           ; (AX:DX) -> user buffer
        getusrbufz3                     ; copy asciiz string to kernel buffer
        ld_si
        ld_ds_norpl                     ; (DS:SI) -> edit string
        getusrbufz3                     ; copy asciiz string to kernel buffer
        ld_di                           ; DI = offset for source string
        ld_es_norpl                     ; ES:DI -> source string
        ld_bx                           ; load edit level

;***DT  preDOSEDITNAME - DosEditName pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSEDITNAME>,
;          TP    = .preDOSEDITNAME,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosEditName Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+6,I,<SHORTPATHLEN>),
;          ASCIIZ= (<KSTK_ARGS>+10,I,<SHORTPATHLEN>),
;          <LOG_BX>,
;          FMT   = "Edit string = <FMT_ASCIIZ>",
;          FMT   = "Source string = <FMT_ASCIIZ>",
;          FMT   = "Level = <FMT_BX>"


        RASpretrace                     ; RAS pre-invocation trace

        farcall w_EditName, ORD_DOSEDITNAME              ; call the worker;@SEC

;***DT  postDOSEDITNAME - DosEditName post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSEDITNAME>,
;          TP    = .postDOSEDITNAME,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosEditName Post-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_WORD>,INDIRECT,<MAXPATHLEN>),
;          <LOG_RETVAL>,
;          FMT   = "Resultant string = <FMT_ASCIIZ>",
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSEDITNAME


;***    DOSENUMATTRIBUTE - Enumerate a file or directory's extended attributes
;
;       INVOKE  PUSH    WORD    RefType         (1 word)
;               PUSH@   OTHER   FileHandle or PathName (2 words)
;               PUSH    DWORD   EntryNum        (2 words)
;               PUSH@   OTHER   EnumBuf         (2 words)
;               PUSH    DWORD   EnumBufSize     (2 words)
;               PUSH@   DWORD   EnumBufCnt      (2 words)
;               PUSH    DWORD   InfoLevel       (2 words)
;               PUSH    DWORD   0               (2 words)
;               call    DOSENUMATTRIBUTE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               error_invalid_handle
;                               invalid parameters
;
;
SysEntry DOSENUMATTRIBUTE, ORD_DOSENUMATTRIBUTE, 15

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        ld_cx_0                         ; fake file handle lockID low word
        ld_dx_0                         ; fake file handle lockID high word
        ld_ah                           ; AH = InfoLevel
        skip_word                       ; skip unused high word of InfoLevel

        skip_ptr                        ; Skip enumbufcnt
        skip_2word                      ; Skip enumbufsize
        rplstampptr                     ; rpl-stamp pointer
        skip_ptr                        ; Skip enumbuf
        skip_2word                      ; Skip entrynum
        skip_2word                      ; Skip FileRef
        cmp_je      1,ea10              ; if RefType = pathname
                                        ; go copy to buffer

        uncond_jmp  ea20                ; skip loading string

ea10:
        backup_2word                    ; back up to FileRef
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer

ea20:
        ld_al                           ; AL = RefType

        ld_parampkt_bx                  ; BX = offset to parameter structure

;***DT  preDOSENUMATTRIBUTE - DosEnumAttribute pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSENUMATTRIBUTE>,
;          TP    = .preDOSENUMATTRIBUTE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosEnumAttribute Pre-Invocation",

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_EnumAttribute, ORD_DOSENUMATTRIBUTE    ; call the worker;@SEC

;***DT  postDOSENUMATTRIBUTE - DosEnumAttribute post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSENUMATTRIBUTE>,
;          TP    = .postDOSENUMATTRIBUTE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosEnumAttribute Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSENUMATTRIBUTE


;***    DOSPROTECTENUMATTRIBUTE - Enumerate a file or directory's extended attributes
;
;       INVOKE  PUSH    WORD    RefType          (1 word)
;               PUSH@   OTHER   FileHandle or PathName (2 words)
;               PUSH    DWORD   EntryNum         (2 words)
;               PUSH@   OTHER   EnumBuf          (2 words)
;               PUSH    DWORD   EnumBufSize      (2 words)
;               PUSH@   DWORD   EnumBufCnt       (2 words)
;               PUSH    DWORD   InfoLevel        (2 words)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               PUSH    DWORD   0                (2 words)
;               call    DOSPROTECTENUMATTRIBUTE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               error_invalid_handle
;                               invalid parameters
;
;
SysEntry DOSPROTECTENUMATTRIBUTE, ORD_DOSPROTECTENUMATTRIBUTE, 17

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        ld_cx                           ; file handle lockID low word
        ld_dx                           ; file handle lockID high word
        ld_ah                           ; AH = InfoLevel
        skip_word                       ; skip unused high word of InfoLevel

        skip_ptr                        ; Skip enumbufcnt
        skip_2word                      ; Skip enumbufsize
        rplstampptr                     ; rpl-stamp pointer
        skip_ptr                        ; Skip enumbuf
        skip_2word                      ; Skip entrynum
        skip_2word                      ; Skip FileRef
        cmp_je      1,pea10             ; if RefType = pathname
                                        ; go copy to buffer

        uncond_jmp  pea20               ; skip loading string

pea10:
        backup_2word                    ; back up to FileRef
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer

pea20:
        ld_al                           ; AL = RefType

        ld_parampkt_bx                  ; BX = offset to parameter structure

;***DT  preDOSPROTECTENUMATTRIBUTE - DosProtectEnumAttribute pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTENUMATTRIBUTE>,
;          TP    = .preDOSPROTECTENUMATTRIBUTE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectEnumAttribute Pre-Invocation",

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_ProtectEnumAttribute, ORD_DOSPROTECTENUMATTRIBUTE       ;@SEC

;***DT  postDOSPROTECTENUMATTRIBUTE - DosProtectEnumAttribute post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTENUMATTRIBUTE>,
;          TP    = .postDOSPROTECTENUMATTRIBUTE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectEnumAttribute Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTENUMATTRIBUTE


;***    DOSFILEIO - Multiple Lock/Unlock, Seek, Read/Write
;
;       INVOKE  PUSH  WORD  FileHandle        ; File Handle
;               PUSH@ OTHER CommandList       ; Ptr to Command buffer
;               PUSH  WORD  CommandListLen    ; Length of Command buffer
;               PUSH@ OTHER ErrorOffset       ; Ptr to Command error offset
;               CALL  DOSFILEIO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSFILEIO, ORD_DOSFILEIO,FIO_ArgWords

        rplstampptr
        skip_ptr                        ; skip ErrorOffset ptr
        ld_cx                           ; CX = length of buffer
        rplstampptr
        skip_ptr                        ; skip CommandList ptr
        ld_dx                           ; file handle
        ld_parampkt_bx
        ld_si_0                         ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword
        ld_imm_ah      00h              ; force file handle lockID check

;***DT  preDOSFILEIO - DosFileIO pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFILEIO>,
;          TP    = .preDOSFILEIO,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFileIO Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FileIO, ORD_DOSFILEIO                ; call the worker  ;@SEC

;***DT  postDOSFILEIO - DosFileIO post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFILEIO>,
;          TP    = .postDOSFILEIO,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFileIO Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSFILEIO

;***    DOSPROTECTFILEIO - Multiple Lock/Unlock, Seek, Read/Write
;
;       INVOKE  PUSH  WORD  FileHandle        ; File Handle
;               PUSH@ OTHER CommandList       ; Ptr to Command buffer
;               PUSH  WORD  CommandListLen    ; Length of Command buffer
;               PUSH@ OTHER ErrorOffset       ; Ptr to Command error offset
;               PUSH  DWORD FileHandleLockID  ; File Handle LockID
;               CALL  DOSPROTECTFILEIO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSPROTECTFILEIO, ORD_DOSPROTECTFILEIO,PFIO_ArgWords

        ld_si                           ; filehandlelockID low word
        ld_di                           ; filehandlelockID high word
        rplstampptr
        skip_ptr                        ; skip ErrorOffset ptr
        ld_cx                           ; CX = length of buffer
        rplstampptr
        skip_ptr                        ; skip CommandList ptr
        ld_dx                           ; file handle
        ld_parampkt_bx
        ld_imm_ah      00h              ; force file handle lockID check

;***DT  preDOSPROTECTFILEIO - DosProtectFileIO pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTFILEIO>,
;          TP    = .preDOSPROTECTFILEIO,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectFileIO Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FileIO, ORD_DOSPROTECTFILEIO      ; call the worker     ;@SEC

;***DT  postDOSPROTECTFILEIO - DosProtectFileIO post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTFILEIO>,
;          TP    = .postDOSPROTECTFILEIO,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectFileIO Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSPROTECTFILEIO


;***    DOSFILELOCKS - File lock manager
;
;       Unlock and/or lock a range in an opened file.
;
;       INVOKE  PUSH    WORD    Handle          (1 word)
;               PUSH@   OTHER   UnLockRange     (2 words)
;               PUSH@   OTHER   LockRange       (2 words)
;               call    DOSFILELOCKS
;
;       RETURN  (ax) = error code
;
SysEntry DOSFILELOCKS, ORD_DOSFILELOCKS, 5

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_imm_ax       0               ; set sharemode flags to "exclusive"
                                        ; AH = force check of filehandle lockID
                                        ; use CX:DX as fake filehandle lockID
                                        ; since timeout value defaults to 0
                                        ; ("immediate return") in 16:16
        ld_dx_0                         ; CX:DX = fake filehandle lockID
        ld_cx_0                         ;

        ld_di                           ; lock range into ES:DI
        ld_es
        ld_si                           ; unlock range into DS:SI
        ld_ds
        ld_bx                           ; handle

;***DT  preDOSFILELOCKS - DosFileLocks pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFILELOCKS>,
;          TP    = .preDOSFILELOCKS,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFileLocks Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FileLocks, ORD_DOSFILELOCKS                             ;@SEC

;***DT  postDOSFILELOCKS - DosFileLocks post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFILELOCKS>,
;          TP    = .postDOSFILELOCKS,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFileLocks Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFILELOCKS


;***    DOSPROTECTFILELOCKS - File lock manager
;
;       Unlock and/or lock a range in an opened file.
;
;       INVOKE  PUSH    WORD    Handle           (1 word)
;               PUSH@   OTHER   UnLockRange      (2 words)
;               PUSH@   OTHER   LockRange        (2 words)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSPROTECTFILELOCKS
;
;       RETURN  (ax) = error code
;
SysEntry DOSPROTECTFILELOCKS, ORD_DOSPROTECTFILELOCKS, 7

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_imm_ax       0               ; set sharemode flags to "exclusive"
                                        ; AH = force check of filehandle lockID
                                        ; use CX:DX as filehandle lockID
                                        ; timeout value defaults to 0
                                        ; ("immediate return") in 16:16
        ld_dx                           ;
        ld_cx                           ; CX:DX = filehandle lockID

        ld_di                           ; lock range into ES:DI
        ld_es
        ld_si                           ; unlock range into DS:SI
        ld_ds
        ld_bx                           ; handle

;***DT  preDOSPROTECTFILELOCKS - DosProtectFileLocks pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTFILELOCKS>,
;          TP    = .preDOSPROTECTFILELOCKS,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectFileLocks Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FileLocks, ORD_DOSPROTECTFILELOCKS                      ;@SEC

;***DT  postDOSPROTECTFILELOCKS - DosProtectFileLocks post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTFILELOCKS>,
;          TP    = .postDOSPROTECTFILELOCKS,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectFileLocks Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTFILELOCKS


;***    DOSFINDCLOSE - terminate a search
;
;       INVOKE  push    WORD Dirhandle          (1 word)
;               call    DOSFINDCLOSE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSFINDCLOSE, ORD_DOSFINDCLOSE, 1

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_bx                           ; BX = search handle to close

;***DT  preDOSFINDCLOSE - DosFindClose pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDCLOSE>,
;          TP    = .preDOSFINDCLOSE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindClose Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindClose, ORD_DOSFINDCLOSE        ; call the worker    ;@SEC

;***DT  postDOSFINDCLOSE - DosFindClose post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDCLOSE>,
;          TP    = .postDOSFINDCLOSE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindClose Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFINDCLOSE


;***    DOSFINDFIRST - begin a directory search
;
;       SEE DOSFINDFIRST2, below (for FileInfoLevel support)
;
;       INVOKE  push@   ASCIIZ Filename         (2 words)
;               push@   WORD Dirhandle          (2 words)
;               push    WORD Attribute          (1 word)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    DWORD 0L RESERVED       (2 words)
;               call    DOSFINDFIRST
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;

;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.
;
;             This structure is passed to the worker (because there aren't
;             enough registers).

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

SysEntry DOSFINDFIRST, ORD_DOSFINDFIRST, FF_ArgWords

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        skip_ptr                        ; skip searchcount pointer
        skip_word                       ; Skip over buffer length
        rplstampptr                     ; RPLstamp pointer to result buffer
        skip_5word                      ; Skip buf ptr, Srch Attribute and
                                            ; handle pointer
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel1         ; AL = interface level 1
        ld_imm_dx   0                   ; DX = 0 b722492

;***DT  preDOSFINDFIRST - DosFindFirst pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDFIRST>,
;          TP    = .preDOSFINDFIRST,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFirst Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+20,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindFirst, ORD_DOSFINDFIRST             ; call the worker @SEC
        skip_ptr                        ; skip over reserved DWORD 0
        st_cx                           ; report search count
        skip_4word                      ; advance to search handle pointer
        st_bx                           ; update search handle

;***DT  postDOSFINDFIRST - DosFindFirst post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDFIRST>,
;          TP    = .postDOSFINDFIRST,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFirst Post-Invocation",
;          <LOG_BX>,
;          <LOG_RETVAL>,
;          FMT   = "Search handle = <FMT_BX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFINDFIRST


;***    DOSFINDFIRST2 - begin a directory search
;
;       SEE DOSFINDFIRST, above (for old interface; no FileInfoLevel suport)
;
;       INVOKE  push@   ASCIIZ Filename         (2 words)
;               push@   WORD Dirhandle          (2 words)
;               push    WORD Attribute          (1 word)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    WORD FileInfoLevel      (1 word)
;               push    DWORD 0L RESERVED       (2 words)
;               call    DOSFINDFIRST2
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;

;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.
;
;             This structure is passed to the worker (because there aren't
;             enough registers).

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

SysEntry DOSFINDFIRST2, ORD_DOSFINDFIRST2, FF2_ArgWords

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        skip_4word                      ; Skip over InfoLevel, SrchCount ptr and
                                            ; buffer length
        rplstampptr                     ; RPLstamp pointer to result buffer
        skip_5word                      ; Skip buf ptr, Srch Attribute and
                                            ; handle pointer
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer
        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel2         ; AL = interface level 2
        ld_imm_dx   0                   ; DX = 0 b722492

;***DT  preDOSFINDFIRST2 - DosFindFirst2 pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDFIRST2>,
;          TP    = .preDOSFINDFIRST2,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFirst2 Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+22,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindFirst, ORD_DOSFINDFIRST2             ; call the worker @SEC
        skip_ptr                        ; skip over reserved DWORD 0
        skip_word                       ; skip over FileInfoLevel
        st_cx                           ; report search count
        skip_4word                      ; advance to search handle pointer
        st_bx                           ; update search handle

;***DT  postDOSFINDFIRST2 - DosFindFirst2 post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDFIRST2>,
;          TP    = .postDOSFINDFIRST2,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFirst2 Post-Invocation",
;          <LOG_BX>,
;          <LOG_RETVAL>,
;          FMT   = "Search handle = <FMT_BX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFINDFIRST2

;***    DOSIFINDFIRST - begin a directory search
;
;       This entry point is called by a 32->16 bit thunk that also
;       packs any EA buffers.
;
;       SEE DOSFINDFIRST, above (for old interface; no FileInfoLevel suport)
;
;       INVOKE  push@   ASCIIZ Filename         (2 words)
;               push@   WORD Dirhandle          (2 words)
;               push    WORD Attribute          (1 word)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    WORD InfoLevel          (1 word)
;               push    DWORD FlatRetData       (2 words)
;               push    DWORD FlatRsltBufPtr    (2 words)
;               push    DWORD FlatSrchCountPtr  (2 words)
;               call    DOSFINDFIRST2
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;

;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.
;
;             This structure is passed to the worker (because there aren't
;             enough registers).

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

SysEntry DOSIFINDFIRST, ORD_DOSIFINDFIRST, FF32_ArgWords

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_4word                      ; skip flat pointers
        skip_ptr                        ; skip RetData
        skip_4word                      ; Skip over InfoLevel, SrchCount ptr and
                                        ; buffer length
        rplstampptr                     ; RPLstamp pointer to result buffer
        skip_5word                      ; Skip buf ptr, Srch Attribute and
                                            ; handle pointer
        getusrbufz3                     ; copy asciiz string to kernel buffer
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer
        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel2         ; AL = interface level 2

        farcall w_32FindFirst, ORD_DOSIFINDFIRST        ; call the worker ;@SEC
        skip_4word                      ; skip flat pointers
        skip_ptr                        ; skip RetData
        skip_word                       ; skip InfoLevel
;       st_cx                           ; report search count
        skip_ptr                        ; skip search count
        skip_4word                      ; advance to search handle pointer
        st_bx                           ; update search handle

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSIFINDFIRST


;***    DOSFINDFROMNAME - continue a directory search from a given position
;
;       INVOKE  push    WORD Dirhandle          (1 words)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    DWORD Position          (2 words)
;               push@   ASCIIZ FileName         (2 words)
;               call    DOSFINDFROMNAME
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSFINDFROMNAME, ORD_DOSFINDFROMNAME, FFNM_ArgWords

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        skip_4word                      ; Skip over @FileName, Position
        ld_ind_ax                       ; AX = request search count
        skip_word                       ; skip over buffer length
        rplstampptr                     ; RPLstamp pointer to result buffer
        skip_2word                      ; skip over @ResultBuf
        skip_word                       ; skip over DirHandle
        ld_parampkt_bx                  ; BX = offset to parameter structure

;***DT  preDOSFINDFROMNAME - DosFindFromName pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDFROMNAME>,
;          TP    = .preDOSFINDFROMNAME,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFromName Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>,INDIRECT,<MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+<SKIP_PTR>,DIRECT,4),
;          MEM   = (<KSTK_ARGS>+18,DIRECT,2),
;          FMT   = "Name = <FMT_ASCIIZ>",
;          FMT   = "Position = <FMT_C_PTR>  Directory Handle = <FMT_C_WORD>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindFromName, ORD_DOSFINDFROMNAME     ; call the worker ;@SEC
        skip_ptr                        ; skip over pointer to Filename
        skip_2word                      ; skip over Position
        st_cx                           ; report search count

;***DT  postDOSFINDFROMNAME - DosFindFromName post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDFROMNAME>,
;          TP    = .postDOSFINDFROMNAME,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindFromName Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Search count = <FMT_CX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFINDFROMNAME


;***    DOSFINDNEXT - continue a directory search
;
;       INVOKE  push    WORD Dirhandle          (1 words)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               call    DOSFINDNEXT
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSFINDNEXT, ORD_DOSFINDNEXT, 6

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_ind_ax                       ; AX = request search count
        ld_cx                           ; CX = buffer length

        ld_di                           ; ES:DI -> result buffer
        ld_es

        ld_bx                           ; BX = search handle

        ld_imm_dx       0               ; DX = 16-bit caller

;***DT  preDOSFINDNEXT - DosFindNext pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDNEXT>,
;          TP    = .preDOSFINDNEXT,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNext Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindNext, ORD_DOSFINDNEXT              ; call the worker;@SEC
        st_cx                           ; report search count

;***DT  postDOSFINDNEXT - DosFindNext post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDNEXT>,
;          TP    = .postDOSFINDNEXT,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNext Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFINDNEXT


;***    DOSIFINDNEXT - continue a directory search
;
;       This entry point is called by a 32->16 bit thunk that resides
;       in DOSCALL1.DLL.
;
;       INVOKE  push    WORD Dirhandle          (1 words)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push@   OTHER FlatRetData       (2 words)
;               push@   OTHER FlatResultbuf     (2 words)
;               push@   DWORD FlatSearchcount   (2 words)

;               call    DOSIFINDNEXT
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSIFINDNEXT, ORD_DOSIFINDNEXT, FN32_ArgWords

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_4word                      ; skip flat pointers
        skip_ptr                        ; skip RetData
        rplstampptr                     ; RPLstamp pointer to search count
        skip_ptr                        ; skip pointer to search count
        skip_word                       ; skip result buf length
        rplstampptr                     ; RPLstamp pointer to result buf
        ld_parampkt_bx                  ; BX = offset to parameter structure

        farcall w_32FindNext, ORD_DOSIFINDNEXT            ; call the worker @SEC

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSIFINDNEXT





;***    DOSFINDNOTIFYCLOSE - terminate a path watch
;
;       INVOKE  push    WORD Dirhandle          (1 word)
;               call    DOSFINDNOTIFYCLOSE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSFINDNOTIFYCLOSE, ORD_DOSFINDNOTIFYCLOSE, 1

        ld_bx                           ; BX = path handle to close

;***DT  preDOSFINDNOTIFYCLOSE - DosFindNotifyClose pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDNOTIFYCLOSE>,
;          TP    = .preDOSFINDNOTIFYCLOSE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyClose Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindNotifyClose, ORD_DOSFINDNOTIFYCLOSE  ; call the worker @SEC

;***DT  postDOSFINDNOTIFYCLOSE - DosFindNotifyClose post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDNOTIFYCLOSE>,
;          TP    = .postDOSFINDNOTIFYCLOSE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyClose Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSFINDNOTIFYCLOSE


;***    DOSFINDNOTIFYFIRST - begin a directory watch
;
;
;       INVOKE  push@   ASCIIZ Filename         (2 words)
;               push@   WORD Dirhandle          (2 words)
;               push    WORD Attribute          (1 word)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    WORD FileInfoLevel      (1 word)
;               push    DWORD TimeOut           (2 words)
;               push    DWORD 0L RESERVED       (2 words)
;               call    DOSFINDNOTIFYFIRST
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;

;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in FIND.INC) must
;             match in size and structure.
;
;             This structure is passed to the worker (because there aren't
;             enough registers).

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

SysEntry DOSFINDNOTIFYFIRST, ORD_DOSFINDNOTIFYFIRST, FNY_ArgWords

        reser_dd_arg                    ; check reserved argument
        ld_ax                           ; Low word of timeout
        ld_dx                           ; High word of timeout
        skip_word                       ; skip over FileInfoLevel
        rplstampptr                     ; rpl stamp searchcount pointer
        skip_ptr                        ; skip searchcount pointer
        ld_cx                           ; CX = buffer length
        rplstampptr                     ; rpl stamp buffer pointer
        skip_ptr                        ; skip buffer pointer
        skip_word                       ; skip over ATTRIBUTE
        rplstampptr                     ; rpl stamp handle pointer
        skip_ptr                        ; skip handle pointer
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_si
        ld_ds_norpl                     ; DS:SI -> filename in kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure

;***DT  preDOSFINDNOTIFYFIRST - DosFindNotifyFirst pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDNOTIFYFIRST>,
;          TP    = .preDOSFINDNOTIFYFIRST,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyFirst Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+26,INDIRECT,<MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+20,DIRECT,2),
;          MEM   = (<KSTK_ARGS>+8,DIRECT,2),
;          <LOG_DX>,
;          <LOG_AX>,
;          FMT   = "Name = <FMT_ASCIIZ>",
;          FMT   = "Attribute = %P %W Level = %P %W",
;          FMT   = "Timeout = <FMT_DX><FMT_AX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindNotifyFirst, ORD_DOSFINDNOTIFYFIRST                 ;@SEC
        skip_ptr                        ; skip over reserved DWORD 0
        skip_ptr                        ; skip over timeout
        skip_word                       ; skip over FileInfoLevel
        st_cx                           ; report search count
        skip_4word                      ; advance to search handle pointer
        st_bx                           ; update search handle

;***DT  postDOSFINDNOTIFYFIRST - DosFindNotifyFirst post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDNOTIFYFIRST>,
;          TP    = .postDOSFINDNOTIFYFIRST,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyFirst Post-Invocation",
;          <LOG_CX>,
;          <LOG_BX>,
;          <LOG_RETVAL>,
;          FMT   = "Search count = <FMT_CX> Handle = <FMT_BX>",
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSFINDNOTIFYFIRST


;***    DOSFINDNOTFIYNEXT - continue a directory watch
;
;       INVOKE  push    WORD Dirhandle          (1 words)
;               push@   OTHER Resultbuf         (2 words)
;               push    WORD Resultbuflen       (1 word)
;               push@   WORD Searchcount        (2 words)
;               push    DWORD TimeOut           (2 words)
;               call    DOSFINDNOTIFYNEXT
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSFINDNOTIFYNEXT, ORD_DOSFINDNOTIFYNEXT, 8

        ld_ax                           ; Low word of timeout
        ld_dx                           ; High word of timeout
        ld_ind_si                       ; SI = request Change count
        ld_cx                           ; CX = buffer length

        ld_di                           ; ES:DI -> result buffer
        ld_es

        ld_bx                           ; BX = search handle

;***DT  preDOSFINDNOTIFYNEXT - DosFindNotifyNext pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFINDNOTIFYNEXT>,
;          TP    = .preDOSFINDNOTIFYNEXT,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyNext Pre-Invocation",
;          <LOG_SI>,
;          <LOG_BX>,
;          FMT   = "Change count = <FMT_SI> Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_FindNotifyNext, ORD_DOSFINDNOTIFYNEXT                   ;@SEC
        skip_ptr                        ; skip over timeout
        st_cx                           ; report change count

;***DT  postDOSFINDNOTIFYNEXT - DosFindNotifyNext post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFINDNOTIFYNEXT>,
;          TP    = .postDOSFINDNOTIFYNEXT,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFindNotifyNext Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Change count = <FMT_CX> Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSFINDNOTIFYNEXT


;***    DOSFORCEDELETE - Delete a file or named pipe
;
;       INVOKE  push@   ASCIIZ Name             (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSFORCEDELETE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSFORCEDELETE, ORD_DOSFORCEDELETE, 4

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

;***DT  preDOSFORCEDELETE - DosForceDelete pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFORCEDELETE>,
;          TP    = .preDOSFORCEDELETE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosForceDelete Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_PTR>,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_Unlink, ORD_DOSFORCEDELETE        ; call the worker     ;@SEC

;***DT  postDOSFORCEDELETE - DosForceDelete post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFORCEDELETE>,
;          TP    = .postDOSFORCEDELETE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosForceDelete Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSFORCEDELETE


;***    DOSFSATTACH - Attach Drive/pseudo-Char Device to FSD.
;
;
;  ENTRY   push@ ASCIIZ   ptr to drive/device name           (2 word)
;          push@ ASCIIZ   ptr to FSD name                    (2 word)
;          push@ other    ptr to data buffer                 (2 word)
;          push  word     data buffer length                 (1 word)
;          push  word     opflag                             (1 word)
;          push  dword    0                                  (2 word)
;
;          call    DOSFSATTACH
;
;       EXIT    (ax) = return code
;                       0 - success
;                       x - INVALID_DRIVE
;                       x - INVALID_PATH
;                       x - INVALID_FSD_NAME
;                       x - INVALID_PARAMETER
;
;       NOTES: device name for character/pseudo character devices must
;              be of the form  "\DEV\devicename"
;
;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.
;
SysEntry DOSFSATTACH, ORD_DOSFSATTACH,FSA_ArgWords

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

;       72417 removed fscrit
;   enterfscrit                        ; get serialization thread
    reser_dd_arg                       ; reser_dd_arg thop
    ld_ax                              ; ld_ax thop with opflag
    skip_word                          ; skp data buffer length
    rplstampptr                        ; rpl-stamp pointer
    skip_ptr                           ; skp data buffer pointer
    getusrbufz3                        ; copy string to kernel buffer
    ld_si                              ; load lo word of FSDName
    ld_ds_norpl                        ; DS:SI -> FSDName in kernel buffer
    getusrbufz3                        ; copy string to kernel buffer
    ld_parampkt_bx                     ; BX = offset to parameter struc
                                       ; REMEMBER, data buf@ not validated!!

;***DT  preDOSFSATTACH - DosFSAttach pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFSATTACH>,
;          TP    = .preDOSFSATTACH,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFSAttach Pre-Invocation",
;          ASCIIZ=(<KSTK_ARGS>+16,INDIRECT,<SHORTPATHLEN>),
;          ASCIIZ=(<KSTK_ARGS>+12,INDIRECT,<SHORTPATHLEN>),
;          <LOG_AX>,
;          FMT   = "Device = <FMT_ASCIIZ>",
;          FMT   = "FSD = <FMT_ASCIIZ>",
;          FMT   = "OpFlag = <FMT_AX>"

        RASpretrace                     ; RAS pre-invocation trace

    farcall w_FSAttach, ORD_DOSFSATTACH                 ; call the worker ;@SEC

;***DT  postDOSFSATTACH - DosFSAttach post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFSATTACH>,
;          TP    = .postDOSFSATTACH,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFSAttach Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;   exitfscrit                         ; release semaphore

EndEntry DOSFSATTACH


;***    DOSFSCTL - Extendable File System Control
;
;  ENTRY   push@ other    ptr to data area                   (2 word)
;          push  word     length of data area                (1 word)
;          push@ word     ptr to len of data area returned (2 words)
;          push@ other    ptr to parameter list              (2 word)
;          push  word     length of parameter list           (1 word)
;          push@ word     ptr to len of param.area returned (2 words)
;          push  word     function code                      (1 word)
;          push@ ASCIIZ   name of FSD/path of file/dir       (2 word)
;          push  word     file handle                        (1 word)
;          push  word     method of routing(handle/path...)  (1 word)
;          push  dword    0                                  (2 word)
;
;          call    DOSFSCTL
;
;       EXIT    (ax) = return code
;                       0 - success
;                       x - ERROR_INTERRUPT
;                       x - ERROR_INVALID_FUNCTION
;                       x - ERROR_INVALID_CATEGORY
;                       x - ERROR_INVALID_PARAMETER
;                       x - ERROR_INVALID_HANDLE
;                       x - ERROR_INVALID_FSD_NAME
;                       x - ERROR_INVALID_DRIVE
;
;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.

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

SysEntry DOSFSCTL, ORD_DOSFSCTL, FSC_ArgWords

    reser_dd_arg                            ; verify dword of 0
    ld_ax                                   ; AX = route method
    ld_cx                                   ; CX = file handle
    getusrnzbuf                             ; IF not null, copy name to kernel
    skip_ptr                                ; skip RouteName
    skip_word                               ; skip function code
    rplstampptr                             ; RPL stamp parm len out
        skip_ptr                                        ; skip ptr to parm len out
    skip_word                               ; skip parm length
    rplstampptr                             ; RPL stamp parm area ptr
    skip_ptr                                ; skip parm area pointer
        rplstampptr                                     ; RPL stamp data area len out
        skip_ptr                                        ; skip data len out
    skip_word                               ; skip data length
    rplstampptr                             ; RPL stamp data area ptr
    ld_parampkt_bx                          ; BX -> stack frame structure

;***DT  preDOSFSCTL - DosFSCtl pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSFSCTL>,
;          TP    = .preDOSFSCTL,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFSCtl Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+8,INDIRECT,<MAXPATHLEN>),
;          <LOG_CX>,
;          <LOG_AX>,
;          FMT   = "FSD = <FMT_ASCIIZ>",
;          FMT   = "Handle = <FMT_CX> Route = <FMT_AX>"

        RASpretrace                     ; RAS pre-invocation trace

    farcall w_FSCtl, ORD_DOSFSCTL       ; call the worker routine         ;@SEC

;***DT  postDOSFSCTL - DosFSCtl post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSFSCTL>,
;          TP    = .postDOSFSCTL,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosFSCtl Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSFSCTL


;***    DOSICOPY - copy file or subdirectory
;
;       INVOKE  push@   ASCIIZ  SourceName      (2 words)
;               push@   ASCIIZ  TargetName      (2 words)
;               push    WORD    OpMode          (1 word)
;               push    DWORD   0               (2 words)
;               call    DOSICOPY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       ERROR_FILENAME_EXCED_RANGE
;                       ERROR_PATH_NOT_FOUND
;                       ERROR_SHARING_VIOLATION
;                       ERROR_INSUFFICIENT_DISK_SPACE
;                       ERROR_ACCESS_DENIED
;                       ERROR_DIRECTORY
;                       ERROR_FILE_NOT_FOUND
;                       ERROR_NOT_DOS_DISK
;                       ERROR_DRIVE_LOCKED
;                       ERROR_SHARING_BUFFER_EXCEEDED

SysEntry DOSICOPY, ORD_DOSICOPY, 7, GDT_DOSICOPY

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        ld_cx                           ; cx = OpMode
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl
        mv_esdi_dsdx                    ; es:di -> target name
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; ds:dx -> source name

;***DT  preDOSICOPY - DosICopy pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSICOPY>,
;          TP    = .preDOSICOPY,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosICopy Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+10,INDIRECT,<SHORTPATHLEN>),
;          ASCIIZ= (<KSTK_ARGS>+6,INDIRECT,<SHORTPATHLEN>),
;          <LOG_CX>,
;          FMT   = "Source = <FMT_ASCIIZ>",
;          FMT   = "Target = <FMT_ASCIIZ>",
;          FMT   = "OpMode = <FMT_CX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_Copy, ORD_DOSICOPY    ; call the worker                 ;@SEC

;***DT  postDOSICOPY - DosICopy post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSICOPY>,
;          TP    = .postDOSICOPY,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosICopy Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSICOPY

;***    DOSIDEVIOCTL - perform control functions directly on device (32bit)
;               (INTERNAL - called only from DosCall1.dll)
;
;       See also DOSDEVIOCTL(2), above
;
;  DOSIDEVIOCTL performs control functions on the device specifed by
;  the opened device handle.  It handles length parameters for both data and
;  the parameter list.
;
;       INVOKE  push    WORD DevHandle  (1 word)
;               push    WORD Category   (1 word)
;               push    WORD Function   (1 word)
;               push@   OTHER ParmList  (2 words)
;               push    ParmListLength  (1 word)
;               push@   OTHER pParmLenInOut (2 words)
;               push@   OTHER Data      (2 words)
;               push    DataLength      (1 word)
;               push@   OTHER pDataLenInOut (2 words)
;               call    DOSIDEVIOCTL
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;
;

SysEntry DOSIDEVIOCTL, ORD_DOSIDEVIOCTL, DIOCTL_ArgWords

        rplstampptr                     ; stamp DataLenInOut ptr
        skip_ptr                        ; skip the ptr

        skip_word                       ; len of DataPkt

        rplstampptr                     ; ptr to data packet
        skip_ptr                        ; stamp Data packet ptr

        rplstampptr                     ; stamp ParmLenInOut ptr
        skip_ptr                        ; and skip it

        skip_word                       ; skip the of parmpkt

        rplstampptr                     ; stamp Parm packet ptr
        skip_ptr                        ; and skip it

        skip_2word                      ; skip function,cat,handle
        skip_word

        ld_parampkt_bx                  ; BX = offset to parameter structure

;***DT  preDOSIDEVIOCTL - DosIDevIoctl pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIDEVIOCTL>,
;          TP    = .preDOSIDEVIOCTL,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIDevIoctl Pre-Invocation",

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_32DevIOCtl, ORD_DOSIDEVIOCTL    ; call the worker       ;@SEC

;***DT  postDOSIDEVIOCTL - DosIDevIoctl post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIDEVIOCTL>,
;          TP    = .postDOSIDEVIOCTL,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIDevIoctl Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

didi2:  RASposttrace                    ; RAS post-invocation trace

EndEntry DOSIDEVIOCTL


;***   DOSIREAD - read the specified file
;
;      INVOKE  push    WORD FileHandle         (1 word)
;              push@   OTHER BufferArea        (2 words)
;              push    WORD BufferLength       (1 word)
;              push@   WORD BytesRead          (2 words)
;              call    DOSIREAD
;
;       RETURN  (ax) = return code
;                      0 - success
;                       nonzero - error
;                              Invalid file handle
;                              Invalid parameter
;
;      NOTE    Worker does protection validation.
;              RAS traceing is done in DOSREAD (ring 3).

SysEntry DOSIREAD, ORD_DOSIREAD, 6, GDT_DOSIREAD

       ld_disi                         ; return value point (used by tracepoint)
       ld_cx                           ; put count in CX
       ld_dsdx                         ; load pointer to buffer
       ld_bx                           ; put handle in BX

;***DT preDOSIREAD - DosIRead pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIREAD>,
;         TP    = .preDOSIREAD,
;         TYPE  = (PRE,API),
;         GROUP = FS,
;         DESC  = "(OS) DosIRead Pre-Invocation",
;         <LOG_BX>,
;         <LOG_DS>,
;         <LOG_DX>,
;         <LOG_CX>,
;         <LOG_DI>,
;         <LOG_SI>,
;         FMT   = "File Handle = <FMT_BX>  Buffer = <FMT_DS>:<FMT_DX>",
;         FMT   = "Buffer Size = <FMT_CX>  Pointer to bytes read = <FMT_DI>:<FMT_SI>"

       RASpretrace                     ; RAS pre-invocation trace

       ld_imm_ax   1                   ; force lockID check
       ld_si_0                         ; fake filehandlelockID lowword
       ld_di_0                         ; fake filehandlelockID highword

       farcall w_Read, ORD_DOSIREAD    ; call the worker                  ;@SEC
       st_cx                           ; save the number of bytes actually read

;***DT postDOSIREAD - DosIRead post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIREAD>,
;         TP    = .postDOSIREAD,
;         TYPE  = (POST,API),
;         GROUP = FS,
;         DESC  = "(OS) DosIRead Post-Invocation",
;         <LOG_CX>,
;         <LOG_RETVAL>,
;         FMT   = "Bytes Read = <FMT_CX>  Return code = <FMT_RETVAL>"

       RASposttrace                    ; RAS post-invocation trace

EndEntry DOSIREAD


;***   DOSIPROTECTREAD - read the specified file
;
;      INVOKE  push    WORD FileHandle         (1 word)
;              push@   OTHER BufferArea        (2 words)
;              push    WORD BufferLength       (1 word)
;              push@   WORD BytesRead          (2 words)
;              push    DWORD FileHandleLockID  (2 words)
;              call    DOSIPROTECTREAD
;
;       RETURN  (ax) = return code
;                      0 - success
;                       nonzero - error
;                              Invalid file handle
;                              Invalid parameter
;
;      NOTE    Worker does protection validation.
;              RAS traceing is done in DOSREAD (ring 3).

SysEntry DOSIPROTECTREAD, ORD_DOSIPROTECTREAD, 8, GDT_DOSIPROTECTREAD

      ld_si                           ; filehandlelockID lowword
      ld_di                           ; filehandlelockID highword
      skip_ptr                        ; return value point, skip for now
      ld_cx                           ; put count in CX
      ld_dsdx                         ; load pointer to buffer
      ld_bx                           ; put handle in BX
      ld_imm_ax       1               ; force lockID check

;***DT preDOSIPROTECTREAD - DosIProtectRead pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIPROTECTREAD>,
;         TP    = .preDOSIPROTECTREAD,
;         TYPE  = (PRE,API),
;         GROUP = FS,
;         DESC  = "(OS) DosIProtectRead Pre-Invocation",
;         <LOG_BX>,
;         FMT   = "Handle = <FMT_BX>"

       RASpretrace                     ; RAS pre-invocation trace

       farcall w_Read, ORD_DOSIPROTECTREAD   ; call the worker            ;@SEC
       skip_2word                      ; skip over file handle lockID
       st_cx                           ; save the number of bytes actually read

;***DT postDOSIPROTECTREAD - DosIProtectRead post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIPROTECTREAD>,
;         TP    = .postDOSIPROTECTREAD,
;         TYPE  = (POST,API),
;         GROUP = FS,
;         DESC  = "(OS) DosIProtectRead Post-Invocation",
;         <LOG_CX>,
;         <LOG_RETVAL>,
;         FMT   = "Bytes Read = <FMT_CX>  Return code = <FMT_RETVAL>"

       RASposttrace                    ; RAS post-invocation trace

EndEntry DOSIPROTECTREAD


;***    DOSISETFILEINFO - Set a File's Information
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    WORD    FileInfoLevel   (1 word)
;               PUSH@   OTHER   FileInfoBuf     (2 words)
;               PUSH    WORD    FileInfoBufSize (1 word)
;               call    DOSISETFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSISETFILEINFO, ORD_DOSISETFILEINFO, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle
        ld_imm_ax     0                 ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword
        mov  dh, 1                      ; to indicate 32-bit call

;***DT preDOSISETFILEINFO - DosISetFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSISETFILEINFO>,
;          TP    = .preDOSISETFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetFileInfo Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Info Level = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFileInfo, ORD_DOSISETFILEINFO   ; call the worker    ;@SEC

;***DT postDOSISETFILEINFO - DosISetFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSISETFILEINFO>,
;          TP    = .postDOSISETFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSISETFILEINFO


;***    DOSIPROTECTSETFILEINFO - Set a File's Information
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    WORD    FileInfoLevel   (1 word)
;               PUSH@   OTHER   FileInfoBuf     (2 words)
;               PUSH    WORD    FileInfoBufSize (1 word)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSIPROTECTSETFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSIPROTECTSETFILEINFO, ORD_DOSIPROTECTSETFILEINFO, 7, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_ax                           ; FileHandleLockID lowword
        ld_di                           ; FileHandleLockID highword
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle
        mov  dh, 1                      ; to indicate 32-bit call

;***DT preDOSIPROTECTSETFILEINFO - DosIProtectSetFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIPROTECTSETFILEINFO>,
;          TP    = .preDOSIPROTECTSETFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosIProtectSetFileInfo Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Info Level = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFileInfo, ORD_DOSIPROTECTSETFILEINFO   ; call the worker @SEC

;***DT postDOSIPROTECTSETFILEINFO - DosIProtectSetFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIPROTECTSETFILEINFO>,
;          TP    = .postDOSIPROTECTSETFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosIProtectSetFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSIPROTECTSETFILEINFO


;***    DOSISETPATHINFO - Set a path object's information
;
;       INVOKE  PUSH@   WORD    PathName        (2 words)
;               PUSH    WORD    PathInfoLevel   (1 word)
;               PUSH@   OTHER   PathInfoBuf     (2 words)
;               PUSH    WORD    PathInfoBufSize (1 word)
;               PUSH    WORD    PathInfoFlags   (1 word)
;               PUSH    DWORD   0               (2 words)
;               call    DOSISETPATHINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSISETPATHINFO, ORD_DOSISETPATHINFO, 9, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        ld_si                           ; SI = path info flags (write_through)
        ld_cx                           ; CX = PathInfoBufSize
        ld_di                           ; DI = offset for PathInfoBuf
        ld_es                           ; ES:DI -> PathInfoBuf
        ld_bx                           ; BX = PathInfoLevel
        getusrbufz206                   ; copy asciiz string to kernel buffer
        ld_dsdx_norpl                   ; DS:DX -> kernel buffer
        ld_imm_ax       1               ; to indicate 32 bit call

;***DT preDOSISETPATHINFO - DosSetPathInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSISETPATHINFO>,
;          TP    = .preDOSISETPATHINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetPathInfo Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+14, INDIRECT, <MAXPATHLEN>),
;          <LOG_BX>,
;          FMT   = "Path =<FMT_ASCIIZ>",
;          FMT   = "Info Level = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetPathInfo, ORD_DOSISETPATHINFO   ; call the worker    ;@SEC

;***DT postDOSISETPATHINFO - DosISetPathInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSISETPATHINFO>,
;          TP    = .postDOSISETPATHINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetPathInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSISETPATHINFO


;***    DOSISETRELMAXFH - Set New Max file handles relative to current max
;
;       INVOKE  PUSH    @DWORD   ReqRelCount     (2 words)
;               PUSH    @DWORD   CurrentMaxFH    (2 words)
;               call    DOSISETRELMAXFH
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;
SysEntry DOSISETRELMAXFH, ORD_DOSISETRELMAXFH, 4,GDT_DOSISETRELMAXFH

;       72417 removed fscrit
;       enterfscrit             ; Entering kernel
        rplstampptr
        ld_si
        ld_dx                   ; dx:si -> pCurrentMaxFH
        rplstampptr
        ld_di
        ld_bx                   ; bx:di -> pReqRelCount

;***DT preDOSISETRELMAXFH - DosISetRelMaxFH pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSISETRELMAXFH>,
;          TP    = .preDOSISETRELMAXFH,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetRelMaxFH Pre-Invocation",

        RASpretrace             ; RAS pre-invokation

        farcall w_SetRelMaxFH, ORD_DOSISETRELMAXFH   ; call the worker    ;@SEC

;***DT postDOSISETRELMAXFH - DosISetRelMaxFH post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSISETRELMAXFH>,
;          TP    = .postDOSISETRELMAXFH,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosISetRelMaxFH Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit              ; Exiting Kernel

EndEntry DOSISETRELMAXFH


;***    DOSIWRITE - Write the specified file
;
;       INVOKE  push    WORD FileHandle         (1 word)
;               push@   OTHER BufferArea        (2 words)
;               push    WORD BufferLength       (1 word)
;               push@   WORD BytesWritten       (2 words)
;               call    DOSIWRITE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid file handle
;                               zero length buffer value
;                               write_invalid_handle
;                               write_access_denied
;
;       NOTE    Worker does protection validation.
;               RAS traceing is done in DOSWRITE (ring 3).
;
SysEntry DOSIWRITE, ORD_DOSIWRITE, 6, GDT_DOSIWRITE

        ld_disi                         ; return value point (used by tracepoint)
        ld_cx                           ; put count in CX
        ld_dsdx                         ; load pointer to buffer
        ld_bx                           ; put handle in BX

;***DT  preDOSIWRITE - DosIWrite pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIWRITE>,
;          TP    = .preDOSIWRITE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIWrite Pre-Invocation",
;         <LOG_BX>,
;         <LOG_DS>,
;         <LOG_DX>,
;         <LOG_CX>,
;         <LOG_DI>,
;         <LOG_SI>,
;         FMT   = "File Handle = <FMT_BX>  Buffer = <FMT_DS>:<FMT_DX>",
;         FMT   = "Buffer Size = <FMT_CX>  Pointer to bytes written = <FMT_DI>:<FMT_SI>"

        RASpretrace                     ; RAS pre-invocation trace

        ld_si_0                         ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword
        ld_imm_ax      1                ; force lockID check

        farcall w_Write, ORD_DOSIWRITE  ; call the worker                 ;@SEC
        st_cx                           ; number of bytes actually written

;***DT  postDOSIWRITE - DosIWrite post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIWRITE>,
;          TP    = .postDOSIWRITE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIWrite Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Bytes Written = <FMT_CX>  Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSIWRITE


;***    DOSIPROTECTWRITE - Write the specified file
;
;       INVOKE  push    WORD FileHandle         (1 word)
;               push@   OTHER BufferArea        (2 words)
;               push    WORD BufferLength       (1 word)
;               push@   WORD BytesWritten       (2 words)
;               push    DWORD FileHandleLockID  (2 words)
;               call    DOSIPROTECTWRITE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid file handle
;                               zero length buffer value
;                               write_invalid_handle
;                               write_access_denied
;
;       NOTE    Worker does protection validation.
;               RAS traceing is done in DOSWRITE (ring 3).
;
SysEntry DOSIPROTECTWRITE, ORD_DOSIPROTECTWRITE, 8, GDT_DOSIPROTECTWRITE

        ld_si                           ; filehandlelockID lowword
        ld_di                           ; filehandlelockID highword
        skip_ptr                        ; return value point, skip for now
        ld_cx                           ; put count in CX
        ld_dsdx                         ; load pointer to buffer
        ld_bx                           ; put handle in BX
        ld_imm_ax   1                   ; force lockID check

;***DT  preDOSIPROTECTWRITE - DosIProtectWrite pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSIPROTECTWRITE>,
;          TP    = .preDOSIPROTECTWRITE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIPROTECTWrite Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_Write, ORD_DOSIPROTECTWRITE                             ;@SEC
        skip_2word                      ; skip over file handle lockID
        st_cx                           ; number of bytes actually written

;***DT  postDOSIPROTECTWRITE - DosIProtectWrite post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSIPROTECTWRITE>,
;          TP    = .postDOSIPROTECTWRITE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosIProtectWrite Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Bytes Written = <FMT_CX>  Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSIPROTECTWRITE


;***    DOSMKDIR - Create the specified directory
;
;       Also see DOSMKDIR2, below
;
;       INVOKE  push@   ASCIIZ DataArea         (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSMKDIR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSMKDIR, ORD_DOSMKDIR, 4

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer
        ld_si_0
        ld_bx_0                         ; SI:BX = NULL pointer (no EA)

;***DT  preDOSMKDIR - DosMkDir pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSMKDIR>,
;          TP    = .preDOSMKDIR,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMkDir Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_DWORD>,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_MkDir, ORD_DOSMKDIR   ; call the worker                 ;@SEC

;***DT  postDOSMKDIR - DosMkDir post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSMKDIR>,
;          TP    = .postDOSMKDIR,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMkDir Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSMKDIR


;***    DOSMKDIR2 - Create the specified directory, version 2
;
;       Also see DOSMKDIR, above
;
;       INVOKE  push@   ASCIIZ  DirName         (2 words)
;               push@   OTHER   EABuf           (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSMKDIR2
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSMKDIR2, ORD_DOSMKDIR2, 6

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        ld_si                           ; load pointer to EABuf
        rplstampsel                     ; rpl-stamp selector
        ld_bx                           ; (bx:si) -> EABuf
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer
                                        ; (ds:dx) -> ASCIIZ DirName

;***DT  preDOSMKDIR2 - DosMkDir2 pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSMKDIR2>,
;          TP    = .preDOSMKDIR2,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMkDir2 Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_DWORD>+<SKIP_PTR>,INDIRECT,<MAXPATHLEN>),
;          FMT   = "Path = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_MkDir, ORD_DOSMKDIR2  ; call the worker                 ;@SEC

;***DT  postDOSMKDIR2 - DosMkDir2 post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSMKDIR2>,
;          TP    = .postDOSMKDIR2,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMkDir2 Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSMKDIR2


;***    DOSMOVE - Rename the specified file
;
;       INVOKE  push@   ASCIIZ OldName          (2 words)
;               push@   ASCIIZ NewName          (2 words)
;               push@   DWORD 0                 (2 words)
;               call    DOSMOVE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSMOVE, ORD_DOSMOVE, 6, GDT_DOSMOVE

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer
        mv_esdi_dsdx                    ; move new name to ES:DI
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

;***DT  preDOSMOVE - DosMove pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSMOVE>,
;          TP    = .preDOSMOVE,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMove Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_DWORD>,I,<SHORTPATHLEN>),
;          ASCIIZ= (<KSTK_ARGS>+<SKIP_DWORD>+<SKIP_PTR>,I,<SHORTPATHLEN>),
;          FMT   = "New name = <FMT_ASCIIZ>",
;          FMT   = "Old name = <FMT_ASCIIZ>"

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_Rename, ORD_DOSMOVE   ; call the worker                 ;@SEC

;***DT  postDOSMOVE - DosMove post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSMOVE>,
;          TP    = .postDOSMOVE,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosMove Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSMOVE


;***    DOSNEWSIZE - Set the size of a file
;
;       INVOKE  push    word Handle             (1 word)
;               push    dword Filesize          (2 words)
;               call    DOSNEWSIZE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSNEWSIZE, ORD_DOSNEWSIZE, 3, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel

        ld_dx                           ; dword length
        ld_cx
        ld_bx                           ; handle
        ld_si_0                         ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword


;***DT preDOSNEWSIZE - DosNewSize pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSNEWSIZE>,
;          TP    = .preDOSNEWSIZE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosNewSize Pre-Invocation",
;          <LOG_CX>,
;          <LOG_DX>,
;          <LOG_BX>,
;          FMT   = "Filesize <FMT_CX><FMT_DX>  Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_NewSize, ORD_DOSNEWSIZE   ; call the worker             ;@SEC


;***DT postDOSNEWSIZE - DosNewSize post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSNEWSIZE>,
;          TP    = .postDOSNEWSIZE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosNewSize Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSNEWSIZE


;***    DOSPROTECTNEWSIZE - Set the size of a file
;
;       INVOKE  push    word Handle             (1 word)
;               push    dword Filesize          (2 words)
;               push    dword FileHandleLockID  (2 words)
;               call    DOSPROTECTNEWSIZE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSPROTECTNEWSIZE, ORD_DOSPROTECTNEWSIZE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel

        ld_si                           ; filehandlelockID lowword
        ld_di                           ; filehandlelockID highword
        ld_dx                           ; dword length
        ld_cx
        ld_bx                           ; handle


;***DT preDOSPROTECTNEWSIZE - DosProtectNewSize pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTNEWSIZE>,
;          TP    = .preDOSPROTECTNEWSIZE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectNewSize Pre-Invocation",
;          <LOG_CX>,
;          <LOG_DX>,
;          <LOG_BX>,
;          FMT   = "Filesize <FMT_CX><FMT_DX>  Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_NewSize, ORD_DOSPROTECTNEWSIZE    ; call the worker     ;@SEC

;***DT postDOSPROTECTNEWSIZE - DosProtectNewSize post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTNEWSIZE>,
;          TP    = .postDOSPROTECTNEWSIZE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectNewSize Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTNEWSIZE


;***    DOSOPEN - Open and/or Create file, return handle, set size
;
;       SEE DOSOPEN2, below (for EA support)
;
;       INVOKE  push@   asciiz Filename         (2 words)
;               push@   word Handle             (2 words)
;               push@   word Action             (2 words)
;               push    dword Size              (2 words)
;               push    word Attribute          (1 word)
;               push    word ControlFlag        (1 word)
;               push    word OpenMode           (1 word)
;               push    dword 0L RESERVED       (2 words)
;               call    DOSOPEN
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;

.erre (size OpenStruc) EQ (OPN_ArgWords * 2)

SysEntry DOSOPEN, ORD_DOSOPEN, OPN_ArgWords, GDT_DOSOPEN,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        skip_5word                      ; Skip over mode,flag,attribute,size
        skip_ptr                        ; skip over Action address
        skip_ptr                        ; skip over Handle address
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel1         ; AL = interface level 1


;***DT preDOSOPEN - DosOpen pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPEN>,
;          TP    = .preDOSOPEN,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+22, INDIRECT, <MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+4, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+6, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+8, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+10,DIRECT, 4),
;          FMT   = "Filename = <FMT_ASCIIZ>",
;          FMT   = "Mode = <FMT_C_WORD>  Control = <FMT_C_WORD>",
;          FMT   = "Attrib = <FMT_C_WORD>  Size = <FMT_C_PTR>"

        RASpretrace             ; RAS pre-invokation

        farcall api_OpenCreate, ORD_DOSOPEN   ; call the worker (@PhysDisk) @SEC
        skip_7word                      ; skip over input part of arg. stk.
        st_bx                           ; store action taken code
        st_ax                           ; store handle (0 if we failed)

;***DT postDOSOPEN - DosOpen post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPEN>,
;          TP    = .postDOSOPEN,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen Post-Invocation",
;          <LOG_BX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Action = <FMT_BX>  Handle = <FMT_AX>"
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSOPEN


;***    DOSOPEN2 - Open and/or Create file, return handle, set size
;
;       SEE DOSOPEN, above (for old interface, with no EA support)
;
;       INVOKE  push@   asciiz Filename         (2 words)
;               push@   word Handle             (2 words)
;               push@   word Action             (2 words)
;               push    dword Size              (2 words)
;               push    word Attribute          (1 word)
;               push    word ControlFlag        (1 word)
;               push    dword OpenMode          (2 words)
;               push@   other EABuf             (2 words)
;               push    dword 0L RESERVED       (2 words)
;               call    DOSOPEN2
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;

.erre (size Open2Struc) EQ (OPN2_ArgWords * 2)

SysEntry DOSOPEN2, ORD_DOSOPEN2, OPN2_ArgWords, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        rplstampptr                     ; rpl stamp EABuf pointer
        skip_ptr                        ; skip EABuf
        skip_4word                      ; Skip over mode,flag,attribute
        skip_2word                      ; skip size
        skip_ptr                        ; skip over Action address
        skip_ptr                        ; skip over Handle address
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel2         ; AL = interface level 2

;***DT preDOSOPEN2 - DosOpen pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPEN2>,
;          TP    = .preDOSOPEN2,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen2 Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+28, INDIRECT, <MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+8, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+12,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+14,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+16,DIRECT, 4),
;          FMT   = "Filename = <FMT_ASCIIZ>",
;          FMT   = "Mode = <FMT_C_WORD>  Control = <FMT_C_WORD>",
;          FMT   = "Attrib = <FMT_C_WORD>  Size = <FMT_C_DWORD>"

        RASpretrace             ; RAS pre-invokation                   ;aa03902

        farcall api_OpenCreate, ORD_DOSOPEN2    ; call the worker (@PhysDisk) @SEC
        skip_10word                     ; skip over input part of arg. stk.
        st_bx                           ; store action taken code
        st_ax                           ; store handle (0 if we failed)

;***DT postDOSOPEN2 - DosOpen2 post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPEN2>,
;          TP    = .postDOSOPEN2,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen2 Post-Invocation",
;          <LOG_BX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Action = <FMT_BX>  Handle = <FMT_AX>"
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace            ;aa03902

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSOPEN2


;***    DOSOPEN2COMPT - Open and/or Create file, return handle, set size
;
;       SEE DOSOPEN2, above (for non COMPATIBILITY MODE entry)
;
;       INVOKE  push@   asciiz Filename         (2 words)
;               push@   word Handle             (2 words)
;               push@   word Action             (2 words)
;               push    dword Size              (2 words)
;               push    word Attribute          (1 word)
;               push    word ControlFlag        (1 word)
;               push    dword OpenMode          (2 words)
;               push@   other EABuf             (2 words)
;               push    dword 0L RESERVED       (2 words)
;               call    DOSOPEN2COMPT
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;

.erre (size Open2Struc) EQ (OPN2_ArgWords * 2)

SysEntry DOSOPEN2COMPT, ORD_DOSOPEN2COMPT, OPN2_ArgWords, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        rplstampptr                     ; rpl stamp EABuf pointer
        skip_ptr                        ; skip EABuf
        skip_4word                      ; Skip over mode,flag,attribute
        skip_2word                      ; skip size
        skip_ptr                        ; skip over Action address
        skip_ptr                        ; skip over Handle address
        getusrbufz3                     ; copy asciiz string to kernel buffer
        ld_dsdx_norpl                   ; load pointer to kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel3         ; AL = interface level 3

;***DT preDOSOPEN2COMPT - DosOpen2Compt pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPEN2COMPT>,
;          TP    = .preDOSOPEN2COMPT,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen2Compt Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+28, INDIRECT, <MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+8, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+12,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+14,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+16,DIRECT, 4),
;          FMT   = "Filename = <FMT_ASCIIZ>",
;          FMT   = "Mode = <FMT_C_WORD>  Control = <FMT_C_WORD>",
;          FMT   = "Attrib = <FMT_C_WORD>  Size = <FMT_C_DWORD>"

        RASpretrace             ; RAS pre-invokation

        farcall api_OpenCreate, ORD_DOSOPEN2COMPT ; call worker (@PhysDisk) @SEC
        skip_10word                     ; skip over input part of arg. stk.
        st_bx                           ; store action taken code
        st_ax                           ; store handle (0 if we failed)

;***DT postDOSOPEN2COMPT - DosOpen2Compt post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPEN2COMPT>,
;          TP    = .postDOSOPEN2COMPT,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpen2Compt Post-Invocation",
;          <LOG_BX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Action = <FMT_BX>  Handle = <FMT_AX>"
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace             ; RAS pre-invokation

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSOPEN2COMPT


;***    DOSPROTECTOPEN - Open and/or Create file, return handle, set size
;
;       SEE DOSOPEN2, above (for old interface, with no protected
;                            file-handle support)
;
;       INVOKE  push@   asciiz Filename         (2 words)
;               push@   word Handle             (2 words)
;               push@   word Action             (2 words)
;               push    dword Size              (2 words)
;               push    word Attribute          (1 word)
;               push    word ControlFlag        (1 word)
;               push    dword OpenMode          (2 words)
;               push@   other EABuf             (2 words)
;               push@   dword FileHandleLockID  (2 words)
;               push    dword 0L RESERVED       (2 words)
;               call    DOSPROTECTOPEN
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;

.erre (size Open3Struc) EQ (OPN3_ArgWords * 2)

SysEntry DOSPROTECTOPEN, ORD_DOSPROTECTOPEN, OPN3_ArgWords, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        skip_ptr                        ; skip over FileHandleLockID address
        rplstampptr                     ; rpl stamp EABuf pointer
        skip_ptr                        ; skip EABuf
        skip_4word                      ; Skip over mode,flag,attribute
        skip_2word                      ; skip size
        skip_ptr                        ; skip over Action address
        skip_ptr                        ; skip over Handle address
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

        ld_parampkt_bx                  ; BX = offset to parameter structure
        ld_imm_al   IFaceLevel4         ; AL = interface level 4

;***DT preDOSPROTECTOPEN - DosOpen pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTOPEN>,
;          TP    = .preDOSPROTECTOPEN,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DOSPROTECTOPEN Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+28, INDIRECT, <MAXPATHLEN>),
;          MEM   = (<KSTK_ARGS>+8, DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+12,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+14,DIRECT, 2),
;          MEM   = (<KSTK_ARGS>+16,DIRECT, 4),
;          FMT   = "Filename = <FMT_ASCIIZ>",
;          FMT   = "Mode = <FMT_C_WORD>  Control = <FMT_C_WORD>",
;          FMT   = "Attrib = <FMT_C_WORD>  Size = <FMT_C_DWORD>"

        RASpretrace             ; RAS pre-invokation                   ;aa03902

        farcall api_OpenCreate, ORD_DOSPROTECTOPEN ; call worker (@PhysDisk) @SEC

        skip_ptr                ; skip over reserved dword
        st_edx                  ; return FileHandleLockID low-word to user
        skip_8word              ; skip over part of arg. stack and
                                ; point to action taken address
        st_bx                   ; store action taken code
        st_ax                   ; store handle (0 if we failed)

;***DT postDOSPROTECTOPEN - DosProtectOpen post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTOPEN>,
;          TP    = .postDOSPROTECTOPEN,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectOpen Post-Invocation",
;          <LOG_BX>,
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Action = <FMT_BX>  Handle = <FMT_AX>"
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace            ;aa03902

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTOPEN


;***    DOSOPENCHANGENOTIFY
;
;       INVOKE  push@   OTHER   PathBuf         (2 words)
;               push    DWORD   LogSize         (2 words)
;               push    @WORD   Handle          (2 words)
;               push    DWORD   0               (2 words)
;               call    DOSOPENCHANGENOTIFY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSOPENCHANGENOTIFY, ORD_DOSOPENCHANGENOTIFY, 8

        reser_dd_arg                    ; check the reserved argument
        ld_ax                           ; Low word of Logsize
        ld_dx                           ; High word of Logsize
        skip_ptr                        ; skip over Handle address
        ld_si                           ; load pointer to EABuf
        rplstampsel                     ; rpl-stamp selector
        ld_bx                           ; (bx:si) -> PathBuf

;***DT  preDOSOPENCHANGENOTIFY - DosOpenChangeNotify pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPENCHANGENOTIFY>,
;          TP    = .preDOSOPENCHANGENOTIFY,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpenChangeNotify Pre-Invocation",

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_OpenChangeNotify, ORD_DOSOPENCHANGENOTIFY               ;@SEC
        skip_ptr                        ; skip over reserved DWORD 0
        st_bx                           ; update search handle

;***DT  postDOSOPENCHANGENOTIFY - DosOpenChangeNotify post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPENCHANGENOTIFY>,
;          TP    = .postDOSOPENCHANGENOTIFY,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpenChangeNotify Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSOPENCHANGENOTIFY


;***    DOSOPLOCKRELEASE - Indicate that oplock cleanup has completed
;
;       INVOKE  push    DWORD KernelKey         (2 words)
;               push    WORD Flags              (1 word)
;               call    DOSOPLOCKRELEASE
;
;       RETURN  none
;
SysEntry DOSOPLOCKRELEASE, ORD_DOSOPLOCKRELEASE, 3, ,

       ; enterfscrit                     ; Entering kernel
        ld_cx                           ; (CX) = flags
        ld_si
        ld_ds_norpl                     ; (DS:SI) = kernel key

;***DT preDOSOPLOCKRELEASE - DosOpLockRelease pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPLOCKRELEASE>,
;          TP    = .preDOSOPLOCKRELEASE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpLockRelease Pre-Invocation",
;          <LOG_DS>,
;          <LOG_SI>,
;          <LOG_CX>,
;          FMT   = "Kernel key = <FMT_DS>:<FMT_SI>   Flags = <FMT_CX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_OpLockRelease, ORD_DOSOPLOCKRELEASE                     ;@SEC

;***DT postDOSOPLOCKRELEASE - DosOpLockRelease post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPLOCKRELEASE>,
;          TP    = .postDOSOPLOCKRELEASE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpLockRelease Post-Invocation",

        RASposttrace            ; RAS post-invocation trace

       ; exitfscrit                      ; Exiting Kernel

EndEntry DOSOPLOCKRELEASE


;***    DOSOPLOCKSHUTDOWN - Clean up any threads waiting for oplock processing
;
;       INVOKE  call    DOSOPLOCKSHUTDOWN
;
;       RETURN  none
;
SysEntry DOSOPLOCKSHUTDOWN, ORD_DOSOPLOCKSHUTDOWN, 0, ,

        farcall w_OpLockShutDown, ORD_DOSOPLOCKSHUTDOWN                   ;@SEC

EndEntry DOSOPLOCKSHUTDOWN


;***    DOSOPLOCKWAIT - Provide thread for clean-up of broken oplocks
;
;       INVOKE  push    @DWORD KernelKey        (2 words)
;               push    @DWORD ServerKey        (2 words)
;               call    DOSOPLOCKWAIT
;
;       RETURN  none
;
SysEntry DOSOPLOCKWAIT, ORD_DOSOPLOCKWAIT, 4, ,

       ; enterfscrit                     ; Entering kernel
        ld_dsdx_norpl                   ; load pointer to server key
        mv_esdi_dsdx                    ; move server key ptr to ES:DI
        ld_dsdx_norpl                   ; load pointer to kernel key

;***DT preDOSOPLOCKWAIT - DosOpLockWait pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSOPLOCKWAIT>,
;          TP    = .preDOSOPLOCKWAIT,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpLockWait Pre-Invocation",

        RASpretrace             ; RAS pre-invokation

        farcall w_OpLockWait, ORD_DOSOPLOCKWAIT                           ;@SEC


;***DT postDOSOPLOCKWAIT - DosOpLockWait post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSOPLOCKWAIT>,
;          TP    = .postDOSOPLOCKWAIT,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosOpLockWait Post-Invocation",
;          MEM   = (<KSTK_ARGS>, INDIRECT, 4),
;          MEM   = (<KSTK_ARGS>+4, INDIRECT, 4),
;          FMT   = "Server Key = <FMT_C_DWORD>  Kernel Key = <FMT_C_DWORD>"

        RASposttrace            ; RAS post-invocation trace

       ; exitfscrit                      ; Exiting Kernel

EndEntry DOSOPLOCKWAIT


;***    DOSQCURDIR - Get current directory
;
;       INVOKE  push    WORD DriveNumber        (1 word)
;               push    @OTHER DirPath          (2 words)
;               push    @WORD DirPathLen        (2 words)
;               call    DOSQCURDIR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid drive number
;                               DirPath buffer overflow
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSQCURDIR, ORD_DOSQCURDIR, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_ind_cx                       ; CX = buffer length
        rplstampptr                     ; RPL stamp buffer pointer
        ld_si
        ld_bx                           ; BX:SI -> user buffer
        ld_dx                           ; drive number into dx


;***DT preDOSQCURDIR - DosQCurDir pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQCURDIR>,
;          TP    = .preDOSQCURDIR,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQCurDir Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Drive Number = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_Current_Dir, ORD_DOSQCURDIR                             ;@SEC
        st_cx                           ; save length of current directory

;***DT postDOSQCURDIR - DosQCurDir post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQCURDIR>,
;          TP    = .postDOSQCURDIR,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQCurDir Post-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+4, INDIRECT, <MAXPATHLEN>),
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Current Dir = <FMT_ASCIIZ>",
;          FMT   = "Len = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQCURDIR


;***    DOSQCURDISK - get the default drive of the requesting process.
;
;       INVOKE  push@   WORD DefaultDrive       (2 words)
;               push@   DWORD LogicalDriveMap   (2 words)
;               call    DOSQCURDISK
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSQCURDISK, ORD_DOSQCURDISK, 4, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel

;***DT preDOSQCURDISK - DosQCurDisk pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQCURDISK>,
;          TP    = .preDOSQCURDISK,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQCurDisk Pre-Invocation",

        RASpretrace             ; RAS pre-invokation

        farcall w_QCurDisk, ORD_DOSQCURDISK              ; call the worker  @SEC
        st_dxax                         ; store the logical drive map
        st_bx                           ; store the default drive

;***DT postDOSQCURDISK - DosQCurDisk post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQCURDISK>,
;          TP    = .postDOSQCURDISK,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQCurDisk Post-Invocation",
;          <LOG_BX>,
;          MEM   = (<KSTK_ARGS>, INDIRECT, 4),
;          <LOG_RETVAL>,
;          FMT   = "Default Drive = <FMT_BX>  Logical Map =<FMT_C_DWORD>",
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQCURDISK


;***    DOSQFHANDSTATE - Query file handle state
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH@   WORD    FileHandleState (2 words)
;               call    DOSQFHANDSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSQFHANDSTATE, ORD_DOSQFHANDSTATE, 3, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_ptr                        ; skip over pointer for now
        ld_bx                           ; handle
        ld_di_0                         ; fake filehandlelockID lowword
        ld_si_0                         ; fake filehandlelockID highword
        ld_imm_ax       0               ; put zero in AX

;***DT preDOSQFHANDSTATE - DosQFHandState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQFHANDSTATE>,
;          TP    = .preDOSQFHANDSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFHandState Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "File Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFHandState, ORD_DOSQFHANDSTATE    ; call the worker    ;@SEC
        st_cx                           ; store file handle state

;***DT postDOSQFHANDSTATE - DosQFHandState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQFHANDSTATE>,
;          TP    = .postDOSQFHANDSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFHandState Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Handle State = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQFHANDSTATE


;***    DOSPROTECTQFHANDSTATE - Query file handle state
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH@   WORD    FileHandleState  (2 words)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSPROTECTQFHANDSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSPROTECTQFHANDSTATE, ORD_DOSPROTECTQFHANDSTATE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_di                           ; filehandlelockID lowword
        ld_si                           ; filehandlelockID highword
        skip_ptr                        ; skip over pointer for now
        ld_bx                           ; handle
        ld_imm_ax       0               ; put zero in AX

;***DT preDOSPROTECTQFHANDSTATE - DosProtectQFHandState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTQFHANDSTATE>,
;          TP    = .preDOSPROTECTQFHANDSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectQFHandState Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "File Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFHandState, ORD_DOSPROTECTQFHANDSTATE  ; call the worker  @SEC
        skip_2word                      ; skip over file handle lockID
        st_cx                           ; store file handle state

;***DT postDOSPROTECTQFHANDSTATE - DosProtectQFHandState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTQFHANDSTATE>,
;          TP    = .postDOSPROTECTQFHANDSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectQFHandState Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "Handle State = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTQFHANDSTATE


;***    DOSQFILEINFO - Query a files information.
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    WORD    FileInfoLevel   (1 word)
;               PUSH@   OTHER   FileInfoBuf     (2 words)
;               PUSH    WORD    FileInfoBufSize (1 word)
;               call    DOSQFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSQFILEINFO, ORD_DOSQFILEINFO, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel

        ld_imm_ax     0                 ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle

;***DT preDOSQFILEINFO - DosQFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQFILEINFO>,
;          TP    = .preDOSQFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFileInfo Pre-Invocation",
;          <LOG_BX>,
;          <LOG_DX>,
;          FMT   = "File Handle = <FMT_BX>  Info Level =  <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFileInfo, ORD_DOSQFILEINFO    ; call the worker        ;@SEC


;***DT postDOSQFILEINFO - DosQFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQFILEINFO>,
;          TP    = .postDOSQFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQFILEINFO


;***    DOSPROTECTQFILEINFO - Query a files information.
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH    WORD    FileInfoLevel    (1 word)
;               PUSH@   OTHER   FileInfoBuf      (2 words)
;               PUSH    WORD    FileInfoBufSize  (1 word)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSPROTECTQFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSPROTECTQFILEINFO, ORD_DOSPROTECTQFILEINFO, 7, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel

        ld_ax                           ; filehandlelockID lowword
        ld_di                           ; filehandlelockID highword
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle

;***DT preDOSPROTECTQFILEINFO - DosProtectQFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTQFILEINFO>,
;          TP    = .preDOSPROTECTQFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectQFileInfo Pre-Invocation",
;          <LOG_BX>,
;          <LOG_DX>,
;          FMT   = "File Handle = <FMT_BX>  Info Level =  <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFileInfo, ORD_DOSPROTECTQFILEINFO    ; call the worker ;@SEC

;***DT postDOSPROTECTQFILEINFO - DosProtectQFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTQFILEINFO>,
;          TP    = .postDOSPROTECTQFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectQFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTQFILEINFO


;***    DOSQFILEMODE - get the attributes of the specified file
;
;       INVOKE  push@   ASCIIZ FilePathName     (2 words)
;               push@   WORD CurrentAttributes  (2 words)
;               push    DWORD 0                 (2 words)
;               call    DOSQFILEMODE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid file path name
;
SysEntry DOSQFILEMODE, ORD_DOSQFILEMODE, 6, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        skip_ptr                        ; return value point, skip for now
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer
        ld_imm_ax       0               ; put zero in AL

;***DT preDOSQFILEMODE - DosQFileMode pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQFILEMODE>,
;          TP    = .preDOSQFILEMODE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFileMode Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+8, INDIRECT, <MAXPATHLEN>),
;          FMT   = "File = <FMT_ASCIIZ>"

        RASpretrace             ; RAS pre-invokation

        farcall w_ChMod, ORD_DOSQFILEMODE        ; call the worker        ;@SEC
        skip_ptr                        ; skip over the reserved argument
        st_cx                           ; store the attribute word

;***DT postDOSQFILEMODE - DosQFileMode post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQFILEMODE>,
;          TP    = .postDOSQFILEMODE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFileMode Post-Invocation",
;          <LOG_CX>,
;          <LOG_RETVAL>,
;          FMT   = "File Mode = <FMT_CX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQFILEMODE


;***    DOSQFSATTACH - Query Attached FSD Information.
;
;   DOSQFSATTACH allows the querying of information about attached remote or
;   local FSD, or a character or pseudo-char device attached to a local or
;   remote FSD.
;
;  ENTRY   push@ ASCIIZ   ptr to drive/device name           (2 word)
;          push  word     ordinal                            (1 word)
;          push  word     FSA info level                     (1 word)
;          push@ other    ptr to data buffer                 (2 word)
;          push@ word     ptr to data buffer length          (2 word)
;          push  dword    0                                  (2 word)
;
;          call    DOSQFSATTACH
;
;       EXIT    (ax) = return code
;                       0 - success
;                       x - INVALID_DRIVE
;                       x - BUFFER_OVERFLOW
;                       x - NO_MORE_ITEMS
;                       x - INVALID_PATH (not in spec, should be added)
;
;       NOTES: device name for character/pseudo character devices must
;              be of the form  "\DEV\devicename"
;
;   WARNING:  If the number or order of the arguments changes, the following
;             equate must also change.  The structure (in ARGFRAME.INC) must
;             match in size and structure.
;
SysEntry DOSQFSATTACH, ORD_DOSQFSATTACH,FSQA_ArgWords, ,

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

;       72417 removed fscrit
;   enterfscrit                        ; get serialization thread
    reser_dd_arg                       ; check DWORD of 0
    rplstampptr                        ; RPL stamp buffer length pointer
    skip_ptr                           ; skip data buffer length@
    rplstampptr                        ; RPL stamp buffer pointer
    skip_ptr                           ; skip data buffer@

    ld_ax                              ; AX = info level
    skip_word                          ; skip ordinal
    getusrnzbuf                        ; IF not null, copy name to kernel
    ld_si
    ld_ds_norpl                        ; DS:SI -> device name
    ld_parampkt_bx                     ; SS:BX -> stack frame structure

;***DT preDOSQFSATTACH - DosQFSAttach pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQFSATTACH>,
;          TP    = .preDOSQFSATTACH,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFSAttach Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+16, INDIRECT, <MAXPATHLEN>),
;          <LOG_AX>,
;          FMT   = "Path = <FMT_ASCIIZ>",
;          FMT   = "Info Level = <FMT_AX>"

        RASpretrace             ; RAS pre-invokation

    farcall w_qFSAttach, ORD_DOSQFSATTACH         ; call worker           ;@SEC
    skip_ptr                           ; skip dword of 0
    st_cx                              ; load AX into data length

;***DT postDOSQFSATTACH - DosQFSAttach post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQFSATTACH>,
;          TP    = .postDOSQFSATTACH,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFSAttach Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;   exitfscrit                         ; release serialization thread

EndEntry DOSQFSATTACH


;***    DOSQFSINFO - Query file system information.
;
;       Query information from a file system device.
;
;       INVOKE  PUSH    WORD    DriveNumber     (1 word)
;               PUSH    WORD    FSInfoLevel     (1 word)
;               PUSH@   OTHER   FSInfoBuf       (2 words)
;               PUSH    WORD    FSInfoBufSize   (1 word)
;               call    DOSQFSINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSQFSINFO, ORD_DOSQFSINFO, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; size of buffer
        ld_di                           ; offset for FSInfoBuf
        ld_es                           ; selector for FSInfoBuf
        ld_ax                           ; FSInfoLevel
        ld_dx                           ; drive number

;***DT preDOSQFSINFO - DosQFSInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQFSINFO>,
;          TP    = .preDOSQFSINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFSInfo Pre-Invocation",
;          <LOG_DX>,
;          <LOG_AX>,
;          FMT   = "Drive = <FMT_DX>   Info Level = <FMT_AX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QFsInfo, ORD_DOSQFSINFO       ; call the worker         ;@SEC

;***DT postDOSQFSINFO - DosQFSInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQFSINFO>,
;          TP    = .postDOSQFSINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQFSInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQFSINFO


;***    DOSQHANDTYPE - Query a handle type
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH@   WORD    HandType        (2 words)
;               PUSH@   WORD    FlagWord        (2 words)
;               call    DOSQHANDTYPE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;
SysEntry DOSQHANDTYPE, ORD_DOSQHANDTYPE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        skip_2ptr                       ; skip pointers for now
        ld_bx                           ; put handle in BX

;***DT preDOSQHANDTYPE - DosQHandType pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQHANDTYPE>,
;          TP    = .preDOSQHANDTYPE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQHandType Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handle = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QHandType, ORD_DOSQHANDTYPE             ; call the worker  @SEC
        st_bx                           ; return flag word
        st_ax                           ; return handle type

;***DT postDOSQHANDTYPE - DosQHandType post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQHANDTYPE>,
;          TP    = .postDOSQHANDTYPE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQHandType Post-Invocation",
;          MEM   = (<KSTK_ARGS>+4, INDIRECT, 2),
;          MEM   = (<KSTK_ARGS>, INDIRECT, 2),
;          <LOG_RETVAL>,
;          FMT   = "Handle Type = <FMT_C_WORD>  Flags = <FMT_C_WORD>",
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQHANDTYPE


;***    DOSQPATHINFO - Query information about the object in the path
;
;       INVOKE  PUSH@   WORD    PathName        (2 words)
;               PUSH    WORD    FileInfoLevel   (1 word)
;               PUSH@   OTHER   FileInfoBuf     (2 words)
;               PUSH    WORD    FileInfoBufSize (1 word)
;               PUSH    DWORD   0               (2 words)
;               call    DOSQPATHINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSQPATHINFO, ORD_DOSQPATHINFO, 8, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        ld_cx                           ; CX = PathInfoBufSize
        ld_di                           ; DI = offset for PathInfoBuf
        ld_es                           ; ES:DI -> PathInfoBuf
        ld_bx                           ; BX = PathInfoLevel
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; DS:DX -> kernel buffer

;***DT preDOSQPATHINFO - DosQPathInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQPATHINFO>,
;          TP    = .preDOSQPATHINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQPathInfo Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+12, INDIRECT, <MAXPATHLEN>),
;          <LOG_BX>,
;          FMT   = "Path = <FMT_ASCIIZ>",
;          FMT   = "Info Level = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QPathInfo, ORD_DOSQPATHINFO             ; call the worker  @SEC

;***DT postDOSQPATHINFO - DosQPathInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQPATHINFO>,
;          TP    = .postDOSQPATHINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQPathInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSQPATHINFO


;***    DOSQSYSINFO - query system information
;
;       ENTRY   PUSH    WORD  Index
;               PUSH@   OTHER SysInfoBuf
;               PUSH    WORD  SysInfoBufSize
;
;       EXIT    (AX) = error code
;                       ERROR_INVALID_PARAMETER
;                       ERROR_BUFFER_OVERFLOW

SysEntry DOSQSYSINFO, ORD_DOSQSYSINFO, 4

        ld_dx                           ; (DX) = buffer size
        ld_di
        ld_bx                           ; (BX:DI) = return buffer
        ld_si                           ; (SI) = index

;***DT preDOSQSYSINFO - DosQSysInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQSYSINFO>,
;          TP    = .preDOSQSYSINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQSysInfo Pre-Invocation",
;          <LOG_SI>,
;          FMT   = "Index = <FMT_SI>"

        RASpretrace             ; RAS pre-invokation

        farcall w_QSysInfo, ORD_DOSQSYSINFO              ; call the worker  @SEC

;***DT postDOSQSYSINFO - DosQSysInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQSYSINFO>,
;          TP    = .postDOSQSYSINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQSysInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

EndEntry DOSQSYSINFO


;***    DOSQVERIFY - return the value of the verify flag.
;
;       INVOKE  push@   WORD VerifySetting      (2 words)
;               call    DOSQVERIFY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       Cannot return an error
;
SysEntry DOSQVERIFY, ORD_DOSQVERIFY, 2, ,


;***DT preDOSQVERIFY - DosQVerify pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSQVERIFY>,
;          TP    = .preDOSQVERIFY,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQVerify Pre-Invocation",

        RASpretrace             ; RAS pre-invokation

        farcall w_QVerify, ORD_DOSQVERIFY       ; call the worker         ;@SEC
        st_ax                                   ; return verify flag

;***DT postDOSQVERIFY - DosQVerify post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSQVERIFY>,
;          TP    = .postDOSQVERIFY,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosQVerify Post-Invocation",
;          <LOG_AX>,
;          <LOG_RETVAL>,
;          FMT   = "Verify Flag = <FMT_AX>  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

EndEntry DOSQVERIFY


;***    DOSREAD - really Ring 3 code - See DOSIREAD for Ring 0 code


;****   DOSREADASYNC - really Ring 3 code


;***    DOSRESETCHANGENOTIFY
;
;       INVOKE  push@   OTHER   LogBuf          (2 words)
;               push    DWORD   BufSize         (2 words)
;               push@   DWORD   LogCount        (2 words)
;               push    WORD    Handle          (1 word)
;               call    DOSRESETCHANGENOTIFY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSRESETCHANGENOTIFY, ORD_DOSRESETCHANGENOTIFY, 7

        ld_cx                           ; handle
        ld_ax                           ; Low word of Logsize
        skip_word                       ; High word of Logsize
        rplstampptr
        ld_di
        ld_dx                           ; dx:di -> count
        ld_si                           ; load pointer to InfoBuf
        rplstampsel                     ; rpl-stamp selector
        ld_bx                           ; (bx:si) -> InfoBuf

;***DT  preDOSRESETCHANGENOTIFY - DosResetChangeNotify pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSRESETCHANGENOTIFY>,
;          TP    = .preDOSRESETCHANGENOTIFY,
;          TYPE  = (PRE,API),
;          GROUP = FS,
;          DESC  = "(OS) DosResetChangeNotify Pre-Invocation",

        RASpretrace                     ; RAS pre-invocation trace

        farcall w_ResetChangeNotify, ORD_DOSRESETCHANGENOTIFY             ;@SEC

;***DT  postDOSRESETCHANGENOTIFY - DosResetChangeNotify post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSRESETCHANGENOTIFY>,
;          TP    = .postDOSRESETCHANGENOTIFY,
;          TYPE  = (POST,API),
;          GROUP = FS,
;          DESC  = "(OS) DosResetChangeNotify Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return code = <FMT_RETVAL>"

        RASposttrace                    ; RAS post-invocation trace

EndEntry DOSRESETCHANGENOTIFY


;***    DOSRMDIR - Remove the specified directory
;
;       INVOKE  push@   ASCIIZ DirectoryName            (2 words)
;               push@   DWORD 0                         (2 words)
;               call    DOSRMDIR
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSRMDIR, ORD_DOSRMDIR, 4, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer

;***DT preDOSRMDIR - DosRmDir pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSRMDIR>,
;          TP    = .preDOSRMDIR,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosRmDir Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+4, INDIRECT, <MAXPATHLEN>),
;          FMT   = "Directory = <FMT_ASCIIZ>"

        RASpretrace             ; RAS pre-invokation

        farcall w_RmDir, ORD_DOSRMDIR                 ; call the worker   ;@SEC

;***DT postDOSRMDIR - DosRmDir post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSRMDIR>,
;          TP    = .postDOSRMDIR,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosRmDir Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSRMDIR


;****   DOSSCANENV - really Ring3 code


;****   DOSSEARCHPATH - really Ring3 code


;***    DOSSELECTDISK - set the default drive of the calling process.
;
;       INVOKE  push    WORD NewDriveNumber     (1 word)
;               call    DOSSELECTDISK
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid drive
;
SysEntry DOSSELECTDISK, ORD_DOSSELECTDISK, 1, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_dx                           ; drive number

;***DT preDOSSELECTDISK - DosSelectDisk pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSELECTDISK>,
;          TP    = .preDOSSELECTDISK,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSelectDisk Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Drive Number = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SelectDisk, ORD_DOSSELECTDISK    ; call the worker      ;@SEC

;***DT postDOSSELECTDISK - DosSelectDisk post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSELECTDISK>,
;          TP    = .postDOSSELECTDISK,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSelectDisk Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSELECTDISK


;***    DOSSETFHANDSTATE - Set file handle state
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    WORD    FileHandleState (1 word)
;               call    DOSSETFHANDSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSSETFHANDSTATE, ORD_DOSSETFHANDSTATE, 2, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; new file handle state
        ld_bx                           ; handle
        ld_di_0                         ; fake filehandlelockID lowword
        ld_si_0                         ; fake filehandlelockID highword
        ld_imm_ax       0               ; put zero in AX

;***DT preDOSSETFHANDSTATE - DosSetFHandState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETFHANDSTATE>,
;          TP    = .preDOSSETFHANDSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFHandState Pre-Invocation",
;          <LOG_BX>,
;          <LOG_CX>,
;          FMT   = "File Handle = <FMT_BX>  State = <FMT_CX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFHandState, ORD_DOSSETFHANDSTATE  ; call the worker  ;@SEC


;***DT postDOSSETFHANDSTATE - DosSetFHandState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETFHANDSTATE>,
;          TP    = .postDOSSETFHANDSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFHandState Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETFHANDSTATE


;***    DOSPROTECTSETFHANDSTATE - Set file handle state
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH    WORD    FileHandleState  (1 word)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSPROTECTSETFHANDSTATE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
SysEntry DOSPROTECTSETFHANDSTATE, ORD_DOSPROTECTSETFHANDSTATE, 4, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_di                           ; filehandlelockID lowword
        ld_si                           ; filehandlelockID highword
        ld_cx                           ; new file handle state
        ld_bx                           ; handle
        ld_imm_ax       0               ; put zero in AX

;***DT preDOSPROTECTSETFHANDSTATE - DosSetProtectFHandState pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTSETFHANDSTATE>,
;          TP    = .preDOSPROTECTSETFHANDSTATE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectSetFHandState Pre-Invocation",
;          <LOG_BX>,
;          <LOG_CX>,
;          FMT   = "File Handle = <FMT_BX>  State = <FMT_CX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFHandState, ORD_DOSPROTECTSETFHANDSTATE              ;@SEC

;***DT postDOSPROTECTSETFHANDSTATE - DosProtectSetFHandState post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTSETFHANDSTATE>,
;          TP    = .postDOSPROTECTSETFHANDSTATE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectSetFHandState Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "  Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTSETFHANDSTATE


;***    DOSSETFILEINFO - Set a File's Information
;
;       INVOKE  PUSH    WORD    FileHandle      (1 word)
;               PUSH    WORD    FileInfoLevel   (1 word)
;               PUSH@   OTHER   FileInfoBuf     (2 words)
;               PUSH    WORD    FileInfoBufSize (1 word)
;               call    DOSSETFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSSETFILEINFO, ORD_DOSSETFILEINFO, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle
        ld_imm_ax     0                 ; fake filehandlelockID lowword
        ld_di_0                         ; fake filehandlelockID highword
        xor  dh,dh                      ; to indicate 16 bit call

;***DT preDOSSETFILEINFO - DosSetFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETFILEINFO>,
;          TP    = .preDOSSETFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFileInfo Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Info Level = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFileInfo, ORD_DOSSETFILEINFO    ; call the worker    ;@SEC


;***DT postDOSSETFILEINFO - DosSetFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETFILEINFO>,
;          TP    = .postDOSSETFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETFILEINFO


;***    DOSPROTECTSETFILEINFO - Set a File's Information
;
;       INVOKE  PUSH    WORD    FileHandle       (1 word)
;               PUSH    WORD    FileInfoLevel    (1 word)
;               PUSH@   OTHER   FileInfoBuf      (2 words)
;               PUSH    WORD    FileInfoBufSize  (1 word)
;               PUSH    DWORD   FileHandleLockID (2 words)
;               call    DOSPROTECTSETFILEINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               ERROR_INVALID_HANDLE
;                               invalid parameters
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSPROTECTSETFILEINFO, ORD_DOSPROTECTSETFILEINFO, 7, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_ax                           ; FileHandleLockID lowword
        ld_di                           ; FileHandleLockID highword
        ld_cx                           ; FileInfoBufSize
        ld_si                           ; offset for FileInfoBuf
        ld_ds                           ; selector for FileInfoBuf
        ld_dx                           ; FileInfoLevel
        ld_bx                           ; handle
        xor  dh,dh                      ; to indicate 16-bit call

;***DT preDOSPROTECTSETFILEINFO - DosProtectSetFileInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSPROTECTSETFILEINFO>,
;          TP    = .preDOSPROTECTSETFILEINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectSetFileInfo Pre-Invocation",
;          <LOG_DX>,
;          FMT   = "Info Level = <FMT_DX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFileInfo, ORD_DOSPROTECTSETFILEINFO  ; call the worker  @SEC

;***DT postDOSPROTECTSETFILEINFO - DosSetProtectFileInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSPROTECTSETFILEINFO>,
;          TP    = .postDOSPROTECTSETFILEINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosProtectSetFileInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSPROTECTSETFILEINFO


;***    DOSSETFILEMODE - set the attributes of the specified file
;
;       INVOKE  push@   ASCIIZ FilePathName     (2 words)
;               push    WORD NewAttribute       (1 words)
;               push    DWORD 0                 (2 words)
;               call    DOSSETFILEMODE
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               Invalid file path name
;                               Invalid new attribute
;
SysEntry DOSSETFILEMODE, ORD_DOSSETFILEMODE, 5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check the reserved argument
        ld_cx                           ; new attribute word
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; load pointer to kernel buffer
        ld_imm_ax       1               ; put one in AL

;***DT preDOSSETFILEMODE - DosSetFileMode pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETFILEMODE>,
;          TP    = .preDOSSETFILEMODE,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFileMode Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+6, INDIRECT, <MAXPATHLEN>),
;          FMT   = "File = <FMT_ASCIIZ>"

        RASpretrace             ; RAS pre-invokation

        farcall w_ChMod, ORD_DOSSETFILEMODE          ; call the worker    ;@SEC

;***DT postDOSSETFILEMODE - DosSetFileMode post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETFILEMODE>,
;          TP    = .postDOSSETFILEMODE,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFileMode Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETFILEMODE


;***    DOSSETFSINFO - Set file-system-specific info
;
;       INVOKE  PUSH  WORD  DriveNumber       ; Drive number
;               PUSH  WORD  FSInfoLevel       ; File system data type
;               PUSH@ OTHER FSInfoBuf         ; File system info buffer
;               PUSH  WORD  FSInfoBufSize     ; File system info buffer size
;               CALL  DosSetFsInfo
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSSETFSINFO, ORD_DOSSETFSINFO,5, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_cx                           ; length of buffer
        ld_dsdx                         ; buffer pointer
        ld_ax                           ; level requested
        ld_bx                           ; drive of interest

;***DT preDOSSETFSINFO - DosSetFSInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETFSINFO>,
;          TP    = .preDOSSETFSINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFSInfo Pre-Invocation",
;          <LOG_AX>,
;          FMT   = "Level = <FMT_AX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetFSInfo, ORD_DOSSETFSINFO             ; call the worker  @SEC

;***DT postDOSSETFSINFO - DosSetFSInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETFSINFO>,
;          TP    = .postDOSSETFSINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetFSInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETFSINFO


;***    DOSSETMAXFH - Set maximum file handles
;
;       INVOKE  PUSH    WORD    NumberHandles   (1 word)
;               call    DOSSETMAXFH
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;
SysEntry DOSSETMAXFH, ORD_DOSSETMAXFH, 1,GDT_DOSSETMAXFH

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        ld_bx                           ; number of file handles

;***DT preDOSSETMAXFH - DosSetMaxFH pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETMAXFH>,
;          TP    = .preDOSSETMAXFH,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetMaxFH Pre-Invocation",
;          <LOG_BX>,
;          FMT   = "Handles = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetMaxFH, ORD_DOSSETMAXFH              ; call the worker  @SEC

;***DT postDOSSETMAXFH - DosSetMaxFH post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETMAXFH>,
;          TP    = .postDOSSETMAXFH,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetMaxFH Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETMAXFH

;***    DOSSETPATHINFO - Set a path object's information
;
;       INVOKE  PUSH@   WORD    PathName        (2 words)
;               PUSH    WORD    PathInfoLevel   (1 word)
;               PUSH@   OTHER   PathInfoBuf     (2 words)
;               PUSH    WORD    PathInfoBufSize (1 word)
;               PUSH    WORD    PathInfoFlags   (1 word)
;               PUSH    DWORD   0               (2 words)
;               call    DOSSETPATHINFO
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSSETPATHINFO, ORD_DOSSETPATHINFO, 9, ,

;       72417 removed fscrit
;       enterfscrit                     ; Entering kernel
        reser_dd_arg                    ; check reserved argument
        ld_si                           ; SI = path info flags (write_through)
        ld_cx                           ; CX = PathInfoBufSize
        ld_di                           ; DI = offset for PathInfoBuf
        ld_es                           ; ES:DI -> PathInfoBuf
        ld_bx                           ; BX = PathInfoLevel
        getusrbufz206                   ; copy asciiz string to kernel buffer ;### CP20 PTR B721314
        ld_dsdx_norpl                   ; DS:DX -> kernel buffer
        ld_imm_ax       0               ; to indicate 16 bit call

;***DT preDOSSETPATHINFO - DosSetPathInfo pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETPATHINFO>,
;          TP    = .preDOSSETPATHINFO,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetPathInfo Pre-Invocation",
;          ASCIIZ= (<KSTK_ARGS>+14, INDIRECT, <MAXPATHLEN>),
;          <LOG_BX>,
;          FMT   = "Path =<FMT_ASCIIZ>",
;          FMT   = "Info Level = <FMT_BX>"

        RASpretrace             ; RAS pre-invokation

        farcall w_SetPathInfo, ORD_DOSSETPATHINFO        ; call the worker  @SEC

;***DT postDOSSETPATHINFO - DosSetPathInfo post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETPATHINFO>,
;          TP    = .postDOSSETPATHINFO,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetPathInfo Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

;       72417 removed fscrit
;       exitfscrit                      ; Exiting Kernel

EndEntry DOSSETPATHINFO


;***    DOSSETVERIFY - set/reset the verify switch
;
;       INVOKE  push    WORD VerifySetting      (1 word)
;               call    DOSSETVERIFY
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;                               error_invalid_verify_switch
;
SysEntry DOSSETVERIFY, ORD_DOSSETVERIFY, 1, ,

        ld_ax                                   ; verify setting

;***DT preDOSSETVERIFY - DosSetVerify pre-invocation trace point
;
;    TRACE MINOR = <RAS_PRE_DOSSETVERIFY>,
;          TP    = .preDOSSETVERIFY,
;          TYPE  = (PRE, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetVerify Pre-Invocation",

        RASpretrace             ; RAS pre-invokation

        farcall w_SetVerify, ORD_DOSSETVERIFY    ; call the worker        ;@SEC

;***DT postDOSSETVERIFY - DosSetVerify post-invocation trace point
;
;    TRACE MINOR = <RAS_POST_DOSSETVERIFY>,
;          TP    = .postDOSSETVERIFY,
;          TYPE  = (POST, API),
;          GROUP = FS,
;          DESC  = "(OS) DosSetVerify Post-Invocation",
;          <LOG_RETVAL>,
;          FMT   = "Return Code = <FMT_RETVAL>"

        RASposttrace            ; RAS post-invocation trace

EndEntry DOSSETVERIFY


;***    DOSSHUTDOWN - Shutdown filesystems for reboot or poweroff
;
;       INVOKE  PUSH    DWORD   (0 or pointer to packet)
;               call    DOSSHUTDOWN
;
;       RETURN  (ax) = return code
;                       0 - success
;                       nonzero - error
;
;       NOTE    Worker does protection validation.
;
SysEntry DOSSHUTDOWN, ORD_DOSSHUTDOWN, 2, ,TRC_FS

        enterfscrit                     ; Entering kernel
        ld_disi                         ; load pointer to packet or 0
        ld_cx_0                         ; mark api caller
        farcall w_Shutdown, ORD_DOSSHUTDOWN                               ;@SEC
        exitfscrit                      ; Exiting Kernel

EndEntry DOSSHUTDOWN



;***    DOSWRITE - really Ring 3 code - See DOSIREAD for Ring 0 code


;****   DOSWRITEASYNC - really Ring 3 code
HIGH3CODE ENDS

        END
