diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DOS/FINFO.ASM | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/DOS/FINFO.ASM')
| -rw-r--r-- | v4.0/src/DOS/FINFO.ASM | 286 |
1 files changed, 286 insertions, 0 deletions
diff --git a/v4.0/src/DOS/FINFO.ASM b/v4.0/src/DOS/FINFO.ASM new file mode 100644 index 0000000..0df2bc1 --- /dev/null +++ b/v4.0/src/DOS/FINFO.ASM | |||
| @@ -0,0 +1,286 @@ | |||
| 1 | ; SCCSID = @(#)finfo.asm 1.1 85/04/11 | ||
| 2 | TITLE FILE_INFO - Internal Get/Set File Info routines | ||
| 3 | NAME FILE_INFO | ||
| 4 | ; Low level routines for returning file information and setting file | ||
| 5 | ; attributes | ||
| 6 | ; | ||
| 7 | ; GET_FILE_INFO | ||
| 8 | ; SET_FILE_ATTRIBUTE | ||
| 9 | ; | ||
| 10 | ; Modification history: | ||
| 11 | ; | ||
| 12 | ; Created: ARR 30 March 1983 | ||
| 13 | ; | ||
| 14 | |||
| 15 | ; | ||
| 16 | ; get the appropriate segment definitions | ||
| 17 | ; | ||
| 18 | .xlist | ||
| 19 | include dosseg.asm | ||
| 20 | |||
| 21 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 22 | ASSUME SS:DOSGROUP,CS:DOSGROUP | ||
| 23 | |||
| 24 | .xcref | ||
| 25 | INCLUDE DOSSYM.INC | ||
| 26 | INCLUDE DEVSYM.INC | ||
| 27 | include fastxxxx.inc | ||
| 28 | include fastopen.inc | ||
| 29 | .cref | ||
| 30 | .list | ||
| 31 | |||
| 32 | Installed = TRUE | ||
| 33 | |||
| 34 | i_need THISCDS,DWORD | ||
| 35 | i_need CURBUF,DWORD | ||
| 36 | i_need NoSetDir,BYTE | ||
| 37 | i_need THISDRV,BYTE | ||
| 38 | I_need EXTERR_CLASS,BYTE | ||
| 39 | I_need EXTERR_ACTION set | ||
| 40 | I_need EXTERR_LOCUS,BYTE | ||
| 41 | i_need DMAADD,DWORD | ||
| 42 | i_need FastOpenFlg,BYTE | ||
| 43 | |||
| 44 | SUBTTL GET_FILE_INFO -- Get File Information | ||
| 45 | PAGE | ||
| 46 | |||
| 47 | ; Inputs: | ||
| 48 | ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL | ||
| 49 | ; terminated) | ||
| 50 | ; [CURR_DIR_END] Points to end of Current dir part of string | ||
| 51 | ; ( = -1 if current dir not involved, else | ||
| 52 | ; Points to first char after last "/" of current dir part) | ||
| 53 | ; [THISCDS] Points to CDS being used | ||
| 54 | ; (Low word = -1 if NUL CDS (Net direct request)) | ||
| 55 | ; [SATTRIB] Is attribute of search, determines what files can be found | ||
| 56 | ; Function: | ||
| 57 | ; Get Information about a file | ||
| 58 | ; Returns: | ||
| 59 | ; CARRY CLEAR | ||
| 60 | ; AX = Attribute of file | ||
| 61 | ; CX = Time stamp of file | ||
| 62 | ; DX = Date stamp of file | ||
| 63 | ; BX:DI = Size of file (32 bit) | ||
| 64 | ; CARRY SET | ||
| 65 | ; AX is error code | ||
| 66 | ; error_file_not_found | ||
| 67 | ; Last element of path not found | ||
| 68 | ; error_path_not_found | ||
| 69 | ; Bad path (not in curr dir part if present) | ||
| 70 | ; error_bad_curr_dir | ||
| 71 | ; Bad path in current directory part of path | ||
| 72 | ; DS preserved, others destroyed | ||
| 73 | |||
| 74 | procedure GET_FILE_INFO,NEAR | ||
| 75 | DOSAssume CS,<DS>,"Get_File_Info" | ||
| 76 | ASSUME ES:NOTHING | ||
| 77 | |||
| 78 | Invoke TestNet | ||
| 79 | JNC Local_Info | ||
| 80 | ; invoke OWN_SHARE2 ;IFS. IFS owns share ? ;AN000; | ||
| 81 | ; JZ ifsshare ;IFS. yes ;AN000; | ||
| 82 | ; PUSH WORD PTR [DMAADD+2] ;IFS. save DMAADD ;AN000; | ||
| 83 | ; PUSH WORD PTR [DMAADD] ;IFS. ;AN000; | ||
| 84 | ; invoke IFS_SEARCH_FIRST ;IFS. do search first ;AN000; | ||
| 85 | ; JC nofiles ;IFS. file not existing ;AN000; | ||
| 86 | delete_next_file: ;IFS. ;AN000; | ||
| 87 | ; invoke IFS_REN_DEL_CHECK ;IFS. do REN_DEL_CHECK ;AN000; | ||
| 88 | ; JNC share_okok ;IFS. share ok ;AN000; | ||
| 89 | ; MOV AX,error_sharing_violation ;IFS. share violation ;AN000; | ||
| 90 | ; JMP SHORT nofiles ;IFS. ;AN000; | ||
| 91 | share_okok: | ||
| 92 | ; POP WORD PTR [DMAADD] ;IFS. retor DMAADD ;AN000; | ||
| 93 | ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; | ||
| 94 | ifsshare: | ||
| 95 | IF NOT Installed | ||
| 96 | transfer NET_GET_FILE_INFO | ||
| 97 | ELSE | ||
| 98 | MOV AX,(multNET SHL 8) OR 15 | ||
| 99 | INT 2FH | ||
| 100 | return | ||
| 101 | ENDIF | ||
| 102 | nofiles: | ||
| 103 | ; POP WORD PTR [DMAADD] ;IFS. retor DMAADD ;AN000; | ||
| 104 | ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; | ||
| 105 | ; ret ;IFS. return | ||
| 106 | |||
| 107 | LOCAL_INFO: | ||
| 108 | EnterCrit critDisk | ||
| 109 | MOV [NoSetDir],1 ; if we find a dir, don't change to it | ||
| 110 | invoke Get_FAST_PATH | ||
| 111 | info_check: | ||
| 112 | JNC info_check_dev | ||
| 113 | |||
| 114 | NO_PATH: | ||
| 115 | DOSAssume CS,<DS>,"FINFO/No_Path" | ||
| 116 | ASSUME ES:NOTHING | ||
| 117 | |||
| 118 | JNZ bad_path | ||
| 119 | OR CL,CL | ||
| 120 | JZ bad_path | ||
| 121 | info_no_file: | ||
| 122 | MOV AX,error_file_not_found | ||
| 123 | BadRet: | ||
| 124 | STC | ||
| 125 | justRet: | ||
| 126 | LeaveCrit critDisk | ||
| 127 | return | ||
| 128 | |||
| 129 | bad_path: | ||
| 130 | MOV AX,error_path_not_found | ||
| 131 | jmp BadRet | ||
| 132 | |||
| 133 | info_check_dev: | ||
| 134 | OR AH,AH | ||
| 135 | JS info_no_file ; device | ||
| 136 | PUSH DS | ||
| 137 | MOV DS,WORD PTR [CURBUF+2] | ||
| 138 | ASSUME DS:NOTHING | ||
| 139 | MOV SI,BX | ||
| 140 | XOR BX,BX ; Assume size=0 (dir) | ||
| 141 | MOV DI,BX | ||
| 142 | MOV CX,[SI.dir_time] | ||
| 143 | MOV DX,[SI.dir_date] | ||
| 144 | XOR AH,AH | ||
| 145 | MOV AL,[SI.dir_attr] | ||
| 146 | TEST AL,attr_directory | ||
| 147 | JNZ NO_SIZE | ||
| 148 | MOV DI,[SI.dir_size_l] | ||
| 149 | MOV BX,[SI.dir_size_h] | ||
| 150 | NO_SIZE: | ||
| 151 | POP DS | ||
| 152 | CLC | ||
| 153 | jmp JustRet | ||
| 154 | EndProc GET_FILE_INFO | ||
| 155 | |||
| 156 | Break <SET_FILE_ATTRIBUTE -- Set File Attribute> | ||
| 157 | |||
| 158 | ; Inputs: | ||
| 159 | ; [WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL | ||
| 160 | ; terminated) | ||
| 161 | ; [CURR_DIR_END] Points to end of Current dir part of string | ||
| 162 | ; ( = -1 if current dir not involved, else | ||
| 163 | ; Points to first char after last "/" of current dir part) | ||
| 164 | ; [THISCDS] Points to CDS being used | ||
| 165 | ; (Low word = -1 if NUL CDS (Net direct request)) | ||
| 166 | ; [SATTRIB] is attribute of search (determines what files may be found) | ||
| 167 | ; AX is new attributes to give to file | ||
| 168 | ; Function: | ||
| 169 | ; Set File Attributes | ||
| 170 | ; Returns: | ||
| 171 | ; CARRY CLEAR | ||
| 172 | ; No error | ||
| 173 | ; CARRY SET | ||
| 174 | ; AX is error code | ||
| 175 | ; error_file_not_found | ||
| 176 | ; Last element of path not found | ||
| 177 | ; error_path_not_found | ||
| 178 | ; Bad path (not in curr dir part if present) | ||
| 179 | ; error_bad_curr_dir | ||
| 180 | ; Bad path in current directory part of path | ||
| 181 | ; error_access_denied | ||
| 182 | ; Attempt to set an attribute which cannot be set | ||
| 183 | ; (attr_directory, attr_volume_ID) | ||
| 184 | ; error_sharing_violation | ||
| 185 | ; Sharing mode of file did not allow the change | ||
| 186 | ; (this request requires exclusive write/read access) | ||
| 187 | ; (INT 24H generated) | ||
| 188 | ; DS preserved, others destroyed | ||
| 189 | |||
| 190 | procedure SET_FILE_ATTRIBUTE,NEAR | ||
| 191 | DOSAssume CS,<DS>,"Set_File_Attribute" | ||
| 192 | ASSUME ES:NOTHING | ||
| 193 | |||
| 194 | TEST AX,NOT attr_changeable | ||
| 195 | JZ set_look | ||
| 196 | BAD_ACC: | ||
| 197 | MOV ExtErr_Locus,errLoc_UNK | ||
| 198 | MOV ExtErr_Class,errClass_Apperr | ||
| 199 | MOV ExtErr_Action,errAct_Abort | ||
| 200 | MOV AX,error_access_denied | ||
| 201 | STC | ||
| 202 | return | ||
| 203 | |||
| 204 | set_look: | ||
| 205 | Invoke TestNet | ||
| 206 | JNC Local_Set | ||
| 207 | |||
| 208 | IF NOT Installed | ||
| 209 | transfer NET_SEQ_SET_FILE_ATTRIBUTE | ||
| 210 | ELSE | ||
| 211 | PUSH AX | ||
| 212 | MOV AX,(multNET SHL 8) OR 14 | ||
| 213 | INT 2FH | ||
| 214 | POP BX ; clean stack | ||
| 215 | return | ||
| 216 | ENDIF | ||
| 217 | |||
| 218 | LOCAL_SET: | ||
| 219 | EnterCrit critDisk | ||
| 220 | PUSH AX ; Save new attributes | ||
| 221 | MOV [NoSetDir],1 ; if we find a dir, don't change to it | ||
| 222 | invoke GetPath ; get path through fastopen if there ;AC000; | ||
| 223 | JNC set_check_device | ||
| 224 | POP BX ; Clean stack (don't zap AX) | ||
| 225 | JMP NO_PATH | ||
| 226 | |||
| 227 | set_check_device: | ||
| 228 | OR AH,AH | ||
| 229 | JNS set_check_share | ||
| 230 | POP AX | ||
| 231 | LeaveCrit critDisk | ||
| 232 | JMP BAD_ACC ; device | ||
| 233 | |||
| 234 | set_check_share: | ||
| 235 | POP AX ; Get new attributes | ||
| 236 | invoke REN_DEL_Check | ||
| 237 | JNC set_do | ||
| 238 | MOV AX,error_sharing_violation | ||
| 239 | jmp short ok_bye | ||
| 240 | |||
| 241 | set_do: | ||
| 242 | LES DI,[CURBUF] | ||
| 243 | AND BYTE PTR ES:[BX].dir_attr,NOT attr_changeable | ||
| 244 | OR BYTE PTR ES:[BX].dir_attr,AL | ||
| 245 | |||
| 246 | TEST ES:[DI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; | ||
| 247 | JNZ yesdirty ;LB. don't increment dirty count ;AN000; | ||
| 248 | invoke INC_DIRTY_COUNT ;LB. ;AN000; | ||
| 249 | OR ES:[DI.buf_flags],buf_dirty | ||
| 250 | yesdirty: | ||
| 251 | MOV AL,[THISDRV] | ||
| 252 | ;;;; 10/1/86 F.C update fastopen cache | ||
| 253 | PUSH DX | ||
| 254 | PUSH DI | ||
| 255 | MOV AH,0 ; dir entry update | ||
| 256 | MOV DL,AL ; drive number A=0,B=1,, | ||
| 257 | MOV DI,BX ; ES:DI -> dir entry | ||
| 258 | invoke FastOpen_Update | ||
| 259 | POP DI | ||
| 260 | POP DX | ||
| 261 | ;;;; 9/11/86 F.C update fastopen cache | ||
| 262 | invoke FlushBuf | ||
| 263 | JNC OK_BYE | ||
| 264 | MOV AX,error_file_not_found | ||
| 265 | OK_BYE: | ||
| 266 | LeaveCrit critDisk | ||
| 267 | return | ||
| 268 | |||
| 269 | EndProc SET_FILE_ATTRIBUTE | ||
| 270 | |||
| 271 | |||
| 272 | |||
| 273 | procedure GET_FAST_PATH,NEAR | ||
| 274 | ASSUME DS:NOTHING,ES:NOTHING | ||
| 275 | |||
| 276 | OR [FastOpenFlg],FastOpen_Set ;FO. trigger fastopen ;AN000; | ||
| 277 | invoke GetPath | ||
| 278 | PUSHF ;FO. ;AN000; | ||
| 279 | AND [FastOpenFlg],Fast_yes ;FO. clear all fastopen flags ;AN000; | ||
| 280 | POPF ;FO. ;AN000; | ||
| 281 | return | ||
| 282 | |||
| 283 | EndProc GET_FAST_PATH | ||
| 284 | |||
| 285 | CODE ENDS | ||
| 286 | END | ||