]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/IFSFUNC/IFSDIR.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / IFSFUNC / IFSDIR.ASM
1 PAGE ,132 ; \ f ;AN000;
2 ; SCCSID = @(#)ifsdir.asm 1.0 87/05/11 ;AN000;
3 TITLE IFSFUNC DIRECTORY ROUTINES - Routines for IFS driver dispatch ;AN000;
4 NAME NETDIR ;AN000;
5 ;************************************************************************************ ;AN000;
6 ; ;AN000;
7 ; DIRECTORY related IFS driver calls ;AN000;
8 ; ;AN000;
9 ; IFS_RMDIR ;AN000;
10 ; IFS_MKDIR ;AN000;
11 ; IFS_CHDIR ;AN000;
12 ; ;AN000;
13 ; Programming notes: ;AN000;
14 ; Old redirector segmentation preserved. ;AN000;
15 ; Directory routines do not generate critical errors. ;AN000;
16 ; ;AN000;
17 ; REVISION HISTORY: ;AN000;
18 ; A000 Original version 4.00 May 1987
19 ; A001 PTM 3671- check for null cds 3/88 RPS/RMG
20 ; ;AN000;
21 ; LOC - 67 ;AN000;
22 ; LOD - 4 ;AN000;
23 ; ;AN000;
24 ;************************************************************************************ ;AN000;
25 ;AN000;
26 .xlist ;AN000;
27 .xcref ;AN000;
28 INCLUDE IFSSYM.INC ;AN000;
29 INCLUDE IFSFSYM.INC ;AN000;
30 INCLUDE DOSSYM.INC ;AN000;
31 INCLUDE DEVSYM.INC ;AN000;
32 .cref ;AN000;
33 .list ;AN000;
34 ;AN000;
35 AsmVars <IBM, Installed, Debug> ;AN000;
36 ;AN000;
37 ; define the base code segment of the network support first ;AN000;
38 ;AN000;
39 ifsseg SEGMENT BYTE PUBLIC 'ifsseg' ;AN000;
40 ifsseg ENDS ;AN000;
41 ;AN000;
42 ; include the rest of the segment definitions for normal MSDOS ;AN000;
43 ;AN000;
44 include dosseg.asm ;AN000;
45 ;AN000;
46 DATA SEGMENT WORD PUBLIC 'DATA' ;AN000;
47 ;AN000;
48 ; DOSGROUP data ;AN000;
49 Extrn WFP_START:WORD ;AN000;
50 Extrn THISCDS:DWORD ;AN000;
51 ;AN000;
52 DATA ENDS ;AN000;
53 ;AN000;
54 ;AN000;
55 ; define our own code segment ;AN000;
56 ;AN000;
57 ifsseg SEGMENT BYTE PUBLIC 'ifsseg' ;AN000;
58 ASSUME SS:DOSGROUP,CS:ifsseg ;AN000;
59 ;AN000;
60 ;IFS Data ;AN000;
61 Extrn IFSR:WORD ;AN000;
62 Extrn DEVICE_CB@_OFFSET:WORD ;AN000;
63 ;AN000;
64 BREAK <IFS_RMDIR Remove an IFS Directory> ;AN000;
65 ;************************************************************************************ ;AN000;
66 ; ;AN000;
67 ; IFS_RMDIR ;AN000;
68 ; ;AN000;
69 ;Called by: ;AN000;
70 ; IFSFUNC Dispatcher ;AN000;
71 ; ;AN000;
72 ; Routines called: ;AN000;
73 ; CDS_TO_CD ;AN000;
74 ; CALL_IFS ;AN000;
75 ; ;AN000;
76 ; Inputs: ;AN000;
77 ; [WFP_START] Points to WFP string ;AN000;
78 ; [THISCDS] Points to CDS being used ;AN000;
79 ; ;AN000;
80 ; Function: ;AN000;
81 ; Prep IFSRH as follows: (* indicate which fields set) ;AN000;
82 ; * IFSR_LENGTH DW 42 ; Request length ;AN000;
83 ; * IFSR_FUNCTION DB 4 ; Execute API function ;AN000;
84 ; IFSR_RETCODE DW ? ;AN000;
85 ; IFSR_RETCLASS DB ? ;AN000;
86 ; IFSR_RESV1 DB 16 DUP(0) ;AN000;
87 ; * IFSR_APIFUNC DB 4 ; Remove Directory ;AN000;
88 ; IFSR_ERROR_CLASS DB ? ;AN000;
89 ; IFSR_ERROR_ACTION DB ? ;AN000;
90 ; IFSR_ERROR_LOCUS DB ? ;AN000;
91 ; IFSR_ALLOWED DB ? ;AN000;
92 ; IFSR_I24_RETRY DB ? ;AN000;
93 ; IFSR_I24_RESP DB ? ;AN000;
94 ; IFSR_RESV2 DB ? ;AN000;
95 ; * IFSR_DEVICE_CB@ DD ? ; Call CDS_TO_CD to convert CDS to CD ;AN000;
96 ; ; and set this as pointer to it. ;AN000;
97 ; IFSR_OPEN_CB@ DD ? ;AN000;
98 ; * IFSR_NAME@ DD ? ; [WFP_START] ;AN000;
99 ; ;AN000;
100 ; CALL routine, CALL_IFS, with pointer to CURDIR_IFSR_HDR ;AN000;
101 ; IF IFSR_RETCODE = 0 THEN ;AN000;
102 ; Call CD_TO_CDS ;AN000;
103 ; Clear carry ;AN000;
104 ; ELSE ;AN000;
105 ; Set carry ;AN000;
106 ; Put error code in AX ;AN000;
107 ; ENDIF ;AN000;
108 ; ;AN000;
109 ; Outputs: ;AN000;
110 ; Carry clear: CDS FSDA updated ;AN000;
111 ; Carry set on error: error_path_not_found (bad path) ;AN000;
112 ; error_access_denied (file/device not empty) ;AN000;
113 ; ;AN000;
114 ; Notes: DS preserved, others destroyed ;AN000;
115 ; ;AN000;
116 ;************************************************************************************ ;AN000;
117 ;AN000;
118 ;AN000;
119 procedure IFS_RMDIR,NEAR ;AN000;
120 ;AN000;
121 entry IFS_SEQ_RMDIR ;AN000;
122 ;AN000;
123 ifsr_fcn_def EXECAPI ; define ifsr fields for rmdir ;AN000;
124 ifsr_api_def RMDIR ;AN000;
125 ;AN000;
126 PUSH DS ; preserve DS ;AN000;
127 ;AN000;
128 invoke PREP_IFSR ; init ifsr, sets es:bx -> ifsr ;AN000;
129 ;AN000;
130 MOV ES:[BX.IFSR_APIFUNC],IFSRMDIR ;AN000;
131 JMP SHORT CHDIR_10 ; go finish in ifs_chdir ;AN000;
132 ;AN000;
133 EndProc IFS_RMDIR ;AN000;
134 ;AN000;
135 BREAK <IFS_MKDIR Create an IFS Directory> ;AN000;
136 ;AN000;
137 ;************************************************************************************ ;AN000;
138 ; ;AN000;
139 ; IFS_MKDIR ;AN000;
140 ; ;AN000;
141 ; Called by: IFSFUNC Dispatcher ;AN000;
142 ; ;AN000;
143 ; Routines called: CDS_TO_CD ;AN000;
144 ; CALL_IFS ;AN000;
145 ; ;AN000;
146 ; Inputs: ;AN000;
147 ; [WFP_START] Points to WFP string ;AN000;
148 ; [THISCDS] Points to CDS being used. Not NULL. ;AN000;
149 ; ;AN000;
150 ; Function: ;AN000;
151 ; Prep IFSRH as follows: (* indicate which fields set) ;AN000;
152 ; * IFSR_LENGTH DW 42 ; Request length ;AN000;
153 ; * IFSR_FUNCTION DB 4 ; Execute API function ;AN000;
154 ; IFSR_RETCODE DW ? ;AN000;
155 ; IFSR_RETCLASS DB ? ;AN000;
156 ; IFSR_RESV1 DB 16 DUP(0) ;AN000;
157 ; * IFSR_APIFUNC DB 3 ; Create Directory ;AN000;
158 ; IFSR_ERROR_CLASS DB ? ;AN000;
159 ; IFSR_ERROR_ACTION DB ? ;AN000;
160 ; IFSR_ERROR_LOCUS DB ? ;AN000;
161 ; IFSR_ALLOWED DB ? ;AN000;
162 ; IFSR_I24_RETRY DB ? ;AN000;
163 ; IFSR_I24_RESP DB ? ;AN000;
164 ; IFSR_RESV2 DB ? ;AN000;
165 ; * IFSR_DEVICE_CB@ DD ? ; Call CDS_TO_CD to convert CDS to CD ;AN000;
166 ; ; and set this as pointer to it. ;AN000;
167 ; IFSR_OPEN_CB@ DD ? ;AN000;
168 ; * IFSR_NAME@ DD ? ; [WFP_START] ;AN000;
169 ; ;AN000;
170 ; CALL routine, CALL_IFS, with pointer to CURDIR_IFSR_HDR ;AN000;
171 ; ;AN000;
172 ; IF IFSR_RETCODE = 0 THEN ;AN000;
173 ; Call CD_TO_CDS ;AN000;
174 ; Clear carry ;AN000;
175 ; ELSE ;AN000;
176 ; Set carry ;AN000;
177 ; Put error code in AX ;AN000;
178 ; ENDIF ;AN000;
179 ; ;AN000;
180 ; Outputs: ;AN000;
181 ; Carry clear: CDS FSDA updated ;AN000;
182 ; Carry set on error: error_path_not_found (bad path) ;AN000;
183 ; error_access_denied ;AN000;
184 ; (Attempt to re-create read only file , or ;AN000;
185 ; create a second volume id or create a dir) ;AN000;
186 ; ;AN000;
187 ; Notes: DS preserved, others destroyed ;AN000;
188 ; ;AN000;
189 ;************************************************************************************ ;AN000;
190 ;AN000;
191 procedure IFS_MKDIR,NEAR ;AN000;
192 ;AN000;
193 entry IFS_SEQ_MKDIR ;AN000;
194 ;AN000;
195 ifsr_fcn_def EXECAPI ; define ifsr fields for mkdir ;AN000;
196 ifsr_api_def MKDIR ;AN000;
197 ;AN000;
198 PUSH DS ; preserve DS ;AN000;
199 ;AN000;
200 invoke PREP_IFSR ; init ifsr, sets es:bx -> ifsr ;AN000;
201 ;AN000;
202 MOV ES:[BX.IFSR_APIFUNC],IFSMKDIR ;AN000;
203 JMP SHORT CHDIR_10 ; go finish in ifs_chdir ;AN000;
204 ;AN000;
205 EndProc IFS_MKDIR ;AN000;
206 ;AN000;
207 BREAK <IFS_CHDIR Check for validity and change directory> ;AN000;
208 ;AN000;
209 ;AN000;
210 ;************************************************************************************ ;AN000;
211 ; ;AN000;
212 ; IFS_CHDIR ;AN000;
213 ; ;AN000;
214 ; Called by: IFSFUNC Dispatcher ;AN000;
215 ; ;AN000;
216 ; Routines called: CDS_TO_CD ;AN000;
217 ; CD_TO_CDS ;AN000;
218 ; CALL_IFS ;AN000;
219 ; ;AN000;
220 ; Inputs: ;AN000;
221 ; [WFP_START] Points to WFP string ;AN000;
222 ; [THISCDS] Points to CDS being used. Not NUL. ;AN000;
223 ; ;AN000;
224 ; Function: ;AN000;
225 ; Prep IFSRH as follows: (* indicate which fields set) ;AN000;
226 ; * IFSR_LENGTH DW 42 ; Request length ;AN000;
227 ; * IFSR_FUNCTION DB 4 ; Execute API function ;AN000;
228 ; IFSR_RETCODE DW ? ;AN000;
229 ; IFSR_RETCLASS DB ? ;AN000;
230 ; IFSR_RESV1 DB 16 DUP(0) ;AN000;
231 ; * IFSR_APIFUNC DB 5 ; Change Directory ;AN000;
232 ; IFSR_ERROR_CLASS DB ? ;AN000;
233 ; IFSR_ERROR_ACTION DB ? ;AN000;
234 ; IFSR_ERROR_LOCUS DB ? ;AN000;
235 ; IFSR_ALLOWED DB ? ;AN000;
236 ; IFSR_I24_RETRY DB ? ;AN000;
237 ; IFSR_I24_RESP DB ? ;AN000;
238 ; IFSR_RESV2 DB ? ;AN000;
239 ; * IFSR_DEVICE_CB@ DD ? ; Call CDS_TO_CD to convert CDS to CD ;AN000;
240 ; ; and set this as pointer to it. ;AN000;
241 ; IFSR_OPEN_CB@ DD ? ;AN000;
242 ; * IFSR_NAME@ DD ? ; [WFP_START] ;AN000;
243 ; ;AN000;
244 ; CALL routine, CALL_IFS, with pointer to CURDIR_IFSR_HDR ;AN000;
245 ; ;AN000;
246 ; IF IFSR_RETCODE = 0 THEN ;AN000;
247 ; Call CD_TO_CDS to update CDS ;AN000;
248 ; Clear carry ;AN000;
249 ; ELSE ;AN000;
250 ; Set carry ;AN000;
251 ; Put error code in AX ;AN000;
252 ; ENDIF ;AN000;
253 ; ;AN000;
254 ; Outputs: ;AN000;
255 ; Carry clear: CDS updated. ;AN000;
256 ; Carry set on error: error_path_not_found (bad path) ;AN000;
257 ; error_access_denied ;AN000;
258 ; ;AN000;
259 ; Notes: DS preserved, others destroyed ;AN000;
260 ; ;AN000;
261 ;************************************************************************************ ;AN000;
262 ;AN000;
263 procedure IFS_CHDIR,NEAR ;AN000;
264 ;AN000;
265 ifsr_fcn_def EXECAPI ; define ifsr fields for chdir ;AN000;
266 ifsr_api_def CHDIR ;AN000;
267 ;AN000;
268 PUSH DS ; preserve DS ;AN000;
269 ;AN000;
270 invoke PREP_IFSR ; init ifsr, sets es:bx -> ifsr ;AN000;
271 ;AN000;
272 MOV ES:[BX.IFSR_APIFUNC],IFSCHDIR ;AN000;
273 ;AN000;
274 CHDIR_10: ; Welcome rmdir/mkdir code ;AN000;
275 MOV ES:[BX.IFSR_LENGTH],LENGTH_CHDIR ;AN000;
276 MOV ES:[BX.IFSR_FUNCTION],IFSEXECAPI ;AN000;
277 ; ds -> dosgroup ;AN000;
278 MOV SI,WORD PTR [WFP_START] ; to access thiscds & wfp ;AN000;
279 invoke STRIP_WFP_START ; ditch leading d:\ ;AN000;
280 MOV WORD PTR ES:[BX.IFSR_NAME@],SI ;AN000;
281 MOV WORD PTR ES:[BX.IFSR_NAME@+2],DS ;AN000;
282 LDS SI,[THISCDS] ;AN000;
283 SaveReg <DS,SI> ;AN000;
284 MOV DEVICE_CB@_OFFSET,IFSR_DEVICE_CB@ ;AN000;
285 CMP SI,NULL_PTR ; skip cds work if cds null ;AN001;
286 JE CHDIR_20 ;AN001;
287 invoke CDS_TO_CD ; CDS: sets [THISIFS] ;AN000;
288 ; IFSR_DEVICE_CB@ ;AN000;
289 ; ds - ifsseg ;AN000;
290 CHDIR_20: ;AN001;
291 SaveReg <CS> ; make sure ds = ifsseg ;AN001;
292 RestoreReg <DS> ;AN001;
293 ;************************************************
294 invoke CALL_IFS ; call fs with dir request ;AN000;
295 ;************************************************
296 ;AN000;
297 RestoreReg <DI,ES> ; restore cds ptr into es:di ;AN000;
298 JC CHDIR_1000 ;AN000;
299 CMP DI,NULL_PTR ; skip cds work if cds null ;AN001;
300 JE CHDIR_40 ;AN001;
301 invoke CD_TO_CDS ; update cds ;AN000;
302
303 CHDIR_40: ;AN001;
304 CLC ;AN000;
305 ;AN000;
306 CHDIR_1000: ; finished ;AN000;
307 POP DS ; restore DS ;AN000;
308 return ;AN000;
309 ;AN000;
310 EndProc IFS_CHDIR ;AN000;
311 ;AN000;
312 ifsseg ENDS ;AN000;
313 END ;AN000;