1 ; SCCSID = @(#)dircall.asm 1.1 85/04/10
2 ; SCCSID = @(#)dircall.asm 1.1 85/04/10
3 TITLE DIRCALL
- Directory manipulation internal calls
5 ; Low level directory manipulation routines for making removing and
6 ; verifying local or NET directories
12 ; Modification history:
14 ; Created: ARR 30 March 1983
18 ; get the appropriate segment definitions
23 CODE SEGMENT BYTE PUBLIC 'CODE'
24 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
49 i_need FastOpenFlg
,BYTE ; DOS 3.3
50 i_need FastOpenTable
,BYTE ; DOS 3.3
51 i_need WFP_START
,WORD ; DOS 3.3
52 i_need HIGH_SECTOR
,WORD ; F.C. >32mb
54 BREAK <DOS_MkDir
- Make a directory
entry>
57 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL
59 ; [CURR_DIR_END] Points to end of Current dir part of string
60 ; ( = -1 if current dir not involved, else
61 ; Points to first char after last "/" of current dir part)
62 ; [THISCDS] Points to CDS being used
63 ; (Low word = -1 if NUL CDS (Net direct request))
65 ; Make a new directory
71 ; error_path_not_found
72 ; Bad path (not in curr dir part if present)
74 ; Bad path in current directory part of path
76 ; Already exists, device name
77 ; DS preserved, Others destroyed
79 procedure DOS_MKDIR
,NEAR
80 DOSAssume
CS,<DS>,"DOS_MkDir"
88 MOV AX,(multNET
SHL 8) OR 3
94 MOV AX,error_access_denied
102 transfer SET_MKND_ERR
; Map the MakeNode error and return
107 ; MakeNode requires an SFT to fiddle with. We Use a temp spot (RENBUF)
109 MOV WORD PTR [THISSFT
+2],SS
110 MOV WORD PTR [THISSFT
],OFFSET DOSGroup
:RenBuf
112 ; NOTE: Need WORD PTR because MASM takes type of
113 ; TempSFT (byte) instead of type of sf_mft (word).
115 MOV WORD PTR RenBuf
.sf_mft
,0 ; make sure SHARER won't complain.
116 MOV AL,attr_directory
121 JZ NODEACCERRJ
; Can't make a device into a directory
122 LES BP,[THISDPB
] ; Makenode zaps this
126 PUSH SI ; Pointer to dir_first
127 PUSH WORD PTR [DI.buf_sector
+2] ;F.C. >32mb
129 PUSH WORD PTR [DI.buf_sector
] ; Sector of new node
131 PUSH [DIRSTART
] ; Parent for .. entry
133 MOV [DIRSTART
],AX ; Null directory
135 JC NODEEXISTSPOPDEL
; No room
136 invoke GETENT
; First entry
137 JC NODEEXISTSPOPDEL
; Screw up
140 TEST ES:[DI.buf_flags
],buf_dirty
;LB. if already dirty ;AN000;
141 JNZ yesdirty
;LB. don't increment dirty count ;AN000;
142 invoke INC_DIRTY_COUNT
;LB. ;AN000;
143 OR ES:[DI.buf_flags
],buf_dirty
145 ADD DI,BUFINSIZ
; Point at buffer
147 MOV DX,[DIRSTART
] ; Point at itself
153 MOV [ALLOWED
],allowed_FAIL
+ allowed_RETRY
154 POP DX ; Entry sector
155 POP [HIGH_SECTOR
] ;F.C. >32mb
163 OR [DI.buf_flags
],buf_isDIR
164 POP SI ; dir_first pointer
168 MOV [SI+2],DX ; Zero size
171 TEST [DI.buf_flags
],buf_dirty
;LB. if already dirty ;AN000;
172 JNZ yesdirty2
;LB. don't increment dirty count ;AN000;
173 invoke INC_DIRTY_COUNT
;LB. ;AN000;
174 OR [DI.buf_flags
],buf_dirty
; Dirty buffer
177 MOV AL,ES:[BP.dpb_drive
]
179 MOV AX,error_access_denied
185 POP DX ; Entry sector
186 POP [HIGH_SECTOR
] ; F.C. >32mb
189 MOV [ALLOWED
],allowed_FAIL
+ allowed_RETRY
195 OR [DI.buf_flags
],buf_isDIR
196 POP SI ; dir_first pointer
198 SUB SI,dir_first
;Point back to start of dir entry
199 MOV BYTE PTR [SI],0E5H ; Free the entry
200 CALL DIRUP
; Error doesn't matter since erroring anyway
210 BREAK <DOS_ChDir
-- Verify a directory
>
213 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL
215 ; [CURR_DIR_END] Points to end of Current dir part of string
216 ; ( = -1 if current dir not involved, else
217 ; Points to first char after last "/" of current dir part)
218 ; [THISCDS] Points to CDS being used May not be NUL
220 ; Validate the path for potential new current directory
223 ; [SATTRIB] is modified by this call
225 ; CX is cluster number of the DIR, LOCAL CDS ONLY
226 ; Caller must NOT set ID fields on a NET CDS.
229 ; error_path_not_found
231 ; error_access_denied
232 ; device or file name
233 ; DS preserved, Others destroyed
235 procedure DOS_CHDIR
,NEAR
236 DOSAssume
CS,<DS>,"DOS_Chdir"
244 MOV AX,(multNET
SHL 8) OR 5
251 TEST ES:[DI.curdir_flags
],curdir_splice
;PTM.
253 MOV ES:[DI.curdir_ID
],0FFFFH ;PTM.
256 MOV [SATTRIB
],attr_directory
+attr_system
+attr_hidden
257 ; Dir calls can find these
258 ; DOS 3.3 6/24/86 FastOpen
260 OR [FastOpenFlg
],FastOpen_Set
; set fastopen flag
263 AND [FastOpenFlg
],Fast_yes
; clear it all ;AC000;
265 ; DOS 3.3 6/24/86 FastOpen
266 MOV AX,error_path_not_found
268 JNZ NOTDIRPATH
; Path not a DIR
269 MOV CX,[DIRSTART
] ; Get cluster number
277 BREAK <DOS_RmDir
-- Remove a directory
>
280 ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL
282 ; [CURR_DIR_END] Points to end of Current dir part of string
283 ; ( = -1 if current dir not involved, else
284 ; Points to first char after last "/" of current dir part)
285 ; [THISCDS] Points to CDS being used
286 ; (Low word = -1 if NUL CDS (Net direct request))
289 ; NOTE: Attempt to remove current directory must be detected by caller
292 ; [SATTRIB] is modified by this call
297 ; error_path_not_found
298 ; Bad path (not in curr dir part if present)
300 ; Bad path in current directory part of path
301 ; error_access_denied
302 ; device or file name, root directory
303 ; Bad directory ('.' '..' messed up)
304 ; DS preserved, Others destroyed
306 procedure DOS_RMDIR
,NEAR
307 DOSAssume
CS,<DS>,"DOS_RmDir"
315 MOV AX,(multNET
SHL 8) OR 1
323 MOV [SATTRIB
],attr_directory
+attr_system
+attr_hidden
324 ; Dir calls can find these
326 JC NOPATH
; Path not found
327 JNZ NOTDIRPATH
; Path not a DIR
330 JNZ rmdir_get_buf
; No
334 MOV AX,error_path_not_found
348 SUB BX,DI ; Compute true offset
349 PUSH BX ; Save entry pointer
350 PUSH WORD PTR [DI.buf_sector
+2] ;F.C. >32mb
351 PUSH WORD PTR [DI.buf_sector
] ; Save sector number
354 MOV DI,OFFSET DOSGROUP
:NAME1
359 STOSB ; Nul terminate it
360 invoke STARTSRCH
; Set search
361 invoke GETENTRY
; Get start of directory
362 JC NOTDIRPATHPOP
; Screw up
363 MOV DS,WORD PTR [CURBUF
+2]
367 CMP AX,(' ' SHL 8) OR '.' ; First entry '.'?
368 JNZ NOTDIRPATHPOP
; Nope
369 ADD SI,(SIZE dir_entry
) - 2 ; Next entry
371 CMP AX,('.' SHL 8) OR '.' ; Second entry '..'?
372 JNZ NOTDIRPATHPOP
; Nope
374 MOV [LASTENT
],2 ; Skip . and ..
375 invoke GETENTRY
; Get next entry
376 JC NOTDIRPATHPOP
; Screw up
377 MOV [ATTRIB
],attr_directory
+attr_hidden
+attr_system
378 invoke SRCH
; Do a search
379 JNC NOTDIRPATHPOP
; Found another entry!
381 JNZ NOTDIRPATHPOP
; Failure of search due to I 24 FAIL
385 invoke Delete_FSeek
; delete the fastseek entry
387 invoke RELEASE
; Release data in sub dir
388 JC NOTDIRPATHPOP
; Screw up
389 POP DX ; Sector # of entry
390 POP [HIGH_SECTOR
] ; F.C. >32mb
392 MOV [ALLOWED
],allowed_FAIL
+ allowed_RETRY
394 invoke GETBUFFR
; Get sector back
395 JC NOTDIRPATHPOP2
; Screw up
398 OR [DI.buf_flags
],buf_isDIR
399 POP BX ; Pointer to start of entry
400 ADD BX,DI ; Corrected
401 MOV BYTE PTR [BX],0E5H ; Free the entry
403 ;DOS 3.3 FastOpen 6/16/86 F.C.
406 invoke FastOpen_Delete
; call fastopen to delete an entry
408 ;DOS 3.3 FastOpen 6/16/86 F.C.
410 JMP DIRUP
; In MKDIR, dirty buffer and flush