diff options
Diffstat (limited to 'v4.0/src/CMD/SHARE')
| -rw-r--r-- | v4.0/src/CMD/SHARE/GSHARE.ASM | 2405 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/GSHARE2.ASM | 2979 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/MAKEFILE | 67 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/SHARE.LNK | 9 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/SHARE.SKL | 27 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/SHAREHDR.INC | 72 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/SHARELNK.ASM | 213 | ||||
| -rw-r--r-- | v4.0/src/CMD/SHARE/SHARESR.ASM | 73 |
8 files changed, 5845 insertions, 0 deletions
diff --git a/v4.0/src/CMD/SHARE/GSHARE.ASM b/v4.0/src/CMD/SHARE/GSHARE.ASM new file mode 100644 index 0000000..de9b1b3 --- /dev/null +++ b/v4.0/src/CMD/SHARE/GSHARE.ASM | |||
| @@ -0,0 +1,2405 @@ | |||
| 1 | Title Share_1 - IBM CONFIDENTIAL | ||
| 2 | ; $SALUT (0,36,41,44) | ||
| 3 | include SHAREHDR.INC | ||
| 4 | ; | ||
| 5 | ; Label: "The DOS SHARE Utility" | ||
| 6 | ; "Version 4.00 (C) Copyright 1988 Microsoft" | ||
| 7 | ; "Licenced Material - Program Property of Microsoft" | ||
| 8 | ; | ||
| 9 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 10 | |||
| 11 | extrn fnm:near, rsc:near, rmn:near, cps:near, ofl:near, sle:near, interr:near | ||
| 12 | |||
| 13 | NAME Sharer | ||
| 14 | |||
| 15 | .xlist | ||
| 16 | .xcref | ||
| 17 | INCLUDE DOSSYM.INC | ||
| 18 | include dpl.asm | ||
| 19 | .cref | ||
| 20 | .list | ||
| 21 | |||
| 22 | AsmVars <IBM, Installed> | ||
| 23 | |||
| 24 | Installed = TRUE ; for installed version | ||
| 25 | |||
| 26 | OFF Macro reg,val | ||
| 27 | IF installed | ||
| 28 | mov reg,OFFSET val | ||
| 29 | ELSE | ||
| 30 | mov si,OFFSET DOSGROUP:val | ||
| 31 | ENDIF | ||
| 32 | ENDM | ||
| 33 | |||
| 34 | ERRNZ Macro x | ||
| 35 | IF x NE 0 | ||
| 36 | %out ERRNZ failed | ||
| 37 | ENDIF | ||
| 38 | ENDM | ||
| 39 | ; if we are installed, then define the base code segment of the sharer first | ||
| 40 | |||
| 41 | IF Installed | ||
| 42 | Share SEGMENT PARA PUBLIC 'SHARE' | ||
| 43 | Share ENDS | ||
| 44 | ; include the rest of the segment definitions for normal msdos | ||
| 45 | ; We CANNOT include dosseg because start is not declared para in that file | ||
| 46 | |||
| 47 | ; $SALUT (4,9,17,36) | ||
| 48 | |||
| 49 | START SEGMENT PARA PUBLIC 'START' | ||
| 50 | START ENDS | ||
| 51 | |||
| 52 | CONSTANTS SEGMENT WORD PUBLIC 'CONST' | ||
| 53 | CONSTANTS ENDS | ||
| 54 | |||
| 55 | DATA SEGMENT WORD PUBLIC 'DATA' | ||
| 56 | DATA ENDS | ||
| 57 | |||
| 58 | TABLE SEGMENT BYTE PUBLIC 'TABLE' | ||
| 59 | TABLE ENDS | ||
| 60 | |||
| 61 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 62 | CODE ENDS | ||
| 63 | |||
| 64 | LAST SEGMENT PARA PUBLIC 'LAST' | ||
| 65 | LAST ENDS | ||
| 66 | |||
| 67 | DOSGROUP GROUP START,CONSTANTS,DATA,TABLE,CODE,LAST | ||
| 68 | ELSE | ||
| 69 | include dosseg.asm | ||
| 70 | ENDIF | ||
| 71 | |||
| 72 | DATA SEGMENT WORD PUBLIC 'DATA' | ||
| 73 | Extrn ThisSFT:DWORD ; pointer to SFT entry | ||
| 74 | Extrn User_ID:WORD | ||
| 75 | Extrn Proc_ID:WORD | ||
| 76 | Extrn WFP_START:WORD | ||
| 77 | Extrn BytPos:DWORD | ||
| 78 | extrn OpenBuf:BYTE | ||
| 79 | extrn user_in_ax:WORD | ||
| 80 | IF debug | ||
| 81 | Extrn BugLev:WORD | ||
| 82 | Extrn BugTyp:WORD | ||
| 83 | include bugtyp.asm | ||
| 84 | ENDIF | ||
| 85 | DATA ENDS | ||
| 86 | |||
| 87 | ; if we are not installed, then the code here is just part of the normal | ||
| 88 | ; MSDOS code segment otherwise, define our own code segment | ||
| 89 | |||
| 90 | .sall | ||
| 91 | IF NOT INSTALLED | ||
| 92 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 93 | ASSUME SS:DOSGROUP,CS:DOSGROUP | ||
| 94 | ELSE | ||
| 95 | Share SEGMENT PARA PUBLIC 'SHARE' | ||
| 96 | ASSUME SS:DOSGROUP,CS:SHARE | ||
| 97 | ENDIF | ||
| 98 | |||
| 99 | extrn MFT:BYTE | ||
| 100 | extrn skip_check:BYTE | ||
| 101 | |||
| 102 | include mft.inc | ||
| 103 | |||
| 104 | PUBLIC FreLock,Serial | ||
| 105 | |||
| 106 | IF installed | ||
| 107 | Frelock DW ? ; FWA of lock free list | ||
| 108 | ELSE | ||
| 109 | Frelock DW OFFSET DOSGROUP:lck8 ; FWA of lock free list | ||
| 110 | ENDIF | ||
| 111 | Serial DW 0 ; serial number | ||
| 112 | DS_Org dw 0 ;an000;DS on entry to routine | ||
| 113 | |||
| 114 | ZERO EQU 0 | ||
| 115 | ONE EQU 1 | ||
| 116 | |||
| 117 | FRAME struc | ||
| 118 | |||
| 119 | SavedBP dw ? | ||
| 120 | RetOFF dw ? | ||
| 121 | Parm_1 dw ? | ||
| 122 | Parm_2 dw ? | ||
| 123 | |||
| 124 | FRAME ends | ||
| 125 | |||
| 126 | ; $SALUT (4,4,9,41) | ||
| 127 | |||
| 128 | BREAK <Sharer - MultiProcess File Sharer> | ||
| 129 | |||
| 130 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 131 | ; | ||
| 132 | ; MSDOS MFT Functions | ||
| 133 | ; | ||
| 134 | ; The Master File Table (MFT) associates the cannonicalized pathnames, | ||
| 135 | ; lock records and SFTs for all files open on this machine. | ||
| 136 | ; | ||
| 137 | ; These functions are supplied to maintain the MFT and extract | ||
| 138 | ; information from it. All MFT access should be via these routines so | ||
| 139 | ; that the MFT structure can remain flexible. | ||
| 140 | ; | ||
| 141 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 142 | |||
| 143 | BREAK <Mft_enter - Make an MFT entry and check access> | ||
| 144 | |||
| 145 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 146 | ; | ||
| 147 | ; mft_enter - make an entry in the MFT | ||
| 148 | ; | ||
| 149 | ; mft_enter is called to make an entry in the MFT. | ||
| 150 | ; mft_enter checks for a file sharing conflict: | ||
| 151 | ; No conflict: | ||
| 152 | ; A new MFT entry is created, or the existing one updated, | ||
| 153 | ; as appropriate. | ||
| 154 | ; Conflicts: | ||
| 155 | ; The existing MFT is left alone. Note that if we had to | ||
| 156 | ; create a new MFT there cannot be, by definition, sharing | ||
| 157 | ; conflicts. | ||
| 158 | ; If no conflict has been discovered, the SFT list for the file is | ||
| 159 | ; checked for one that matches the following conditions: | ||
| 160 | ; | ||
| 161 | ; If mode == 70 then | ||
| 162 | ; don't link in SFT | ||
| 163 | ; increment refcount | ||
| 164 | ; If mode&sfIsFCB and userids match and process ids match then | ||
| 165 | ; don't link in SFT | ||
| 166 | ; | ||
| 167 | ; ENTRY ThisSFT points to an SFT structure. The sf_mode field | ||
| 168 | ; contains the desired sharing mode. | ||
| 169 | ; WFP_Start is an offset from DOSGroup of the full pathname for | ||
| 170 | ; the file | ||
| 171 | ; User_ID = 16-bit user id of issuer | ||
| 172 | ; Proc_ID = 16-bit process id of issuer | ||
| 173 | ; (DS) = (SS) = DOSGroup | ||
| 174 | ; EXIT 'C' clear if no error' | ||
| 175 | ; 'C' set if error | ||
| 176 | ; (ax) = error code | ||
| 177 | ; USES ALL but DS | ||
| 178 | ; | ||
| 179 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 180 | |||
| 181 | Procedure mft_enter,NEAR | ||
| 182 | |||
| 183 | ; int 3 | ||
| 184 | nop | ||
| 185 | nop | ||
| 186 | |||
| 187 | EnterCrit critShare | ||
| 188 | |||
| 189 | DOSAssume SS <DS>,"MFT_Enter entry" | ||
| 190 | ASSUME ES:NOTHING,SS:DOSGROUP | ||
| 191 | push ds | ||
| 192 | |||
| 193 | ; find or make a name record | ||
| 194 | |||
| 195 | mov si,WFP_Start ; (DS:SI) = FBA of file name | ||
| 196 | mov al,1 ; allow creation of MFT entry | ||
| 197 | push es | ||
| 198 | |||
| 199 | ASSUME DS:NOTHING | ||
| 200 | |||
| 201 | call FNM ; find or create name in MFT | ||
| 202 | pop es | ||
| 203 | mov ax,error_sharing_buffer_exceeded | ||
| 204 | jc ent9 ; not enough space | ||
| 205 | ; | ||
| 206 | ; (bx) = fwa name record | ||
| 207 | ; | ||
| 208 | lds si,ThisSFT | ||
| 209 | call ASC ; try to add to chain | ||
| 210 | |||
| 211 | ; As noted above, we don't have to worry about an "empty" name record | ||
| 212 | ; being left if ASC refuses to add the SFT - ASC cannot refuse if we had | ||
| 213 | ; just created the MFT... | ||
| 214 | |||
| 215 | ; return. | ||
| 216 | ; | ||
| 217 | ; 'C' and (Ax) setup appropriately | ||
| 218 | |||
| 219 | ent9: pop ds | ||
| 220 | |||
| 221 | LeaveCrit critShare | ||
| 222 | |||
| 223 | ret | ||
| 224 | |||
| 225 | EndProc mft_enter | ||
| 226 | |||
| 227 | BREAK <MftClose - Close out an MFT for given SFT> | ||
| 228 | |||
| 229 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 230 | ; | ||
| 231 | ; MFTclose | ||
| 232 | ; | ||
| 233 | ; MFTclose(SFT) | ||
| 234 | ; | ||
| 235 | ; MFTclose removes the SFT entry from the MFT structure. If this was | ||
| 236 | ; the last SFT for the particular file the file's entry is also removed | ||
| 237 | ; from the MFT structure. If the sharer is installed after some | ||
| 238 | ; processing has been done, the MFT field of the SFTs will be 0; we must | ||
| 239 | ; ignore these guys. | ||
| 240 | ; | ||
| 241 | ; If the sft indicates FCB, we do nothing special. The SFT behaves | ||
| 242 | ; EXACTLY like a normal handle. | ||
| 243 | ; | ||
| 244 | ; If the sft indicates mode 70 then we do nothing special. These are | ||
| 245 | ; normal HANDLES. | ||
| 246 | ; | ||
| 247 | ; Note that we always care about the SFT refcount. A refcount of 1 | ||
| 248 | ; means that the SFT is going idle and that we need to remove the sft | ||
| 249 | ; from the chain. | ||
| 250 | ; | ||
| 251 | ; ENTRY (ES:DI) points to an SFT structure | ||
| 252 | ; (DS) = (SS) = DOSGroup | ||
| 253 | ; EXIT NONE | ||
| 254 | ; USES ALL but DS, ES:DI | ||
| 255 | ; | ||
| 256 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 257 | |||
| 258 | Procedure MFTclose,NEAR | ||
| 259 | |||
| 260 | ; int 3 | ||
| 261 | nop | ||
| 262 | nop | ||
| 263 | |||
| 264 | EnterCrit critShare | ||
| 265 | |||
| 266 | DOSAssume SS,<DS>,"MFTClose entry" | ||
| 267 | ASSUME ES:NOTHING | ||
| 268 | mov ax,es:[di].sf_MFT | ||
| 269 | |||
| 270 | fmt TypShare,LevShEntry,<"MFTClose by $x:$x of $x:$x ($x)\n">,<User_ID,Proc_id,ES,DI,AX> | ||
| 271 | |||
| 272 | or ax,ax | ||
| 273 | jz mcl10 ; No entry for it, ignore (carry clear) | ||
| 274 | push ds | ||
| 275 | push es | ||
| 276 | push di | ||
| 277 | ;;;call CSL ; clear SFT locks ;AC008; | ||
| 278 | |||
| 279 | ASSUME DS:NOTHING | ||
| 280 | |||
| 281 | mov ax,es:[di].sf_ref_count ; (ax) = ref count | ||
| 282 | ; | ||
| 283 | ; We need to release information in one of two spots. First, when the SFT has | ||
| 284 | ; a ref count of 0. Here, there are no more referents and, thus, no sharing | ||
| 285 | ; record need be kept. Second, the ref count may be -1 indicating that the | ||
| 286 | ; sft is being kept but that the sharing information is no longer needed. | ||
| 287 | ; This occurs in creates of existing files, where we verify the allowed | ||
| 288 | ; access, truncate the file and regain the access. If the truncation | ||
| 289 | ; generates an error, we do NOT want to have the access locked down. | ||
| 290 | ; | ||
| 291 | |||
| 292 | |||
| 293 | OR AX,AX | ||
| 294 | jz mcl85 ; ref count is 0 - don't dechain | ||
| 295 | inc ax ; -1 + 1 = 0. Busy sft. | ||
| 296 | jnz mcl9 | ||
| 297 | mcl85: | ||
| 298 | call CSL ; clear SFT locks ;AC008; | ||
| 299 | call RSC ; remove sft from chain | ||
| 300 | jnz mcl9 ; not the last sft for this name | ||
| 301 | call RMN ; remove name record | ||
| 302 | mcl9: | ||
| 303 | pop di ; restore regs for exit | ||
| 304 | pop es | ||
| 305 | pop ds | ||
| 306 | mcl10: | ||
| 307 | LeaveCrit critShare | ||
| 308 | |||
| 309 | ret | ||
| 310 | |||
| 311 | EndProc MFTclose | ||
| 312 | |||
| 313 | BREAK <MftClU - Close out all MFTs for given UID> | ||
| 314 | |||
| 315 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 316 | ; | ||
| 317 | ; MFTcloseU | ||
| 318 | ; | ||
| 319 | ; MFTcloseM(UID) | ||
| 320 | ; | ||
| 321 | ; MFTcloseM removes all entrys for user UID from the MFT structure. We | ||
| 322 | ; walk the MFT structure closing all relevant SFT's for the user. | ||
| 323 | ; We do it the dumb way, iterating closes until the SF ref count is | ||
| 324 | ; 0. | ||
| 325 | ; | ||
| 326 | ; ENTRY User_ID = 16-bit user id of issuer | ||
| 327 | ; (SS) + DOSGroup | ||
| 328 | ; EXIT 'C' clear | ||
| 329 | ; USES ALL | ||
| 330 | ; | ||
| 331 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 332 | |||
| 333 | Procedure MFTclU,NEAR | ||
| 334 | |||
| 335 | ; int 3 | ||
| 336 | nop | ||
| 337 | nop | ||
| 338 | |||
| 339 | ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 340 | |||
| 341 | EnterCrit critShare | ||
| 342 | mov ax,User_ID | ||
| 343 | |||
| 344 | fmt TypShare,LevShEntry,<"\nCloseUser $x\n">,<AX> | ||
| 345 | |||
| 346 | sub bx,bx ; insensitive to PID | ||
| 347 | sub dx,dx | ||
| 348 | invoke BCS ; bulk close the SFTs | ||
| 349 | LeaveCrit critShare | ||
| 350 | return | ||
| 351 | EndProc MFTclU | ||
| 352 | |||
| 353 | BREAK <MftCloseP - Close out all MFTs for given UID/PID> | ||
| 354 | |||
| 355 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 356 | ; | ||
| 357 | ; MFTcloseP | ||
| 358 | ; | ||
| 359 | ; MFTcloseP(PID, UID) | ||
| 360 | ; | ||
| 361 | ; MFTcloseP removes all entrys for process PID on machine MID from the | ||
| 362 | ; MFT structure. We walk the MFT structure closing all relevant | ||
| 363 | ; SFT's. Do it the dumb way by iterating closes until the SFTs | ||
| 364 | ; disappear. | ||
| 365 | ; | ||
| 366 | ; ENTRY (SS) = DOSGROUP | ||
| 367 | ; User_ID = 16-bit user id of issuer | ||
| 368 | ; Proc_ID = 16-bit process id of issuer | ||
| 369 | ; EXIT 'C' clear | ||
| 370 | ; USES ALL | ||
| 371 | ; | ||
| 372 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 373 | |||
| 374 | Procedure MFTcloseP,NEAR | ||
| 375 | |||
| 376 | ; int 3 | ||
| 377 | nop | ||
| 378 | nop | ||
| 379 | |||
| 380 | ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 381 | |||
| 382 | EnterCrit critShare | ||
| 383 | mov ax,User_ID | ||
| 384 | mov bx,-1 | ||
| 385 | mov dx,Proc_ID | ||
| 386 | |||
| 387 | fmt TypShare,LevShEntry,<"\nClose UID/PID $x:$x\n">,<AX,DX> | ||
| 388 | |||
| 389 | call BCS ; Bulk close the SFTs | ||
| 390 | LeaveCrit critShare | ||
| 391 | |||
| 392 | ret | ||
| 393 | |||
| 394 | EndProc MFTcloseP | ||
| 395 | |||
| 396 | BREAK <MftCloN - Close file by name> | ||
| 397 | |||
| 398 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 399 | ; | ||
| 400 | ; MFTcloseN | ||
| 401 | ; | ||
| 402 | ; MFTcloseN(name) | ||
| 403 | ; | ||
| 404 | ; MFTcloseN removes all entrys for the given file from the MFT | ||
| 405 | ; structure. | ||
| 406 | ; | ||
| 407 | ; NOTE: this function is used infrequently and need not be fast. | ||
| 408 | ; (although for typical use it's not all that slow...) | ||
| 409 | ; | ||
| 410 | ; ENTRY DS:SI point to dpl. | ||
| 411 | ; (SS) = DOSGroup | ||
| 412 | ; EXIT 'C' clear if no error | ||
| 413 | ; 'C' set if error | ||
| 414 | ; AX = error_path_not_found if not currently open | ||
| 415 | ; USES ALL | ||
| 416 | ; | ||
| 417 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 418 | |||
| 419 | Procedure MFTcloN,NEAR | ||
| 420 | |||
| 421 | ; int 3 | ||
| 422 | nop | ||
| 423 | nop | ||
| 424 | |||
| 425 | ASSUME SS:DOSGROUP,ES:NOTHING,DS:NOTHING | ||
| 426 | |||
| 427 | EnterCrit critShare | ||
| 428 | MOV DX,[SI.DPL_DX] | ||
| 429 | MOV DS,[SI.DPL_DS] | ||
| 430 | mov si,dx ; (DS:SI) = fwa name | ||
| 431 | sub al,al ; don't create if not found | ||
| 432 | push ds | ||
| 433 | push si | ||
| 434 | call FNM ; find name in MFT | ||
| 435 | mov ax,error_path_not_found ; assume error | ||
| 436 | jc mclo9 ; not found exit | ||
| 437 | |||
| 438 | ; Name was found. Lets yank the SFT entrys one at a time. | ||
| 439 | |||
| 440 | mclo1: les di,[bx].mft_sptr ; (ES:DI) = SFT address | ||
| 441 | mov WORD PTR ThisSFT,di | ||
| 442 | mov WORD PTR ThisSFT+2,es ; point to SFT | ||
| 443 | cmp es:[di].sf_ref_count,1 | ||
| 444 | jnz mclo15 | ||
| 445 | call CPS | ||
| 446 | mclo15: | ||
| 447 | Context DS | ||
| 448 | |||
| 449 | IF installed | ||
| 450 | MOV AX,(multDOS SHL 8) + 1 | ||
| 451 | INT 2FH | ||
| 452 | ELSE | ||
| 453 | call DOS_Close | ||
| 454 | ENDIF | ||
| 455 | mclo2: | ||
| 456 | |||
| 457 | ASSUME DS:NOTHING | ||
| 458 | |||
| 459 | pop si | ||
| 460 | pop ds | ||
| 461 | push ds | ||
| 462 | push si | ||
| 463 | sub al,al ; don't create an entry | ||
| 464 | call FNM ; find the name gain | ||
| 465 | jnc mclo1 ; got still more | ||
| 466 | clc | ||
| 467 | |||
| 468 | ; exit. 'C' and (ax) setup | ||
| 469 | ; | ||
| 470 | ; (TOS+2:TOS) = address of ASCIZ string | ||
| 471 | |||
| 472 | mclo9: pop si ; clean stack | ||
| 473 | pop ds | ||
| 474 | LeaveCrit critShare | ||
| 475 | |||
| 476 | ret | ||
| 477 | |||
| 478 | EndProc MFTcloN | ||
| 479 | |||
| 480 | BREAK <Set_Mult_Block - Try to set multiple locks> | ||
| 481 | |||
| 482 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 483 | ; | ||
| 484 | ; NAME: Set_Mult_Block - Set Multiple Block Locks | ||
| 485 | ; | ||
| 486 | ; FUNCTION: Set_Mult_Block sets a lock on 1 or more specified ranges | ||
| 487 | ; of a file. An error is returned if any lock range conflicts | ||
| 488 | ; with another. Ranges of Locks are cleared via Clr_Mult_Block. | ||
| 489 | ; | ||
| 490 | ; In DOS 3.3 only one lock range could be set at a time using | ||
| 491 | ; Set_Block. For DOS 4.00 this routine will replace Set_Block | ||
| 492 | ; in the jump table and will make repeated calls to Set_Block | ||
| 493 | ; in order to process 1 or more lock ranges. | ||
| 494 | ; | ||
| 495 | ; NOTE: - This is an all new interface to IBMDOS | ||
| 496 | ; | ||
| 497 | ; INPUT: (AL) = 0 - lock all | ||
| 498 | ; = 80 - lock write | ||
| 499 | ; (CX) = the number of lock ranges | ||
| 500 | ; (DS:DX) = pointer to the range list | ||
| 501 | ; (ES:DI) = SFT address | ||
| 502 | ; User_ID = 16-bit user id of issuer | ||
| 503 | ; Proc_ID = 16-bit process id of issuer | ||
| 504 | ; (SS) = DOSGroup | ||
| 505 | ; | ||
| 506 | ; OUTPUT: Lock records filled in for all blocks specified | ||
| 507 | ; | ||
| 508 | ; REGISTERS USED: ALL but DS | ||
| 509 | ; (NOT RESTORED) | ||
| 510 | ; | ||
| 511 | ; LINKAGE: IBMDOS Jump Table | ||
| 512 | ; | ||
| 513 | ; EXTERNAL Invoke: Load_Regs, Set_Block, Clr_Block | ||
| 514 | ; REFERENCES: | ||
| 515 | ; | ||
| 516 | ; NORMAL 'C' clear if no error | ||
| 517 | ; EXIT: | ||
| 518 | ; | ||
| 519 | ; ERROR 'C' set if error | ||
| 520 | ; EXIT: (ax) = error code | ||
| 521 | ; ('error_lock_violation' if conflicting locks) | ||
| 522 | ; | ||
| 523 | ; CHANGE 04/15/87 - First release | ||
| 524 | ; LOG: | ||
| 525 | ; | ||
| 526 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 527 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 528 | ; | ||
| 529 | ; START Set_Mult_Block | ||
| 530 | ; | ||
| 531 | ; count = start_count | ||
| 532 | ; search till count = 0 | ||
| 533 | ; invoke Load_Regs | ||
| 534 | ; invoke Set_Block | ||
| 535 | ; exit if error | ||
| 536 | ; clear_count = start_count - current_count | ||
| 537 | ; loop till clear_count = 0 | ||
| 538 | ; invoke Load_Regs | ||
| 539 | ; invoke Clr_Block | ||
| 540 | ; leave if error | ||
| 541 | ; end loop | ||
| 542 | ; set error status | ||
| 543 | ; orelse | ||
| 544 | ; endloop | ||
| 545 | ; set successful status | ||
| 546 | ; endsrch | ||
| 547 | ; if error status | ||
| 548 | ; load return code | ||
| 549 | ; endif | ||
| 550 | ; return | ||
| 551 | ; | ||
| 552 | ; END Set_Mult_Block | ||
| 553 | ; | ||
| 554 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 555 | |||
| 556 | Procedure Set_Mult_Block,NEAR | ||
| 557 | |||
| 558 | ; PUSH DS ;ICE | ||
| 559 | ; push bx ;ICE | ||
| 560 | ; push ax ;ICE | ||
| 561 | |||
| 562 | ; mov bx,0140H ;ICE | ||
| 563 | ; xor ax,ax ;ICE | ||
| 564 | ; mov ds,ax ;ICE | ||
| 565 | ; mov ax,word ptr ds:[bx] ;ICE | ||
| 566 | ; mov word ptr ds:[bx],ax ;ICE | ||
| 567 | |||
| 568 | ; pop ax ;ICE | ||
| 569 | ; pop bx ;ICE | ||
| 570 | ; POP DS ;ICE | ||
| 571 | |||
| 572 | |||
| 573 | |||
| 574 | EnterCrit critShare ; ;AN000; | ||
| 575 | |||
| 576 | ASSUME ES:NOTHING,DS:NOTHING ; ;AN000; | ||
| 577 | ; set up for loop | ||
| 578 | |||
| 579 | ; WE HAVE: (from IBMDOS) | WE NEED: (for Set_Block) | ||
| 580 | |||
| 581 | ; (AL) = 0 - lock all | (BX) = 0 lock all operations | ||
| 582 | ; = 80- lock write | = 1 lock write operations | ||
| 583 | ; (CX) = the number of lock ranges | (CX:DX) = offset of area | ||
| 584 | ; (DS:DX) = pointer to the range list | (SI:AX) = length of area | ||
| 585 | ; (ES:DI) = SFT address | (ES:DI) = SFT address | ||
| 586 | |||
| 587 | ; int 3 | ||
| 588 | nop | ||
| 589 | nop | ||
| 590 | |||
| 591 | mov DS_Org,ds ;an000;save entry DS | ||
| 592 | |||
| 593 | Context DS ; ;AN000; | ||
| 594 | CMP CX,01h ;DO WE HAVE A COUNT? ;AN000; | ||
| 595 | |||
| 596 | ;; $if ae ; if the count was valid ;AN000; | ||
| 597 | ; $if e ; if the count was valid ;AC006; | ||
| 598 | JNE $$IF1 | ||
| 599 | |||
| 600 | ;; PUSH CX ; count = start_count ;AN000; | ||
| 601 | ;; PUSH DX ; save pointer to range list ;AN000; | ||
| 602 | MOV BP,DX ; save current index into list ;AN000; | ||
| 603 | ;; AND AX,0080H ; clear high byte and be sure low is ;AN000; | ||
| 604 | ; set if applicable | ||
| 605 | ;; ROL AL,1 ; move high bit to bit 0 | ||
| 606 | ;; MOV BX,AX ; SET UP TYPE OF LOCK ;AN000; | ||
| 607 | |||
| 608 | ;; $do ; loop till count = 0 ;AN000; | ||
| 609 | ;; cmp cx,00 ;an000;see if at end | ||
| 610 | ;; $leave e ;an000;exit if at end | ||
| 611 | ;; push cx ;an000;save cx - our counter | ||
| 612 | ;; push di ;an000;save di - our SFT pointer | ||
| 613 | call load_regs ;an000;load the registers for call | ||
| 614 | ; to set_block | ||
| 615 | call set_block ;an000;set the lock block | ||
| 616 | ;; pop di ;an000;restore our SFT pointer | ||
| 617 | ;; pop cx ;an000;restore cx - our counter | ||
| 618 | ;; $leave c ;an000;on error exit loop | ||
| 619 | ;; dec cx ;an000;decrease counter | ||
| 620 | ;; $enddo ;an000;end loop | ||
| 621 | |||
| 622 | ;; $if c ;an000;if an error occurred | ||
| 623 | ;; pop dx ;an000;restore range list pointer | ||
| 624 | ;; pop ax ;an000;obtain original count | ||
| 625 | ;; sub ax,cx ;an000;determine how many locks set | ||
| 626 | ;; mov cx,ax ;an000;set the loop counter with count | ||
| 627 | ;; mov bp,dx ;an000;set bp to point to range list | ||
| 628 | ;; $do ;an000;while cx not = 0 | ||
| 629 | ;; cmp cx,00 ;an000;at end? | ||
| 630 | ;; $leave e ;an000;yes, exit | ||
| 631 | ;; push cx ;an000;save cx - our counter | ||
| 632 | ;; push di ;an000;save di - our SFT pointer | ||
| 633 | ;; call load_regs ;an000;load the registers for call | ||
| 634 | ; to clr_block | ||
| 635 | ;; call clr_block ;an000;clear the locks | ||
| 636 | ;; pop di ;an000;restore our SFT pointer | ||
| 637 | ;; pop cx ;an000;restore cx - our counter | ||
| 638 | ;; $leave c ;an000;on error exit | ||
| 639 | ;; dec cx ;an000;decrease counter | ||
| 640 | ;; $enddo ;an000; | ||
| 641 | ;; stc ;an000;signal an error occurred | ||
| 642 | ;; $else ;an000;no error occurred in locking | ||
| 643 | ;; pop ax ;an000;clear off the stack | ||
| 644 | ;; pop ax ;an000; to balance it | ||
| 645 | ;; clc ;an000;signal no error occurred | ||
| 646 | ;; $endif ;an000; | ||
| 647 | ; $else ;an000;cx was 0 - this is an error | ||
| 648 | JMP SHORT $$EN1 | ||
| 649 | $$IF1: | ||
| 650 | stc ;an000;signal an error occurred | ||
| 651 | ; $endif ; ;an000; | ||
| 652 | $$EN1: | ||
| 653 | |||
| 654 | ; $if c ; if there was an error ;AN000; | ||
| 655 | JNC $$IF4 | ||
| 656 | MOV AX,error_lock_violation ; load the return code ;AN000; | ||
| 657 | ; $endif ; endif there was an error ;AN000; | ||
| 658 | $$IF4: | ||
| 659 | |||
| 660 | LeaveCrit critShare ; ;AN000; | ||
| 661 | |||
| 662 | ret ; return - all set ;AN000; | ||
| 663 | |||
| 664 | EndProc Set_Mult_Block | ||
| 665 | |||
| 666 | BREAK <Load_Regs - Load Registers for ?_Block call> | ||
| 667 | |||
| 668 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 669 | ; | ||
| 670 | ; NAME: Load_Regs - Load Registers for ?_Block calls | ||
| 671 | ; | ||
| 672 | ; FUNCTION: This subroutine loads the High and Low Offsets and the | ||
| 673 | ; High and Low lengths for Lock ranges from the Range List. | ||
| 674 | ; | ||
| 675 | ; INPUT: (DS_Org:PB) - Range list entry to be loaded | ||
| 676 | ; | ||
| 677 | ; OUTPUT: (DX) - Low Offset | ||
| 678 | ; (CX) - High Offset | ||
| 679 | ; (AX) - Low Length | ||
| 680 | ; (SI) - High Length | ||
| 681 | ; | ||
| 682 | ; REGISTERS USED: AX CX DX BP SI | ||
| 683 | ; (NOT RESTORED) | ||
| 684 | ; | ||
| 685 | ; LINKAGE: Called by: Set_Mult_Block, Clr_Mult_Block | ||
| 686 | ; | ||
| 687 | ; EXTERNAL none | ||
| 688 | ; REFERENCES: | ||
| 689 | ; | ||
| 690 | ; NORMAL none | ||
| 691 | ; EXIT: | ||
| 692 | ; | ||
| 693 | ; ERROR none | ||
| 694 | ; EXIT: | ||
| 695 | ; | ||
| 696 | ; CHANGE 04/15/87 - first release | ||
| 697 | ; LOG: | ||
| 698 | ; | ||
| 699 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 700 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 701 | ; | ||
| 702 | ; START Load_Regs | ||
| 703 | ; | ||
| 704 | ; recover index into range list | ||
| 705 | ; advance pointer to next entry | ||
| 706 | ; load DX - Low Offset | ||
| 707 | ; load CX - High Offset | ||
| 708 | ; load AX - Low Length | ||
| 709 | ; load SI - High Length | ||
| 710 | ; return | ||
| 711 | ; | ||
| 712 | ; END Load_Regs | ||
| 713 | ; | ||
| 714 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 715 | |||
| 716 | Procedure Load_Regs,NEAR | ||
| 717 | |||
| 718 | push ds ; save our DS ;an000; | ||
| 719 | mov ds,DS_Org ; get range list segment ;an000; | ||
| 720 | mov si,bp ; recover pointer ;AN000; | ||
| 721 | ADD BP,08h ; move to next entry in list ;AN000; | ||
| 722 | MOV DX,[SI] ; low position ;AN000; | ||
| 723 | MOV CX,[SI+2] ; high position ;AN000; | ||
| 724 | MOV AX,[SI+4] ; low length ;AN000; | ||
| 725 | MOV SI,[SI+6] ; high length ;AN000; | ||
| 726 | pop ds ; restore DS ;an000; | ||
| 727 | |||
| 728 | ret ; ;AN000; | ||
| 729 | |||
| 730 | EndProc Load_Regs | ||
| 731 | |||
| 732 | BREAK <Clr_Mult_Block - Try to clear multiple locks> | ||
| 733 | |||
| 734 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 735 | ; | ||
| 736 | ; NAME: Clr_Mult_Block - Clear Multiple Block Locks | ||
| 737 | ; | ||
| 738 | ; FUNCTION: Clr_Mult_Block removes the locks on 1 or more specified | ||
| 739 | ; ranges of a file. An error is returned if any lock range | ||
| 740 | ; does not exactly match. Ranges of Locks are set via | ||
| 741 | ; Set_Mult_Block. | ||
| 742 | ; | ||
| 743 | ; In DOS 3.3 only one lock range could be cleared at a time | ||
| 744 | ; using Clr_Block. For DOS 4.00 this routine will replace | ||
| 745 | ; Clr_Block in the jump table and will make repeated calls | ||
| 746 | ; to Set_Block in order to process 1 or more lock ranges. | ||
| 747 | ; | ||
| 748 | ; NOTE: - This is an all new interface to IBMDOS | ||
| 749 | ; - an unlock all 'lock all' request will unlock both | ||
| 750 | ; 'lock all' and 'lock write'. | ||
| 751 | ; - an unlock all 'lock write' request will not unlock | ||
| 752 | ; 'lock all's. It will only unlock 'lock write's. | ||
| 753 | ; (if you can understand the above statement, | ||
| 754 | ; understanding the code will be easy!) | ||
| 755 | ; | ||
| 756 | ; INPUT: (AL) = 0 - lock all | ||
| 757 | ; = 80- lock write | ||
| 758 | ; (CX) = the number of lock ranges - NB: all if -1 *** | ||
| 759 | ; (DS:DX) = pointer to the range list | ||
| 760 | ; (ES:DI) = SFT address | ||
| 761 | ; User_ID = 16-bit user id of issuer | ||
| 762 | ; Proc_ID = 16-bit process id of issuer | ||
| 763 | ; (SS) = DOSGroup | ||
| 764 | ; | ||
| 765 | ; OUTPUT: Lock records filled in for all blocks specified | ||
| 766 | ; | ||
| 767 | ; REGISTERS USED: ALL but DS | ||
| 768 | ; (NOT RESTORED) | ||
| 769 | ; | ||
| 770 | ; LINKAGE: IBMDOS Jump Table | ||
| 771 | ; | ||
| 772 | ; EXTERNAL Invoke: Load_Regs, Set_Block, Clr_Block, Clr_List | ||
| 773 | ; REFERENCES: | ||
| 774 | ; | ||
| 775 | ; NORMAL 'C' clear if no error | ||
| 776 | ; EXIT: | ||
| 777 | ; | ||
| 778 | ; ERROR 'C' set if error | ||
| 779 | ; EXIT: (ax) = error code | ||
| 780 | ; ('error_lock_violation' if conflicting locks) | ||
| 781 | ; | ||
| 782 | ; CHANGE 04/15/87 - First release | ||
| 783 | ; LOG: | ||
| 784 | ; | ||
| 785 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 786 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 787 | ; | ||
| 788 | ; START Clr_Mult_Block | ||
| 789 | ; | ||
| 790 | ; if count is valid and | ||
| 791 | ; if file (SFT) is 'shared' then | ||
| 792 | ; if count = all | ||
| 793 | ; find first RLR | ||
| 794 | ; loop till all RLR cleared | ||
| 795 | ; if PROC_ID matches and | ||
| 796 | ; if UID matches and | ||
| 797 | ; if SFT matches then | ||
| 798 | ; if ulocking lock_all or | ||
| 799 | ; if this RLR is lock_write | ||
| 800 | ; clear the lock | ||
| 801 | ; endif | ||
| 802 | ; endif | ||
| 803 | ; find next RLR | ||
| 804 | ; end loop | ||
| 805 | ; else | ||
| 806 | ; invoke Clr_List | ||
| 807 | ; endif | ||
| 808 | ; set successful status | ||
| 809 | ; else | ||
| 810 | ; set error status | ||
| 811 | ; endif | ||
| 812 | ; if error | ||
| 813 | ; load return code | ||
| 814 | ; endif | ||
| 815 | ; | ||
| 816 | ; ret | ||
| 817 | ; | ||
| 818 | ; END Clr_Mult_Block | ||
| 819 | ; | ||
| 820 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 821 | |||
| 822 | Procedure clr_mult_block,NEAR | ||
| 823 | |||
| 824 | |||
| 825 | lock_all equ 0h | ||
| 826 | |||
| 827 | ; PUSH DS ;ICE | ||
| 828 | ; push bx ;ICE | ||
| 829 | ; push ax ;ICE | ||
| 830 | |||
| 831 | ; mov bx,0140H ;ICE | ||
| 832 | ; xor ax,ax ;ICE | ||
| 833 | ; mov ds,ax ;ICE | ||
| 834 | ; mov ax,word ptr ds:[bx] ;ICE | ||
| 835 | ; mov word ptr ds:[bx],ax ;ICE | ||
| 836 | |||
| 837 | ; pop ax ;ICE | ||
| 838 | ; pop bx ;ICE | ||
| 839 | ; POP DS ;ICE | ||
| 840 | |||
| 841 | EnterCrit critShare ; ;AN000; | ||
| 842 | |||
| 843 | ASSUME ES:NOTHING,DS:NOTHING ; ;AN000; | ||
| 844 | |||
| 845 | ; int 3 | ||
| 846 | nop | ||
| 847 | nop | ||
| 848 | |||
| 849 | mov DS_Org,DS ;an000;save entry DS | ||
| 850 | |||
| 851 | Context DS ; ;AN000; | ||
| 852 | |||
| 853 | CMP CX,01h ; do we have a count? ;AN000; | ||
| 854 | ;; $IF AE,AND ; IF A VALID COUNT | ||
| 855 | ; $IF E,AND ; IF A VALID COUNT ;AC006; | ||
| 856 | JNE $$IF6 | ||
| 857 | cmp es:[di].sf_mft,0 ; is this SFT shared? ;AN000; | ||
| 858 | ; $IF NE ; AND IF FILE IS 'SHARED' THEN | ||
| 859 | JE $$IF6 | ||
| 860 | |||
| 861 | ; WE HAVE: (from IBMDOS) | WE NEED: | ||
| 862 | |||
| 863 | ; (AL) = 0 - lock all | (AX) = 0 lock all operations | ||
| 864 | ; = 80- lock write | = 1 lock write operations | ||
| 865 | ; (CX) = - 1 (unlock all locks) | (DS) = CS | ||
| 866 | ; | (DS:DI) = previous RLR | ||
| 867 | ; | (DS:SI) = current RLR | ||
| 868 | ; (ES:DI) = current SFT | | ||
| 869 | |||
| 870 | ;; and ax,0080h ;be sure it is set right (mask 80 bit) ;AC002; | ||
| 871 | ; existing interface | ||
| 872 | ;; rol al,1 ;put high bit in bit 0 ;AC002; | ||
| 873 | |||
| 874 | ;; CMP CX,-1h ; ;AN000; | ||
| 875 | ;; $IF E ; IF unlock all locks then ;AN000; | ||
| 876 | |||
| 877 | ;; push cs ; ;AN000; | ||
| 878 | ;; pop ds ; ;AN000; | ||
| 879 | ;; mov cx,di ; ES:CX is the SFT ;AN004; | ||
| 880 | |||
| 881 | ; ASSUME ds:nothing | ||
| 882 | |||
| 883 | ;; mov si,es:[di].sf_mft ; DS:SI points to MFT ;AN000; | ||
| 884 | |||
| 885 | ;; lea di,[si].mft_lptr ; DS:DI = addr of ptr to lock record ;AN000; | ||
| 886 | ;; mov si,[di] ; DS:SI = address of 1st lock record ;AN000; | ||
| 887 | |||
| 888 | ;; $DO ; loop through the RLR's ;AN000; | ||
| 889 | |||
| 890 | ; DS:DI = points to previous RLR or MFT if no RLR. | ||
| 891 | ; DS:SI = points to current RLR | ||
| 892 | ; ES:CX = SFT address | ||
| 893 | ; AX = lock type | ||
| 894 | |||
| 895 | ;; and si,si ; are we at the end of the chain? ;AN000; | ||
| 896 | ;; $LEAVE Z ; we'er done with CF = 0 ;AN000; | ||
| 897 | |||
| 898 | ;; mov bp,[si].rlr_pid ; get PROC_ID ;AN000; | ||
| 899 | ;; cmp bp,PROC_ID ; is it ours? ;AN000; | ||
| 900 | ;; $IF E,AND ; ;AN000; | ||
| 901 | ;; mov bp,es ; ;AN000; | ||
| 902 | ;; cmp bp,WORD PTR [si].rlr_sptr+2 ; ;AC004; | ||
| 903 | ;; $IF E,AND ; ;AN000; | ||
| 904 | ;; cmp cx,WORD PTR [si].rlr_sptr ; ;AC004; | ||
| 905 | ;; mov si,[di] ; restore pointer to current (using ;AN000; | ||
| 906 | ; previous) | ||
| 907 | ;; $IF E ; if it is ours ;AN000; | ||
| 908 | |||
| 909 | ; this is it. its OURS ! | ||
| 910 | |||
| 911 | ;; cmp ax,lock_all ; ;AN000; | ||
| 912 | |||
| 913 | ;; $IF E,OR ; if unlocking all or ;AN000; | ||
| 914 | |||
| 915 | ;; mov bp,[si].rlr_type ; get lock type ;AN000; | ||
| 916 | ;; cmp bp,rlr_lall ; is it lock all? ;AN000; | ||
| 917 | |||
| 918 | ;; $IF NE ; if not a LOCK ALL lock ;AN000; | ||
| 919 | |||
| 920 | ; remove the RLR from the chain | ||
| 921 | |||
| 922 | ;; mov bx,[si].rlr_next ; get the pointer to the next RLR ;AN000; | ||
| 923 | ;; mov [di],bx ; install it in the last ;AN000; | ||
| 924 | |||
| 925 | ; put defunct lock record on the free chain | ||
| 926 | |||
| 927 | ;; mov bx,Frelock ; ;AN000; | ||
| 928 | ;; mov [si].rlr_next,bx ; ;AN000; | ||
| 929 | ;; mov Frelock,si ; ;AN000; | ||
| 930 | ;; mov si,di ; back up to last ;AN000; | ||
| 931 | |||
| 932 | ;; $ENDIF ; should we unlock it ;AN000; | ||
| 933 | |||
| 934 | ;; $ENDIF ; it was ours! ;AN000; | ||
| 935 | |||
| 936 | ; advance to next RLR | ||
| 937 | |||
| 938 | ;; mov di,si ; load address of next RLR ;AN000; | ||
| 939 | ;; mov si,[di] ; update pointer to next RLR ;AN000; | ||
| 940 | |||
| 941 | ;; $ENDDO ; loop back to the start ;AN000; | ||
| 942 | |||
| 943 | ;; $ELSE ; else, its a LIST ! ;AN000; | ||
| 944 | |||
| 945 | ; set up for loop | ||
| 946 | |||
| 947 | ; WE HAVE: (from IBMDOS) | WE NEED: (for Clr_Block) | ||
| 948 | |||
| 949 | ; (AX) = 0 - lock all | (BX) = 0 lock all operations | ||
| 950 | ; = 1 - lock write | = 1 lock write operations | ||
| 951 | ; (CX) = the number of lock ranges | (CX:DX) = offset of area | ||
| 952 | ; (DS:DX) = pointer to the range list | (SI:AX) = length of area | ||
| 953 | ; (ES:DI) = SFT address | (ES:DI) = SFT address | ||
| 954 | |||
| 955 | ;; PUSH CX ; count = start_count ;AN000; | ||
| 956 | ;; PUSH DX ; save pointer to range list ;AN000; | ||
| 957 | MOV BP,DX ; save current index into list ;AN000; | ||
| 958 | ;; MOV BX,AX ; SET UP TYPE OF LOCK ;AN000; | ||
| 959 | |||
| 960 | call Clr_List ; call Clr_List to process the list ;AN000; | ||
| 961 | |||
| 962 | ;; $ENDIF ; ;AN000; | ||
| 963 | |||
| 964 | ; $ELSE ; NOT VALID | ||
| 965 | JMP SHORT $$EN6 | ||
| 966 | $$IF6: | ||
| 967 | |||
| 968 | STC ; ;AN000; | ||
| 969 | |||
| 970 | ; $ENDIF ; VALID/INVALID ;AN000; | ||
| 971 | $$EN6: | ||
| 972 | |||
| 973 | ; $IF C ; if carry is set ;AN000; | ||
| 974 | JNC $$IF9 | ||
| 975 | MOV AX,error_lock_violation ; load error condition ;AN000; | ||
| 976 | ; $ENDIF ; carry not set ;AN000; | ||
| 977 | $$IF9: | ||
| 978 | |||
| 979 | LeaveCrit critShare ; ;AN000; | ||
| 980 | |||
| 981 | ret ; return - all set ;AN000; | ||
| 982 | |||
| 983 | EndProc clr_mult_block | ||
| 984 | |||
| 985 | BREAK <Clr_List - Clear a list of user specified locks> | ||
| 986 | |||
| 987 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 988 | ; | ||
| 989 | ; NAME: Clr_List - Clear a list of user specified locks | ||
| 990 | ; | ||
| 991 | ; FUNCTION: Clr_List makes multiple calls to Clr_Block to clear | ||
| 992 | ; multiple lock ranges of a file. An error is returned | ||
| 993 | ; if any lock range does not exactly match. Ranges of | ||
| 994 | ; Locks are then set via Set_Mult_Block. | ||
| 995 | ; | ||
| 996 | ; | ||
| 997 | ; INPUT: (BX) = 0 lock all operations | ||
| 998 | ; = 1 lock write operations | ||
| 999 | ; (CX:DX) = offset of area | ||
| 1000 | ; (SI:AX) = length of area | ||
| 1001 | ; (ES:DI) = SFT address | ||
| 1002 | ; (SS:SP+2)= original index \ see FRAME struc | ||
| 1003 | ; (SS:SP+4)= original count / | ||
| 1004 | ; | ||
| 1005 | ; OUTPUT: Lock records removed for all blocks specified | ||
| 1006 | ; Stack cleard on return | ||
| 1007 | ; | ||
| 1008 | ; REGISTERS USED: ALL but DS | ||
| 1009 | ; (NOT RESTORED) | ||
| 1010 | ; | ||
| 1011 | ; LINKAGE: IBMDOS Jump Table | ||
| 1012 | ; | ||
| 1013 | ; EXTERNAL Invoke: Load_Regs, Set_Block, Clr_Block | ||
| 1014 | ; REFERENCES: | ||
| 1015 | ; | ||
| 1016 | ; NORMAL 'C' clear if no error | ||
| 1017 | ; EXIT: | ||
| 1018 | ; | ||
| 1019 | ; ERROR 'C' set if error | ||
| 1020 | ; EXIT: (ax) = error code | ||
| 1021 | ; ('error_lock_violation' if conflicting locks) | ||
| 1022 | ; | ||
| 1023 | ; CHANGE 04/15/87 - First release | ||
| 1024 | ; LOG: | ||
| 1025 | ; | ||
| 1026 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1027 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1028 | ; | ||
| 1029 | ; START Clr_List | ||
| 1030 | ; | ||
| 1031 | ; search till count = 0 | ||
| 1032 | ; set up for call | ||
| 1033 | ; call clr_Block | ||
| 1034 | ; exit if c | ||
| 1035 | ; clear_count = start_count - current_count | ||
| 1036 | ; loop till clear_count = 0 | ||
| 1037 | ; set up for call | ||
| 1038 | ; call Set_Block | ||
| 1039 | ; end loop | ||
| 1040 | ; set error status | ||
| 1041 | ; orelse | ||
| 1042 | ; endloop | ||
| 1043 | ; set successful status | ||
| 1044 | ; endsrch | ||
| 1045 | ; return | ||
| 1046 | ; | ||
| 1047 | ; END Clr_List | ||
| 1048 | ; | ||
| 1049 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1050 | |||
| 1051 | Procedure Clr_List,NEAR | ||
| 1052 | |||
| 1053 | ;; $do ;an000;while cx not = 0 | ||
| 1054 | ;; cmp cx,00 ;an000;at end? | ||
| 1055 | ;; $leave e ;an000;yes | ||
| 1056 | ;; push cx ;an000;save cx - our counter | ||
| 1057 | ;; push di ;an000;save di - our SFT pointer | ||
| 1058 | call load_regs ;an000;set up for clr_block call | ||
| 1059 | ;; push bp ; save pointer to range entry ;AN000; | ||
| 1060 | call clr_block ;an000;remove the lock | ||
| 1061 | ;; pop bp ; recover pointer to range entry ;AN000; | ||
| 1062 | ;; pop di ;an000;restore our SFT pointer | ||
| 1063 | ;; pop cx ;an000;restore cx - our counter | ||
| 1064 | ;; $leave c ;an000;leave on error | ||
| 1065 | ;; dec cx ;an000;decrease counter | ||
| 1066 | ;; $enddo ;an000; | ||
| 1067 | |||
| 1068 | ;; $if c ;an000;an error occurred | ||
| 1069 | ;; push bp ;an000;save bp | ||
| 1070 | ;; mov bp,sp ;an000;get sp | ||
| 1071 | ;; mov dx,[bp].parm_1 ;an000;recover original index | ||
| 1072 | ;; mov ax,[bp].Parm_2 ; original count ;AN000; | ||
| 1073 | ;; pop bp | ||
| 1074 | ;; SUB AX,CX ; how many did we do? ;AN000; | ||
| 1075 | ;; MOV CX,AX ; set up the loop ;AN000; | ||
| 1076 | ;; MOV BP,DX ; save the index ;AN000; | ||
| 1077 | |||
| 1078 | ;; $DO ; ;AN000; | ||
| 1079 | ;; cmp cx,00 ;an000;at end? | ||
| 1080 | ;; $leave e ;an000;yes | ||
| 1081 | ;; push cx ;an000;save cx - our counter | ||
| 1082 | ;; push di ;an000;save di - our SFT pointer | ||
| 1083 | ;; call load_regs ;an000;set up for set_block call | ||
| 1084 | ;; call set_block ;an000;reset the locks | ||
| 1085 | ;; pop di ;an000;restore our SFT pointer | ||
| 1086 | ;; pop cx ;an000;restore cx - our counter | ||
| 1087 | ;; $leave c ;an000;leave on error | ||
| 1088 | ;; dec cx ;an000;decrease counter | ||
| 1089 | ;; $enddo ;an000; | ||
| 1090 | ;; stc ;an000;signal an error | ||
| 1091 | ;; $else ;an000; | ||
| 1092 | ;; clc ;an000;signal no error | ||
| 1093 | ;; $endif ;an000; | ||
| 1094 | |||
| 1095 | ;; ret 4 ; return (clear Parm_1 & Parm_2) ;AN000; | ||
| 1096 | ret ; return (clear Parm_1 & Parm_2) ;AC006; | ||
| 1097 | |||
| 1098 | EndProc Clr_List | ||
| 1099 | |||
| 1100 | |||
| 1101 | BREAK <Set_Block - Try to set a lock> | ||
| 1102 | |||
| 1103 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1104 | ; | ||
| 1105 | ; NAME: Set_Block - set byte range lock on a file | ||
| 1106 | ; | ||
| 1107 | ; FUNCTION: Set_Block sets a lock on a specified range of a file. An | ||
| 1108 | ; error is returned if the lock conflicts with another. | ||
| 1109 | ; Locks are cleared via clr_block. | ||
| 1110 | ; | ||
| 1111 | ; INPUT: (ES:DI) = SFT address | ||
| 1112 | ; (CX:DX) = offset of area | ||
| 1113 | ; (SI:AX) = length of area | ||
| 1114 | ; (BX) = 0 lock all operations | ||
| 1115 | ; = 1 lock write operations | ||
| 1116 | ; User_ID = 16-bit user id of issuer | ||
| 1117 | ; Proc_ID = 16-bit process id of issuer | ||
| 1118 | ; (SS) = DOSGroup | ||
| 1119 | ; | ||
| 1120 | ; OUTPUT: Lock records removed for all blocks specified | ||
| 1121 | ; | ||
| 1122 | ; REGISTERS USED: ALL but DS, BP | ||
| 1123 | ; (NOT RESTORED) | ||
| 1124 | ; | ||
| 1125 | ; LINKAGE: Invoked by: Set_Mult_Block | ||
| 1126 | ; | ||
| 1127 | ; EXTERNAL Invoke: CLP (SLE), OFL | ||
| 1128 | ; REFERENCES: | ||
| 1129 | ; | ||
| 1130 | ; NORMAL 'C' clear if no error | ||
| 1131 | ; EXIT: | ||
| 1132 | ; | ||
| 1133 | ; ERROR 'C' set if error | ||
| 1134 | ; EXIT: | ||
| 1135 | ; | ||
| 1136 | ; CHANGE 04/15/87 - lock only write support | ||
| 1137 | ; LOG: | ||
| 1138 | ; | ||
| 1139 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1140 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1141 | ; | ||
| 1142 | ; START Set_Block | ||
| 1143 | ; | ||
| 1144 | ; if a valid SFT and | ||
| 1145 | ; invoke CLP | ||
| 1146 | ; if no lock conflicts and | ||
| 1147 | ; invoke OFL | ||
| 1148 | ; if empty lock record available | ||
| 1149 | ; store SFT pointer | ||
| 1150 | ; store lock range | ||
| 1151 | ; add RLR to the chain | ||
| 1152 | ; store PROC_ID | ||
| 1153 | ; store rlr_type | ||
| 1154 | ; set successful return status | ||
| 1155 | ; else | ||
| 1156 | ; set error return status | ||
| 1157 | ; endif | ||
| 1158 | ; return | ||
| 1159 | ; | ||
| 1160 | ; END Set_Block | ||
| 1161 | ; | ||
| 1162 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1163 | |||
| 1164 | Procedure Set_Block,NEAR | ||
| 1165 | |||
| 1166 | ASSUME ES:NOTHING,DS:NOTHING | ||
| 1167 | |||
| 1168 | Context DS | ||
| 1169 | |||
| 1170 | push bp ; preserve (bp) ;AN000; | ||
| 1171 | push ds ; preserve (ds) | ||
| 1172 | ;; push bx ; preserve (bx) ;AN000; | ||
| 1173 | cmp es:[di].sf_mft,ZERO | ||
| 1174 | ; $if nz,and ; if file is SHARED and ;AC000; | ||
| 1175 | JZ $$IF11 | ||
| 1176 | push di | ||
| 1177 | call clp ; do common setup code | ||
| 1178 | |||
| 1179 | ASSUME DS:NOTHING | ||
| 1180 | |||
| 1181 | pop bp | ||
| 1182 | ; $if nc,and ; if no (lock conflict) error and ;AC000; | ||
| 1183 | JC $$IF11 | ||
| 1184 | |||
| 1185 | ; Its ok to set this lock. Get a free block and fill it in | ||
| 1186 | ; (es:bp) = sft | ||
| 1187 | ; (ds:si) = pointer to name record | ||
| 1188 | ; (ax:bx) = fba lock area | ||
| 1189 | ; (cx:dx) = lba lock area | ||
| 1190 | ; (ds:di) = pointer to pointer to previous lock | ||
| 1191 | ; (TOS) = saved (bx) | ||
| 1192 | ; (TOS+1) = saved (ds) | ||
| 1193 | ; (TOS+2) = saved (bp) | ||
| 1194 | |||
| 1195 | call OFL ; (ds:di) = pointer to new, orphan lock record | ||
| 1196 | ; $if nc ; if space available ;AC000; | ||
| 1197 | JC $$IF11 | ||
| 1198 | mov WORD PTR [di].rlr_sptr,bp ; store SFT offset | ||
| 1199 | mov WORD PTR [di].rlr_sptr+2,es ; store SFT offset | ||
| 1200 | mov [di].rlr_fba+2,ax | ||
| 1201 | mov [di].rlr_fba,bx ; store lock range | ||
| 1202 | mov [di].rlr_lba+2,cx | ||
| 1203 | mov [di].rlr_lba,dx | ||
| 1204 | |||
| 1205 | ; add to front of chain | ||
| 1206 | ; | ||
| 1207 | ; (ds:si) = fwa MFT name record | ||
| 1208 | |||
| 1209 | mov ax,[si].mft_lptr | ||
| 1210 | mov [di].rlr_next,ax | ||
| 1211 | mov [si].mft_lptr,di | ||
| 1212 | ; | ||
| 1213 | ; Set process ID of lock | ||
| 1214 | ; | ||
| 1215 | mov ax,proc_id | ||
| 1216 | mov [di].rlr_pid,ax | ||
| 1217 | |||
| 1218 | ; | ||
| 1219 | ;; pop bx ; recover lock type ;AN000; | ||
| 1220 | ;; push bx ; restore the stack ;AN000; | ||
| 1221 | ;; mov [di].rlr_type,bx ; set the rlr_type field ;AN000; | ||
| 1222 | clc ; we finished OK | ||
| 1223 | |||
| 1224 | ; $else ; ;AC000; | ||
| 1225 | JMP SHORT $$EN11 | ||
| 1226 | $$IF11: | ||
| 1227 | |||
| 1228 | mov ax,error_lock_violation | ||
| 1229 | stc | ||
| 1230 | |||
| 1231 | ; $endif ; ;AC000; | ||
| 1232 | $$EN11: | ||
| 1233 | |||
| 1234 | ;; pop bx ; ;AN000; | ||
| 1235 | pop ds | ||
| 1236 | pop bp ; ;AC000; | ||
| 1237 | |||
| 1238 | ret ; return - all set | ||
| 1239 | |||
| 1240 | EndProc Set_Block | ||
| 1241 | |||
| 1242 | BREAK <Clr_Block - Try to clear a lock> | ||
| 1243 | |||
| 1244 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1245 | ; | ||
| 1246 | ; NAME: Clr_Block - clear byte range lock on a file | ||
| 1247 | ; | ||
| 1248 | ; FUNCTION: Clr_Block clears a lock on a specified range of a file. | ||
| 1249 | ; Locks are set via set_block. | ||
| 1250 | ; | ||
| 1251 | ; INPUT: (ES:DI) = SFT address | ||
| 1252 | ; (CX:DX) = offset of area | ||
| 1253 | ; (SI:AX) = length of area | ||
| 1254 | ; (BX) = 0 lock all operations | ||
| 1255 | ; = 1 lock write operations | ||
| 1256 | ; User_ID = 16-bit user id of issuer | ||
| 1257 | ; Proc_ID = 16-bit process id of issuer | ||
| 1258 | ; (SS) = DOSGroup | ||
| 1259 | ; | ||
| 1260 | ; OUTPUT: Lock record removed for block specified. | ||
| 1261 | ; | ||
| 1262 | ; REGISTERS USED: ALL but DS | ||
| 1263 | ; (NOT RESTORED) | ||
| 1264 | ; | ||
| 1265 | ; LINKAGE: Invoked by: Clr_Mult_Block | ||
| 1266 | ; | ||
| 1267 | ; EXTERNAL Invoke: CLP (SLE), OFL | ||
| 1268 | ; REFERENCES: | ||
| 1269 | ; | ||
| 1270 | ; NORMAL 'C' clear if no error | ||
| 1271 | ; EXIT: | ||
| 1272 | ; | ||
| 1273 | ; ERROR 'C' set if error | ||
| 1274 | ; EXIT: (ax) = error code | ||
| 1275 | ; ('error_lock_violation' if conflicting locks or | ||
| 1276 | ; range does not exactly match previous lock) | ||
| 1277 | ; | ||
| 1278 | ; CHANGE 04/15/87 - lock only write support | ||
| 1279 | ; LOG: | ||
| 1280 | ; | ||
| 1281 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1282 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1283 | ; | ||
| 1284 | ; START Clr_Block | ||
| 1285 | ; | ||
| 1286 | ; if file is SHARED and | ||
| 1287 | ; if lock is valid and | ||
| 1288 | ; if SFT matches and | ||
| 1289 | ; if PROC_ID matches | ||
| 1290 | ; if lock_reqest = lock_type | ||
| 1291 | ; unchain the lock | ||
| 1292 | ; put defunct lock on free chain | ||
| 1293 | ; clear error status | ||
| 1294 | ; else | ||
| 1295 | ; set error status | ||
| 1296 | ; endif | ||
| 1297 | ; else | ||
| 1298 | ; flush the stack | ||
| 1299 | ; set error status | ||
| 1300 | ; endif | ||
| 1301 | ; if error | ||
| 1302 | ; load return code | ||
| 1303 | ; endif | ||
| 1304 | ; return | ||
| 1305 | ; | ||
| 1306 | ; END Clr_Block | ||
| 1307 | ; | ||
| 1308 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1309 | |||
| 1310 | Procedure Clr_Block,NEAR | ||
| 1311 | |||
| 1312 | ASSUME ES:NOTHING,DS:NOTHING | ||
| 1313 | |||
| 1314 | Context DS | ||
| 1315 | push ds | ||
| 1316 | ;; push bx ; save type of operation ;AN000; | ||
| 1317 | cmp es:[di].sf_mft,ZERO | ||
| 1318 | |||
| 1319 | ; $if nz,and ; if file is SHARED and ;AC000; | ||
| 1320 | JZ $$IF14 | ||
| 1321 | |||
| 1322 | push di | ||
| 1323 | call clp ; do common setup code | ||
| 1324 | |||
| 1325 | ASSUME DS:NOTHING | ||
| 1326 | |||
| 1327 | pop bp ; ES:BP points to sft. | ||
| 1328 | ;; pop bx ; recover the type of operation ;AN000; | ||
| 1329 | |||
| 1330 | ; $if c,and ; if lock exists and ;AC000; | ||
| 1331 | JNC $$IF14 | ||
| 1332 | ; $if z,and ; if range given correctly and ;AC000; | ||
| 1333 | JNZ $$IF14 | ||
| 1334 | ; | ||
| 1335 | ; We've got the lock | ||
| 1336 | ; | ||
| 1337 | ; (ds:di) = address of pointer (offset) to previous lock record | ||
| 1338 | ; (es:BP) = sft address | ||
| 1339 | ; | ||
| 1340 | ; Now comes the tricky part. Is the lock for us? Does the lock match the SFT | ||
| 1341 | ; that was given us? If not, then error. | ||
| 1342 | ; | ||
| 1343 | mov si,[di] ; (DS:SI) = address of lock record | ||
| 1344 | cmp word ptr [si].rlr_sptr,bp | ||
| 1345 | |||
| 1346 | ; $if z,and ; if SFT matches and ;AC000; | ||
| 1347 | JNZ $$IF14 | ||
| 1348 | |||
| 1349 | mov bp,es | ||
| 1350 | cmp word ptr [si].rlr_sptr+2,bp | ||
| 1351 | ; $if z,and ; (check both words of SFT pointer) ;AC000; | ||
| 1352 | JNZ $$IF14 | ||
| 1353 | mov bp,proc_id | ||
| 1354 | cmp [si].rlr_pid,bp | ||
| 1355 | |||
| 1356 | ;; $if z,and ; if PROC_ID matches ;AC000; | ||
| 1357 | ; $if z ; if PROC_ID matches ;AC006; | ||
| 1358 | JNZ $$IF14 | ||
| 1359 | ; | ||
| 1360 | ; Make sure that the type of request and the lock type match | ||
| 1361 | ; | ||
| 1362 | ;; cmp bx,lock_all ; ;AN000; | ||
| 1363 | |||
| 1364 | ;; $IF E,OR ; if unlocking all or ;AN000; | ||
| 1365 | |||
| 1366 | ;; mov bp,[si].rlr_type ; get lock type ;AN000; | ||
| 1367 | ;; cmp bp,rlr_lall ; is it lock all? ;AN000; | ||
| 1368 | |||
| 1369 | ;; $IF NE ; if not a LOCK ALL lock ;AN000; | ||
| 1370 | ; | ||
| 1371 | ; The locks match the proper open invocation. Unchain the lock | ||
| 1372 | ; | ||
| 1373 | mov ax,[si].rlr_next | ||
| 1374 | mov [di],ax ; chain it out | ||
| 1375 | |||
| 1376 | ; put defunct lock record on the free chain | ||
| 1377 | ; | ||
| 1378 | ; (ds:si) = address of freed lock rec | ||
| 1379 | |||
| 1380 | mov ax,Frelock | ||
| 1381 | mov [si].rlr_next,ax | ||
| 1382 | mov Frelock,si | ||
| 1383 | clc | ||
| 1384 | |||
| 1385 | ; $else ; we have an error ;AC000; | ||
| 1386 | JMP SHORT $$EN14 | ||
| 1387 | $$IF14: | ||
| 1388 | |||
| 1389 | stc | ||
| 1390 | |||
| 1391 | ; $endif ; Endif - an error ;AC000; | ||
| 1392 | $$EN14: | ||
| 1393 | |||
| 1394 | ; $if c ; If an error was found ;AC000; | ||
| 1395 | JNC $$IF17 | ||
| 1396 | |||
| 1397 | mov ax,error_lock_violation | ||
| 1398 | |||
| 1399 | ; $endif ; Endif - an error was found ;AC000; | ||
| 1400 | $$IF17: | ||
| 1401 | |||
| 1402 | pop ds ; restore DS | ||
| 1403 | |||
| 1404 | ret | ||
| 1405 | |||
| 1406 | |||
| 1407 | EndProc Clr_Block | ||
| 1408 | |||
| 1409 | BREAK <CLP - Common Lock Preamble> | ||
| 1410 | |||
| 1411 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1412 | ; | ||
| 1413 | ; NAME: CLP - Common Lock Preamble | ||
| 1414 | ; | ||
| 1415 | ; FUNCTION: This routine contains a common code fragment for set_block | ||
| 1416 | ; and clr_block. | ||
| 1417 | ; | ||
| 1418 | ; INPUT: (ES:DI) = SFT address | ||
| 1419 | ; (CX:DX) = offset of area | ||
| 1420 | ; (SI:AX) = length of area | ||
| 1421 | ; User_ID = 16-bit user id of issuer | ||
| 1422 | ; Proc_ID = 16-bit process id of issuer | ||
| 1423 | ; (SS) = (DS) = DOSGroup | ||
| 1424 | ; | ||
| 1425 | ; OUTPUT: (ds:si) = MFT address | ||
| 1426 | ; | ||
| 1427 | ; REGISTERS USED: ALL but ES | ||
| 1428 | ; (NOT RESTORED) | ||
| 1429 | ; | ||
| 1430 | ; LINKAGE: Invoked by: Set_Block, Clr_Block | ||
| 1431 | ; | ||
| 1432 | ; EXTERNAL Invoke: SLE | ||
| 1433 | ; REFERENCES: | ||
| 1434 | ; | ||
| 1435 | ; NORMAL 'C' clear if no overlap | ||
| 1436 | ; EXIT: (ax:bx) = offset of first byte in range | ||
| 1437 | ; (cx:dx) = offset of last byte in range | ||
| 1438 | ; | ||
| 1439 | ; ERROR 'C' set if overlap | ||
| 1440 | ; EXIT: 'Z' set if 1-to-1 match | ||
| 1441 | ; (di) points to previous lock | ||
| 1442 | ; | ||
| 1443 | ; CHANGE 04/15/87 - lock only write support | ||
| 1444 | ; LOG: | ||
| 1445 | ; | ||
| 1446 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1447 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1448 | ; | ||
| 1449 | ; START CLP | ||
| 1450 | ; | ||
| 1451 | ; shuffle arguments | ||
| 1452 | ; if valid length | ||
| 1453 | ; invoke SLE | ||
| 1454 | ; set successful return status | ||
| 1455 | ; else | ||
| 1456 | ; set error return status | ||
| 1457 | ; endif | ||
| 1458 | ; return | ||
| 1459 | ; | ||
| 1460 | ; END CLP | ||
| 1461 | ; | ||
| 1462 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1463 | |||
| 1464 | Procedure CLP,NEAR | ||
| 1465 | |||
| 1466 | mov bx,dx ; shuffle arguments | ||
| 1467 | xchg dx,ax | ||
| 1468 | xchg ax,cx ; (ax:bx) = offset | ||
| 1469 | mov cx,si ; (cx:dx) = length | ||
| 1470 | |||
| 1471 | or si,dx ; see if length is 0 | ||
| 1472 | |||
| 1473 | ; $if nz,and ; if length is > 0 and ;AC000; | ||
| 1474 | JZ $$IF19 | ||
| 1475 | |||
| 1476 | add dx,bx | ||
| 1477 | adc cx,ax ; (cx:dx) = lba+1 | ||
| 1478 | |||
| 1479 | ; $if nc,or ; no carry is ok ;AC000; | ||
| 1480 | JNC $$LL19 | ||
| 1481 | |||
| 1482 | mov si,dx | ||
| 1483 | or si,cx | ||
| 1484 | |||
| 1485 | ; $if z ; if !> 0 then ;AC000; | ||
| 1486 | JNZ $$IF19 | ||
| 1487 | $$LL19: | ||
| 1488 | |||
| 1489 | sub dx,1 ; (cx:dx) = lba of locked region | ||
| 1490 | sbb cx,0 | ||
| 1491 | |||
| 1492 | push cs | ||
| 1493 | pop ds | ||
| 1494 | ; (es:di) is sft | ||
| 1495 | push si | ||
| 1496 | mov si,es:[di].sf_mft | ||
| 1497 | push si | ||
| 1498 | mov di,1 ; Find own locks | ||
| 1499 | call SLE | ||
| 1500 | ; di points to previous lock record | ||
| 1501 | pop si | ||
| 1502 | pop bp | ||
| 1503 | |||
| 1504 | ; $else ; we have an error ;AC000; | ||
| 1505 | JMP SHORT $$EN19 | ||
| 1506 | $$IF19: | ||
| 1507 | |||
| 1508 | xor si,si | ||
| 1509 | inc si ; carry unchanged, zero reset | ||
| 1510 | mov ax,error_lock_violation ; assume error | ||
| 1511 | stc | ||
| 1512 | |||
| 1513 | ; $endif ; endif - we have an error ;AC000; | ||
| 1514 | $$EN19: | ||
| 1515 | |||
| 1516 | ret | ||
| 1517 | |||
| 1518 | EndProc CLP | ||
| 1519 | |||
| 1520 | BREAK <Chk_Block - See if the specified I/O violates locks> | ||
| 1521 | |||
| 1522 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1523 | ; | ||
| 1524 | ; NAME: Chk_Block - check range lock on a file | ||
| 1525 | ; | ||
| 1526 | ; FUNCTION: Chk_Block is called to interogate the lock status of a | ||
| 1527 | ; region of a file. | ||
| 1528 | ; | ||
| 1529 | ; NOTE: This routine is called for every disk I/O operation | ||
| 1530 | ; and MUST BE FAST | ||
| 1531 | ; | ||
| 1532 | ; INPUT: (ES:DI) points to an SFT structure | ||
| 1533 | ; (AL) = 80h - Write operation = 0 - any non write operation | ||
| 1534 | ; (CX) is the number of bytes being read or written | ||
| 1535 | ; BytPos is a long (low first) offset into the file | ||
| 1536 | ; of the I/O | ||
| 1537 | ; User_ID = 16-bit user id of issuer | ||
| 1538 | ; Proc_ID = 16-bit process id of issuer | ||
| 1539 | ; (SS) = DOSGroup | ||
| 1540 | ; | ||
| 1541 | ; OUTPUT: CF set according to status and presence of locks (see below) | ||
| 1542 | ; | ||
| 1543 | ; REGISTERS USED: ALL but ES,DI,CX,DS | ||
| 1544 | ; (NOT RESTORED) | ||
| 1545 | ; | ||
| 1546 | ; LINKAGE: IBMDOS Jump Table | ||
| 1547 | ; | ||
| 1548 | ; NORMAL 'C' clear if no error | ||
| 1549 | ; EXIT: | ||
| 1550 | ; | ||
| 1551 | ; ERROR 'C' set if error | ||
| 1552 | ; EXIT: (ax) = error code | ||
| 1553 | ; ('error_lock_violation' if conflicting locks) | ||
| 1554 | ; | ||
| 1555 | ; CHANGE 04/15/87 - lock only write support | ||
| 1556 | ; LOG: | ||
| 1557 | ; | ||
| 1558 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1559 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1560 | ; | ||
| 1561 | ; START Chk_Block | ||
| 1562 | ; | ||
| 1563 | ; if shared SFT and | ||
| 1564 | ; if locks exist | ||
| 1565 | ; invoke SLE | ||
| 1566 | ; if lock conflicts occur (error) | ||
| 1567 | ; if this is !write operation and | ||
| 1568 | ; if a write lock found | ||
| 1569 | ; set successfull status | ||
| 1570 | ; else | ||
| 1571 | ; set error status | ||
| 1572 | ; endif | ||
| 1573 | ; else no error | ||
| 1574 | ; flush stack | ||
| 1575 | ; endif | ||
| 1576 | ; endif | ||
| 1577 | ; | ||
| 1578 | ; ret | ||
| 1579 | ; | ||
| 1580 | ; END Chk_Block | ||
| 1581 | ; | ||
| 1582 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1583 | |||
| 1584 | Procedure Chk_Block,NEAR | ||
| 1585 | |||
| 1586 | ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 1587 | |||
| 1588 | write_op equ 080h ; write operation requested ;AN000; | ||
| 1589 | lock_all equ 0h ; lock all specified ;AN000; | ||
| 1590 | |||
| 1591 | ; PUSH DS ;ICE | ||
| 1592 | ; push bx ;ICE | ||
| 1593 | ; push ax ;ICE | ||
| 1594 | |||
| 1595 | ; mov bx,0140H ;ICE | ||
| 1596 | ; xor ax,ax ;ICE | ||
| 1597 | ; mov ds,ax ;ICE | ||
| 1598 | ; mov ax,word ptr ds:[bx] ;ICE | ||
| 1599 | ; mov word ptr ds:[bx],ax ;ICE | ||
| 1600 | |||
| 1601 | ; pop ax ;ICE | ||
| 1602 | ; pop bx ;ICE | ||
| 1603 | ; POP DS ;ICE | ||
| 1604 | EnterCrit critShare | ||
| 1605 | |||
| 1606 | ; int 3 | ||
| 1607 | nop | ||
| 1608 | nop | ||
| 1609 | |||
| 1610 | PUSH ES | ||
| 1611 | PUSH DI | ||
| 1612 | PUSH CX | ||
| 1613 | PUSH DS | ||
| 1614 | cmp es:[di].sf_mft,0 | ||
| 1615 | |||
| 1616 | ; $if nz,and ; if the file is SHARED and ;AC000; | ||
| 1617 | JZ $$IF22 | ||
| 1618 | |||
| 1619 | push cs | ||
| 1620 | pop ds | ||
| 1621 | mov si,es:[di].sf_MFT ; (DS:SI) = address of MFT record | ||
| 1622 | test [si].mft_lptr,-1 | ||
| 1623 | |||
| 1624 | ; $if nz,and ; if there are locks on this file and ;AC000; | ||
| 1625 | JZ $$IF22 | ||
| 1626 | |||
| 1627 | sub cx,1 ; (cx) = count-1 | ||
| 1628 | cmc | ||
| 1629 | |||
| 1630 | ; $if c ; there are bytes to lock ;AC000; | ||
| 1631 | JNC $$IF22 | ||
| 1632 | |||
| 1633 | ;; push ax ; preserve type of operation ;AN000; | ||
| 1634 | ; DOS passes AL = 80 for writes | ||
| 1635 | ; = 00 for reads | ||
| 1636 | |||
| 1637 | mov ax,WORD PTR BytPos+2 | ||
| 1638 | mov bx,WORD PTR BytPos ; (ax:bx) = offset | ||
| 1639 | mov dx,cx | ||
| 1640 | sub cx,cx | ||
| 1641 | add dx,bx | ||
| 1642 | adc cx,ax ; (cx:dx) = lba of lock area | ||
| 1643 | sub di,di ; ignore own locks | ||
| 1644 | call SLE | ||
| 1645 | ;; pop ax ; recover type of opperation ;AN000; | ||
| 1646 | |||
| 1647 | ; upon return DS:SI points to the RLR with the conflict | ||
| 1648 | |||
| 1649 | ;; $if c ; if lock conflicts occur - error ;AC000; | ||
| 1650 | |||
| 1651 | ; now we must check what type of lock exists | ||
| 1652 | ; and the type of operation in progress. | ||
| 1653 | |||
| 1654 | ;; cmp al,write_op ; ;AN000; | ||
| 1655 | |||
| 1656 | ;; $if ne,and ; if NOT a write operation and ;AN000; | ||
| 1657 | |||
| 1658 | ;; cmp [si].rlr_type,rlr_lwr ; ;AN000; | ||
| 1659 | |||
| 1660 | ;; $if e ; if write locked (NOT all locked) ;AN000; | ||
| 1661 | |||
| 1662 | ;; clc ; then not true conflict - clear error ;AN000; | ||
| 1663 | |||
| 1664 | ;; $else ; else it IS a valid conflict ;AC000; | ||
| 1665 | |||
| 1666 | ;; stc ; true error - set error status | ||
| 1667 | |||
| 1668 | ;; $endif ; endif - a valid conflict ;AC000; | ||
| 1669 | |||
| 1670 | |||
| 1671 | ;; $endif ; endif - conflicts ;AC000; | ||
| 1672 | |||
| 1673 | mov ax,error_lock_violation ; assume error | ||
| 1674 | |||
| 1675 | ; $endif ; endif - no need to check ;AC000; | ||
| 1676 | $$IF22: | ||
| 1677 | |||
| 1678 | ; exit | ||
| 1679 | ; | ||
| 1680 | ; 'C' and (ax) setup | ||
| 1681 | |||
| 1682 | POP DS | ||
| 1683 | POP CX | ||
| 1684 | POP DI | ||
| 1685 | POP ES | ||
| 1686 | LeaveCrit critShare | ||
| 1687 | |||
| 1688 | ret ; exit | ||
| 1689 | |||
| 1690 | EndProc Chk_Block | ||
| 1691 | |||
| 1692 | BREAK <MFT_get - get an entry from the MFT> | ||
| 1693 | |||
| 1694 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1695 | ; | ||
| 1696 | ; MFT_get - get an entry from the MFT | ||
| 1697 | ; | ||
| 1698 | ; MFT_get is used to return information from the MFT. System utilities | ||
| 1699 | ; use this capability to produce status displays. | ||
| 1700 | ; | ||
| 1701 | ; MFT_get first locates the (BX)'th file in the list (no particular | ||
| 1702 | ; ordering is promised). It returns that name and the UID of | ||
| 1703 | ; the (CX)'th SFT on that file and the number of locks on that | ||
| 1704 | ; file via that SFT. | ||
| 1705 | ; | ||
| 1706 | ; ENTRY DS:SI point to DPL which contains: | ||
| 1707 | ; (dBX) = zero-based file index | ||
| 1708 | ; (dCX) = zero-based SFT index | ||
| 1709 | ; (SS) = DOSGroup | ||
| 1710 | ; EXIT 'C' clear if no error | ||
| 1711 | ; ES:DI buffer is filled in with BX'th file name | ||
| 1712 | ; (BX) = user id of SFT | ||
| 1713 | ; (CX) = # of locks via SFT | ||
| 1714 | ; 'C' set if error | ||
| 1715 | ; (ax) = error code | ||
| 1716 | ; ('error_no_more_files' if either index is out | ||
| 1717 | ; of range) | ||
| 1718 | ; | ||
| 1719 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1720 | |||
| 1721 | Procedure MFT_get,NEAR | ||
| 1722 | |||
| 1723 | ; int 3 | ||
| 1724 | nop | ||
| 1725 | nop | ||
| 1726 | |||
| 1727 | ASSUME DS:NOTHING,ES:NOTHING | ||
| 1728 | |||
| 1729 | EnterCrit critShare | ||
| 1730 | MOV BX,[SI.DPL_BX] | ||
| 1731 | MOV CX,[SI.DPL_CX] | ||
| 1732 | Context ES | ||
| 1733 | MOV DI,OFFSET DOSGROUP:OpenBuf | ||
| 1734 | |||
| 1735 | xchg bx,cx ; (cx) = file index | ||
| 1736 | push cs | ||
| 1737 | pop ds | ||
| 1738 | |||
| 1739 | Off SI,mft ; (ds:si) = fwa of OFFSET MFT | ||
| 1740 | |||
| 1741 | ; scan forward until next name | ||
| 1742 | |||
| 1743 | mget1: cmp [si].mft_flag,MFLG_FRE | ||
| 1744 | jz mget3 ; is free space | ||
| 1745 | jl mget7 ; is END | ||
| 1746 | |||
| 1747 | ; have another name. see if this satisfies caller | ||
| 1748 | |||
| 1749 | jcxz mget4 ; caller is happy | ||
| 1750 | dec cx | ||
| 1751 | mget3: add si,[si].mft_len ; skip name record | ||
| 1752 | JMP SHORT mget1 | ||
| 1753 | |||
| 1754 | ; we've located the file name. | ||
| 1755 | ; | ||
| 1756 | ; (bx) = SFT index | ||
| 1757 | ; (DS:SI) = MFT entry | ||
| 1758 | ; (ES:DI) = address of caller's buffer | ||
| 1759 | |||
| 1760 | mget4: push di | ||
| 1761 | push si ; save table offset | ||
| 1762 | add si,mft_name | ||
| 1763 | mget5: lodsb | ||
| 1764 | stosb ; copy name into caller's buffer | ||
| 1765 | or al,al | ||
| 1766 | jnz mget5 | ||
| 1767 | pop si ; (DS:SI) = name record address | ||
| 1768 | xchg bx,cx ; (cx) = SFT chain count | ||
| 1769 | lds di,[si].mft_sptr | ||
| 1770 | mget6: jcxz mget8 ; have reached the SFT we wanted | ||
| 1771 | dec cx | ||
| 1772 | lds di,[di].sf_chain ; get next link | ||
| 1773 | or di,di | ||
| 1774 | jnz mget6 ; follow chain some more | ||
| 1775 | pop di ; (es:di) = buffer address | ||
| 1776 | |||
| 1777 | ;** The file or SFT index was too large - return w/ error | ||
| 1778 | |||
| 1779 | mget7: mov ax,error_no_more_files | ||
| 1780 | stc | ||
| 1781 | LeaveCrit critShare | ||
| 1782 | |||
| 1783 | ret | ||
| 1784 | |||
| 1785 | ;** We've got the SFT he wants. Lets count the locks | ||
| 1786 | ; | ||
| 1787 | ; (es:TOS) = buffer address | ||
| 1788 | ; (DS:DI) = address of SFT | ||
| 1789 | ; (si) = address of mft | ||
| 1790 | |||
| 1791 | mget8: mov ax,[DI].sf_flags | ||
| 1792 | mov dx,ds ; save segment | ||
| 1793 | push cs | ||
| 1794 | pop ds | ||
| 1795 | mov si,[si].mft_lptr ; (DS:SI) = Lock record address | ||
| 1796 | sub cx,cx ; clear counter | ||
| 1797 | |||
| 1798 | mget9: or si,si | ||
| 1799 | jz mget11 ; no more | ||
| 1800 | cmp di,WORD PTR [si].rlr_sptr | ||
| 1801 | jnz mget10 | ||
| 1802 | cmp dx,word PTR [si].rlr_sptr+2 | ||
| 1803 | jnz mget10 | ||
| 1804 | inc cx | ||
| 1805 | mget10: mov si,[si].rlr_next | ||
| 1806 | JMP SHORT mget9 | ||
| 1807 | |||
| 1808 | ; Done counting locks. return the info | ||
| 1809 | ; | ||
| 1810 | ; (cx) = count of locks | ||
| 1811 | ; (es:TOS) = buffer address | ||
| 1812 | |||
| 1813 | mget11: mov ds,dx | ||
| 1814 | mov bx,[di].SF_UID ; (bx) = UID | ||
| 1815 | pop di | ||
| 1816 | clc | ||
| 1817 | LeaveCrit critShare | ||
| 1818 | |||
| 1819 | ret | ||
| 1820 | |||
| 1821 | EndProc MFT_get | ||
| 1822 | |||
| 1823 | BREAK <ASC - Add SFT to Chain> | ||
| 1824 | |||
| 1825 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1826 | ; | ||
| 1827 | ; ASC - Add SFT to Chain | ||
| 1828 | ; | ||
| 1829 | ; ASC is called to add an SFT to the front of the chain. | ||
| 1830 | ; | ||
| 1831 | ; ASC checks the file share mode bits on the other SFTs in the chain and | ||
| 1832 | ; reports a conflict. The new SFT is NOT ADDED in the case of | ||
| 1833 | ; conflicts. | ||
| 1834 | ; | ||
| 1835 | ; ENTRY (BX) = FBA MFT name record | ||
| 1836 | ; (DS:SI) = SFT address | ||
| 1837 | ; EXIT 'C' clear if added | ||
| 1838 | ; (ds:si) point to sft | ||
| 1839 | ; (bx) offset of mft | ||
| 1840 | ; 'C' set if conflict | ||
| 1841 | ; (ax) = error code | ||
| 1842 | ; USES ALL | ||
| 1843 | ; | ||
| 1844 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1845 | |||
| 1846 | Procedure ASC,NEAR | ||
| 1847 | |||
| 1848 | cmp [si].sf_MFT,0 | ||
| 1849 | jnz asc9 ; already on chain - internal error | ||
| 1850 | |||
| 1851 | ; The SFT looks good... lets see if there are any use conflicts | ||
| 1852 | |||
| 1853 | ; Message 1,<"Adding sft "> | ||
| 1854 | |||
| 1855 | mov ax,User_ID ; place user information in SFT | ||
| 1856 | mov [si].sf_UID,ax ; do it before CUC (he checks UID) | ||
| 1857 | mov ax,Proc_ID | ||
| 1858 | mov [si].sf_PID,ax | ||
| 1859 | |||
| 1860 | cmp skip_check,1 | ||
| 1861 | ; $if ne ; | ||
| 1862 | JE $$IF24 | ||
| 1863 | |||
| 1864 | call CUC ; check use conflicts | ||
| 1865 | |||
| 1866 | ; $endif | ||
| 1867 | $$IF24: | ||
| 1868 | |||
| 1869 | jc asc8 ; use conflicts - forget it | ||
| 1870 | |||
| 1871 | ; MessageNum AX | ||
| 1872 | |||
| 1873 | ; MessageNum AX | ||
| 1874 | ; Message 1,<" to "> | ||
| 1875 | ; MEssageNum DS | ||
| 1876 | ; Message 1,<":"> | ||
| 1877 | ; MessageNum SI | ||
| 1878 | ; Message 1,<" "> | ||
| 1879 | |||
| 1880 | mov [si].sf_MFT,bx ; make SFT point to MFT | ||
| 1881 | |||
| 1882 | ; MessageNum [si].sf_mft | ||
| 1883 | ; Message 1,<13,10> | ||
| 1884 | |||
| 1885 | mov cx,[si].sf_mode ; (cx) = open mode | ||
| 1886 | mov dx,ds ; (dx:si) = SFT address | ||
| 1887 | push cs | ||
| 1888 | pop ds ; (ds:bx) = MFT address | ||
| 1889 | |||
| 1890 | ; | ||
| 1891 | ; Not special file and no previous sft found OR normal SFT. We link it in | ||
| 1892 | ; at the head of the list. | ||
| 1893 | ; | ||
| 1894 | ; (dx:si) point to sft | ||
| 1895 | ; (ds:bx) point to mft | ||
| 1896 | ; | ||
| 1897 | les di,[bx].mft_sptr ; get first link | ||
| 1898 | mov word ptr [bx].mft_sptr,si ; link in this sft | ||
| 1899 | mov word ptr [bx].mft_sptr+2,dx ; link in this sft | ||
| 1900 | mov ds,dx | ||
| 1901 | mov word ptr [si].sf_chain,di | ||
| 1902 | mov word ptr [si].sf_chain+2,es | ||
| 1903 | asc75: mov ds,dx ; point back to sft | ||
| 1904 | |||
| 1905 | clc | ||
| 1906 | asc8: ret | ||
| 1907 | |||
| 1908 | ; the SFT is already in use... internal error | ||
| 1909 | |||
| 1910 | asc9: push ax | ||
| 1911 | off ax,ascerr | ||
| 1912 | call INTERR ; NEVER RETURNS | ||
| 1913 | ascerr db "ASC: sft already in use", 13, 10, 0 | ||
| 1914 | |||
| 1915 | EndProc ASC | ||
| 1916 | |||
| 1917 | |||
| 1918 | BREAK <BCS - Bulk Close of SFTs> | ||
| 1919 | |||
| 1920 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1921 | ; | ||
| 1922 | ; BCS - Bulk Close of SFTs | ||
| 1923 | ; | ||
| 1924 | ; BCS scans the MFT structures looking for SFTs that match a UID (and | ||
| 1925 | ; perhaps a PID). The SFTs are closed. The MFT name record is removed | ||
| 1926 | ; if all its SFTs are closed. | ||
| 1927 | ; | ||
| 1928 | ; BCS is called with a PID and a PID MASK. The SFT is closed if its UID | ||
| 1929 | ; matches the supplied UID AND (PID_ & PIDMASK) == PID_supplied | ||
| 1930 | ; | ||
| 1931 | ; We walk the MFT structure closing all relevant SFT's. There is no | ||
| 1932 | ; need for special handling of 70 handles or FCBs. | ||
| 1933 | ; | ||
| 1934 | ; Note that we call DOS_close to close the SFT; DOS_close in turn calls | ||
| 1935 | ; mftclose which may remove the SFT and even the MFT. This means that | ||
| 1936 | ; the MFT may vanish as we are working on it. Whenever we call | ||
| 1937 | ; DOS_close we'll know the next SFT and, if there is no next SFT we'll | ||
| 1938 | ; know the next MFT. (If the MFT were released a pointer to the carcass | ||
| 1939 | ; is not of any help. An MFT carcass cannot help find the next MFT | ||
| 1940 | ; record) | ||
| 1941 | ; | ||
| 1942 | ; ENTRY (AX) = UID to match | ||
| 1943 | ; (BX) = PID mask | ||
| 1944 | ; (DX) = PID value | ||
| 1945 | ; EXIT 'C' clear | ||
| 1946 | ; USES ALL | ||
| 1947 | ; | ||
| 1948 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1949 | |||
| 1950 | ASSUME SS:DOSGROUP | ||
| 1951 | |||
| 1952 | Procedure BCS,NEAR | ||
| 1953 | |||
| 1954 | push cs | ||
| 1955 | pop ds | ||
| 1956 | |||
| 1957 | Off SI,mft ; start at beginning of buffer | ||
| 1958 | |||
| 1959 | ; scan forward to the nearest name record (we may be at it now) | ||
| 1960 | ; | ||
| 1961 | ; (DS:SI) = record pointer | ||
| 1962 | |||
| 1963 | bcs1: cmp [si].mft_flag,MFLG_FRE | ||
| 1964 | jl bcs16 ; at end of names, all done | ||
| 1965 | jg bcs2 ; have a name record | ||
| 1966 | |||
| 1967 | bcs1$5: add si,[si].mft_len ; skip record and loop | ||
| 1968 | jmp bcs1 | ||
| 1969 | |||
| 1970 | bcs16: jmp bcs9 | ||
| 1971 | |||
| 1972 | bcs2: les di,[si].mft_sptr ; got name record - get first SFT | ||
| 1973 | ; run down SFT chain | ||
| 1974 | ; | ||
| 1975 | ; (es:di) = FBA next SFT | ||
| 1976 | ; (ds:si) = FBA name record | ||
| 1977 | ; (ax) = UID to match | ||
| 1978 | ; (bx) = PID mask | ||
| 1979 | ; (dx) = PID value | ||
| 1980 | |||
| 1981 | bcs3: or di,di | ||
| 1982 | jz bcs1$5 ; at end of SFT chain | ||
| 1983 | cmp ax,es:[di].sf_UID | ||
| 1984 | jnz bcs4 ; not a match | ||
| 1985 | mov cx,es:[di].sf_PID | ||
| 1986 | and cx,bx ; apply mask | ||
| 1987 | cmp cx,dx | ||
| 1988 | jz bcs51 ; got a match | ||
| 1989 | bcs4: | ||
| 1990 | les di,es:[di].sf_chain | ||
| 1991 | JMP bcs3 ; chain to next SFT | ||
| 1992 | |||
| 1993 | |||
| 1994 | ; We have an SFT to close | ||
| 1995 | ; | ||
| 1996 | ; (es:di) = FBA SFT to be closed | ||
| 1997 | ; | ||
| 1998 | ; (ds:si) = FBA name record | ||
| 1999 | ; (ax) = UID to match | ||
| 2000 | ; (bx) = PID mask | ||
| 2001 | ; (dx) = PID value | ||
| 2002 | |||
| 2003 | bcs51: mov es:[di].sf_ref_count,1 | ||
| 2004 | push ax | ||
| 2005 | push bx | ||
| 2006 | push dx ; save ID values (ax,bx,dx) and mask | ||
| 2007 | push ds | ||
| 2008 | push si ; save name record address (ds:si) | ||
| 2009 | mov si,word ptr es:[di].sf_chain | ||
| 2010 | or si,si | ||
| 2011 | jnz bcs7 ; isnt last sft, MFT will remain | ||
| 2012 | |||
| 2013 | ; yup, this is the last sft for this MFT, the MFT may evaporate. we have | ||
| 2014 | ; to find the next one NOW, and remember it | ||
| 2015 | |||
| 2016 | pop si ; undo saved name record address | ||
| 2017 | pop ds | ||
| 2018 | bcs6: add si,[si].mft_len ; go to next guy | ||
| 2019 | cmp [si].mft_flag,MFLG_FRE | ||
| 2020 | jz bcs6 ; must be a non-free guy | ||
| 2021 | push ds | ||
| 2022 | push si ; resave our new next MFT | ||
| 2023 | sub si,si ; no next sft | ||
| 2024 | |||
| 2025 | ; Allright, we're ready to call the DOS. | ||
| 2026 | ; | ||
| 2027 | ; (es:di) = FBA sft to be closed | ||
| 2028 | ; ((sp)) = long address of current or next MFT | ||
| 2029 | ; ((sp)+4) = PID value | ||
| 2030 | ; ((sp)+6) = PID mask | ||
| 2031 | ; ((sp)+8) = UID value | ||
| 2032 | |||
| 2033 | bcs7: mov WORD PTR ThisSFT,di | ||
| 2034 | mov WORD PTR ThisSFT+2,es | ||
| 2035 | mov es,word ptr es:[di].sf_chain+2 | ||
| 2036 | SaveReg <es,si> | ||
| 2037 | call CPS ; clear JFN | ||
| 2038 | Context DS | ||
| 2039 | |||
| 2040 | CallInstall DOS_Close,multDos,1 | ||
| 2041 | |||
| 2042 | ASSUME DS:NOTHING | ||
| 2043 | |||
| 2044 | RestoreReg <di,es> ; (es:DI) = offset of next sft | ||
| 2045 | pop si | ||
| 2046 | pop ds ; (DS:SI) = fwa of current or next MFT | ||
| 2047 | pop dx | ||
| 2048 | pop bx | ||
| 2049 | pop ax | ||
| 2050 | or di,di | ||
| 2051 | jnz bcs85 ; have more sft's | ||
| 2052 | JMP bcs1 ; look at this new MFT | ||
| 2053 | bcs85: jmp bcs3 | ||
| 2054 | |||
| 2055 | ; All Done | ||
| 2056 | |||
| 2057 | bcs9: clc | ||
| 2058 | |||
| 2059 | ret | ||
| 2060 | |||
| 2061 | EndProc BCS | ||
| 2062 | |||
| 2063 | BREAK <CSL - Clear SFT Locks> | ||
| 2064 | |||
| 2065 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2066 | ; | ||
| 2067 | ; CSL - Clear SFT Locks | ||
| 2068 | ; | ||
| 2069 | ; CSL clears any locks associated with this SFT. | ||
| 2070 | ; | ||
| 2071 | ; ENTRY (ES:DI) = SFT address | ||
| 2072 | ; EXIT (ES:DI) unchanged | ||
| 2073 | ; USES All but ES,DI | ||
| 2074 | ; | ||
| 2075 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2076 | |||
| 2077 | Procedure CSL,NEAR | ||
| 2078 | |||
| 2079 | mov si,es:[di].sf_MFT | ||
| 2080 | push cs | ||
| 2081 | pop ds | ||
| 2082 | lea bx,[si].mft_lptr ; (DS:BX) = addr of lock ptr | ||
| 2083 | mov si,[bx] ; (DS:SI) = fba first lock record | ||
| 2084 | |||
| 2085 | ; scan the locks looking for belongers. | ||
| 2086 | ; | ||
| 2087 | ; (es:di) = SFT address | ||
| 2088 | ; (ds:si) = this lock address | ||
| 2089 | ; (ds:bx) = address of link (offset value) to this lock (prev lock) | ||
| 2090 | |||
| 2091 | csl1: or si,si | ||
| 2092 | jz csl3 ; done with lock list | ||
| 2093 | cmp di,word ptr [si].rlr_sptr | ||
| 2094 | jnz csl2 ; not my lock | ||
| 2095 | mov ax,es | ||
| 2096 | cmp ax,word ptr [si].rlr_sptr+2 | ||
| 2097 | jnz csl2 ; not my lock | ||
| 2098 | ; | ||
| 2099 | ; Make sure that the lock REALLY belongs to the correct process | ||
| 2100 | ; | ||
| 2101 | cmp user_in_ax, (ServerCall shl 8) + 4 ; only check if ; @@01 | ||
| 2102 | jnz csl15 ; process specific; @@01 | ||
| 2103 | mov ax,Proc_ID | ||
| 2104 | cmp ax,[si].rlr_pid ; is process ID of lock = this PID? | ||
| 2105 | jnz csl2 ; nope, skip this lock | ||
| 2106 | |||
| 2107 | ; got a lock to remove | ||
| 2108 | |||
| 2109 | csl15: | ||
| 2110 | mov dx,[si].rlr_next | ||
| 2111 | mov [bx],dx ; link him out | ||
| 2112 | mov ax,Frelock | ||
| 2113 | mov [si].rlr_next,ax | ||
| 2114 | mov Frelock,si | ||
| 2115 | mov si,dx ; (DS:SI) = next lock address | ||
| 2116 | JMP SHORT csl1 | ||
| 2117 | |||
| 2118 | ERRNZ rlr_next ; lock is not ours... follow chain | ||
| 2119 | csl2: mov bx,si | ||
| 2120 | mov si,[si].rlr_next | ||
| 2121 | JMP SHORT csl1 | ||
| 2122 | |||
| 2123 | ; All done | ||
| 2124 | |||
| 2125 | csl3: ret | ||
| 2126 | |||
| 2127 | EndProc CSL | ||
| 2128 | |||
| 2129 | ASSUME DS:NOTHING | ||
| 2130 | |||
| 2131 | BREAK <CUC - check usage conflicts> | ||
| 2132 | |||
| 2133 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2134 | ; | ||
| 2135 | ; Use conflict table | ||
| 2136 | ; | ||
| 2137 | ; Algorithm: | ||
| 2138 | ; | ||
| 2139 | ; if ((newmode == COMPAT) or (oldmode == COMPAT)) | ||
| 2140 | ; and (user ID's match) | ||
| 2141 | ; then accept | ||
| 2142 | ; else | ||
| 2143 | ; for new and old mode, compute index of (SH*3)+ACC | ||
| 2144 | ; shift right table[new_index] by old_index+2; | ||
| 2145 | ; 'C' set if FAIL | ||
| 2146 | ; | ||
| 2147 | ; The bit in the old_index position indicates the success or failure. 0 | ||
| 2148 | ; => allow access, 1 => fail access | ||
| 2149 | ; | ||
| 2150 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2151 | |||
| 2152 | PUBLIC CUCA | ||
| 2153 | |||
| 2154 | CUCA: DW 0ffffh ; Compat Read | ||
| 2155 | DW 0ffffh ; Compat Write | ||
| 2156 | DW 0ffffh ; Compat Read/Write | ||
| 2157 | DW 0ffffh ; Deny R/W Read | ||
| 2158 | DW 0ffffh ; Deny R/W Write | ||
| 2159 | DW 0ffffh ; Deny R/W Read/Write | ||
| 2160 | DW 0df7fh ; Deny W Read | ||
| 2161 | DW 0dbffh ; Deny W Write | ||
| 2162 | DW 0dfffh ; Deny W Read/Write | ||
| 2163 | DW 0beffh ; Deny R Read | ||
| 2164 | DW 0b7ffh ; Deny R Write | ||
| 2165 | DW 0bfffh ; Deny R Read/Write | ||
| 2166 | DW 01c7fh ; Deny None Read | ||
| 2167 | DW 003ffh ; Deny None Write | ||
| 2168 | DW 01fffh ; Deny None Read/Write | ||
| 2169 | |||
| 2170 | ; 4443 3322 2111 000 | ||
| 2171 | ; Deny/Compat / DDDD DDDD DDDD CCCx | ||
| 2172 | ; DenyRead / R RR RRR | ||
| 2173 | ; DenyWrite 1st Access =< WW WWWW | ||
| 2174 | ; AccessRead \ R RR RR RR R R R | ||
| 2175 | ; AccessWrite \ WW W W WW WW WW | ||
| 2176 | ; x 1111 1111 1111 1111 | ||
| 2177 | ; C R 00 1111 1111 1111 1111 ffff | ||
| 2178 | ; C W 01 1111 1111 1111 1111 ffff | ||
| 2179 | ; C RW 02 1111 1111 1111 1111 ffff | ||
| 2180 | |||
| 2181 | ; DRWR 10 1111 1111 1111 1111 ffff | ||
| 2182 | ; DRW W 11 1111 1111 1111 1111 ffff | ||
| 2183 | ; DRWRW 12 1111 1111 1111 1111 ffff | ||
| 2184 | ; D WR 20 1101 1111 0111 1111 df7f | ||
| 2185 | |||
| 2186 | ; D W W 21 1101 1011 1111 1111 dbff | ||
| 2187 | ; D WRW 22 1101 1111 1111 1111 dfff | ||
| 2188 | ; DR R 30 1011 1110 1111 1111 beff | ||
| 2189 | ; DR W 31 1011 0111 1111 1111 b7ff | ||
| 2190 | |||
| 2191 | ; DR RW 32 1011 1111 1111 1111 bfff | ||
| 2192 | ; D R 40 0001 1100 0111 1111 1c7f | ||
| 2193 | ; D W 41 0000 0011 1111 1111 03ff | ||
| 2194 | ; D RW 42 0001 1111 1111 1111 1fff | ||
| 2195 | |||
| 2196 | ; In order to allow the greatest number of accesses, compatability read mode | ||
| 2197 | ; is treated as deny-write read. The other compatability modes are treated | ||
| 2198 | ; as deny-both. | ||
| 2199 | |||
| 2200 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2201 | ; | ||
| 2202 | ; CUC - check usage conflicts | ||
| 2203 | ; | ||
| 2204 | ; CUC is called to see if a would-be open would generate a share | ||
| 2205 | ; conflict with an existing open. See CUCA for the algorithm and table | ||
| 2206 | ; format. | ||
| 2207 | ; | ||
| 2208 | ; ENTRY (BX) = FBA MFT name record | ||
| 2209 | ; (DS:SI) = SFT address | ||
| 2210 | ; EXIT 'C' clear if OK | ||
| 2211 | ; 'C' set if conflict | ||
| 2212 | ; (ax) = error code | ||
| 2213 | ; USES ALL but arguments (BX, DS:SI) | ||
| 2214 | ; | ||
| 2215 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2216 | |||
| 2217 | Procedure CUC,NEAR | ||
| 2218 | |||
| 2219 | push ds | ||
| 2220 | pop es | ||
| 2221 | mov di,si ; (es:di) = FBA SFT record | ||
| 2222 | call gom ; get open mode | ||
| 2223 | mov ch,al | ||
| 2224 | and ch,sharing_mask ; (ch) = new guy share | ||
| 2225 | jz cuc0 ; new guy is compatability mode | ||
| 2226 | mov ch,sharing_mask | ||
| 2227 | cuc0: call csi ; compute share index | ||
| 2228 | add ax,ax ; *2 for word index | ||
| 2229 | xchg ax,si ; (si) = share table index | ||
| 2230 | push cs | ||
| 2231 | pop ds ; (ds:bx) = FBA MFT record | ||
| 2232 | mov dx,WORD PTR CUCA[si] ; (dx) = share mask | ||
| 2233 | lds si,[bx].mft_sptr ; (ds:si) = first sft guy | ||
| 2234 | |||
| 2235 | ; ready to do access compares. | ||
| 2236 | ; | ||
| 2237 | ; (ds:si) = address of next sft | ||
| 2238 | ; (es:di) = address of new sft | ||
| 2239 | ; (dx) = share word from CUCA | ||
| 2240 | ; (cs:bx) = MFT offset | ||
| 2241 | ; (ch) = 0 if new SFT is compatibilty mode, else sharing_mask | ||
| 2242 | |||
| 2243 | cuc1: or si,si | ||
| 2244 | jz cuc9 ; at end of chain, no problems | ||
| 2245 | call gom ; if not FCB, then mode in al is good | ||
| 2246 | mov ah,al | ||
| 2247 | and ah,sharing_mask ; (ah) = sharing mode | ||
| 2248 | or ah,ch ; (ah) = 0 iff new and old is SH_COMP | ||
| 2249 | jnz cuc2 ; neither is SH_COMP | ||
| 2250 | |||
| 2251 | ; Both the old and the new guy are SH_COMP mode. If the UIDs match, | ||
| 2252 | ; step onward. If they don't match do normal share check. | ||
| 2253 | |||
| 2254 | mov bp,es:[di].sf_UID | ||
| 2255 | cmp bp,[si].sf_UID | ||
| 2256 | jz cuc20 ; equal => next sft to check | ||
| 2257 | |||
| 2258 | cuc2: call csi ; compute the share index | ||
| 2259 | inc ax | ||
| 2260 | inc ax | ||
| 2261 | xchg al,cl ; (cl) = shift count | ||
| 2262 | mov ax,dx | ||
| 2263 | sar ax,cl ; select the bit | ||
| 2264 | jc cuc8 ; a conflict! | ||
| 2265 | cuc20: | ||
| 2266 | lds si,[si].sf_chain | ||
| 2267 | JMP cuc1 ; chain to next SFT and try again | ||
| 2268 | |||
| 2269 | ; Have a share conflict | ||
| 2270 | |||
| 2271 | cuc8: mov ax,error_sharing_violation ; assume share conflict | ||
| 2272 | stc | ||
| 2273 | |||
| 2274 | ; done with compare. Restore regs and return | ||
| 2275 | ; | ||
| 2276 | ; 'C' set as appropriate | ||
| 2277 | ; (es:di) = new SFT address | ||
| 2278 | ; (ax) set as appropriate | ||
| 2279 | ; (bx) = MFT offset | ||
| 2280 | |||
| 2281 | cuc9: push es | ||
| 2282 | pop ds | ||
| 2283 | mov si,di | ||
| 2284 | |||
| 2285 | ret | ||
| 2286 | |||
| 2287 | EndProc CUC | ||
| 2288 | |||
| 2289 | BREAK <csi - compute share index> | ||
| 2290 | |||
| 2291 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2292 | ; | ||
| 2293 | ; csi - compute share index | ||
| 2294 | ; | ||
| 2295 | ; | ||
| 2296 | ; If the mode byte has a leading 7 then it is interpreted as a 0 | ||
| 2297 | ; csi turns a mode byte into an index from 0 to 14: | ||
| 2298 | ; | ||
| 2299 | ; (share index)*3 + (access index) | ||
| 2300 | ; | ||
| 2301 | ; ENTRY (al) = mode byte | ||
| 2302 | ; EXIT (ax) = index | ||
| 2303 | ; USES AX, CL | ||
| 2304 | ; | ||
| 2305 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2306 | |||
| 2307 | Procedure CSI,NEAR | ||
| 2308 | |||
| 2309 | mov ah,al | ||
| 2310 | and ah,access_mask ; (ah) = access bits | ||
| 2311 | and al,sharing_mask ; (al) = share bites | ||
| 2312 | ERRNZ sharing_mask-0F0h | ||
| 2313 | cmp al,sharing_net_FCB | ||
| 2314 | jnz csi1 | ||
| 2315 | xor al,al | ||
| 2316 | csi1: | ||
| 2317 | shr al,1 | ||
| 2318 | shr al,1 | ||
| 2319 | shr al,1 | ||
| 2320 | mov cl,al ; (cl) = SHVAL*2 | ||
| 2321 | shr al,1 | ||
| 2322 | add al,cl ; (al) = SHVAL*3 | ||
| 2323 | add al,ah ; (al) = SH*3 + ACC | ||
| 2324 | sub ah,ah | ||
| 2325 | |||
| 2326 | ret | ||
| 2327 | |||
| 2328 | EndProc CSI | ||
| 2329 | |||
| 2330 | Break <GOM - get open mode> | ||
| 2331 | |||
| 2332 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2333 | ; | ||
| 2334 | ; GOM - get open mode | ||
| 2335 | ; | ||
| 2336 | ; Find the correct open mode given the encoded sf_mode. Note that files | ||
| 2337 | ; marked READ-ONLY and are opened in compatability read-only are treated as | ||
| 2338 | ; deny-write read-only. FCB opens are sharing_compat open_for_both and | ||
| 2339 | ; net FCB opens are sharing_compat | ||
| 2340 | ; | ||
| 2341 | ; Entry: (DS:SI) points to SFT | ||
| 2342 | ; Exit: (AL) has correct mode | ||
| 2343 | ; Uses: (AX) | ||
| 2344 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2345 | |||
| 2346 | Procedure GOM,NEAR | ||
| 2347 | |||
| 2348 | mov ax,[si].sf_mode | ||
| 2349 | TEST AX,sf_IsFCB | ||
| 2350 | jz gom1 ; if not FCB, then mode in al is good | ||
| 2351 | mov al,sharing_compat+open_for_both | ||
| 2352 | gom1: | ||
| 2353 | mov ah,al | ||
| 2354 | and ah,sharing_mask | ||
| 2355 | cmp ah,sharing_net_FCB ; is sharing from net FCB? | ||
| 2356 | jnz gom2 ; no, got good mode | ||
| 2357 | and al,access_mask ; yes, convert to compat mode sharing | ||
| 2358 | or al,sharing_compat | ||
| 2359 | ; | ||
| 2360 | ; The sharing mode and access mode in AL is now correct for the file. See if | ||
| 2361 | ; mode is compatability. If so and file is read-only, convert access mode to | ||
| 2362 | ; deny-write read. | ||
| 2363 | ; | ||
| 2364 | gom2: | ||
| 2365 | mov ah,al | ||
| 2366 | and ah,sharing_mask | ||
| 2367 | retnz ; not compatability, return. | ||
| 2368 | test [si].sf_attr,attr_read_only | ||
| 2369 | retz ; not read-only | ||
| 2370 | mov al,sharing_deny_write + open_for_read | ||
| 2371 | |||
| 2372 | ret | ||
| 2373 | |||
| 2374 | EndProc GOM | ||
| 2375 | |||
| 2376 | SHARE ENDS | ||
| 2377 | |||
| 2378 | END | ||
| 2379 | ELSE | ||
| 2380 | CODE ENDS | ||
| 2381 | ENDIF | ||
| 2382 | END ; This can't be inside the if | ||
| 2383 | ; mode is compatability. If so and file is read-only, convert access mode to | ||
| 2384 | ; deny-write read. | ||
| 2385 | ; | ||
| 2386 | gom2: | ||
| 2387 | mov ah,al | ||
| 2388 | and ah,sharing_mask | ||
| 2389 | retnz ; not compatability, return. | ||
| 2390 | test [si].sf_attr,attr_read_only | ||
| 2391 | retz ; not read-only | ||
| 2392 | mov al,sharing_deny_write + open_for_read | ||
| 2393 | |||
| 2394 | ret | ||
| 2395 | |||
| 2396 | EndProc GOM | ||
| 2397 | |||
| 2398 | SHARE ENDS | ||
| 2399 | |||
| 2400 | END | ||
| 2401 | ELSE | ||
| 2402 | CODE ENDS | ||
| 2403 | ENDIF | ||
| 2404 | END ; This can't be inside the if | ||
| 2405 | \ No newline at end of file | ||
diff --git a/v4.0/src/CMD/SHARE/GSHARE2.ASM b/v4.0/src/CMD/SHARE/GSHARE2.ASM new file mode 100644 index 0000000..6341c5a --- /dev/null +++ b/v4.0/src/CMD/SHARE/GSHARE2.ASM | |||
| @@ -0,0 +1,2979 @@ | |||
| 1 | Title Share_2 | ||
| 2 | ; $SALUT (0,36,41,44) | ||
| 3 | include SHAREHDR.INC | ||
| 4 | ; | ||
| 5 | ; Label: "The DOS SHARE Utility" | ||
| 6 | ; "Version 4.00 (C) Copyright 1988 Microsoft" | ||
| 7 | ; "Licenced Material - Program Property of Microsoft" | ||
| 8 | ; | ||
| 9 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 10 | |||
| 11 | NAME Sharer2 | ||
| 12 | |||
| 13 | ; INCLUDE DOSSYM.INC | ||
| 14 | ; INCLUDE SYSMSG.INC | ||
| 15 | .xlist | ||
| 16 | .xcref | ||
| 17 | INCLUDE DOSSYM.INC | ||
| 18 | INCLUDE SYSMSG.INC | ||
| 19 | .cref | ||
| 20 | .list | ||
| 21 | page 80,132 | ||
| 22 | |||
| 23 | MSG_UTILNAME <SHARE> | ||
| 24 | |||
| 25 | ShareDataVersion = 1 | ||
| 26 | |||
| 27 | AsmVars <IBM, Installed> | ||
| 28 | |||
| 29 | Installed = TRUE ; for installed version | ||
| 30 | |||
| 31 | OFF Macro reg,val | ||
| 32 | IF installed | ||
| 33 | mov reg,OFFSET val | ||
| 34 | ELSE | ||
| 35 | mov si,OFFSET DOSGROUP:val | ||
| 36 | ENDIF | ||
| 37 | ENDM | ||
| 38 | |||
| 39 | ERRNZ Macro x | ||
| 40 | IF x NE 0 | ||
| 41 | %out ERRNZ failed | ||
| 42 | ENDIF | ||
| 43 | ENDM | ||
| 44 | ;--------------------------------------- | ||
| 45 | ; if we are installed, then define the | ||
| 46 | ; base code segment of the sharer first | ||
| 47 | ;--------------------------------------- | ||
| 48 | ; $SALUT (4,9,17,36) | ||
| 49 | |||
| 50 | IF Installed | ||
| 51 | |||
| 52 | Share SEGMENT BYTE PUBLIC 'SHARE' | ||
| 53 | Share ENDS | ||
| 54 | |||
| 55 | ENDIF | ||
| 56 | |||
| 57 | ;--------------------------------------- | ||
| 58 | ; include the rest of the segment | ||
| 59 | ; definitions for normal msdos | ||
| 60 | |||
| 61 | ; segment ordering for MSDOS | ||
| 62 | |||
| 63 | ;--------------------------------------- | ||
| 64 | include dosseg.asm | ||
| 65 | |||
| 66 | CONSTANTS SEGMENT | ||
| 67 | |||
| 68 | extrn DataVersion:BYTE ; version number of DOS data. | ||
| 69 | extrn JShare:BYTE ; location of DOS jump table. | ||
| 70 | extrn sftFCB:DWORD ; [SYSTEM] pointer to FCB cache table | ||
| 71 | extrn KeepCount:WORD ; [SYSTEM] LRU count for FCB cache | ||
| 72 | extrn CurrentPDB:WORD | ||
| 73 | |||
| 74 | CONSTANTS ENDS | ||
| 75 | |||
| 76 | DATA SEGMENT | ||
| 77 | |||
| 78 | extrn ThisSFT:DWORD ; pointer to SFT entry | ||
| 79 | extrn WFP_start:WORD ; pointer to name string | ||
| 80 | extrn User_ID:WORD | ||
| 81 | extrn Proc_ID:WORD | ||
| 82 | extrn SFT_addr:DWORD | ||
| 83 | extrn Arena_Head:WORD | ||
| 84 | extrn fshare:BYTE | ||
| 85 | extrn pJFN:DWORD | ||
| 86 | extrn JFN:WORD | ||
| 87 | |||
| 88 | IF DEBUG | ||
| 89 | |||
| 90 | extrn BugLev:WORD | ||
| 91 | extrn BugTyp:WORD | ||
| 92 | include bugtyp.asm | ||
| 93 | |||
| 94 | ENDIF | ||
| 95 | |||
| 96 | |||
| 97 | DATA ENDS | ||
| 98 | |||
| 99 | ;--------------------------------------- | ||
| 100 | ; if we are not installed, then the | ||
| 101 | ; code here is just part of the normal | ||
| 102 | ; MSDOS code segment otherwise, | ||
| 103 | ; define our own code segment | ||
| 104 | ;--------------------------------------- | ||
| 105 | |||
| 106 | .sall | ||
| 107 | IF NOT INSTALLED | ||
| 108 | |||
| 109 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 110 | |||
| 111 | ASSUME SS:DOSGROUP,CS:DOSGROUP | ||
| 112 | |||
| 113 | ELSE | ||
| 114 | |||
| 115 | Share SEGMENT BYTE PUBLIC 'SHARE' | ||
| 116 | |||
| 117 | ASSUME SS:DOSGROUP,CS:SHARE | ||
| 118 | |||
| 119 | ENDIF | ||
| 120 | |||
| 121 | Extrn FreLock:WORD,Serial:WORD | ||
| 122 | Extrn MFT_Enter:NEAR,MFTClose:NEAR,MFTClu:NEAR,MFTCloseP:NEAR | ||
| 123 | Extrn MFTCloN:NEAR | ||
| 124 | Extrn Set_Mult_Block:NEAR,Clr_Mult_Block:NEAR,Chk_Block:NEAR | ||
| 125 | Extrn MFT_Get:NEAR | ||
| 126 | |||
| 127 | include mft.inc | ||
| 128 | |||
| 129 | ; $SALUT (4,4,9,41) | ||
| 130 | |||
| 131 | BREAK <FNM - Find name in MFT> | ||
| 132 | |||
| 133 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 134 | ; | ||
| 135 | ; FNM - Find name in MFT | ||
| 136 | ; | ||
| 137 | ; FNM searches the MFT for a name record. | ||
| 138 | ; | ||
| 139 | ; ENTRY (DS:SI) = pointer to name string (.asciz) | ||
| 140 | ; (al) = 1 to create record if non exists | ||
| 141 | ; = 0 otherwise | ||
| 142 | ; EXIT 'C' clear if found or created | ||
| 143 | ; (DS:BX) = address of MFT name record | ||
| 144 | ; 'C' set if error | ||
| 145 | ; If not to create, item not found | ||
| 146 | ; (DS:SI) unchanged | ||
| 147 | ; If to create, am out of space | ||
| 148 | ; (ax) = error code | ||
| 149 | ; USES ALL | ||
| 150 | ; | ||
| 151 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 152 | |||
| 153 | Procedure FNM,NEAR | ||
| 154 | |||
| 155 | push ds ; save string address | ||
| 156 | push si | ||
| 157 | xchg bh,al ; (bh) = create flag | ||
| 158 | or bh,bh ; if not creating | ||
| 159 | jz fnm01 ; skip sft test | ||
| 160 | |||
| 161 | ;--------------------------------------- | ||
| 162 | ; run down through string counting | ||
| 163 | ; and summing | ||
| 164 | ;--------------------------------------- | ||
| 165 | |||
| 166 | fnm01: sub dx,dx ; (dx) = byte count | ||
| 167 | sub bl,bl ; (bl) = sum | ||
| 168 | |||
| 169 | fnm1: lodsb ; (al) = next char | ||
| 170 | add bl,al | ||
| 171 | adc bl,0 | ||
| 172 | inc dx | ||
| 173 | and al,al | ||
| 174 | jnz fnm1 ; terminate after null char | ||
| 175 | |||
| 176 | ;--------------------------------------- | ||
| 177 | ; Info computed. | ||
| 178 | ; Start searching name list | ||
| 179 | |||
| 180 | ; (bh) = create flag | ||
| 181 | ; (bl) = sum byte | ||
| 182 | ; (dx) = byte count | ||
| 183 | ; (TOS+2:TOS) = name string address | ||
| 184 | ;--------------------------------------- | ||
| 185 | push cs | ||
| 186 | pop ds | ||
| 187 | |||
| 188 | Off SI,mft | ||
| 189 | |||
| 190 | fnm2: cmp [si].mft_flag,MFLG_FRE | ||
| 191 | jl fnm10 ; at end - name not found | ||
| 192 | jz fnm4 ; is free, just skip it | ||
| 193 | cmp bl,[si].mft_sum ; do sums compare? | ||
| 194 | jz fnm5 ; its a match - look further | ||
| 195 | fnm4: add si,[si].mft_len ; not a match... skip it | ||
| 196 | JMP SHORT fnm2 | ||
| 197 | ;--------------------------------------- | ||
| 198 | ; name checksums match | ||
| 199 | ; - compare the actual strings | ||
| 200 | ; | ||
| 201 | ; (dx) = length | ||
| 202 | ; (ds:si = MFT address | ||
| 203 | ; (bh) = create flag | ||
| 204 | ; (bl) = sum byte | ||
| 205 | ; (dx) = byte count | ||
| 206 | ; (TOS+2:TOS) = name string address | ||
| 207 | ;--------------------------------------- | ||
| 208 | |||
| 209 | fnm5: mov cx,dx ; (cx) = length to match | ||
| 210 | pop di | ||
| 211 | pop es ; (ES:DI) = fba given name | ||
| 212 | push es | ||
| 213 | push di | ||
| 214 | push si ; save MFT offset | ||
| 215 | add si,mft_name ; (ds:si) = fwa string in record | ||
| 216 | repz cmpsb | ||
| 217 | pop si ; (ds:si) = fwa name record | ||
| 218 | jnz fnm4 ; not a match | ||
| 219 | |||
| 220 | ;--------------------------------------- | ||
| 221 | ; Yes, we've found it. Return the info | ||
| 222 | ; | ||
| 223 | ; (TOS+2:TOS) = name string address | ||
| 224 | ;--------------------------------------- | ||
| 225 | |||
| 226 | fmt TypShare,LevMFTSrch,<"FNM found name record at $x\n">,<si> | ||
| 227 | pop ax ; discard unneeded stack stuff | ||
| 228 | pop ax | ||
| 229 | mov bx,si ; (ds:bx) = fwa name record | ||
| 230 | clc | ||
| 231 | |||
| 232 | ret | ||
| 233 | ;--------------------------------------- | ||
| 234 | ;** | ||
| 235 | ;** Its not in the list | ||
| 236 | ;** - lets find a free spot and put | ||
| 237 | ;** it there | ||
| 238 | ; | ||
| 239 | ; (bh) = create flag | ||
| 240 | ; (bl) = sum byte | ||
| 241 | ; (dx) = string length | ||
| 242 | ; (TOS+2:TOS) = ASCIZ string address | ||
| 243 | ; (ds) = SEG CODE | ||
| 244 | ;--------------------------------------- | ||
| 245 | fnm10: | ||
| 246 | and bh,bh | ||
| 247 | jnz fnm10$5 ; yes, insert it | ||
| 248 | pop si | ||
| 249 | pop ds ; no insert, its a "not found" | ||
| 250 | stc | ||
| 251 | |||
| 252 | fmt TypShare,LevMFTSrch,<"FNM failing\n"> | ||
| 253 | |||
| 254 | mov ax,error_path_not_found | ||
| 255 | |||
| 256 | ret | ||
| 257 | |||
| 258 | fnm10$5: | ||
| 259 | add dx,mft_name ; (dx) = minimum space needed | ||
| 260 | |||
| 261 | off SI,mft | ||
| 262 | |||
| 263 | fnm11: cmp [si].mft_flag,MFLG_FRE | ||
| 264 | |||
| 265 | IF NOT DEBUG | ||
| 266 | jl fnm20 ; at END, am out of space | ||
| 267 | ELSE | ||
| 268 | jl fnm20j | ||
| 269 | ENDIF | ||
| 270 | |||
| 271 | jz fnm12 ; is a free record | ||
| 272 | add si,[si].mft_len ; skip name record | ||
| 273 | JMP SHORT fnm11 | ||
| 274 | |||
| 275 | IF DEBUG | ||
| 276 | fnm20j: jmp fnm20 | ||
| 277 | ENDIF | ||
| 278 | |||
| 279 | fnm12: mov ax,[si].mft_len ; Have free record, (ax) = total length | ||
| 280 | cmp ax,dx | ||
| 281 | jnc fnm13 ; big enough | ||
| 282 | add si,ax | ||
| 283 | JMP SHORT fnm11 ; not large enough - move on | ||
| 284 | |||
| 285 | ;--------------------------------------- | ||
| 286 | ; OK, we have a record which is big | ||
| 287 | ; enough. If its large enough to hold | ||
| 288 | ; another name record of 6 characters | ||
| 289 | ; than we'll split the block, else | ||
| 290 | ; we'll just use the whole thing | ||
| 291 | ; | ||
| 292 | ; (ax) = size of free record | ||
| 293 | ; (dx) = size needed | ||
| 294 | ; (ds:si) = address of free record | ||
| 295 | ; (bl) = sum byte | ||
| 296 | ; (TOS+2:TOS) = name string address | ||
| 297 | ;--------------------------------------- | ||
| 298 | |||
| 299 | fnm13: sub ax,dx ; (ax) = total size of proposed fragment | ||
| 300 | cmp ax,mft_name+6 | ||
| 301 | jc fnm14 ; not big enough to split | ||
| 302 | push bx ; save sum byte | ||
| 303 | mov bx,dx ; (bx) = offset to start of new name record | ||
| 304 | mov [bx][si].mft_flag,MFLG_FRE | ||
| 305 | mov [bx][si].mft_len,ax ; setup tail as free record | ||
| 306 | sub ax,ax ; don't extend this record | ||
| 307 | pop bx ; restore sum byte | ||
| 308 | fnm14: add dx,ax ; (dx) = total length of this record | ||
| 309 | mov [si].mft_len,dx | ||
| 310 | mov [si].mft_sum,bl | ||
| 311 | mov [si].mft_flag,MFLG_NAM | ||
| 312 | |||
| 313 | fmt TypShare,LevMFTSrch,<"FNM creating record at $x\n">,<si> | ||
| 314 | |||
| 315 | push ds | ||
| 316 | pop es ; (es) = MFT segment for "stow" | ||
| 317 | sub ax,ax | ||
| 318 | mov di,si | ||
| 319 | add di,mft_lptr | ||
| 320 | stosw ; zero LCK pointer | ||
| 321 | ERRNZ mft_sptr-mft_lptr-2 | ||
| 322 | ; add di,mft_sptr-mft_lptr-2 | ||
| 323 | stosw ; zero SFT pointer | ||
| 324 | stosw ; zero SFT pointer | ||
| 325 | inc serial ; bump serial number | ||
| 326 | mov ax,serial | ||
| 327 | ERRNZ mft_serl-mft_sptr-4 | ||
| 328 | ; ADD di,mft_serl-mft_sptr-4 | ||
| 329 | stosw | ||
| 330 | ;--------------------------------------- | ||
| 331 | ; We're all setup except for the name. | ||
| 332 | ; Note that we'll block copy the whole | ||
| 333 | ; name field, even though the name may | ||
| 334 | ; be shorter than that (we may have | ||
| 335 | ; declined to fragment this memory block) | ||
| 336 | ; | ||
| 337 | ; (dx) = total length of this record | ||
| 338 | ; (ds:si) = address of working record | ||
| 339 | ; (es) = (ds) | ||
| 340 | ; (TOS+2:TOS) = name string address | ||
| 341 | ;--------------------------------------- | ||
| 342 | mov cx,dx | ||
| 343 | sub cx,mft_name ; compute total size of name area | ||
| 344 | ERRNZ mft_name-mft_serl-2 | ||
| 345 | ; add di,mft_name-mft_serl-2 ; (ES:DI) = target address | ||
| 346 | mov ax,si ; save name record offset | ||
| 347 | pop si | ||
| 348 | pop ds | ||
| 349 | rep movsb | ||
| 350 | mov bx,ax ; (bx) = name record offset | ||
| 351 | push es | ||
| 352 | pop ds ; (DS:BX) = name record offset | ||
| 353 | clc | ||
| 354 | |||
| 355 | ret | ||
| 356 | |||
| 357 | ;** | ||
| 358 | ;** OUT OF FREE SPACE | ||
| 359 | ;** | ||
| 360 | ;** This is tough, folks. Lets trigger a garbage collection and see if | ||
| 361 | ;** there is enough room. If there is, we'll hop back and relook for a | ||
| 362 | ;** free hunk; if there isnt enough space, its error-city! | ||
| 363 | ; | ||
| 364 | ; WARNING: it is important that the garbage collector be told how big a | ||
| 365 | ; name record hole we're looking for... if the size given GCM | ||
| 366 | ; is too small we'll loop doing "no space; collect; no space; | ||
| 367 | ; ...) | ||
| 368 | ; | ||
| 369 | ; (dx) = total length of desired name record | ||
| 370 | ; (ds) = SEG CODE | ||
| 371 | ; (bl) = sum byte | ||
| 372 | ; (TOS+2:TOS) = name string address | ||
| 373 | |||
| 374 | fnm20: | ||
| 375 | mov ax,dx ; (ax) = size wanted | ||
| 376 | sub dx,mft_name ; (dx) = string length for reentry at fnm10 | ||
| 377 | push dx | ||
| 378 | push bx | ||
| 379 | call GCM ; garbage collect MFT | ||
| 380 | pop bx | ||
| 381 | pop dx | ||
| 382 | |||
| 383 | IF DEBUG | ||
| 384 | jnc fnm10j | ||
| 385 | ELSE | ||
| 386 | jnc fnm10 ; go back and find that space | ||
| 387 | ENDIF | ||
| 388 | |||
| 389 | ;--------------------------------------- | ||
| 390 | ; no space, return w/error | ||
| 391 | ;--------------------------------------- | ||
| 392 | |||
| 393 | fnm50: pop ax | ||
| 394 | pop ax ; clean stack | ||
| 395 | mov ax,error_sharing_buffer_exceeded | ||
| 396 | stc | ||
| 397 | |||
| 398 | ret | ||
| 399 | |||
| 400 | IF DEBUG | ||
| 401 | fnm10j: jmp fnm10 | ||
| 402 | ENDIF | ||
| 403 | |||
| 404 | EndProc FNM | ||
| 405 | |||
| 406 | BREAK <GCM - Garbage Collect MFT> | ||
| 407 | |||
| 408 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 409 | ; | ||
| 410 | ; GCM - Garbage Collect MFT | ||
| 411 | ; | ||
| 412 | ; GCM runs down the MFT structure squeezing out the free space and | ||
| 413 | ; putting it into one free block at the end. This is a traditional heap | ||
| 414 | ; collection process. We must be sure to update the pointer in the | ||
| 415 | ; SFTs. This presumes no adjacent free blocks. | ||
| 416 | ; | ||
| 417 | ; ENTRY (ax) = space desired in last free block | ||
| 418 | ; (DS) + SEG CODE | ||
| 419 | ; EXIT 'C' clear if enough space in block | ||
| 420 | ; 'C' set if not enough space | ||
| 421 | ; | ||
| 422 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 423 | |||
| 424 | Procedure GCM,NEAR | ||
| 425 | |||
| 426 | push ax ; save target | ||
| 427 | off si,mft ; (si) = from pointer | ||
| 428 | mov di,si ; (di) = to pointer | ||
| 429 | |||
| 430 | ;--------------------------------------- | ||
| 431 | ; (DI) points to the beginning of | ||
| 432 | ; a free space block | ||
| 433 | ; (SI) points to the next block. | ||
| 434 | ;--------------------------------------- | ||
| 435 | |||
| 436 | gcm1: mov cx,[si].mft_len ; (cx) = size of whatever it is | ||
| 437 | cmp [si].mft_flag,MFLG_FRE | ||
| 438 | jl gcm10 ; END marker | ||
| 439 | jnz gcm2 ; have a name record | ||
| 440 | |||
| 441 | ;--------------------------------------- | ||
| 442 | ; (SI) points to a free block. | ||
| 443 | ; We coalesce it by changing the size. | ||
| 444 | ;--------------------------------------- | ||
| 445 | cmp si,di | ||
| 446 | jz gcm15 ; do NOT coalesce a block with itself | ||
| 447 | add [di].mft_len,cx ; coalesce | ||
| 448 | gcm15: | ||
| 449 | add si,cx ; skip the empty one | ||
| 450 | JMP SHORT gcm1 | ||
| 451 | ;--------------------------------------- | ||
| 452 | ; (SI) points to a non-free, | ||
| 453 | ; non-last block. | ||
| 454 | ; (DI) points to the beginning of a | ||
| 455 | ; free block. | ||
| 456 | ; | ||
| 457 | ; We move the non-free block down over | ||
| 458 | ; the free block | ||
| 459 | ;--------------------------------------- | ||
| 460 | gcm2: cmp si,di | ||
| 461 | jnz gcm3 ; have to copy | ||
| 462 | |||
| 463 | ;--------------------------------------- | ||
| 464 | ; SI = DI => we are at a boundary | ||
| 465 | ; between allocated blocks. | ||
| 466 | ; We do no copying. | ||
| 467 | ;--------------------------------------- | ||
| 468 | add si,cx | ||
| 469 | mov di,si ; no emptys yet... no need to copy | ||
| 470 | JMP SHORT gcm1 | ||
| 471 | ;--------------------------------------- | ||
| 472 | ; CX is length of allocated block. | ||
| 473 | ; - Move it | ||
| 474 | ;--------------------------------------- | ||
| 475 | |||
| 476 | gcm3: mov bx,di ; (DS:BX) = new home for this record | ||
| 477 | mov ax,ds | ||
| 478 | mov es,ax | ||
| 479 | rep movsb | ||
| 480 | ;--------------------------------------- | ||
| 481 | ; We've moved the record, now fix up | ||
| 482 | ; the pointers in the SFT chain | ||
| 483 | ; | ||
| 484 | ; (si) = address of next record | ||
| 485 | ; (di) = address of next free byte | ||
| 486 | ; (bx) = address of record in its new home | ||
| 487 | ; (TOS) = needed space | ||
| 488 | ;--------------------------------------- | ||
| 489 | push di | ||
| 490 | push ds | ||
| 491 | lds di,[bx].mft_sptr ; (ds:di) = chain of SFT | ||
| 492 | gcm4: or di,di | ||
| 493 | jz gcm5 ; no more SFT | ||
| 494 | mov [di].sf_mft,bx ; install new MFT position | ||
| 495 | lds di,[di].sf_chain ; link to next | ||
| 496 | JMP gcm4 ; fix next SFT | ||
| 497 | |||
| 498 | gcm5: pop ds | ||
| 499 | pop di | ||
| 500 | ;--------------------------------------- | ||
| 501 | ; (DI) points to beginning of | ||
| 502 | ; new free record (moved) | ||
| 503 | ; (SI) points to next record | ||
| 504 | ; | ||
| 505 | ; Make sure that the (DI) record | ||
| 506 | ; has correct format | ||
| 507 | ;--------------------------------------- | ||
| 508 | |||
| 509 | mov [di].mft_flag,MFLG_FRE ; indicate free record | ||
| 510 | mov [di].mft_len,si ; calculate correct length | ||
| 511 | sub [di].mft_len,di | ||
| 512 | ;--------------------------------------- | ||
| 513 | ; MFT now has correct record structure. | ||
| 514 | ; Go find more free blocks | ||
| 515 | ;--------------------------------------- | ||
| 516 | JMP SHORT gcm1 | ||
| 517 | ;--------------------------------------- | ||
| 518 | ; We have scanned the entire table, | ||
| 519 | ; compacting all empty records together. | ||
| 520 | ; | ||
| 521 | ; (di) = first free byte in table | ||
| 522 | ; (si) = address of END record | ||
| 523 | ; (TOS) = size needed | ||
| 524 | ; | ||
| 525 | ; Be extra careful!!! | ||
| 526 | ;--------------------------------------- | ||
| 527 | gcm10: mov ax,si | ||
| 528 | sub ax,di ; (ax) = free space | ||
| 529 | pop bx ; (bx) = space wanted | ||
| 530 | sub ax,bx | ||
| 531 | |||
| 532 | ret | ||
| 533 | |||
| 534 | EndProc GCM | ||
| 535 | |||
| 536 | BREAK <RMN - Remove MFT Name record> | ||
| 537 | |||
| 538 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 539 | ; | ||
| 540 | ; RMN - Remove MFT Name record | ||
| 541 | ; | ||
| 542 | ; RMN removes a name record from the MFT list. The record is marked | ||
| 543 | ; free and all free space is coalesced. | ||
| 544 | ; | ||
| 545 | ; ENTRY (DS:BX) = FBA MFT name record | ||
| 546 | ; EXIT to INTERR if lock and SFT chains are not empty | ||
| 547 | ; USES ALL | ||
| 548 | ; | ||
| 549 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 550 | |||
| 551 | Procedure RMN,NEAR | ||
| 552 | |||
| 553 | mov si,bx | ||
| 554 | mov ax,word ptr [si].mft_sptr | ||
| 555 | or ax,word ptr [si].mft_lptr | ||
| 556 | jnz RMNIER1 ; not clean - internal error | ||
| 557 | mov si,bx ; (ds:si) = fwa name record | ||
| 558 | |||
| 559 | mov [si].mft_flag,MFLG_FRE ; mark free | ||
| 560 | |||
| 561 | call mrg ; coalesce all free space | ||
| 562 | |||
| 563 | ret | ||
| 564 | |||
| 565 | RMNIER1:push ax | ||
| 566 | off ax,rmnerr1 | ||
| 567 | |||
| 568 | RMNIER: call INTERR ; internal error | ||
| 569 | |||
| 570 | rmnerr1 db "RMN: SFT LCK fields not 0", 13, 10, 0 | ||
| 571 | |||
| 572 | EndProc RMN | ||
| 573 | |||
| 574 | Break <MRG - merge all free space> | ||
| 575 | |||
| 576 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 577 | ; | ||
| 578 | ; MRG - merge all free space | ||
| 579 | ; | ||
| 580 | ; MRG - walk through mft merging adjacent free space. | ||
| 581 | ; | ||
| 582 | ; Inputs: ds = CS | ||
| 583 | ; Outputs: none (all free space coalesced) | ||
| 584 | ; Registers Revised: none | ||
| 585 | ; | ||
| 586 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 587 | |||
| 588 | Procedure MRG,near | ||
| 589 | |||
| 590 | assume ds:nothing,es:nothing | ||
| 591 | |||
| 592 | push si | ||
| 593 | push bx | ||
| 594 | |||
| 595 | off si,mft ; start at beginning | ||
| 596 | mrg1: mov bx,[si].mft_len ; get length | ||
| 597 | cmp [si].mft_flag,MFLG_FRE ; is record free? | ||
| 598 | jl mrg9 ; done. | ||
| 599 | jz mrg2 ; yes, try to merge with next | ||
| 600 | mrg15: add si,bx ; advance to next | ||
| 601 | jmp mrg1 | ||
| 602 | ;--------------------------------------- | ||
| 603 | ; (si) points to free record. | ||
| 604 | ; - See if next is free | ||
| 605 | ;--------------------------------------- | ||
| 606 | mrg2: cmp [bx][si].mft_flag,MFLG_FRE | ||
| 607 | jnz mrg15 ; not free, go scan again | ||
| 608 | mov bx,[bx][si].mft_len ; get length of next guy | ||
| 609 | add [si].mft_len,bx ; increase our length | ||
| 610 | jmp mrg1 ; and check again | ||
| 611 | mrg9: pop bx | ||
| 612 | pop si | ||
| 613 | |||
| 614 | ret | ||
| 615 | |||
| 616 | EndProc MRG | ||
| 617 | |||
| 618 | BREAK <RSC - Remove SFT from SFT chain> | ||
| 619 | |||
| 620 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 621 | ; | ||
| 622 | ; RSC - Remove SFT from SFT chain | ||
| 623 | ; | ||
| 624 | ; RSC removes a given SFT from its chain. The caller must insure that | ||
| 625 | ; any locks have been cleared and that the SFT is indeed free. The | ||
| 626 | ; sf_mft field is zeroed to indicate that this SFT is no longer chained. | ||
| 627 | ; | ||
| 628 | ; NOTE - RSC does NOT remove the name record if this was the last SFT on | ||
| 629 | ; it. The caller must check for this and remove it, if | ||
| 630 | ; necessary. | ||
| 631 | ; | ||
| 632 | ; ENTRY (ES:DI) = SFT address | ||
| 633 | ; EXIT (DS:BX) = FBA name record for this SFT | ||
| 634 | ; 'Z' set if this is the last SFT | ||
| 635 | ; USES ALL | ||
| 636 | ; | ||
| 637 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 638 | |||
| 639 | Procedure RSC,NEAR | ||
| 640 | |||
| 641 | push cs | ||
| 642 | pop ds | ||
| 643 | |||
| 644 | mov ax,es ; easy spot for compare | ||
| 645 | mov bx,es:[di].sf_mft | ||
| 646 | lea si,[bx].mft_sptr-sf_chain ; ds:[si].sf_chain point to prev link | ||
| 647 | rsc1: or si,si | ||
| 648 | jz rscier | ||
| 649 | cmp word ptr [si].sf_chain,di | ||
| 650 | jnz rsc15 | ||
| 651 | cmp word ptr [si].sf_chain+2,ax | ||
| 652 | jz rsc2 | ||
| 653 | rsc15: lds si,[si].sf_chain | ||
| 654 | jmp rsc1 | ||
| 655 | ;--------------------------------------- | ||
| 656 | ; (es:di) is sft | ||
| 657 | ; (ds:si) is prev sft link | ||
| 658 | ;--------------------------------------- | ||
| 659 | rsc2: mov ax,word ptr es:[di].sf_chain | ||
| 660 | mov word ptr ds:[si].sf_chain,ax | ||
| 661 | mov ax,word ptr es:[di].sf_chain+2 | ||
| 662 | mov word ptr ds:[si].sf_chain+2,ax | ||
| 663 | |||
| 664 | push cs | ||
| 665 | pop ds | ||
| 666 | xor bx,bx | ||
| 667 | xchg bx,es:[di].sf_MFT ; (DS:bx) = MFT address | ||
| 668 | ; and 0 MFT pointer (show free) | ||
| 669 | cmp word ptr [bx].mft_sptr,0 ; set z flag if no more sft | ||
| 670 | |||
| 671 | ret | ||
| 672 | |||
| 673 | rscier: push ax | ||
| 674 | off ax,rscerr | ||
| 675 | |||
| 676 | call interr | ||
| 677 | |||
| 678 | rscerr db "RSC: SFT not in SFT list", 13, 10, 0 | ||
| 679 | |||
| 680 | EndProc RSC | ||
| 681 | |||
| 682 | BREAK <SLE - Scan for Lock Entry> | ||
| 683 | |||
| 684 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 685 | ; | ||
| 686 | ; SLE - Scan for Lock Entry | ||
| 687 | ; | ||
| 688 | ; SLE scans a lock list looking for a lock range that overlaps the | ||
| 689 | ; caller-supplied range. SLE indicates: | ||
| 690 | ; | ||
| 691 | ; no overlap | ||
| 692 | ; partial overlay | ||
| 693 | ; 1-to-1 match | ||
| 694 | ; | ||
| 695 | ; ENTRY (AX:BX) = FBA of area | ||
| 696 | ; (CX:DX) = LBA of area | ||
| 697 | ; (DS:SI) = address of name record | ||
| 698 | ; (DI) = 0 to ignore locks by User_ID Proc_ID ThisSFT | ||
| 699 | ; = 1 to consider all locks | ||
| 700 | ; EXIT 'C' clear if no overlap | ||
| 701 | ; AX,BX,CX,DX preserved | ||
| 702 | ; 'C' set if overlap | ||
| 703 | ; (di) = address of pointer to found record | ||
| 704 | ; (i.e., DS:((di)) = address of lock record) | ||
| 705 | ; 'Z' set if 1-to-1 match | ||
| 706 | ; USES ALL but (ds), (es) (also see EXIT) | ||
| 707 | ; | ||
| 708 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 709 | |||
| 710 | Procedure SLE,NEAR | ||
| 711 | |||
| 712 | push es | ||
| 713 | and di,di | ||
| 714 | pushf ; Z set to ignore own locks | ||
| 715 | lea di,[si].mft_lptr ; (ds:di) = addr of ptr to lock record | ||
| 716 | mov si,[di] ; (ds:si) = address of 1st lock record | ||
| 717 | |||
| 718 | ;--------------------------------------- | ||
| 719 | ; check out next lock | ||
| 720 | ; | ||
| 721 | ; (ds:si) = address of next lock record | ||
| 722 | ; (ds:di) = address of pointer to next | ||
| 723 | ; lock record | ||
| 724 | ; (TOS) = flags (Z set to ignore | ||
| 725 | ; own locks) | ||
| 726 | ; (TOS+1) = Saved ES | ||
| 727 | ;--------------------------------------- | ||
| 728 | sle1: and si,si | ||
| 729 | jz sle9 ; list exhaused, ergo no overlap | ||
| 730 | popf ; | ||
| 731 | pushf | ||
| 732 | jnz sle2 ; am to check all locks | ||
| 733 | |||
| 734 | ;--------------------------------------- | ||
| 735 | ; am to ignore own locks... | ||
| 736 | ; check the user and proc IDs on this one | ||
| 737 | ;--------------------------------------- | ||
| 738 | |||
| 739 | ;dcl - this code used to compare the process id in the sft pointed to by the | ||
| 740 | ; lock. now we compare the lock process id to the current process id. this | ||
| 741 | ; allows a child process to lock an area and then do i/o with it. before, | ||
| 742 | ; the child could lock it, but then could not access it | ||
| 743 | |||
| 744 | |||
| 745 | mov bp,[si].rlr_pid ;dcl | ||
| 746 | cmp bp,Proc_id ;dcl | ||
| 747 | jnz sce1$5 ;dcl | ||
| 748 | les si,[si].rlr_sptr ; (si) = sft address ;dcl | ||
| 749 | mov bp,es:[si].sf_UID ;dcl | ||
| 750 | cmp bp,User_ID ;dcl | ||
| 751 | jnz sce1$5 ; doesn't belong to user ;dcl | ||
| 752 | mov bp,es ;dcl | ||
| 753 | cmp bp,WORD PTR ThisSFT+2 | ||
| 754 | jnz sce1$5 | ||
| 755 | cmp si,WORD PTR ThisSFT | ||
| 756 | sce1$5: mov si,[di] ; (ds:si) = address of next lock record | ||
| 757 | jz sle3 ; owned by user - ignore | ||
| 758 | |||
| 759 | sle2: mov bp,dx | ||
| 760 | sub bp,[si].rlr_fba ; compare proposed last to first of record | ||
| 761 | mov bp,cx | ||
| 762 | sbb bp,[si].rlr_fba+2 | ||
| 763 | jc sle3 ; proposed is above current | ||
| 764 | mov bp,[si].rlr_lba | ||
| 765 | sub bp,bx ; compare proposed first to last of record | ||
| 766 | mov bp,[si].rlr_lba+2 | ||
| 767 | sbb bp,ax | ||
| 768 | jnc sle5 ; we have a hit | ||
| 769 | |||
| 770 | ;--------------------------------------- | ||
| 771 | ; This entry is harmless... | ||
| 772 | ; chain to the next one | ||
| 773 | ;--------------------------------------- | ||
| 774 | ERRNZ rlr_next | ||
| 775 | |||
| 776 | sle3: mov di,si ; save addr of pointer to next | ||
| 777 | mov si,[di] | ||
| 778 | JMP SHORT sle1 | ||
| 779 | ;--------------------------------------- | ||
| 780 | ; We have an overlap. | ||
| 781 | ; - See if its an exact match | ||
| 782 | ; | ||
| 783 | ; (ds:di) = address of pointer | ||
| 784 | ; (offset only) to the lock record | ||
| 785 | ; (ds:si) = address of lock record | ||
| 786 | ; (TOS) = flags ('Z' set if to ignore | ||
| 787 | ; own locks) | ||
| 788 | ; (TOS+1) = saved (es) | ||
| 789 | ;--------------------------------------- | ||
| 790 | |||
| 791 | sle5: xor ax,[si].rlr_fba+2 ; require a 4-word match | ||
| 792 | xor bx,[si].rlr_fba | ||
| 793 | xor cx,[si].rlr_lba+2 | ||
| 794 | xor dx,[si].rlr_lba | ||
| 795 | or ax,bx | ||
| 796 | or ax,cx | ||
| 797 | or ax,dx ; 'Z' set if exact match | ||
| 798 | stc ; flag an overlap | ||
| 799 | mov ax,error_lock_violation | ||
| 800 | sle9: pop bp ; discard flags (pushf) | ||
| 801 | pop es ; restore (es) | ||
| 802 | |||
| 803 | ;--------------------------------------- | ||
| 804 | ; (ds:si) = address of lock record | ||
| 805 | ; for Chk_Block | ||
| 806 | ;--------------------------------------- | ||
| 807 | ret | ||
| 808 | |||
| 809 | EndProc SLE | ||
| 810 | |||
| 811 | BREAK <OFL - obtain free lock-record> | ||
| 812 | |||
| 813 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 814 | ; | ||
| 815 | ; OFL - obtain free lock-record | ||
| 816 | ; | ||
| 817 | ; OFL returns a free lock-record, if one can be had. | ||
| 818 | ; | ||
| 819 | ; ENTRY (DS) = MFT Segment | ||
| 820 | ; EXIT 'C' clear if OK | ||
| 821 | ; (DI) = FBA lock record | ||
| 822 | ; 'C' set if no space | ||
| 823 | ; (ax) = error code | ||
| 824 | ; USES DI, FLAGS | ||
| 825 | ; | ||
| 826 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 827 | |||
| 828 | Procedure OFL,NEAR | ||
| 829 | |||
| 830 | mov di,Frelock | ||
| 831 | and di,di | ||
| 832 | |||
| 833 | ; $if nz ; if something there | ||
| 834 | JZ $$IF1 | ||
| 835 | |||
| 836 | push [di].rlr_next | ||
| 837 | pop Frelock ; chain off of the list | ||
| 838 | ; exit with 'C' clear | ||
| 839 | |||
| 840 | ; $else ; none on free list | ||
| 841 | JMP SHORT $$EN1 | ||
| 842 | $$IF1: | ||
| 843 | |||
| 844 | mov ax,error_sharing_buffer_exceeded ; None on free list, give up until | ||
| 845 | stc ; garbage collector is ready | ||
| 846 | |||
| 847 | ; $endif | ||
| 848 | $$EN1: | ||
| 849 | |||
| 850 | ret | ||
| 851 | |||
| 852 | EndProc OFL | ||
| 853 | |||
| 854 | Break <CPS - close process SFT> | ||
| 855 | |||
| 856 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 857 | ; | ||
| 858 | ; CPS - close process SFT. | ||
| 859 | ; | ||
| 860 | ; During maintenance, it is necessary to close a | ||
| 861 | ; file given ONLY the SFT. This necessitates walking all PDB's JFN | ||
| 862 | ; tables looking for the SFN. The difficult part is in generating the | ||
| 863 | ; SFN from the SFT. This is done by enumerating SFT's and comparing for | ||
| 864 | ; the correct SFT. Finding all PDBs is easy: walk arena and check | ||
| 865 | ; owner fields | ||
| 866 | ; | ||
| 867 | ; Inputs: ThisSFT points to SFT of interest | ||
| 868 | ; Outputs: Handle is closed on user | ||
| 869 | ; Registers Revised: none | ||
| 870 | ; | ||
| 871 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 872 | |||
| 873 | Procedure CPS,NEAR | ||
| 874 | |||
| 875 | ASSUME DS:NOTHING,ES:NOTHING | ||
| 876 | |||
| 877 | SaveReg <DS,SI,ES,DI,AX,BX,CX> | ||
| 878 | |||
| 879 | lds si,ThisSFT | ||
| 880 | xor bx,bx | ||
| 881 | cps01: | ||
| 882 | |||
| 883 | CallInstall SFFromSFN,multDOS,22,bx,bx | ||
| 884 | |||
| 885 | jc cps31 ; no more SFN's. Must be FCB. | ||
| 886 | |||
| 887 | CallInstall PointComp,multDOS,20 | ||
| 888 | |||
| 889 | jz cps02 ; found matching SFN, go scan. | ||
| 890 | inc bx ; did not match, go back for more | ||
| 891 | jmp cps01 | ||
| 892 | ;--------------------------------------- | ||
| 893 | ; BL is the sfn we want to find. Walk | ||
| 894 | ; the memory arena enumerating all PDB's | ||
| 895 | ; and zap the handle tables for the | ||
| 896 | ; specified sfn. | ||
| 897 | ;--------------------------------------- | ||
| 898 | cps02: | ||
| 899 | mov al,bl | ||
| 900 | mov ds,Arena_Head ; get first arena pointer | ||
| 901 | |||
| 902 | ;--------------------------------------- | ||
| 903 | ; DS:[0] is the arena header. | ||
| 904 | ; AL is sfn to be closed | ||
| 905 | ;--------------------------------------- | ||
| 906 | cps1: | ||
| 907 | mov cx,ds:[arena_owner] | ||
| 908 | mov bx,ds | ||
| 909 | inc bx ; is the owner the same as the current | ||
| 910 | cmp cx,bx ; block? | ||
| 911 | jnz cps2 ; no, go skip some more... | ||
| 912 | |||
| 913 | ;--------------------------------------- | ||
| 914 | ; CX:0 is the correct pointer to a PDB. | ||
| 915 | ;--------------------------------------- | ||
| 916 | push ds | ||
| 917 | mov ds,cx | ||
| 918 | ;--------------------------------------- | ||
| 919 | ; Given a PDB at DS:0, scan his handle | ||
| 920 | ; table and then loop through the next | ||
| 921 | ; PDB link. | ||
| 922 | ;--------------------------------------- | ||
| 923 | cps15: | ||
| 924 | call CPJ ; free for this PDB | ||
| 925 | lds cx,DS:[PDB_Next_PDB] ; advance to next | ||
| 926 | cmp cx,-1 | ||
| 927 | jnz cps15 ; there is another link to process | ||
| 928 | pop ds | ||
| 929 | ;--------------------------------------- | ||
| 930 | ; We have processed the current | ||
| 931 | ; allocation block pointed to by DS. | ||
| 932 | ; DS:[0] is the allocation block | ||
| 933 | ;--------------------------------------- | ||
| 934 | cps2: | ||
| 935 | cmp ds:[arena_signature],arena_signature_end | ||
| 936 | jz cps3 ; no more blocks to do | ||
| 937 | mov bx,ds ; get current address | ||
| 938 | add bx,DS:[Arena_size] ; add on size of block | ||
| 939 | inc bx ; remember size of header | ||
| 940 | mov ds,bx ; link to next | ||
| 941 | jmp cps1 | ||
| 942 | ;--------------------------------------- | ||
| 943 | ; Just for good measure, use CurrentPDB | ||
| 944 | ; and clean off him | ||
| 945 | ;--------------------------------------- | ||
| 946 | cps3: | ||
| 947 | mov ds,CurrentPDB | ||
| 948 | |||
| 949 | call CPJ | ||
| 950 | |||
| 951 | cps31: | ||
| 952 | |||
| 953 | RestoreReg < | ||
| 954 | |||
| 955 | RestoreReg <CX,BX,AX,DI,ES,SI,DS> | ||
| 956 | |||
| 957 | ret | ||
| 958 | |||
| 959 | EndProc CPS | ||
| 960 | |||
| 961 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 962 | ; | ||
| 963 | ; CPJ - | ||
| 964 | ; | ||
| 965 | ; Scan JFN table for SFT # and put in -1 if found | ||
| 966 | ; | ||
| 967 | ; Input: DS:0 is PDB | ||
| 968 | ; AL is SFT index # of interest | ||
| 969 | ; | ||
| 970 | ; Output: None | ||
| 971 | ; | ||
| 972 | ; Uses: Flags,CX,ES,DI | ||
| 973 | ; | ||
| 974 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 975 | |||
| 976 | Procedure CPJ,NEAR | ||
| 977 | |||
| 978 | assume ds:nothing,es:nothing | ||
| 979 | |||
| 980 | mov cx,ds:[PDB_JFN_length] | ||
| 981 | les di,ds:[PDB_JFN_pointer] | ||
| 982 | cld | ||
| 983 | cpj1: repne scasb | ||
| 984 | |||
| 985 | retnz ; none found | ||
| 986 | |||
| 987 | mov byte ptr es:[di-1],-1 ; free this | ||
| 988 | jcxz CPJret ; Found one in last JFN entry | ||
| 989 | jmp cpj1 ; keep looking | ||
| 990 | CPJret: | ||
| 991 | |||
| 992 | ret | ||
| 993 | |||
| 994 | EndProc CPJ | ||
| 995 | |||
| 996 | Break <SFM - convert an mft pointer into a serial number> | ||
| 997 | |||
| 998 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 999 | ; | ||
| 1000 | ; SFM - convert a pointer to a mft entry into the serial number for that | ||
| 1001 | ; entry. We keep these around to see if a FCB really points to the correct | ||
| 1002 | ; SFT. | ||
| 1003 | ; | ||
| 1004 | ; Inputs: BX is the mft pointer | ||
| 1005 | ; Outputs: BX is the serial number | ||
| 1006 | ; Registers Revised: none | ||
| 1007 | ; | ||
| 1008 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1009 | |||
| 1010 | Procedure SFM,NEAR | ||
| 1011 | |||
| 1012 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 1013 | |||
| 1014 | mov bx,cs:[bx].mft_serl | ||
| 1015 | |||
| 1016 | ret | ||
| 1017 | |||
| 1018 | EndProc SFM | ||
| 1019 | |||
| 1020 | Break <ShChk - check a fcb for share related information> | ||
| 1021 | |||
| 1022 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1023 | ; | ||
| 1024 | ; ShChk - check a fcb for share related information | ||
| 1025 | ; | ||
| 1026 | ; ShChk - checks the reserved field contents of an FCB with a SFT to see | ||
| 1027 | ; if they represent the same file. The open ref count must be > 0. | ||
| 1028 | ; | ||
| 1029 | ; Inputs: DS:SI point to FCB | ||
| 1030 | ; ES:DI point to SFT | ||
| 1031 | ; Outputs: Carry Set if contents do not match | ||
| 1032 | ; Carry clear if contents match | ||
| 1033 | ; BX has first cluster | ||
| 1034 | ; Registers Revised: none | ||
| 1035 | ; | ||
| 1036 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1037 | |||
| 1038 | Procedure ShChk,NEAR | ||
| 1039 | |||
| 1040 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 1041 | |||
| 1042 | CMP ES:[DI].sf_ref_count,0 | ||
| 1043 | JZ BadSFT | ||
| 1044 | MOV BX,ES:[DI].sf_mft ; Local file or dev with sharing | ||
| 1045 | |||
| 1046 | call SFM | ||
| 1047 | |||
| 1048 | CMP BX,[SI].fcb_l_mfs | ||
| 1049 | JNZ BadSFT | ||
| 1050 | MOV BX,[SI].fcb_l_firclus | ||
| 1051 | |||
| 1052 | ret | ||
| 1053 | |||
| 1054 | BadSFT: stc | ||
| 1055 | |||
| 1056 | ret | ||
| 1057 | |||
| 1058 | EndProc ShChk | ||
| 1059 | |||
| 1060 | Break <ShSave - save information from SFT into an FCB> | ||
| 1061 | |||
| 1062 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1063 | ; | ||
| 1064 | ; ShSave - save information from SFT into an FCB | ||
| 1065 | ; | ||
| 1066 | ; ShSave - copy information into the reserved area of an FCB from a SFT. | ||
| 1067 | ; This is so that we can later match the SFT with the FCB. | ||
| 1068 | ; | ||
| 1069 | ; Inputs: ES:DI point to SFT | ||
| 1070 | ; DS:SI point to FCB | ||
| 1071 | ; Outputs: FCB reserved field is filled in | ||
| 1072 | ; BL = FCBSHARE | ||
| 1073 | ; Registers Revised: AX,BX | ||
| 1074 | ; | ||
| 1075 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1076 | |||
| 1077 | Procedure ShSave,NEAR | ||
| 1078 | |||
| 1079 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 1080 | |||
| 1081 | MOV AL,ES:[DI].sf_attr ; move attribute (for reopen) | ||
| 1082 | MOV [SI].FCB_l_attr,AL | ||
| 1083 | MOV AX,ES:[DI].sf_firclus ; get first cluster | ||
| 1084 | MOV [SI].FCB_l_firclus,AX | ||
| 1085 | MOV BX,ES:[DI].sf_mft ; get sharing pointer | ||
| 1086 | |||
| 1087 | call SFM | ||
| 1088 | |||
| 1089 | MOV [SI].FCB_l_mfs,BX | ||
| 1090 | MOV BL,FCBSHARE | ||
| 1091 | |||
| 1092 | ret | ||
| 1093 | |||
| 1094 | EndProc ShSave | ||
| 1095 | |||
| 1096 | Break <ShCol - collapse identical handle SFTs in mode 70 only> | ||
| 1097 | |||
| 1098 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1099 | ; | ||
| 1100 | ; ShCol - collapse identical handle SFTs in mode 70 only | ||
| 1101 | ; | ||
| 1102 | ; ShCol - collapse same 70-mode handles together. This represents network | ||
| 1103 | ; originated FCBs. Since FCB's are incredibly mis-behaved, we collapse the | ||
| 1104 | ; SFT's for identical files, thus using a single sft for each file instead | ||
| 1105 | ; of a separate sft for each instance of the file. | ||
| 1106 | ; | ||
| 1107 | ; Note that the redirectors will collapse multiple instances of these | ||
| 1108 | ; files together. FCB's are pretty misbehaved, so the redirector will | ||
| 1109 | ; inform us of EACH close done on an FCB. Therefore, we must increment | ||
| 1110 | ; the ref count each time we see a collapse here. | ||
| 1111 | ; | ||
| 1112 | ; Inputs: DS:SI ThisSFT has new sft to find. | ||
| 1113 | ; Outputs: Carry set - no matching SFT was found | ||
| 1114 | ; Carry clear - matching SFT was found and all collapsing done. | ||
| 1115 | ; AX has proper handle | ||
| 1116 | ; Registers Revised: all. | ||
| 1117 | ; | ||
| 1118 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1119 | |||
| 1120 | Procedure ShCol,NEAR | ||
| 1121 | |||
| 1122 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGROUP | ||
| 1123 | |||
| 1124 | ;--------------------------------------- | ||
| 1125 | ; Collapse the files ONLY if | ||
| 1126 | ; the mode is for net FCB's | ||
| 1127 | ;--------------------------------------- | ||
| 1128 | |||
| 1129 | MOV AL,BYTE PTR [SI].sf_mode | ||
| 1130 | AND AL,sharing_mask | ||
| 1131 | CMP AL,sharing_net_FCB | ||
| 1132 | JNZ UseJFN | ||
| 1133 | |||
| 1134 | ;--------------------------------------- | ||
| 1135 | ; In share support | ||
| 1136 | ;--------------------------------------- | ||
| 1137 | |||
| 1138 | XOR BX,BX ; for (i=0; sffromsfn(i); i++) { | ||
| 1139 | OpenScan: | ||
| 1140 | |||
| 1141 | CallInstall SFFromSFN,multDOS,22,bx,bx | ||
| 1142 | |||
| 1143 | JC UseJFN | ||
| 1144 | |||
| 1145 | CallInstall PointComp,multDOS,20 ; if (!pointcomp (s,d)) | ||
| 1146 | |||
| 1147 | JZ OpenNext | ||
| 1148 | CMP ES:[DI].sf_ref_count,0 | ||
| 1149 | JZ OpenNext | ||
| 1150 | MOV AX,ES:[DI].sf_mode | ||
| 1151 | CMP AX,[SI].sf_mode | ||
| 1152 | JNZ OpenNext | ||
| 1153 | MOV AX,ES:[DI].sf_mft | ||
| 1154 | CMP AX,[SI].sf_mft | ||
| 1155 | JNZ OpenNext | ||
| 1156 | MOV AX,WORD PTR ES:[DI].sf_UID | ||
| 1157 | CMP AX,WORD PTR [SI].sf_uid | ||
| 1158 | JNZ OpenNext | ||
| 1159 | MOV AX,WORD PTR ES:[DI].sf_pid | ||
| 1160 | CMP AX,WORD PTR [SI].sf_pid | ||
| 1161 | JZ OpenFound | ||
| 1162 | OpenNext: | ||
| 1163 | INC BX | ||
| 1164 | JMP OpenScan | ||
| 1165 | ;-------------------------------------- | ||
| 1166 | ; DS:SI points to an sft which is a | ||
| 1167 | ; duplicate of that found in | ||
| 1168 | ; ES:DI is the older one. | ||
| 1169 | ; | ||
| 1170 | ; We call mftclose to release the | ||
| 1171 | ; appropriate info. | ||
| 1172 | ;-------------------------------------- | ||
| 1173 | OpenFound: | ||
| 1174 | MOV [SI].sf_ref_count,0 ; free 'new' sft | ||
| 1175 | |||
| 1176 | SaveReg <DS,SI,ES,DI,BX> | ||
| 1177 | |||
| 1178 | Context DS | ||
| 1179 | |||
| 1180 | LES DI,ThisSFT | ||
| 1181 | |||
| 1182 | call MFTClose | ||
| 1183 | |||
| 1184 | RestoreReg <AX,DI,ES,SI,DS> | ||
| 1185 | |||
| 1186 | ASSUME DS:NOTHING | ||
| 1187 | |||
| 1188 | INC ES:[DI].sf_ref_count ; d->refcount++; | ||
| 1189 | XOR BX,BX ; find jfn with sfn as contents | ||
| 1190 | JFNScan: | ||
| 1191 | |||
| 1192 | CallInstall pJFNFromHandle,multDOS,32,AX,AX | ||
| 1193 | |||
| 1194 | JC UseJFN ; ran out of handles? | ||
| 1195 | CMP AL,BYTE PTR ES:[DI] ; does JFN have SFN? | ||
| 1196 | jz JFNfound ; YES, go return JFN | ||
| 1197 | INC BX ; no, look at next | ||
| 1198 | JMP JFNScan | ||
| 1199 | JFNFound: | ||
| 1200 | LDS SI,pJFN | ||
| 1201 | MOV BYTE PTR [SI],0FFh ; free JFN | ||
| 1202 | MOV AX,BX ; return JFN | ||
| 1203 | |||
| 1204 | ret | ||
| 1205 | |||
| 1206 | UseJFN: | ||
| 1207 | MOV AX,JFN | ||
| 1208 | |||
| 1209 | ret | ||
| 1210 | |||
| 1211 | EndProc ShCol | ||
| 1212 | |||
| 1213 | Break <ShCloseFile - close a particular file for a particular UID/PID> | ||
| 1214 | |||
| 1215 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1216 | ; | ||
| 1217 | ; ShCloseFile - close a particular file for a particular UID/PID | ||
| 1218 | ; | ||
| 1219 | ; ShCloseFile - Compatability mode programs will often delete files that | ||
| 1220 | ; they had open. This was perfectly valid in the 2.0 days, but this | ||
| 1221 | ; presents a reliability problem in the network based operating environment. | ||
| 1222 | ; As a result, both RENAME and DELETE will call us to see if the file is | ||
| 1223 | ; open by is only. If it is not open or is open by us only, we close it. | ||
| 1224 | ; Note that we will ONLY close compatability SFTs. | ||
| 1225 | ; Otherwise, we signal and error. | ||
| 1226 | ; | ||
| 1227 | ; Inputs: WFT_Start has a DOSGROUP offset to the file name | ||
| 1228 | ; DS is DOSGroup | ||
| 1229 | ; Outputs: nothing relevant. | ||
| 1230 | ; Registers Revised: None. | ||
| 1231 | ; | ||
| 1232 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1233 | |||
| 1234 | Procedure ShCloseFile,NEAR | ||
| 1235 | |||
| 1236 | ASSUME DS:DOSGroup,ES:NOTHING,SS:DOSGroup | ||
| 1237 | |||
| 1238 | SaveReg <AX,BX,CX,DX,SI,DI,BP,DS,ES> | ||
| 1239 | |||
| 1240 | EnterCrit critShare | ||
| 1241 | |||
| 1242 | ShCl: | ||
| 1243 | MOV SI,WFP_Start | ||
| 1244 | XOR AL,AL | ||
| 1245 | |||
| 1246 | call FNM ; attempt to find name in list | ||
| 1247 | |||
| 1248 | ASSUME DS:NOTHING | ||
| 1249 | |||
| 1250 | JC ShCloseDone ; can't find, signal success | ||
| 1251 | |||
| 1252 | ;-------------------------------------- | ||
| 1253 | ; We have found a file in the MFT. | ||
| 1254 | ; Walk the open sft list to find | ||
| 1255 | ; the SFTs for the current UID/PID. | ||
| 1256 | ;-------------------------------------- | ||
| 1257 | MOV CX,DS | ||
| 1258 | LDS SI,[BX].mft_sptr | ||
| 1259 | ShClCheck: | ||
| 1260 | MOV AX,Proc_ID | ||
| 1261 | CMP [SI].sf_PID,AX | ||
| 1262 | JNZ ShCloseDone | ||
| 1263 | MOV AX,User_ID | ||
| 1264 | CMP [SI].sf_UID,AX | ||
| 1265 | JNZ ShCloseDone | ||
| 1266 | MOV AX,[SI].sf_mode | ||
| 1267 | AND AX,sharing_mask | ||
| 1268 | CMP AX,sharing_net_fcb | ||
| 1269 | jz ShClNext | ||
| 1270 | CMP AX,sharing_compat | ||
| 1271 | jnz ShCloseDOne | ||
| 1272 | ShClNext: | ||
| 1273 | LDS SI,[SI].sf_chain | ||
| 1274 | OR SI,SI | ||
| 1275 | JNZ ShClCheck | ||
| 1276 | MOV DS,CX | ||
| 1277 | LDS SI,[BX].mft_sptr | ||
| 1278 | ;-------------------------------------- | ||
| 1279 | ; Everything matches. Set up ThisSFT | ||
| 1280 | ; and walk the chain from the beginning. | ||
| 1281 | ;-------------------------------------- | ||
| 1282 | MOV WORD PTR ThisSFT,SI | ||
| 1283 | MOV WORD PTR ThisSFT+2,DS | ||
| 1284 | ;-------------------------------------- | ||
| 1285 | ; Close all handles for this SFT | ||
| 1286 | ;-------------------------------------- | ||
| 1287 | call CPS | ||
| 1288 | ;-------------------------------------- | ||
| 1289 | ; Close the sft itself. | ||
| 1290 | ;-------------------------------------- | ||
| 1291 | Context DS | ||
| 1292 | |||
| 1293 | CallInstall DOS_Close,multDos,1 | ||
| 1294 | ;-------------------------------------- | ||
| 1295 | ; The SFT may be free and we have no | ||
| 1296 | ; idea where the next is. Go and loop | ||
| 1297 | ; all over. | ||
| 1298 | ;-------------------------------------- | ||
| 1299 | JMP ShCl | ||
| 1300 | ;-------------------------------------- | ||
| 1301 | ; There are no more SFTs to close. Leave | ||
| 1302 | ;--------------------------------------- | ||
| 1303 | ShCloseDone: | ||
| 1304 | |||
| 1305 | LeaveCrit critShare | ||
| 1306 | |||
| 1307 | STC | ||
| 1308 | |||
| 1309 | RestoreReg <ES,DS,BP,DI,SI,DX,CX,BX,AX> | ||
| 1310 | |||
| 1311 | ret | ||
| 1312 | |||
| 1313 | EndProc ShCloseFile | ||
| 1314 | |||
| 1315 | .xall | ||
| 1316 | Break <ShSU - update all SFTs for a specified change> | ||
| 1317 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1318 | ; | ||
| 1319 | ; NAME: ShSU - update all SFTs for a specified change> | ||
| 1320 | ; | ||
| 1321 | ; FUNCTION: In a shared environment, we want to propogate the SFT | ||
| 1322 | ; changes for a particular file to all other SFTs for that | ||
| 1323 | ; file. The types of things we propogate are: | ||
| 1324 | ; | ||
| 1325 | ; - Time of last write - we only do this on CLOSE and on | ||
| 1326 | ; FILETIMES. | ||
| 1327 | ; | ||
| 1328 | ; - Size and allocation information - we do this ONLY when | ||
| 1329 | ; we change sf_size. | ||
| 1330 | ; | ||
| 1331 | ; We achieve this by walking the linked list of SFTs for the | ||
| 1332 | ; file. See PSEUDOCODE below | ||
| 1333 | ; | ||
| 1334 | ; INPUT: ES.DI has SFT that was just Revised. | ||
| 1335 | ; AX = 0 for updating of time from ES:DI into old sfts | ||
| 1336 | ; AX = 1 for updating of size/allocation for growth from ES:DI | ||
| 1337 | ; AX = 2 for updating of size/allocation for shrink from ES:DI | ||
| 1338 | ; AX = 3 for new instance copy into ES:DI | ||
| 1339 | ; AX = 4 for update of codepage and high attribute | ||
| 1340 | ; | ||
| 1341 | ; OUTPUT: All relevant SFTs are updated. | ||
| 1342 | ; | ||
| 1343 | ; REGISTERS USED: All except ES:DI and DS:SI | ||
| 1344 | ; (NOT RESTORED) | ||
| 1345 | ; | ||
| 1346 | ; LINKAGE: DOS Jump Table | ||
| 1347 | ; | ||
| 1348 | ; EXTERNAL Invoke: New_Sft, Call_IFS | ||
| 1349 | ; REFERENCES: Callinstall | ||
| 1350 | ; | ||
| 1351 | ; NORMAL - | ||
| 1352 | ; EXIT: | ||
| 1353 | ; | ||
| 1354 | ; ERROR - | ||
| 1355 | ; EXIT: | ||
| 1356 | ; | ||
| 1357 | ; CHANGE 04/15/87 - Major overhaul and IFS support | ||
| 1358 | ; LOG: | ||
| 1359 | ; | ||
| 1360 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1361 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1362 | ; | ||
| 1363 | ; START ShSU | ||
| 1364 | ; | ||
| 1365 | ; if not a device and | ||
| 1366 | ; if not a network | ||
| 1367 | ; search | ||
| 1368 | ; if our SFT | ||
| 1369 | ; advance to next SFT | ||
| 1370 | ; endif | ||
| 1371 | ; leave if no more SFT's | ||
| 1372 | ; exitif cx = 3 | ||
| 1373 | ; invoke New_Sft | ||
| 1374 | ; orelse | ||
| 1375 | ; if cx = 0 | ||
| 1376 | ; update time | ||
| 1377 | ; update date | ||
| 1378 | ; if non - FAT file system | ||
| 1379 | ; call IFSFUNC | ||
| 1380 | ; endif | ||
| 1381 | ; else cx = 1 or 2 | ||
| 1382 | ; update size | ||
| 1383 | ; if non - FAT file system | ||
| 1384 | ; call IFSFUNC | ||
| 1385 | ; else | ||
| 1386 | ; update first cluster | ||
| 1387 | ; if cx = 2 or | ||
| 1388 | ; if lstclus un-set from create | ||
| 1389 | ; update cluster position | ||
| 1390 | ; update last cluster | ||
| 1391 | ; endif | ||
| 1392 | ; endif | ||
| 1393 | ; endif | ||
| 1394 | ; advance to next SFT | ||
| 1395 | ; endloop | ||
| 1396 | ; endsearch | ||
| 1397 | ; endif | ||
| 1398 | ; return | ||
| 1399 | ; | ||
| 1400 | ; END ShSU | ||
| 1401 | ; | ||
| 1402 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1403 | |||
| 1404 | Procedure ShSU,near | ||
| 1405 | |||
| 1406 | ASSUME DS:NOTHING,ES:NOTHING | ||
| 1407 | |||
| 1408 | nop | ||
| 1409 | ; int 3 | ||
| 1410 | nop | ||
| 1411 | |||
| 1412 | ifs_flag equ 8000h ; ;AN000; | ||
| 1413 | ;--------------------------------------- | ||
| 1414 | ; Do nothing for device or network | ||
| 1415 | ;--------------------------------------- | ||
| 1416 | mov bx,es:[di].sf_mode | ||
| 1417 | and bx,sf_isnet + devid_device | ||
| 1418 | |||
| 1419 | ; $if z,and,long ; if not device and ;AC000; | ||
| 1420 | JZ $$XL1 | ||
| 1421 | JMP $$IF4 | ||
| 1422 | $$XL1: | ||
| 1423 | |||
| 1424 | mov bx,es:[di].sf_MFT | ||
| 1425 | or bx,bx | ||
| 1426 | |||
| 1427 | ; $if nz,,long ; if not network ;AC000; | ||
| 1428 | JNZ $$XL2 | ||
| 1429 | JMP $$IF4 | ||
| 1430 | $$XL2: | ||
| 1431 | |||
| 1432 | EnterCrit critShare | ||
| 1433 | ;--------------------------------------- | ||
| 1434 | ; Walk the sft chain for this file and | ||
| 1435 | ; skip the current SFT (ES:DI) | ||
| 1436 | ;--------------------------------------- | ||
| 1437 | SaveReg <DS,SI> | ||
| 1438 | |||
| 1439 | lds si,cs:[bx].MFT_SPTR | ||
| 1440 | mov cx,ax | ||
| 1441 | |||
| 1442 | ; $search ; ;AC000; | ||
| 1443 | $$DO5: | ||
| 1444 | |||
| 1445 | CallInstall PointComp,multDOS,20 ; pointers different? | ||
| 1446 | |||
| 1447 | ; $if z ; if ourselves ;AC000; | ||
| 1448 | JNZ $$IF6 | ||
| 1449 | |||
| 1450 | lds si,[si].sf_chain ; move to next ;AC000; | ||
| 1451 | |||
| 1452 | ; $endif ; endif - ourselves ;AC000; | ||
| 1453 | $$IF6: | ||
| 1454 | |||
| 1455 | or si,si | ||
| 1456 | |||
| 1457 | ; $leave z ; ;AC000; | ||
| 1458 | JZ $$EN5 | ||
| 1459 | |||
| 1460 | ;--------------------------------------- | ||
| 1461 | ; CX = 0 for updating of time | ||
| 1462 | ; CX = 1 for updating of size/allocation | ||
| 1463 | ; for growth | ||
| 1464 | ; CX = 2 for updating of size/allocation | ||
| 1465 | ; for shrink | ||
| 1466 | ; CX = 3 for new instance copy. | ||
| 1467 | ;--------------------------------------- | ||
| 1468 | cmp cx,2 ; ;AC000; | ||
| 1469 | |||
| 1470 | ; $exitif a ; ;AC000; | ||
| 1471 | JNA $$IF5 | ||
| 1472 | ;--------------------------------------- | ||
| 1473 | ; CX = 3 for new instance copy. | ||
| 1474 | ; CX = 4 for codepage and high attrib update | ||
| 1475 | ;--------------------------------------- | ||
| 1476 | cmp cx,3 ; cx = 3 ? ;an000; | ||
| 1477 | ; $if e ; yes ;an000; | ||
| 1478 | JNE $$IF10 | ||
| 1479 | call New_Sft ; ;AN000; | ||
| 1480 | ;; $else ; cx = 4 ;an000; | ||
| 1481 | ;; call New_CP_Attrib ; update codepage and high attrib ;an000; | ||
| 1482 | ; $endif ; ;an000; | ||
| 1483 | $$IF10: | ||
| 1484 | |||
| 1485 | ; $orelse ; ;AC000; | ||
| 1486 | JMP SHORT $$SR5 | ||
| 1487 | $$IF5: | ||
| 1488 | |||
| 1489 | or cx,cx | ||
| 1490 | |||
| 1491 | ; $if z ; if cx = 0 then ;AC000; | ||
| 1492 | JNZ $$IF13 | ||
| 1493 | ;--------------------------------------- | ||
| 1494 | ; CX = 0 for updating of time | ||
| 1495 | ; | ||
| 1496 | ; Copy time from ES:DI into DS:SI | ||
| 1497 | ;--------------------------------------- | ||
| 1498 | mov bx,es:[di].sf_time | ||
| 1499 | mov [si].sf_time,bx | ||
| 1500 | mov bx,es:[di].sf_date | ||
| 1501 | mov [si].sf_date,bx | ||
| 1502 | test [si].sf_flags,ifs_flag ; ;AN000; | ||
| 1503 | |||
| 1504 | ; $if nz ; if non-FAT ;AC003; | ||
| 1505 | JZ $$IF14 | ||
| 1506 | |||
| 1507 | call Call_IFS ; tell IFS of SFT change ;AN000; | ||
| 1508 | |||
| 1509 | ; $endif ; endif non- FAT ;AN000; | ||
| 1510 | $$IF14: | ||
| 1511 | |||
| 1512 | ; $else ; else - must be >0 and <2 ;AC000; | ||
| 1513 | JMP SHORT $$EN13 | ||
| 1514 | $$IF13: | ||
| 1515 | ;--------------------------------------- | ||
| 1516 | ; CX = 1 for updating of size/allocation | ||
| 1517 | ; for growth | ||
| 1518 | ; CX = 2 for updating of size/allocation | ||
| 1519 | ; for shrink | ||
| 1520 | ; | ||
| 1521 | ; We always copy size and firclus | ||
| 1522 | ;--------------------------------------- | ||
| 1523 | mov bx,word ptr es:[di].sf_size | ||
| 1524 | mov word ptr [si].sf_size,bx | ||
| 1525 | mov bx,word ptr es:[di].sf_size+2 | ||
| 1526 | mov word ptr [si].sf_size+2,bx | ||
| 1527 | test [si].sf_flags,ifs_flag ; ;AN000; | ||
| 1528 | |||
| 1529 | ; $if nz ; if non-FAT ;AC003; | ||
| 1530 | JZ $$IF17 | ||
| 1531 | |||
| 1532 | invoke Call_IFS ; tell IFS of SFT change ;AN000; | ||
| 1533 | |||
| 1534 | ; $else ; else - its FAT ;AN000; | ||
| 1535 | JMP SHORT $$EN17 | ||
| 1536 | $$IF17: | ||
| 1537 | |||
| 1538 | mov bx,es:[di].sf_firclus | ||
| 1539 | mov [si].sf_firclus,bx | ||
| 1540 | cmp cx,2 ; ;AC000; | ||
| 1541 | |||
| 1542 | ; $if z,or ; if SFT is shrinking or ;AC000; | ||
| 1543 | JZ $$LL19 | ||
| 1544 | |||
| 1545 | cmp [si].sf_lstclus,0 ; lstclus UN-set from a create? ;AC000; | ||
| 1546 | |||
| 1547 | ; $if z ; If it is, set lstclus and cluspos too;AC000; | ||
| 1548 | JNZ $$IF19 | ||
| 1549 | $$LL19: | ||
| 1550 | ;--------------------------------------- | ||
| 1551 | ; Shrink the file, move in new cluspos | ||
| 1552 | ; and lstclus | ||
| 1553 | ;--------------------------------------- | ||
| 1554 | mov [si].sf_cluspos,0 ; retrace from start | ||
| 1555 | mov [si].sf_lstclus,bx ; ditto | ||
| 1556 | |||
| 1557 | ; $endif ; endif - set lstclus and cluspos ;AC000; | ||
| 1558 | $$IF19: | ||
| 1559 | |||
| 1560 | ; $endif ; endif FAT ;AN000; | ||
| 1561 | $$EN17: | ||
| 1562 | |||
| 1563 | ; $endif ; enndif - > 0 ;AC000; | ||
| 1564 | $$EN13: | ||
| 1565 | ;--------------------------------------- | ||
| 1566 | ; Link to next SFT | ||
| 1567 | ;--------------------------------------- | ||
| 1568 | lds si,[si].sf_chain | ||
| 1569 | |||
| 1570 | ; $endloop ; ;AC000; | ||
| 1571 | JMP SHORT $$DO5 | ||
| 1572 | $$EN5: | ||
| 1573 | |||
| 1574 | ; $endsrch ; ;AC000; | ||
| 1575 | $$SR5: | ||
| 1576 | ;--------------------------------------- | ||
| 1577 | ; All Done | ||
| 1578 | ;--------------------------------------- | ||
| 1579 | RestoreReg <SI,DS> | ||
| 1580 | |||
| 1581 | LeaveCrit critShare | ||
| 1582 | |||
| 1583 | ; $endif ; endif - device and network ;AC000; | ||
| 1584 | $$IF4: | ||
| 1585 | |||
| 1586 | ret | ||
| 1587 | |||
| 1588 | EndProc ShSU | ||
| 1589 | |||
| 1590 | Break <New_Sft - update a new SFT> | ||
| 1591 | |||
| 1592 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1593 | ; | ||
| 1594 | ; NAME: New_Sft - update a new SFT | ||
| 1595 | ; | ||
| 1596 | ; FUNCTION: Copy all SFT information into a NEW sft of a SHARED file. | ||
| 1597 | ; | ||
| 1598 | ; | ||
| 1599 | ; INPUT: ES.DI has SFT that was just Revised. | ||
| 1600 | ; DS:SI has SFT that is to be updated | ||
| 1601 | ; | ||
| 1602 | ; OUTPUT: SFT is updated. | ||
| 1603 | ; | ||
| 1604 | ; REGISTERS USED: AX, BX | ||
| 1605 | ; (NOT RESTORED) | ||
| 1606 | ; | ||
| 1607 | ; LINKAGE: Invoked by: ShSU | ||
| 1608 | ; | ||
| 1609 | ; EXTERNAL Invoke: Call_IFS | ||
| 1610 | ; REFERENCES: | ||
| 1611 | ; | ||
| 1612 | ; CHANGE 04/15/87 - First release | ||
| 1613 | ; LOG: | ||
| 1614 | ; | ||
| 1615 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1616 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1617 | ; | ||
| 1618 | ; START New_Sft | ||
| 1619 | ; | ||
| 1620 | ; update time | ||
| 1621 | ; update date | ||
| 1622 | ; update size | ||
| 1623 | ; if non - FAT file system | ||
| 1624 | ; call IFSFUNC | ||
| 1625 | ; else | ||
| 1626 | ; update first cluster | ||
| 1627 | ; update cluster position | ||
| 1628 | ; update last cluster | ||
| 1629 | ; endif | ||
| 1630 | ; return | ||
| 1631 | ; | ||
| 1632 | ; END New_Sft | ||
| 1633 | ; | ||
| 1634 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1635 | |||
| 1636 | Procedure New_Sft,near ; ;AN000; | ||
| 1637 | |||
| 1638 | mov bx,[si].sf_time ; update time | ||
| 1639 | mov es:[di].sf_time,bx | ||
| 1640 | mov bx,[si].sf_date ; update date | ||
| 1641 | mov es:[di].sf_date,bx | ||
| 1642 | mov bx,word ptr [si].sf_size ; update size | ||
| 1643 | mov word ptr es:[di].sf_size,bx | ||
| 1644 | mov bx,word ptr [si].sf_size+2 | ||
| 1645 | mov word ptr es:[di].sf_size+2,bx | ||
| 1646 | test es:[di].sf_flags,ifs_flag ; ;AN000; | ||
| 1647 | |||
| 1648 | ; $if nz ; if non-FAT ;AC003; | ||
| 1649 | JZ $$IF26 | ||
| 1650 | |||
| 1651 | call Call_IFS ; tell IFS of SFT change ;AN000; | ||
| 1652 | |||
| 1653 | ; $else ; else - its FAT ;AN000; | ||
| 1654 | JMP SHORT $$EN26 | ||
| 1655 | $$IF26: | ||
| 1656 | |||
| 1657 | mov bx,[si].sf_firclus ; update first cluster | ||
| 1658 | mov es:[di].sf_firclus,bx | ||
| 1659 | mov es:[di].sf_cluspos,0 ; retrace from start | ||
| 1660 | mov es:[di].sf_lstclus,bx ; ditto | ||
| 1661 | |||
| 1662 | ; $endif ; endif FAT ;AN000; | ||
| 1663 | $$EN26: | ||
| 1664 | |||
| 1665 | ret ; we'er done ;AN000; | ||
| 1666 | |||
| 1667 | EndProc New_Sft ; ;AN000; | ||
| 1668 | |||
| 1669 | Break <New_CP_Attrib - update the codepage and attrib in SFT> | ||
| 1670 | |||
| 1671 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1672 | ; | ||
| 1673 | ; NAME: New_CP_Attrib - Update codepage and attrib in SFT | ||
| 1674 | ; | ||
| 1675 | ; FUNCTION: Copy all codepage and attrib into SFT of a SHARED file. | ||
| 1676 | ; | ||
| 1677 | ; | ||
| 1678 | ; INPUT: ES.DI has SFT that was just Revised. | ||
| 1679 | ; DS:SI has SFT that is to be updated | ||
| 1680 | ; | ||
| 1681 | ; OUTPUT: SFT is updated. | ||
| 1682 | ; | ||
| 1683 | ; REGISTERS USED: AX, BX | ||
| 1684 | ; (NOT RESTORED) | ||
| 1685 | ; | ||
| 1686 | ; LINKAGE: Invoked by: ShSU | ||
| 1687 | ; | ||
| 1688 | ; EXTERNAL Invoke: Call_IFS | ||
| 1689 | ; REFERENCES: | ||
| 1690 | ; | ||
| 1691 | ; CHANGE 10/06/87 - First release - D. M. Sewell | ||
| 1692 | ; LOG: | ||
| 1693 | ; | ||
| 1694 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1695 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1696 | ; | ||
| 1697 | ; START New_CP_Attrib | ||
| 1698 | ; | ||
| 1699 | ; Update codepage | ||
| 1700 | ; Update high attribute | ||
| 1701 | ; $if ifs_flag | ||
| 1702 | ; call Call_IFS | ||
| 1703 | ; $endif | ||
| 1704 | ; return | ||
| 1705 | ; | ||
| 1706 | ; END New_CP_Attrib | ||
| 1707 | ; | ||
| 1708 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1709 | |||
| 1710 | ;; Procedure New_CP_Attrib,near ; ;AN000; | ||
| 1711 | |||
| 1712 | ;; mov bx,es:[di].SF_Codepage ; update codepage ;an000; | ||
| 1713 | ;; mov [si].SF_Codepage,bx ;an000; dms; | ||
| 1714 | ;; mov bl,es:[di].SF_Attr_Hi ; update high attribute ;an000; | ||
| 1715 | ;; mov [si].SF_Attr,bl ;an000; dms; | ||
| 1716 | ;; test es:[di].sf_flags,ifs_flag ; ;AN000; | ||
| 1717 | |||
| 1718 | ;; $if nz ; if non-FAT ;AC003; | ||
| 1719 | |||
| 1720 | ;; call Call_IFS ; tell IFS of SFT change ;AN000; | ||
| 1721 | |||
| 1722 | ;; $endif ; endif FAT ;AN000; | ||
| 1723 | |||
| 1724 | ;; ret ; we'er done ;AN000; | ||
| 1725 | |||
| 1726 | ;; EndProc New_CP_Attrib ; ;AN000; | ||
| 1727 | |||
| 1728 | |||
| 1729 | Break <Call_IFS - warn IFS that SFT has changed> | ||
| 1730 | |||
| 1731 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1732 | ; | ||
| 1733 | ; NAME: Call_IFS - warn IFS that SFT has changed | ||
| 1734 | ; | ||
| 1735 | ; FUNCTION: Call IFS thru 2F interupt. | ||
| 1736 | ; | ||
| 1737 | ; INPUT: DS.SI points to SFT that was just Revised. | ||
| 1738 | ; | ||
| 1739 | ; OUTPUT: none | ||
| 1740 | ; | ||
| 1741 | ; REGISTERS USED: AX | ||
| 1742 | ; (NOT RESTORED) | ||
| 1743 | ; | ||
| 1744 | ; LINKAGE: Invoked by: ShSU, New_SFT | ||
| 1745 | ; | ||
| 1746 | ; EXTERNAL Callinstall | ||
| 1747 | ; REFERENCES: | ||
| 1748 | ; | ||
| 1749 | ; CHANGE 04/15/87 - First release | ||
| 1750 | ; LOG: | ||
| 1751 | ; | ||
| 1752 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1753 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 1754 | ; | ||
| 1755 | ; START Call_IFS | ||
| 1756 | ; | ||
| 1757 | ; set up for INT | ||
| 1758 | ; INT 2F | ||
| 1759 | ; return | ||
| 1760 | ; | ||
| 1761 | ; END Call_IFS | ||
| 1762 | ; | ||
| 1763 | ;******************+ END OF PSEUDOCODE +************************************** | ||
| 1764 | |||
| 1765 | Procedure Call_IFS,near ; ;AN000; | ||
| 1766 | |||
| 1767 | CallInstall BlockUpdate,MultIFS,44,CX,CX ; ;AC005; | ||
| 1768 | |||
| 1769 | ret ; ;AN000; | ||
| 1770 | |||
| 1771 | EndProc Call_IFS ; ;AN000; | ||
| 1772 | |||
| 1773 | Break <Internal error routines> | ||
| 1774 | |||
| 1775 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1776 | ; | ||
| 1777 | ; INTERR - INTernal ERRor routines | ||
| 1778 | ; | ||
| 1779 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1780 | |||
| 1781 | Procedure INTERR,NEAR | ||
| 1782 | |||
| 1783 | ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING | ||
| 1784 | |||
| 1785 | SaveReg <BX,SI,DS> ; save registers that get clobbered | ||
| 1786 | |||
| 1787 | push cs ; gain addressability | ||
| 1788 | pop ds | ||
| 1789 | mov si,ax ; get message to print | ||
| 1790 | |||
| 1791 | call gout | ||
| 1792 | |||
| 1793 | off si,IntErrMSG | ||
| 1794 | |||
| 1795 | call gout | ||
| 1796 | |||
| 1797 | RestoreReg <ds,si,bx> | ||
| 1798 | |||
| 1799 | INTERRL:jmp INTERRL ; hang here - we're sick | ||
| 1800 | |||
| 1801 | gout: lodsb | ||
| 1802 | or al,al | ||
| 1803 | retz | ||
| 1804 | mov ah,14 | ||
| 1805 | int 10h | ||
| 1806 | jmp gout | ||
| 1807 | |||
| 1808 | IntErrMsg DB "Share: Internal error", 13, 10, 0 | ||
| 1809 | |||
| 1810 | EndProc INTERR | ||
| 1811 | |||
| 1812 | Break <INT 2F handler> | ||
| 1813 | |||
| 1814 | IF installed | ||
| 1815 | |||
| 1816 | public skip_check | ||
| 1817 | |||
| 1818 | skip_check db 0 ; start with do checking | ||
| 1819 | |||
| 1820 | state_change db 0 ; SHARE change in state flag | ||
| 1821 | ; 0 - no change in state | ||
| 1822 | ; 1 - SHARE load state has changed | ||
| 1823 | |||
| 1824 | CONT DD ? | ||
| 1825 | |||
| 1826 | INT2F PROC FAR | ||
| 1827 | |||
| 1828 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING | ||
| 1829 | cmp ah,multSHARE | ||
| 1830 | jnz ContJ | ||
| 1831 | |||
| 1832 | ; Its for SHARE! Check to see who is calling: | ||
| 1833 | |||
| 1834 | ; AL = | ||
| 1835 | ; 81h its us, with /NC - set skip_check | ||
| 1836 | ; - return 0F0h - end init | ||
| 1837 | ; 80h its us | ||
| 1838 | ; if skip_check is reset | ||
| 1839 | ; - return 0FFh - loaded | ||
| 1840 | ; if skip_check is set | ||
| 1841 | ; - reset skip_check | ||
| 1842 | ; - return 0F0h - end init | ||
| 1843 | ; | ||
| 1844 | ; 40h its IFSFUNC - return 0FFh - loaded | ||
| 1845 | ; | ||
| 1846 | ; 00h its anyone else - clear skip_check | ||
| 1847 | ; - return 0FFh - loaded | ||
| 1848 | |||
| 1849 | test al,80h ; is it share? ;AN010; | ||
| 1850 | ; $if nz ; if it is ;AN010; | ||
| 1851 | JZ $$IF29 | ||
| 1852 | and al,1 ; is /NC set ;AN010; | ||
| 1853 | mov al,0F0H ; assume a quiet return ;AN010; | ||
| 1854 | ; $if nz ; if it is ;AN010; | ||
| 1855 | JZ $$IF30 | ||
| 1856 | cmp skip_check,1 ; is skip_check set ? ;AN011; | ||
| 1857 | ; $if ne ; if it is ;AN011; | ||
| 1858 | JE $$IF31 | ||
| 1859 | mov state_change,1 ; set the change state flag ;AN011; | ||
| 1860 | ; $endif ; ;AN011; | ||
| 1861 | $$IF31: | ||
| 1862 | mov skip_check,1 ; set skip_check ;AN010; | ||
| 1863 | ; $else ; /NC not requested ;AN010; | ||
| 1864 | JMP SHORT $$EN30 | ||
| 1865 | $$IF30: | ||
| 1866 | cmp skip_check,1 ; is skip_check set ? ;AN010; | ||
| 1867 | ; $if e ; if it is ;AN010; | ||
| 1868 | JNE $$IF34 | ||
| 1869 | mov state_change,1 ; set the change state flag ;AN011; | ||
| 1870 | mov skip_check,0 ; reset skip_check ;AN010; | ||
| 1871 | ; $else ; else , its already clear ;AN010; | ||
| 1872 | JMP SHORT $$EN34 | ||
| 1873 | $$IF34: | ||
| 1874 | mov al,0FFH ; and we are loaded ;AN010; | ||
| 1875 | ; $endif ; ;AN010; | ||
| 1876 | $$EN34: | ||
| 1877 | ; $endif ; ;AN010; | ||
| 1878 | $$EN30: | ||
| 1879 | |||
| 1880 | ; $else ; ;AN010; | ||
| 1881 | JMP SHORT $$EN29 | ||
| 1882 | $$IF29: | ||
| 1883 | cmp al,40h ; is it IFSFUNC? ;AN010; | ||
| 1884 | ; $if ne ; if it is not ;AN010; | ||
| 1885 | JE $$IF39 | ||
| 1886 | |||
| 1887 | or al,al ; loop it any other value caus' ;AC010; | ||
| 1888 | Freeze: | ||
| 1889 | jnz freeze ; no one should EVER issue this ;AC010; | ||
| 1890 | cmp skip_check,1 ; is skip_check set ? ;AN010; | ||
| 1891 | ; $if e ; if it is ;AN011; | ||
| 1892 | JNE $$IF40 | ||
| 1893 | mov state_change,1 ; set the change state flag ;AN011; | ||
| 1894 | ; $endif ; ;AN011; | ||
| 1895 | $$IF40: | ||
| 1896 | mov skip_check,0 ; and believe it ! ;AN011; | ||
| 1897 | |||
| 1898 | ; $endif ; ;AN010; | ||
| 1899 | $$IF39: | ||
| 1900 | mov al,0FFH ; else - say we are here ;AN010; | ||
| 1901 | ; $endif ; ;AN010; | ||
| 1902 | $$EN29: | ||
| 1903 | cmp state_change,1 ; SHARE installed state may have change;AN011;d | ||
| 1904 | ; $if e ; - update DOS ;AN011; | ||
| 1905 | JNE $$IF44 | ||
| 1906 | push ax ; ;AN011; | ||
| 1907 | push es ; this is interesting - ;AN011; | ||
| 1908 | MOV AH,Get_In_Vars ; if SHARE =1 and DOS =1 - no change;AN011; | ||
| 1909 | INT 21h ; if SHARE = ;AN011; | ||
| 1910 | |||
| 1911 | ASSUME ES:DOSGROUP | ||
| 1912 | |||
| 1913 | mov al,skip_check ; get the SHARE operating mode ;AN011; | ||
| 1914 | cmp al,1 ; is it a /nc - tell DOS " 1 " ;AN011; | ||
| 1915 | ; $if ne ; if not ;AN011; | ||
| 1916 | JE $$IF45 | ||
| 1917 | dec al ; "full" SHARE - tell DOS " -1 " ;AN011; | ||
| 1918 | ; $endif ; ;AN011; | ||
| 1919 | $$IF45: | ||
| 1920 | MOV fShare,al ; tell DOS we are here ;AN011; | ||
| 1921 | pop es ; ;AN011; | ||
| 1922 | pop ax ; ;AN011; | ||
| 1923 | mov state_change,0 ; REset the change state flag ;AN011; | ||
| 1924 | ; $endif ; ;AN011; | ||
| 1925 | $$IF44: | ||
| 1926 | |||
| 1927 | ASSUME ES:nothing | ||
| 1928 | |||
| 1929 | iret | ||
| 1930 | ContJ: | ||
| 1931 | JMP CONT | ||
| 1932 | INT2F ENDP | ||
| 1933 | |||
| 1934 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSGroup | ||
| 1935 | |||
| 1936 | IRP rtn,<MFT_enter, MFTClose, MFTclU, MFTCloseP, MFTCloN, set_mult_block, clr_mult_block> | ||
| 1937 | J&rtn proc far | ||
| 1938 | call rtn | ||
| 1939 | ret | ||
| 1940 | j&rtn endp | ||
| 1941 | endm | ||
| 1942 | |||
| 1943 | IRP rtn,<chk_block, MFT_get, ShSave, ShChk, ShCol, ShCloseFile, ShSU> | ||
| 1944 | J&rtn proc far | ||
| 1945 | call rtn | ||
| 1946 | ret | ||
| 1947 | j&rtn endp | ||
| 1948 | endm | ||
| 1949 | |||
| 1950 | IRP sect,<critShare> | ||
| 1951 | Procedure E§,NEAR | ||
| 1952 | PUSH AX | ||
| 1953 | MOV AX,8000h+sect | ||
| 1954 | INT int_ibm | ||
| 1955 | POP AX | ||
| 1956 | ret | ||
| 1957 | EndProc E§ | ||
| 1958 | |||
| 1959 | Procedure L§,NEAR | ||
| 1960 | PUSH AX | ||
| 1961 | MOV AX,8100h+sect | ||
| 1962 | INT int_ibm | ||
| 1963 | POP AX | ||
| 1964 | ret | ||
| 1965 | EndProc L§ | ||
| 1966 | ENDM | ||
| 1967 | |||
| 1968 | ENDIF | ||
| 1969 | |||
| 1970 | BREAK <MFT and Lock Record Data Area> | ||
| 1971 | |||
| 1972 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 1973 | ; | ||
| 1974 | ; first MFT record | ||
| 1975 | ; | ||
| 1976 | ; Note that the name field can have garbage after the trailing | ||
| 1977 | ; 00 byte. This is because the field might be too long, but | ||
| 1978 | ; not long enough (at least 16 extra bytes) to fragment. | ||
| 1979 | ; in this case we copy the length of the string area, not | ||
| 1980 | ; the length of the string and thus may copy tailing garbage. | ||
| 1981 | ; | ||
| 1982 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 1983 | |||
| 1984 | PoolSize = 2048 | ||
| 1985 | |||
| 1986 | PUBLIC MFT | ||
| 1987 | |||
| 1988 | MFT DB 0 ; free | ||
| 1989 | DW PoolSize ; PoolSize bytes long | ||
| 1990 | |||
| 1991 | IF not Installed | ||
| 1992 | |||
| 1993 | DB (PoolSize-3) DUP(0) ; leave rest of record | ||
| 1994 | MEND DB -1 ; END record | ||
| 1995 | |||
| 1996 | lck1 DW 0 ; link | ||
| 1997 | DB SIZE RLR_entry-2 DUP(0) | ||
| 1998 | lck2 DW OFFSET DOSGROUP:lck1 ; link | ||
| 1999 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2000 | lck3 DW OFFSET DOSGROUP:lck2 ; link | ||
| 2001 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2002 | lck4 DW OFFSET DOSGROUP:lck3 ; link | ||
| 2003 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2004 | lck5 DW OFFSET DOSGROUP:lck4 ; link | ||
| 2005 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2006 | lck6 DW OFFSET DOSGROUP:lck5 ; link | ||
| 2007 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2008 | lck7 DW OFFSET DOSGROUP:lck6 ; link | ||
| 2009 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2010 | lck8 DW OFFSET DOSGROUP:lck7 ; link | ||
| 2011 | DB SIZE RLR_entry-2 DUP(0) | ||
| 2012 | |||
| 2013 | CODE ENDS | ||
| 2014 | |||
| 2015 | %out Ignore this END error (blasted assembler) | ||
| 2016 | |||
| 2017 | ENDIF | ||
| 2018 | |||
| 2019 | IF Installed | ||
| 2020 | |||
| 2021 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING | ||
| 2022 | |||
| 2023 | IF1 | ||
| 2024 | InitSpace DW PoolSize | ||
| 2025 | ELSE | ||
| 2026 | IF shareinit-MFT LT PoolSize | ||
| 2027 | InitSpace DW PoolSize | ||
| 2028 | ELSE | ||
| 2029 | InitSpace DW shareinit-MFT | ||
| 2030 | ENDIF | ||
| 2031 | ENDIF | ||
| 2032 | InitLocks DW 20 | ||
| 2033 | |||
| 2034 | |||
| 2035 | JTable LABEL BYTE | ||
| 2036 | DD ? | ||
| 2037 | DD JMFT_Enter ; 1 MFT_enter | ||
| 2038 | DD JMFTClose ; 2 MFTClose | ||
| 2039 | DD JMFTclU ; 3 MFTclU | ||
| 2040 | DD JMFTcloseP ; 4 MFTCloseP | ||
| 2041 | DD JMFTcloN ; 5 MFTCloN | ||
| 2042 | DD JSet_Mult_Block ; 6 Set_Mult_Block | ||
| 2043 | DD JClr_Mult_Block ; 7 Clr_Mult_Block | ||
| 2044 | DD JChk_Block ; 8 Chk_Block | ||
| 2045 | DD JMFT_Get ; 9 MFT_get | ||
| 2046 | DD JShSave ; 10 ShSave | ||
| 2047 | DD JShChk ; 11 ShChk | ||
| 2048 | DD JShCol ; 12 ShCol | ||
| 2049 | DD JShCloseFile ; 13 ShCloseFile | ||
| 2050 | DD JShSU ; 14 ShSU | ||
| 2051 | JTableLen = $ - JTable | ||
| 2052 | |||
| 2053 | ; $SALUT (4,9,17,36) | ||
| 2054 | ;--------------------------------------- | ||
| 2055 | ; STRUCTURE TO DEFINE ADDITIONAL | ||
| 2056 | ; COMMAND LINE PARAMETERS | ||
| 2057 | ;--------------------------------------- | ||
| 2058 | PARMS LABEL DWORD | ||
| 2059 | DW OFFSET PARMSX ; POINTER TO PARMS STRUCTURE | ||
| 2060 | DB 0 ; NO DELIMITER LIST FOLLOWS | ||
| 2061 | DB 0 ; NUMBER OF ADDITIONAL DELIMITERS | ||
| 2062 | |||
| 2063 | ;--------------------------------------- | ||
| 2064 | ; STRUCTURE TO DEFINE SORT | ||
| 2065 | ; SYNTAX REQUIREMENTS | ||
| 2066 | ;--------------------------------------- | ||
| 2067 | PARMSX LABEL BYTE | ||
| 2068 | DB 0,0 ; THERE ARE NO POSITIONAL PARAMETERS | ||
| 2069 | DB 1 ; THERE ARE ONLY ONE TYPE OF SWITCH | ||
| 2070 | DW OFFSET SW ; POINTER TO THE SWITCH DEFINITION AREA | ||
| 2071 | DW 0 ; THERE ARE NO KEYWORDS IN SHARE SYNTAX | ||
| 2072 | |||
| 2073 | ;--------------------------------------- | ||
| 2074 | ; STRUCTURE TO DEFINE THE SWITCHES | ||
| 2075 | ;--------------------------------------- | ||
| 2076 | |||
| 2077 | SW LABEL WORD | ||
| 2078 | DW 08001H ; MUST BE NUMERIC | ||
| 2079 | DW 0 ; NO FUNCTION FLAGS | ||
| 2080 | DW OFFSET SWITCH_BUFF ; PLACE RESULT IN SWITCH BUFFER | ||
| 2081 | DW OFFSET VALUES ; NEED VALUE LIST | ||
| 2082 | DB 3 ; TWO SWITCHES IN FOLLOWING LIST | ||
| 2083 | F_SW DB "/F",0 ; /F: INDICATES n FILESPACE REQUESTED | ||
| 2084 | L_SW DB "/L",0 ; /L: INDICATES m LOCKS REQUESTED | ||
| 2085 | N_SW DB "/NC",0 ; /NC: INDICATES no checking required | ||
| 2086 | |||
| 2087 | |||
| 2088 | ;--------------------------------------- | ||
| 2089 | ; VALUE LIST DEFINITION FOR n | ||
| 2090 | ;--------------------------------------- | ||
| 2091 | |||
| 2092 | VALUES LABEL BYTE | ||
| 2093 | DB 1 ; ONE VALUE ALLOWED | ||
| 2094 | DB 1 ; ONLY ONE RANGE | ||
| 2095 | DB FILE_SWITCH ; IDENTIFY IT AS n | ||
| 2096 | DD 1,65535 ; USER CAN SPECIFY /+1 THROUGH /+65535 | ||
| 2097 | |||
| 2098 | ;--------------------------------------- | ||
| 2099 | ; RETURN BUFFER FOR SWITCH INFORMATION | ||
| 2100 | ;--------------------------------------- | ||
| 2101 | ; $SALUT (4,17,27,36) | ||
| 2102 | |||
| 2103 | SWITCH_BUFF LABEL BYTE | ||
| 2104 | SW_TYPE DB ? ; TYPE RETURNED | ||
| 2105 | SW_ITEM_TAG DB ? ; SPACE FOR ITEM TAG | ||
| 2106 | SW_SYN DW ? ; POINTER TO SWITCH LIST ENTRY | ||
| 2107 | SW_VALUE DD ? ; SPACE FOR VALUE | ||
| 2108 | |||
| 2109 | ; $SALUT (4,4,9,41) | ||
| 2110 | |||
| 2111 | Break <INIT - INITalization routines> | ||
| 2112 | |||
| 2113 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2114 | ; | ||
| 2115 | ; INIT - INITalization routines | ||
| 2116 | ; | ||
| 2117 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2118 | |||
| 2119 | Procedure Init,NEAR | ||
| 2120 | |||
| 2121 | PUSH CS | ||
| 2122 | POP DS | ||
| 2123 | |||
| 2124 | ASSUME DS:SHARE | ||
| 2125 | |||
| 2126 | MOV BX,InitSpace | ||
| 2127 | |||
| 2128 | SUB BX,3 | ||
| 2129 | MOV SI,OFFSET MFT | ||
| 2130 | MOV WORD PTR [SI+1],BX ; length of first item | ||
| 2131 | ADD SI,BX ; link to end of structure | ||
| 2132 | MOV BYTE PTR [SI],-1 ; signal end | ||
| 2133 | INC SI ; point to next free byte | ||
| 2134 | |||
| 2135 | MOV CX,initlocks ; count for loop | ||
| 2136 | MOV AX,0 | ||
| 2137 | |||
| 2138 | ; $do ; ;AC000; | ||
| 2139 | $$DO48: | ||
| 2140 | |||
| 2141 | MOV [SI].RLR_next,AX ; link in previous | ||
| 2142 | MOV AX,SI ; this is now previous | ||
| 2143 | ADD SI,SIZE RLR_Entry ; move to next object | ||
| 2144 | |||
| 2145 | ; $enddo loop ; ;AC000; | ||
| 2146 | LOOP $$DO48 | ||
| 2147 | |||
| 2148 | MOV FreLock,AX ; point to beginning of free list | ||
| 2149 | |||
| 2150 | MOV DX,CS | ||
| 2151 | MOV BX,ES | ||
| 2152 | SUB DX,BX | ||
| 2153 | ADD SI,15 | ||
| 2154 | RCR SI,1 | ||
| 2155 | SHR SI,1 | ||
| 2156 | SHR SI,1 | ||
| 2157 | SHR SI,1 | ||
| 2158 | |||
| 2159 | ADD SI,DX | ||
| 2160 | PUSH SI ; # of paras for share on stack | ||
| 2161 | |||
| 2162 | MOV AX,(Get_Interrupt_Vector SHL 8) + 2Fh | ||
| 2163 | INT 21h | ||
| 2164 | MOV WORD PTR CONT,BX | ||
| 2165 | MOV WORD PTR CONT+2,ES | ||
| 2166 | MOV AX,(Set_Interrupt_Vector SHL 8) + 2Fh | ||
| 2167 | MOV DX,OFFSET INT2F | ||
| 2168 | INT 21h | ||
| 2169 | ;--------------------------------------- | ||
| 2170 | ; Notify the DOS that we are around so that | ||
| 2171 | ; the DOS can make expensive calls to us. | ||
| 2172 | ;--------------------------------------- | ||
| 2173 | MOV AH,Get_In_Vars | ||
| 2174 | INT 21h | ||
| 2175 | |||
| 2176 | ASSUME ES:DOSGROUP | ||
| 2177 | |||
| 2178 | mov al,skip_check ; get the SHARE operating mode ;AN011; | ||
| 2179 | cmp al,1 ; is it a /nc - tell DOS " 1 " ;AN011; | ||
| 2180 | |||
| 2181 | ; $if ne ; if not ;AN011; | ||
| 2182 | JE $$IF50 | ||
| 2183 | dec al ; "full" SHARE - tell DOS " -1 " ;AN011; | ||
| 2184 | ; $endif ; | ||
| 2185 | $$IF50: | ||
| 2186 | |||
| 2187 | MOV fShare,al ; tell DOS we are here ;AC011; | ||
| 2188 | ;--------------------------------------- | ||
| 2189 | ; Cram in the new jump table | ||
| 2190 | ;--------------------------------------- | ||
| 2191 | CLI | ||
| 2192 | MOV SI,OFFSET JTable | ||
| 2193 | MOV DI,OFFSET JShare | ||
| 2194 | MOV CX,JTableLen/2 | ||
| 2195 | REP MOVSW | ||
| 2196 | ;--------------------------------------- | ||
| 2197 | ; Examine the size of the FCB cache. | ||
| 2198 | ; If it is NOT the system default of 4,0 | ||
| 2199 | ; change it (via reallocation) to 16,8. | ||
| 2200 | ; The old table is lost. | ||
| 2201 | ;--------------------------------------- | ||
| 2202 | ASSUME DS:NOTHING | ||
| 2203 | |||
| 2204 | CMP KeepCount,0 | ||
| 2205 | |||
| 2206 | ; $if z,and ; if the ",0" part and ;AC000; | ||
| 2207 | JNZ $$IF52 | ||
| 2208 | |||
| 2209 | LDS SI,ES:[BX].SYSI_FCB ; point to the existing cache | ||
| 2210 | CMP [SI].sfCount,4 | ||
| 2211 | |||
| 2212 | ; $if z ; if the "4," part then ;AC000; | ||
| 2213 | JNZ $$IF52 | ||
| 2214 | |||
| 2215 | ;--------------------------------------- | ||
| 2216 | ; Whammo, we need to allocate 16 * size | ||
| 2217 | ; of SF_entry + size of sfTable. | ||
| 2218 | ; Compute this size in paragraphs | ||
| 2219 | ;--------------------------------------- | ||
| 2220 | MOV AX,16 | ||
| 2221 | MOV CX,size sf_entry | ||
| 2222 | MUL CX | ||
| 2223 | ADD AX,(size sf) - 2 | ||
| 2224 | ;--------------------------------------- | ||
| 2225 | ; This size is in bytes... | ||
| 2226 | ; Round up to paragraph size | ||
| 2227 | ;--------------------------------------- | ||
| 2228 | ADD AX,0Fh | ||
| 2229 | RCR AX,1 | ||
| 2230 | SHR AX,1 | ||
| 2231 | SHR AX,1 | ||
| 2232 | SHR AX,1 | ||
| 2233 | ;--------------------------------------- | ||
| 2234 | ; AX is the number of paragraphs to add. | ||
| 2235 | ; Word on stack is current TNR size. | ||
| 2236 | ; Make dos point to new table | ||
| 2237 | ;--------------------------------------- | ||
| 2238 | MOV WORD PTR ES:[BX].SYSI_FCB,0 | ||
| 2239 | MOV WORD PTR ES:[BX].SYSI_FCB+2,SS | ||
| 2240 | POP SI | ||
| 2241 | ADD WORD PTR ES:[BX].SYSI_FCB+2,SI | ||
| 2242 | ;--------------------------------------- | ||
| 2243 | ; Initialize table parts, next link | ||
| 2244 | ; and size | ||
| 2245 | ;--------------------------------------- | ||
| 2246 | MOV DS,WORD PTR ES:[BX].SYSI_FCB+2 | ||
| 2247 | MOV WORD PTR DS:[sfLink],-1 | ||
| 2248 | MOV WORD PTR DS:[sfLink+2],-1 | ||
| 2249 | MOV DS:[sfcount],16 | ||
| 2250 | ;--------------------------------------- | ||
| 2251 | ; Set up succeeding LRU size | ||
| 2252 | ;--------------------------------------- | ||
| 2253 | MOV KeepCount,8 | ||
| 2254 | |||
| 2255 | ADD SI,AX | ||
| 2256 | PUSH SI | ||
| 2257 | |||
| 2258 | ; $endif ; endif - "4,0" ;AC000; | ||
| 2259 | $$IF52: | ||
| 2260 | |||
| 2261 | ;--------------------------------------- | ||
| 2262 | ; Clean out the FCB Cache | ||
| 2263 | ;--------------------------------------- | ||
| 2264 | LES DI,ES:[BX].SYSI_FCB | ||
| 2265 | |||
| 2266 | ASSUME ES:Nothing | ||
| 2267 | |||
| 2268 | MOV CX,ES:[DI].SFCount | ||
| 2269 | LEA DI,[DI].SFTable | ||
| 2270 | |||
| 2271 | ; $do ; ;AC000; | ||
| 2272 | $$DO54: | ||
| 2273 | |||
| 2274 | MOV ES:[DI].sf_ref_count,0 | ||
| 2275 | MOV WORD PTR ES:[DI].sf_position,0 | ||
| 2276 | MOV WORD PTR ES:[DI].sf_position+2,0 | ||
| 2277 | ADD DI,SIZE sf_entry | ||
| 2278 | |||
| 2279 | ; $enddo loop ; ;AC000; | ||
| 2280 | LOOP $$DO54 | ||
| 2281 | |||
| 2282 | STI | ||
| 2283 | |||
| 2284 | ASSUME ES:NOTHING | ||
| 2285 | |||
| 2286 | XOR BX,BX | ||
| 2287 | MOV CX,5 ; StdIN,StdOUT,StdERR,StdAUX,StdPRN | ||
| 2288 | |||
| 2289 | ; $do ; Close STD handles before ;AC000; | ||
| 2290 | $$DO56: | ||
| 2291 | ; keep process | ||
| 2292 | MOV AH,CLOSE | ||
| 2293 | INT 21H | ||
| 2294 | INC BX | ||
| 2295 | |||
| 2296 | ; $enddo loop ; ;AC000; | ||
| 2297 | LOOP $$DO56 | ||
| 2298 | |||
| 2299 | POP DX ; T+R size in DX | ||
| 2300 | MOV AX,(Keep_Process SHL 8) + 0 | ||
| 2301 | INT 21h | ||
| 2302 | MOV AX,(EXIT SHL 8) + 1 | ||
| 2303 | INT 21h ; We'er now resident, return to DOS | ||
| 2304 | |||
| 2305 | EndProc Init | ||
| 2306 | |||
| 2307 | Break <SHAREINIT - Share initialization entry point> | ||
| 2308 | |||
| 2309 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2310 | ; | ||
| 2311 | ; SHAREINIT - Share initialization entry point | ||
| 2312 | ; | ||
| 2313 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2314 | |||
| 2315 | Procedure SHAREINIT,NEAR | ||
| 2316 | |||
| 2317 | ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:STACK | ||
| 2318 | |||
| 2319 | ; int 3 | ||
| 2320 | nop | ||
| 2321 | nop | ||
| 2322 | |||
| 2323 | |||
| 2324 | PUSH DS ; save PSP segment for later stack ;AC001; | ||
| 2325 | ; relocation | ||
| 2326 | |||
| 2327 | ;--------------------------------------- | ||
| 2328 | ; Load Messages | ||
| 2329 | ;--------------------------------------- | ||
| 2330 | call ShLoadMsg ; ;AN000; | ||
| 2331 | ;--------------------------------------- | ||
| 2332 | ; At this point, the DOS version is OK. | ||
| 2333 | ; (checked by SYSLOADMSG) | ||
| 2334 | ; Now - Check the DOS data version | ||
| 2335 | ;--------------------------------------- | ||
| 2336 | ; $if c,or ; if not same as us ;AC009; | ||
| 2337 | JC $$LL58 | ||
| 2338 | |||
| 2339 | MOV AH,Get_In_Vars | ||
| 2340 | INT 21h | ||
| 2341 | |||
| 2342 | ASSUME ES:DOSGROUP | ||
| 2343 | |||
| 2344 | CMP DataVersion,ShareDataVersion | ||
| 2345 | |||
| 2346 | ASSUME ES:NOTHING | ||
| 2347 | |||
| 2348 | ; $if ne ; if not same as us ;AC000; | ||
| 2349 | JE $$IF58 | ||
| 2350 | $$LL58: | ||
| 2351 | mov ax,(Utility_Msg_CLASS shl 8) + Bad_DOS_Ver ; ;AN000; | ||
| 2352 | call ShDispMsg ; ;AN000; | ||
| 2353 | ; $endif ; endif - not same as us ;AC000; | ||
| 2354 | $$IF58: | ||
| 2355 | |||
| 2356 | ;--------------------------------------- | ||
| 2357 | ; Deallocate memory if possible | ||
| 2358 | ;--------------------------------------- | ||
| 2359 | mov ax,ds:[pdb_environ] | ||
| 2360 | or ax,ax | ||
| 2361 | |||
| 2362 | ; $if nz ; if > 0 deallocate memory ;AC000; | ||
| 2363 | JZ $$IF60 | ||
| 2364 | mov es,ax | ||
| 2365 | mov ah,dealloc | ||
| 2366 | int 21h | ||
| 2367 | ; $endif ; endif - > 0 deallocate memory ;AC000; | ||
| 2368 | $$IF60: | ||
| 2369 | |||
| 2370 | ;--------------------------------------- | ||
| 2371 | ; Parse the command line | ||
| 2372 | ;--------------------------------------- | ||
| 2373 | call ShComndParse ; ;AN000; | ||
| 2374 | ;--------------------------------------- | ||
| 2375 | ; Check to see if share already installed. | ||
| 2376 | ;--------------------------------------- | ||
| 2377 | mov al,skip_check ; ;AN010; | ||
| 2378 | or al,80h ; signal its SHARE calling ;AN010; | ||
| 2379 | mov ah,multShare ; ;AC010; | ||
| 2380 | INT 2Fh ; ;AC010; | ||
| 2381 | CMP AL,0FFh ; ;AC010; | ||
| 2382 | |||
| 2383 | ; $if z ; if we'er already loaded ;AC010; | ||
| 2384 | JNZ $$IF62 | ||
| 2385 | mov ax,(UTILITY_MSG_CLASS shl 8) + Sh_Already_Loaded ; ;AC010; | ||
| 2386 | call ShDispMsg ; ;AC010; | ||
| 2387 | ; $endif ; endif - we'er already loaded ;AC010; | ||
| 2388 | $$IF62: | ||
| 2389 | |||
| 2390 | ;--------------------------------------- | ||
| 2391 | ; Check to see if share installed and | ||
| 2392 | ; a toggle was just performed | ||
| 2393 | ;--------------------------------------- | ||
| 2394 | CMP AL,0F0h ; ;AN010; | ||
| 2395 | |||
| 2396 | ; $if z ; if we'er already loaded ;AN010; | ||
| 2397 | JNZ $$IF64 | ||
| 2398 | |||
| 2399 | MOV AX,(EXIT SHL 8) ; ;AN010; | ||
| 2400 | INT 21h ; Return to DOS with RC = 0 ;AN010; | ||
| 2401 | |||
| 2402 | ; $endif ; endif - we'er already loaded ;AN010; | ||
| 2403 | $$IF64: | ||
| 2404 | |||
| 2405 | ;--------------------------------------- | ||
| 2406 | ; All set to initialize the world. | ||
| 2407 | ; Make sure that we have enough memory | ||
| 2408 | ; for everything in our little 64K here. | ||
| 2409 | ; First get avail count of paras. | ||
| 2410 | ;--------------------------------------- | ||
| 2411 | pop es ; recover PSP segment ;AC002; | ||
| 2412 | push es ; ;AC002; | ||
| 2413 | MOV BX,CS | ||
| 2414 | MOV AX,ES:[PDB_Block_Len] | ||
| 2415 | SUB AX,BX | ||
| 2416 | ;--------------------------------------- | ||
| 2417 | ; AX has the number of paragraphs | ||
| 2418 | ; available to us after the beginning | ||
| 2419 | ; of CS. Max this out at 64K. | ||
| 2420 | ;--------------------------------------- | ||
| 2421 | CMP AX,1000h | ||
| 2422 | |||
| 2423 | ; $if a ; if more than we can handle ;AC000; | ||
| 2424 | JNA $$IF66 | ||
| 2425 | MOV AX,1000h ; force it | ||
| 2426 | ; $endif ; endif - more than we can handle ;AC000; | ||
| 2427 | $$IF66: | ||
| 2428 | |||
| 2429 | ;--------------------------------------- | ||
| 2430 | ; Take AX paragraphs and convert them | ||
| 2431 | ; into BX:CX bytes. | ||
| 2432 | ;--------------------------------------- | ||
| 2433 | XOR BX,BX | ||
| 2434 | SHL AX,1 | ||
| 2435 | SHL AX,1 | ||
| 2436 | SHL AX,1 | ||
| 2437 | SHL AX,1 | ||
| 2438 | ADC BX,0 | ||
| 2439 | MOV CX,AX | ||
| 2440 | ;--------------------------------------- | ||
| 2441 | ; compute in DX:AX, the size | ||
| 2442 | ; requested by the user | ||
| 2443 | ;--------------------------------------- | ||
| 2444 | MOV AX,initlocks | ||
| 2445 | MOV SI,size RLR_Entry | ||
| 2446 | MUL SI | ||
| 2447 | ADD AX,OFFSET MFT | ||
| 2448 | ADC DX,0 | ||
| 2449 | ADD AX,InitSpace | ||
| 2450 | ADC DX,0 | ||
| 2451 | ;--------------------------------------- | ||
| 2452 | ; Compare the 32 bit sizes DX:AX and BX:CX. | ||
| 2453 | ; If BX:CX is smaller, then we | ||
| 2454 | ; are out of memory. | ||
| 2455 | ;--------------------------------------- | ||
| 2456 | |||
| 2457 | CMP DX,BX ; try upper half first | ||
| 2458 | |||
| 2459 | ; $if a,or ; if most significant is bigger or ;AC000; | ||
| 2460 | JA $$LL68 | ||
| 2461 | |||
| 2462 | ; $if e,and ; if equal and ;AC000; | ||
| 2463 | JNE $$IF68 | ||
| 2464 | |||
| 2465 | CMP AX,CX ; | ||
| 2466 | |||
| 2467 | ; $if a ; if least significant is bigger ;AC000; | ||
| 2468 | JNA $$IF68 | ||
| 2469 | $$LL68: | ||
| 2470 | |||
| 2471 | mov ax,(EXT_ERR_CLASS shl 8) + No_Mem_Error ; issue error message ;AN000; | ||
| 2472 | |||
| 2473 | call ShDispMsg ; ;AN000; | ||
| 2474 | |||
| 2475 | ; $endif ; endif - bigger ;AC000; | ||
| 2476 | $$IF68: | ||
| 2477 | |||
| 2478 | ;-------------------------------------- | ||
| 2479 | ; Move stack to PSP area. Otherwise we | ||
| 2480 | ; will run into problems with growing | ||
| 2481 | ; the stack into the lock records. | ||
| 2482 | ;--------------------------------------- | ||
| 2483 | POP AX ; this is the entry value for DS (PSP) ;AC001; | ||
| 2484 | MOV SS,AX ; ;AC001; | ||
| 2485 | MOV SP,100h ; ;AC001; | ||
| 2486 | |||
| 2487 | ASSUME SS:NOTHING | ||
| 2488 | ;--------------------------------------- | ||
| 2489 | ; Continue with rest of initialization | ||
| 2490 | ;--------------------------------------- | ||
| 2491 | JMP INIT | ||
| 2492 | |||
| 2493 | EndProc SHAREINIT | ||
| 2494 | |||
| 2495 | Break <ShLoadMsg - Share Load Message> | ||
| 2496 | |||
| 2497 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2498 | ; | ||
| 2499 | ; NAME: ShLoadMsg - Share Load Message | ||
| 2500 | ; | ||
| 2501 | ; FUNCTION: Load the Share messages into the message buffer. | ||
| 2502 | ; | ||
| 2503 | ; INPUT: None | ||
| 2504 | ; | ||
| 2505 | ; OUTPUT: Messages loaded into the message buffer and Message | ||
| 2506 | ; Sevices code initalized | ||
| 2507 | ; | ||
| 2508 | ; REGISTERS USED: DI AX CX DX | ||
| 2509 | ; (NOT RESTORED) | ||
| 2510 | ; | ||
| 2511 | ; LINKAGE: Call near | ||
| 2512 | ; | ||
| 2513 | ; NORMAL CF = O | ||
| 2514 | ; EXIT: | ||
| 2515 | ; | ||
| 2516 | ; ERROR CF = 1 | ||
| 2517 | ; EXIT: | ||
| 2518 | ; | ||
| 2519 | ; CHANGE 04/15/87 - First release | ||
| 2520 | ; LOG: | ||
| 2521 | ; | ||
| 2522 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2523 | |||
| 2524 | ;--------------------------------------- | ||
| 2525 | ; Message Equates | ||
| 2526 | ;--------------------------------------- | ||
| 2527 | |||
| 2528 | ; $SALUT (4,27,34,41) | ||
| 2529 | |||
| 2530 | Bad_DOS_Ver equ 1 ; Incorrect DOS version ;AN000; | ||
| 2531 | Sh_Already_Loaded equ 2 ; SHARE already loaded message number ;AN000; | ||
| 2532 | No_Mem_Error equ 8 ; insufficient memory message number ;AN000; | ||
| 2533 | |||
| 2534 | ; $SALUT (4,4,9,41) | ||
| 2535 | |||
| 2536 | Procedure ShLoadMsg,near ; ;AN000; | ||
| 2537 | ;--------------------------------------- | ||
| 2538 | ; Load the Messages | ||
| 2539 | ;--------------------------------------- | ||
| 2540 | EXTRN SYSLOADMSG:NEAR ; ;AN000; | ||
| 2541 | |||
| 2542 | call SYSLOADMSG ; ;AN000; | ||
| 2543 | |||
| 2544 | ; $IF C ; if we have a MAJOR problem ;AN000; | ||
| 2545 | JNC $$IF70 | ||
| 2546 | mov ah,dh ; save the class | ||
| 2547 | call ShDispMsg ; ;AN000; | ||
| 2548 | ; For pre DOS 2.0, we may come back | ||
| 2549 | xor ax,ax ; here - so do it the old way | ||
| 2550 | push ss ; just in case | ||
| 2551 | push ax ; | ||
| 2552 | |||
| 2553 | xxx proc far ; ;AN000; | ||
| 2554 | ret ; ;AN000; | ||
| 2555 | xxx endp ; ;AN000; | ||
| 2556 | |||
| 2557 | ; $ENDIF ; endif - we have a MAJOR problem ;AN000; | ||
| 2558 | $$IF70: | ||
| 2559 | |||
| 2560 | |||
| 2561 | ret ; ;AN000; | ||
| 2562 | |||
| 2563 | EndProc ShLoadMsg ; | ||
| 2564 | |||
| 2565 | Break <ShDispMsg - Share Display Message> | ||
| 2566 | |||
| 2567 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2568 | ; | ||
| 2569 | ; NAME: ShDispMsg - Share Display Message | ||
| 2570 | ; | ||
| 2571 | ; FUNCTION: Display the messages for share | ||
| 2572 | ; | ||
| 2573 | ; INPUT: AX = message number - AH - Class | ||
| 2574 | ; AL - Number | ||
| 2575 | ; | ||
| 2576 | ; OUTPUT: - Messages output to Output Device | ||
| 2577 | ; - Exit to DOS | ||
| 2578 | ; | ||
| 2579 | ; REGISTERS USED: CX DX | ||
| 2580 | ; (NOT RESTORED) | ||
| 2581 | ; | ||
| 2582 | ; LINKAGE: Call near | ||
| 2583 | ; | ||
| 2584 | ; NORMAL CF = O | ||
| 2585 | ; EXIT: | ||
| 2586 | ; | ||
| 2587 | ; ERROR CF = 1 | ||
| 2588 | ; EXIT: CX = 0 - INCORRECT DOS VERSION | ||
| 2589 | ; | ||
| 2590 | ; CHANGE 04/15/87 - First release | ||
| 2591 | ; LOG: | ||
| 2592 | ; | ||
| 2593 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2594 | |||
| 2595 | ; $SALUT (4,27,34,41) | ||
| 2596 | |||
| 2597 | ; The following structure is a | ||
| 2598 | ; SYSMSG SUBLIST control block. | ||
| 2599 | ; It is initalized for the "already | ||
| 2600 | ; installed " message. The parse | ||
| 2601 | ; routine will set it up to work | ||
| 2602 | ; for parseing. | ||
| 2603 | SUBLIST LABEL WORD | ||
| 2604 | |||
| 2605 | db sub_size ; size of sublist | ||
| 2606 | db 0 ; reserved | ||
| 2607 | msg_offset dw offset SHARE_Name ; insert 'SHARE' | ||
| 2608 | |||
| 2609 | msg_segment LABEL WORD | ||
| 2610 | |||
| 2611 | IF NOT INSTALLED | ||
| 2612 | |||
| 2613 | dw CODE | ||
| 2614 | |||
| 2615 | ELSE | ||
| 2616 | |||
| 2617 | dw SHARE | ||
| 2618 | |||
| 2619 | ENDIF | ||
| 2620 | |||
| 2621 | num_ins db 1 ; only one insert | ||
| 2622 | db Char_Field_ASCIIZ ; data type flag - ascii z string | ||
| 2623 | max_ins db SHARE_Name_Size ; maximum field size | ||
| 2624 | min_ins db SHARE_Name_Size ; minimum field size | ||
| 2625 | db " " ; pad character | ||
| 2626 | |||
| 2627 | sub_size equ $ - SUBLIST | ||
| 2628 | |||
| 2629 | SHARE_Name LABEL WORD | ||
| 2630 | |||
| 2631 | db "SHARE" | ||
| 2632 | |||
| 2633 | SHARE_Name_Size equ $ - Share_Name | ||
| 2634 | |||
| 2635 | db 0 ; make it a Z string | ||
| 2636 | ; $SALUT (4,4,9,41) | ||
| 2637 | |||
| 2638 | Procedure ShDispMsg,near ; ;AN000; | ||
| 2639 | ;--------------------------------------- | ||
| 2640 | ; Set up required parameters | ||
| 2641 | ;-------------------------------------- | ||
| 2642 | MOV BX,STDERR ;display message on STD ERROR ;AN000; | ||
| 2643 | XOR CX,CX ;no substitution required ;AN000; | ||
| 2644 | XOR DX,DX ;set flags to 0 ;AN000; | ||
| 2645 | DEC DH ;and class to utility ;AN000; | ||
| 2646 | cmp ah,PARSE_ERR_CLASS ; | ||
| 2647 | ; $if be,and ; ;AC009; | ||
| 2648 | JNBE $$IF72 | ||
| 2649 | mov dh,ah ; | ||
| 2650 | ; $if e ; set up implied substitution ;AC009; | ||
| 2651 | JNE $$IF72 | ||
| 2652 | |||
| 2653 | ASSUME DS:nothing,ES:DOSGROUP | ||
| 2654 | |||
| 2655 | mov num_ins,cl ; set number of inserts to 0 ;AN009; | ||
| 2656 | mov BYTE PTR max_ins,030h ; set maximum size of insert ;AN009; | ||
| 2657 | mov BYTE PTR min_ins,1 ; set minimum size of insert ;AN009; | ||
| 2658 | push ds ; set up segment ;AN009; | ||
| 2659 | pop [msg_segment] ; ;AN009; | ||
| 2660 | mov BYTE PTR ds:[si],0 ; turn it into a ASCIIZ string ;AN009; | ||
| 2661 | cmp si,msg_offset ; is there something there? ;AN009; | ||
| 2662 | ; $if a ; if it is... ;AN009; | ||
| 2663 | JNA $$IF73 | ||
| 2664 | inc cx ; ;AN009; | ||
| 2665 | ; $endif ; ;AN009; | ||
| 2666 | $$IF73: | ||
| 2667 | ; $endif ; | ||
| 2668 | $$IF72: | ||
| 2669 | cmp al,Sh_Already_Loaded ; SHARE already loaded message ? ;AN000; | ||
| 2670 | ; $if e ; if it is... ;AN000; | ||
| 2671 | JNE $$IF76 | ||
| 2672 | inc cx ; | ||
| 2673 | mov msg_offset,OFFSET SHARE_name ; ensure the pointer is right ;AN010; | ||
| 2674 | ; $endif ; | ||
| 2675 | $$IF76: | ||
| 2676 | push cs ; ensure that SYSMSG has proper ;AC009; | ||
| 2677 | pop ds ; addressability ;AC009; | ||
| 2678 | lea si,SUBLIST ; point to sublist ;AC009; | ||
| 2679 | xor ah,ah ; ;AN000; | ||
| 2680 | |||
| 2681 | ;-------------------------------------- | ||
| 2682 | ; Output the Message | ||
| 2683 | ;--------------------------------------- | ||
| 2684 | EXTRN SYSDISPMSG:NEAR ; ;AN000; | ||
| 2685 | |||
| 2686 | CALL SYSDISPMSG ; ;AN000; | ||
| 2687 | |||
| 2688 | ; $IF C ; if error occured ;AN000; | ||
| 2689 | JNC $$IF78 | ||
| 2690 | |||
| 2691 | CALL Get_DOS_Error ; a DOS extended error occured ;AN000; | ||
| 2692 | CALL SYSDISPMSG ; try to issue it ;AN000; | ||
| 2693 | |||
| 2694 | ; $ENDIF ; endif - error occured ;AN000; | ||
| 2695 | $$IF78: | ||
| 2696 | |||
| 2697 | MOV AX,(EXIT SHL 8) + 0FFH ; exit to DOS ;AN000; | ||
| 2698 | INT 21h ; ;AN000; | ||
| 2699 | |||
| 2700 | ret ; may return if pre DOS 2.0 ;AN000; | ||
| 2701 | |||
| 2702 | EndProc ShDispMsg ; ;AN000; | ||
| 2703 | |||
| 2704 | BREAK < Get_DOS_Error > | ||
| 2705 | |||
| 2706 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2707 | ;Routine name: Get_DOS_Error | ||
| 2708 | ;******************************************************************************* | ||
| 2709 | ; | ||
| 2710 | ;Description: Call DOS to obtain DOS extended error # | ||
| 2711 | ; | ||
| 2712 | ;Called Procedures: None | ||
| 2713 | ; | ||
| 2714 | ;Input: None | ||
| 2715 | ; | ||
| 2716 | ;Output: AX = error number | ||
| 2717 | ; DH = DOS extended error class | ||
| 2718 | ; | ||
| 2719 | ;Change History: Created 5/01/87 FG | ||
| 2720 | ; | ||
| 2721 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2722 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 2723 | ; | ||
| 2724 | ; START Get_DOS_Error | ||
| 2725 | ; | ||
| 2726 | ; call DOS for extended error (INT21 GetExtendedError + 00 <5900>) | ||
| 2727 | ; set up registers for return | ||
| 2728 | ; ret | ||
| 2729 | ; | ||
| 2730 | ; END Get_DOS_Error | ||
| 2731 | ; | ||
| 2732 | ;******************- END OF PSEUDOCODE -************************************** | ||
| 2733 | |||
| 2734 | public Get_DOS_Error | ||
| 2735 | |||
| 2736 | Get_DOS_Error PROC NEAR | ||
| 2737 | |||
| 2738 | mov ax,(GetExtendedError shl 8) ; DOS ext. error ;AN000; | ||
| 2739 | xor bx,bx | ||
| 2740 | push es ; ;AN000; | ||
| 2741 | INT 21h ; GetExtendedError + not_used <5900>;AN000; | ||
| 2742 | pop es | ||
| 2743 | mov bx,STDERR ; fix up bx ;AN000; | ||
| 2744 | xor cx,cx ; fix up cx ;AN000; | ||
| 2745 | mov dh,EXT_ERR_CLASS ; set class to dos error | ||
| 2746 | |||
| 2747 | ret ; ;AN000; | ||
| 2748 | |||
| 2749 | ENDPROC Get_DOS_Error | ||
| 2750 | |||
| 2751 | Break <ShComndParse - Share Command line Parser> | ||
| 2752 | |||
| 2753 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 2754 | ; | ||
| 2755 | ; NAME: ShComndParse - Share Command line Parser | ||
| 2756 | ; | ||
| 2757 | ; FUNCTION: Call the DOS PARSE Service Routines to process the command | ||
| 2758 | ; line. Search for valid switches (/F:n and /L:m) and | ||
| 2759 | ; update the values for file size and number of locks accordingly | ||
| 2760 | ; | ||
| 2761 | ; INPUT: Parameter string from command line in the PSP | ||
| 2762 | ; | ||
| 2763 | ; OUTPUT: INITspace and INITlocks are updated. | ||
| 2764 | ; | ||
| 2765 | ; REGISTERS USED: ES DI AX BX CX DX | ||
| 2766 | ; (NOT RESTORED) | ||
| 2767 | ; | ||
| 2768 | ; LINKAGE: Call | ||
| 2769 | ; | ||
| 2770 | ; NORMAL - If /F:n specified, then INITspace is updated. | ||
| 2771 | ; EXIT: - If /L:m specified, then INITlocks is updated. | ||
| 2772 | ; | ||
| 2773 | ; ERROR If user enters: | ||
| 2774 | ; EXIT: - any parameter or switch other than /F:n or /L:m | ||
| 2775 | ; - an invalid value for "n" or "m" | ||
| 2776 | ; then this routine will display the "Invalid Parameter" | ||
| 2777 | ; error message and terminate. | ||
| 2778 | ; | ||
| 2779 | ; EXTERNAL - System parse service routines | ||
| 2780 | ; REFERENCES: - INT21 - GET PSP Function Call 062h | ||
| 2781 | ; | ||
| 2782 | ; CHANGE 04/15/87 - First release | ||
| 2783 | ; LOG: | ||
| 2784 | ; | ||
| 2785 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 2786 | ;******************+ START OF PSEUDOCODE +************************************** | ||
| 2787 | ; | ||
| 2788 | ; START | ||
| 2789 | ; | ||
| 2790 | ; return | ||
| 2791 | ; | ||
| 2792 | ; END | ||
| 2793 | ; | ||
| 2794 | ;******************- END OF PSEUDOCODE -************************************* | ||
| 2795 | |||
| 2796 | ; $SALUT (4,27,34,41) | ||
| 2797 | |||
| 2798 | ;-------------------------------------- | ||
| 2799 | ; Parse Equates | ||
| 2800 | ;-------------------------------------- | ||
| 2801 | |||
| 2802 | EOL equ -1 ; Indicator for End-Of-Line ;AN000; | ||
| 2803 | NOERROR equ 0 ; Return Indicator for No Errors ;AN000; | ||
| 2804 | FILE_SWITCH equ 1 ; this is a file switch ;AN000; | ||
| 2805 | LOCK_SWITCH equ 2 ; this is a lock switch ;AN000; | ||
| 2806 | Syntax_Error equ 9 ; maximum PARSE error # ;AN000; | ||
| 2807 | |||
| 2808 | ; $SALUT (4,4,9,41) | ||
| 2809 | |||
| 2810 | Procedure ShComndParse,near ; ;AN000; | ||
| 2811 | ;-------------------------------------- | ||
| 2812 | ; Get address of command line | ||
| 2813 | ;-------------------------------------- | ||
| 2814 | EXTRN SYSPARSE:NEAR ; ;AN000; | ||
| 2815 | |||
| 2816 | MOV SI,0081H ; OFFSET OF COMMAND LINE IN PSP ;AN000; | ||
| 2817 | MOV AH,62H ; AH=GET PSP ADDRESS FUNCTION CALL ;AN000; | ||
| 2818 | INT 21H ; PSP SEGMENT RETURNED IN BX ;AN000; | ||
| 2819 | MOV DS,BX ; PUT PSP SEG IN DS ;AN000; | ||
| 2820 | MOV CX,0 ; NUMBER OF PARMS PROCESSED SO FAR ;AN000; | ||
| 2821 | PUSH CS ; ;AN000; | ||
| 2822 | POP ES ; ;AN000; | ||
| 2823 | |||
| 2824 | ASSUME ES:SHARE ; ;AN000; | ||
| 2825 | |||
| 2826 | ;-------------------------------------- | ||
| 2827 | ; Loop for each operand at DS:SI | ||
| 2828 | ;-------------------------------------- | ||
| 2829 | ; $do ; ;AN000; | ||
| 2830 | $$DO80: | ||
| 2831 | |||
| 2832 | LEA DI,PARMS ; ADDRESS OF PARSE CONTROLS ;AN000; | ||
| 2833 | MOV DX,0 ; RESERVED ;AN000; | ||
| 2834 | mov msg_offset,si ; save the start scan point ;AC009; | ||
| 2835 | CALL SYSPARSE ; PARSE IT! ;AN000; | ||
| 2836 | CMP AX,EOL ; ARE WE AT END OF COMMAND LINE ? ;AN000; | ||
| 2837 | |||
| 2838 | ; $leave e ; ;AN000; | ||
| 2839 | JE $$EN80 | ||
| 2840 | |||
| 2841 | CMP AX,NOERROR ; ANY ERRORS? ;AN000; | ||
| 2842 | |||
| 2843 | ; $if ne,or ; if parse says error or ;AN000; | ||
| 2844 | JNE $$LL82 | ||
| 2845 | |||
| 2846 | MOV AX,Syntax_Error ; Parse syntax error - just in case ;AN000; | ||
| 2847 | MOV BX,DX ; PLACE RESULT ADDRESS IN BX ;AN000; | ||
| 2848 | CMP BX,OFFSET SWITCH_BUFF ; ;AN000; | ||
| 2849 | |||
| 2850 | ; $if ne ; if no pointer ;AN000; | ||
| 2851 | JE $$IF82 | ||
| 2852 | $$LL82: | ||
| 2853 | |||
| 2854 | call PARSE_ERROR ; call error routine ;AN000; | ||
| 2855 | |||
| 2856 | ; $endif ; endif - error ;AN000; | ||
| 2857 | $$IF82: | ||
| 2858 | |||
| 2859 | MOV AX,WORD PTR SW_VALUE ; load the value ;AN000; | ||
| 2860 | MOV BX,SW_SYN ; load pointer to synonym ;AN000; | ||
| 2861 | |||
| 2862 | ;-------------------------------------- | ||
| 2863 | ; If user said /F:n, then | ||
| 2864 | ;-------------------------------------- | ||
| 2865 | |||
| 2866 | CMP BX,OFFSET F_SW ; IF USER SPECIFIED /F ;AN000; | ||
| 2867 | |||
| 2868 | ; $if e ; ;AN000; | ||
| 2869 | JNE $$IF84 | ||
| 2870 | |||
| 2871 | CMP INITspace,AX ; is default < requested ? ;AN000; | ||
| 2872 | |||
| 2873 | ; $if b ; if default is < ;AN000; | ||
| 2874 | JNB $$IF85 | ||
| 2875 | MOV INITspace,AX ; save the new value ;AN000; | ||
| 2876 | ; $endif ; endif (else leave it alone) ;AN000; | ||
| 2877 | $$IF85: | ||
| 2878 | |||
| 2879 | ; $else ; else - CHECK FOR LOCKS ;AN000; | ||
| 2880 | JMP SHORT $$EN84 | ||
| 2881 | $$IF84: | ||
| 2882 | |||
| 2883 | ;--------------------------------------- | ||
| 2884 | ; If user said /L:m, then update INITlocks | ||
| 2885 | ;--------------------------------------- | ||
| 2886 | CMP BX,OFFSET L_SW ; IF USER SPECIFIED /L ;AN000; | ||
| 2887 | |||
| 2888 | ; $if e ; if it is ;AN000; | ||
| 2889 | JNE $$IF88 | ||
| 2890 | |||
| 2891 | CMP INITlocks,AX ; is default < requested ? ;AN000; | ||
| 2892 | |||
| 2893 | ; $if b ; if default is < ;AN000; | ||
| 2894 | JNB $$IF89 | ||
| 2895 | MOV INITlocks,AX ; save the value ;AN000; | ||
| 2896 | ; $endif ; endif (else leave it alone) ;AN000; | ||
| 2897 | $$IF89: | ||
| 2898 | |||
| 2899 | ; $else ; else - CHECK FOR TOGGLE ;AN010; | ||
| 2900 | JMP SHORT $$EN88 | ||
| 2901 | $$IF88: | ||
| 2902 | |||
| 2903 | ;--------------------------------------- | ||
| 2904 | ; If user said /NC, then update check_flag | ||
| 2905 | ;--------------------------------------- | ||
| 2906 | CMP BX,OFFSET N_SW ; IF USER SPECIFIED /NC ;AN010; | ||
| 2907 | ; $if ne ; if error ;AC010; | ||
| 2908 | JE $$IF92 | ||
| 2909 | MOV AX,Syntax_Error ; Parse syntax error ;AN000; | ||
| 2910 | call PARSE_ERROR ; call error routine ;AN000; | ||
| 2911 | ; $endif ; endif - error ;AC010; | ||
| 2912 | $$IF92: | ||
| 2913 | |||
| 2914 | mov skip_check,1 ; set the skip check flag ;AN010; | ||
| 2915 | |||
| 2916 | ; $endif ; endif - CHECK FOR TOGGLE ;AN010; | ||
| 2917 | $$EN88: | ||
| 2918 | |||
| 2919 | ; $endif ; endif - CHECK FOR LOCKS ;AN000; | ||
| 2920 | $$EN84: | ||
| 2921 | |||
| 2922 | ; $enddo ; CHECK FOR NEXT PARM ;AN000; | ||
| 2923 | JMP SHORT $$DO80 | ||
| 2924 | $$EN80: | ||
| 2925 | |||
| 2926 | ret ; NORMAL RETURN TO CALLER ;AN000; | ||
| 2927 | |||
| 2928 | ;--------------------------------------- | ||
| 2929 | ; If any other parameter specified, | ||
| 2930 | ; display message and quit | ||
| 2931 | ;--------------------------------------- | ||
| 2932 | PARSE_ERROR: ; ;AN000; | ||
| 2933 | |||
| 2934 | cmp al,Syntax_Error ; error 1 to 9 ? ;AN000; | ||
| 2935 | |||
| 2936 | ; $if a ; if parse error ;AN000; | ||
| 2937 | JNA $$IF97 | ||
| 2938 | |||
| 2939 | mov al,Syntax_Error ; Parse syntax error | ||
| 2940 | |||
| 2941 | ; $endif ; endif errors ;AN000; | ||
| 2942 | $$IF97: | ||
| 2943 | |||
| 2944 | lea bx,Parse_Ret_Code | ||
| 2945 | xlat cs:[bx] | ||
| 2946 | mov ah,PARSE_ERR_CLASS ; set class to parse error ;AN000; | ||
| 2947 | |||
| 2948 | CALL ShDispMsg ; display the parse error ;AN000; | ||
| 2949 | |||
| 2950 | ret ; this should never be used | ||
| 2951 | |||
| 2952 | Parse_Ret_Code label byte | ||
| 2953 | |||
| 2954 | db 0 ; Ret Code 0 - | ||
| 2955 | db 9 ; Ret Code 1 - Too many parameters | ||
| 2956 | db 9 ; Ret Code 2 - Required parameter missing | ||
| 2957 | db 3 ; Ret Code 3 - Invalid switch | ||
| 2958 | db 9 ; Ret Code 4 - Invalid keyword | ||
| 2959 | db 9 ; Ret Code 5 - (reserved) | ||
| 2960 | db 6 ; Ret Code 6 - Parm val out of range | ||
| 2961 | db 9 ; Ret Code 7 - Parameter val not allowed | ||
| 2962 | db 9 ; Ret Code 8 - Parameter val not allowed | ||
| 2963 | db 9 ; Ret Code 9 - Parm format not correct | ||
| 2964 | |||
| 2965 | EndProc ShComndParse ; ;AN000; | ||
| 2966 | |||
| 2967 | include msgdcl.inc | ||
| 2968 | |||
| 2969 | SHARE ENDS | ||
| 2970 | |||
| 2971 | STACK SEGMENT STACK | ||
| 2972 | DB 278 + 128 DUP (?) ; 278 == IBM's ROM requirements | ||
| 2973 | STACK ENDS | ||
| 2974 | |||
| 2975 | ENDIF | ||
| 2976 | |||
| 2977 | END shareinit | ||
| 2978 | |||
| 2979 | \ No newline at end of file | ||
diff --git a/v4.0/src/CMD/SHARE/MAKEFILE b/v4.0/src/CMD/SHARE/MAKEFILE new file mode 100644 index 0000000..d40282f --- /dev/null +++ b/v4.0/src/CMD/SHARE/MAKEFILE | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #************************ makefile for cmd\share ************************* | ||
| 2 | |||
| 3 | msg =..\..\messages | ||
| 4 | dos =..\..\dos | ||
| 5 | inc =..\..\inc | ||
| 6 | hinc =..\..\h | ||
| 7 | here =..\cmd\share # This is the path from INC or MAP dir's to here. | ||
| 8 | make =nmake -i | ||
| 9 | |||
| 10 | # | ||
| 11 | ####################### dependencies begin here. ######################### | ||
| 12 | # | ||
| 13 | |||
| 14 | all: share.exe | ||
| 15 | |||
| 16 | msdos.cl1: $(dos)\msdos.skl \ | ||
| 17 | $(msg)\$(COUNTRY).msg \ | ||
| 18 | $(dos)\makefile | ||
| 19 | copy $(dos)\msdos.skl | ||
| 20 | nosrvbld msdos.skl $(msg)\$(COUNTRY).msg | ||
| 21 | |||
| 22 | |||
| 23 | share.ctl: share.skl $(msg)\$(COUNTRY).msg | ||
| 24 | |||
| 25 | $(inc)\dossym.inc: $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\curdir.inc \ | ||
| 26 | $(inc)\buffer.inc $(inc)\sysvar.inc $(inc)\vector.inc \ | ||
| 27 | $(inc)\mult.inc $(inc)\dirent.inc $(inc)\dpb.inc \ | ||
| 28 | $(inc)\cpmfcb.inc $(inc)\find.inc $(inc)\pdb.inc \ | ||
| 29 | $(inc)\exe.inc $(inc)\sf.inc $(inc)\arena.inc \ | ||
| 30 | $(inc)\intnat.inc $(inc)\mi.inc $(inc)\filemode.inc \ | ||
| 31 | $(inc)\error.inc $(inc)\syscall.inc | ||
| 32 | echo " touch dossym.inc " | ||
| 33 | |||
| 34 | gshare.obj: gshare.asm $(inc)\dossym.inc $(inc)\mft.inc \ | ||
| 35 | $(inc)\bugtyp.asm | ||
| 36 | |||
| 37 | gshare2.obj: gshare2.asm $(inc)\dossym.inc $(inc)\dosseg.asm $(inc)\mft.inc \ | ||
| 38 | $(inc)\bugtyp.asm | ||
| 39 | |||
| 40 | sharesr.obj: sharesr.asm $(inc)\parse.asm $(inc)\psdata.inc | ||
| 41 | |||
| 42 | sharelnk.obj: sharelnk.asm | ||
| 43 | |||
| 44 | $(inc)\nibdos.obj: | ||
| 45 | cd $(inc) | ||
| 46 | $(make) | ||
| 47 | cd $(here) | ||
| 48 | |||
| 49 | $(inc)\const2.obj: | ||
| 50 | cd $(inc) | ||
| 51 | $(make) | ||
| 52 | cd $(here) | ||
| 53 | |||
| 54 | $(inc)\msdata.obj: | ||
| 55 | cd $(inc) | ||
| 56 | $(make) | ||
| 57 | cd $(here) | ||
| 58 | |||
| 59 | $(inc)\msdosme.obj: | ||
| 60 | cd $(inc) | ||
| 61 | $(make) | ||
| 62 | cd $(here) | ||
| 63 | |||
| 64 | share.exe: share.ctl gshare.obj gshare2.obj sharesr.obj $(inc)\nibdos.obj \ | ||
| 65 | $(inc)\const2.obj $(inc)\msdata.obj $(inc)\msdosme.obj sharelnk.obj \ | ||
| 66 | share.lnk | ||
| 67 | link @share.lnk | ||
diff --git a/v4.0/src/CMD/SHARE/SHARE.LNK b/v4.0/src/CMD/SHARE/SHARE.LNK new file mode 100644 index 0000000..879e756 --- /dev/null +++ b/v4.0/src/CMD/SHARE/SHARE.LNK | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | gshare+ | ||
| 2 | gshare2+ | ||
| 3 | sharesr+ | ||
| 4 | sharelnk+ | ||
| 5 | ..\..\inc\nibdos+ | ||
| 6 | ..\..\inc\const2+ | ||
| 7 | ..\..\inc\msdata+ | ||
| 8 | ..\..\inc\msdosme | ||
| 9 | share,share.map /m; | ||
diff --git a/v4.0/src/CMD/SHARE/SHARE.SKL b/v4.0/src/CMD/SHARE/SHARE.SKL new file mode 100644 index 0000000..0be6308 --- /dev/null +++ b/v4.0/src/CMD/SHARE/SHARE.SKL | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | ;================================================ | ||
| 2 | ; SHARE Message Skeleton File | ||
| 3 | ;================================================ | ||
| 4 | |||
| 5 | :util SHARE | ||
| 6 | |||
| 7 | :class 1 | ||
| 8 | |||
| 9 | :use EXTEND8 | ||
| 10 | |||
| 11 | :class 2 | ||
| 12 | ;1 - Too many operands | ||
| 13 | ;2 - Required operand missing | ||
| 14 | :use PARSE3 ;3 - Not in switch list provided | ||
| 15 | ;4 - Not in keyword list provided | ||
| 16 | :use PARSE6 ;6 - Out of range specified | ||
| 17 | ;7 - Not in value list provided | ||
| 18 | ;8 - Not in string list provided | ||
| 19 | :use PARSE9 ;9 - Invalid Parameter | ||
| 20 | |||
| 21 | :class A | ||
| 22 | |||
| 23 | :use 1 COMMON1 ; Incorrect DOS version | ||
| 24 | :use 2 COMMON2 ; "%1 already installed" | ||
| 25 | |||
| 26 | :end | ||
| 27 | \ No newline at end of file | ||
diff --git a/v4.0/src/CMD/SHARE/SHAREHDR.INC b/v4.0/src/CMD/SHARE/SHAREHDR.INC new file mode 100644 index 0000000..e00d5f6 --- /dev/null +++ b/v4.0/src/CMD/SHARE/SHAREHDR.INC | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | page 80,132 | ||
| 2 | ;******************* START OF SPECIFICATIONS *********************************** | ||
| 3 | ; | ||
| 4 | ; MODULE NAME: SHARE.EXE (a true EXE file) | ||
| 5 | ; | ||
| 6 | ; DESCRIPTIVE NAME: SHARE resident service routines - part 1 - GSHARE.SAL | ||
| 7 | ; - part 2 - GSHARE2.SAL | ||
| 8 | ; - part 3 - SHARESR.SAL | ||
| 9 | ; | ||
| 10 | ; FUNCTION: Provide file sharing services for DOS | ||
| 11 | ; | ||
| 12 | ; ENTRY POINT: DOS Jump Table - installed by SHARE at initalization | ||
| 13 | ; | ||
| 14 | ; MFT_Enter 1 | ||
| 15 | ; MFTClose 2 | ||
| 16 | ; MFTClu 3 | ||
| 17 | ; MFTCloseP 4 | ||
| 18 | ; MFTCloN 5 | ||
| 19 | ; Set_Mult_Block 6 | ||
| 20 | ; Clr_Mult_Block 7 | ||
| 21 | ; Chk_Block 8 | ||
| 22 | ; MFT_Get 9 | ||
| 23 | ; | ||
| 24 | ; INPUT: See Prolog to individual entry points | ||
| 25 | ; | ||
| 26 | ; EXIT NORMAL: CF = 0 and requested task performed. | ||
| 27 | ; | ||
| 28 | ; EXIT ERROR: CF = 1 ans error code in AX | ||
| 29 | ; | ||
| 30 | ; INTERNAL REFERENCES: | ||
| 31 | ; | ||
| 32 | ; ROUTINES: Set_Block BCS | ||
| 33 | ; Clr_Block CSL | ||
| 34 | ; CLP CUC | ||
| 35 | ; Load_Regs CSI | ||
| 36 | ; ASC GOM | ||
| 37 | ; | ||
| 38 | ; DATA AREAS: | ||
| 39 | ; | ||
| 40 | ; EXTERNAL REFERENCES: INT 21 INT 2F | ||
| 41 | ; together with: | ||
| 42 | ; | ||
| 43 | ; fnm:near, rsc:near, rmn:near, cps:near, ofl:near, sle:near, interr:near | ||
| 44 | ; | ||
| 45 | ; ROUTINES: | ||
| 46 | ; | ||
| 47 | ; DATA AREAS: | ||
| 48 | ; | ||
| 49 | ; NOTES: The second part of this utility is GSHARE2.ASM | ||
| 50 | ; | ||
| 51 | ; REVISION HISTORY: Version 1.0 09/09/83 - first release GL | ||
| 52 | ; 09/13/83 - Installability MZ | ||
| 53 | ; 01/11/84 - FCB compatability changes MZ | ||
| 54 | ; PTM P000438 08/21/86 - SFT LCK FIELDS not 0 error DL | ||
| 55 | ; Ax000 Ver 4.0 04/15/87 - changed:- Set_Block FJG | ||
| 56 | ; - Clr_Block FJG | ||
| 57 | ; - Chk_Block FJG | ||
| 58 | ; - CLP FJG | ||
| 59 | ; new: - Set_Mult_Block FJG | ||
| 60 | ; - Clr_Mult_Block FJG | ||
| 61 | ; - Load_Regs FJG | ||
| 62 | ; - Clr_List FJG | ||
| 63 | ; Ax002 PTM P001658 10/15/87 - changed I/F to IBMDOS FJG | ||
| 64 | ; Ax003 PTM P002064 10/15/87 - ShSU SFT - IFS call error FJG | ||
| 65 | ; Ax004 PTM P002121 10/29/87 - Clr_Mult_Block cx=-1 err FJG | ||
| 66 | ; Ax005 PTM P002322 11/06/87 - Call_IFS - 2F semaphore FJG | ||
| 67 | ; Ax006 DCR D000494 12/17/87 - DOS 4.00 function reductionFJG | ||
| 68 | ; Ax007 PTM P003841 03/17/88 - access error for Turbo L FJG | ||
| 69 | ; Ax008 PTM P003880 03/17/88 - duped handle error FJG | ||
| 70 | ; Ax009 PTM P003910 03/17/88 - wrong parse error format FJG | ||
| 71 | ; Ax010 DCR D000526 04/27/88 - add /nc switch support FJG | ||
| 72 | ; Ax011 PTM P004546 05/03/88 - add /nc support to fShare FJG | ||
diff --git a/v4.0/src/CMD/SHARE/SHARELNK.ASM b/v4.0/src/CMD/SHARE/SHARELNK.ASM new file mode 100644 index 0000000..c264032 --- /dev/null +++ b/v4.0/src/CMD/SHARE/SHARELNK.ASM | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | PAGE ,132 ; | ||
| 2 | ; SCCSID = @(#)SHARELNK.asm 1.0 87/05/11 | ||
| 3 | TITLE SHARELNK LINK FIX ROUTINES - Routines to resolve SHARE externals | ||
| 4 | NAME SHARELNK | ||
| 5 | |||
| 6 | .xlist | ||
| 7 | .xcref | ||
| 8 | INCLUDE DOSSYM.INC | ||
| 9 | INCLUDE DEVSYM.INC | ||
| 10 | .cref | ||
| 11 | .list | ||
| 12 | |||
| 13 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 14 | code ENDS | ||
| 15 | |||
| 16 | include dosseg.asm | ||
| 17 | |||
| 18 | |||
| 19 | code SEGMENT BYTE PUBLIC 'code' | ||
| 20 | ASSUME CS:dosgroup | ||
| 21 | |||
| 22 | PUBLIC IRETT, SWAP_AREA_LEN, Hash_Temp | ||
| 23 | IRETT DW 0 | ||
| 24 | SWAP_AREA_LEN DW 0 | ||
| 25 | Hash_Temp DW 0 | ||
| 26 | |||
| 27 | procedure LCRITDEVICE,FAR | ||
| 28 | NOP | ||
| 29 | Endproc LCRITDEVICE,FAR | ||
| 30 | |||
| 31 | procedure SETMEM,FAR | ||
| 32 | NOP | ||
| 33 | endproc SETMEM,FAR | ||
| 34 | |||
| 35 | procedure SKIPONE,FAR | ||
| 36 | NOP | ||
| 37 | endproc SKIPONE,FAR | ||
| 38 | |||
| 39 | procedure TWOESC,FAR | ||
| 40 | NOP | ||
| 41 | endproc TWOESC,FAR | ||
| 42 | |||
| 43 | procedure $STD_CON_STRING_INPUT_NO_ECHO,FAR | ||
| 44 | NOP | ||
| 45 | endproc $STD_CON_STRING_INPUT_NO_ECHO,FAR | ||
| 46 | |||
| 47 | procedure $STD_CON_INPUT_NO_ECHO,FAR | ||
| 48 | NOP | ||
| 49 | endproc $STD_CON_INPUT_NO_ECHO,FAR | ||
| 50 | |||
| 51 | procedure INT2F,FAR | ||
| 52 | NOP | ||
| 53 | endproc INT2F,FAR | ||
| 54 | |||
| 55 | procedure $dup_pdb,FAR | ||
| 56 | NOP | ||
| 57 | endproc $dup_pdb,FAR | ||
| 58 | |||
| 59 | procedure LEAVEDOS,FAR | ||
| 60 | NOP | ||
| 61 | endproc LEAVEDOS,FAR | ||
| 62 | |||
| 63 | procedure GETCH,FAR | ||
| 64 | NOP | ||
| 65 | endproc GETCH,FAR | ||
| 66 | |||
| 67 | procedure COPYONE,FAR | ||
| 68 | NOP | ||
| 69 | endproc COPYONE,FAR | ||
| 70 | |||
| 71 | procedure $SETDPB,FAR | ||
| 72 | NOP | ||
| 73 | endproc $SETDPB,FAR | ||
| 74 | |||
| 75 | procedure CALL_ENTRY,FAR | ||
| 76 | NOP | ||
| 77 | endproc CALL_ENTRY,FAR | ||
| 78 | |||
| 79 | procedure ECRITDISK,FAR | ||
| 80 | NOP | ||
| 81 | endproc ECRITDISK,FAR | ||
| 82 | |||
| 83 | procedure COPYLIN,FAR | ||
| 84 | NOP | ||
| 85 | endproc COPYLIN,FAR | ||
| 86 | |||
| 87 | procedure LCRITDISK,FAR | ||
| 88 | NOP | ||
| 89 | endproc LCRITDISK,FAR | ||
| 90 | |||
| 91 | procedure QUIT,FAR | ||
| 92 | NOP | ||
| 93 | endproc QUIT,FAR | ||
| 94 | |||
| 95 | procedure BACKSP,FAR | ||
| 96 | NOP | ||
| 97 | endproc BACKSP,FAR | ||
| 98 | |||
| 99 | procedure DIVOV,FAR | ||
| 100 | NOP | ||
| 101 | endproc DIVOV,FAR | ||
| 102 | |||
| 103 | procedure STAY_RESIDENT,FAR | ||
| 104 | NOP | ||
| 105 | endproc STAY_RESIDENT,FAR | ||
| 106 | |||
| 107 | procedure CTRLZ,FAR | ||
| 108 | NOP | ||
| 109 | endproc CTRLZ,FAR | ||
| 110 | |||
| 111 | procedure EXITINS,FAR | ||
| 112 | NOP | ||
| 113 | endproc EXITINS,FAR | ||
| 114 | |||
| 115 | procedure OKCALL,FAR | ||
| 116 | NOP | ||
| 117 | endproc OKCALL,FAR | ||
| 118 | |||
| 119 | procedure SKIPSTR,FAR | ||
| 120 | NOP | ||
| 121 | endproc SKIPSTR,FAR | ||
| 122 | |||
| 123 | procedure ABSDWRT,FAR | ||
| 124 | NOP | ||
| 125 | endproc ABSDWRT,FAR | ||
| 126 | |||
| 127 | procedure BADCALL,FAR | ||
| 128 | NOP | ||
| 129 | endproc BADCALL,FAR | ||
| 130 | |||
| 131 | procedure REEDIT,FAR | ||
| 132 | NOP | ||
| 133 | endproc REEDIT,FAR | ||
| 134 | |||
| 135 | |||
| 136 | procedure INULDEV,FAR | ||
| 137 | NOP | ||
| 138 | endproc INULDEV,FAR | ||
| 139 | |||
| 140 | procedure ABSDRD,FAR | ||
| 141 | NOP | ||
| 142 | endproc ABSDRD,FAR | ||
| 143 | |||
| 144 | procedure SNULDEV,FAR | ||
| 145 | NOP | ||
| 146 | endproc SNULDEV,FAR | ||
| 147 | |||
| 148 | procedure COPYSTR,FAR | ||
| 149 | NOP | ||
| 150 | endproc COPYSTR,FAR | ||
| 151 | |||
| 152 | procedure ECRITDEVICE,FAR | ||
| 153 | NOP | ||
| 154 | endproc ECRITDEVICE,FAR | ||
| 155 | |||
| 156 | procedure COMMAND,FAR | ||
| 157 | NOP | ||
| 158 | endproc COMMAND,FAR | ||
| 159 | |||
| 160 | procedure ENTERINS,FAR | ||
| 161 | NOP | ||
| 162 | endproc ENTERINS,FAR | ||
| 163 | |||
| 164 | procedure DEVIOCALL2,FAR | ||
| 165 | NOP | ||
| 166 | endproc DEVIOCALL2,FAR | ||
| 167 | |||
| 168 | procedure FASTOPENTABLE,FAR | ||
| 169 | NOP | ||
| 170 | endproc FASTOPENTABLE,FAR | ||
| 171 | |||
| 172 | procedure HEADER,FAR | ||
| 173 | NOP | ||
| 174 | endproc HEADER,FAR | ||
| 175 | |||
| 176 | procedure SYSINITTABLE,FAR | ||
| 177 | NOP | ||
| 178 | endproc SYSINITTABLE,FAR | ||
| 179 | |||
| 180 | procedure FETCHI_TAG,FAR | ||
| 181 | NOP | ||
| 182 | endproc FETCHI_TAG,FAR | ||
| 183 | |||
| 184 | procedure IFS_DOSCALL,FAR | ||
| 185 | NOP | ||
| 186 | endproc IFS_DOSCALL,FAR | ||
| 187 | |||
| 188 | procedure KILNEW,FAR | ||
| 189 | NOP | ||
| 190 | endproc KILNEW,FAR | ||
| 191 | |||
| 192 | procedure PACKET_TEMP,FAR | ||
| 193 | NOP | ||
| 194 | endproc PACKET_TEMP,FAR | ||
| 195 | |||
| 196 | procedure Swap_in_DOS_Len,FAR | ||
| 197 | NOP | ||
| 198 | endproc Swap_in_DOS_Len,FAR | ||
| 199 | |||
| 200 | procedure swap_always_area,far | ||
| 201 | NOP | ||
| 202 | endproc swap_always_area,FAR | ||
| 203 | |||
| 204 | procedure swap_always_area_len,FAR | ||
| 205 | NOP | ||
| 206 | endproc swap_always_area_len,FAR | ||
| 207 | |||
| 208 | procedure swap_in_dos,FAR | ||
| 209 | NOP | ||
| 210 | endproc swap_in_dos,FAR | ||
| 211 | |||
| 212 | code ENDS | ||
| 213 | END | ||
diff --git a/v4.0/src/CMD/SHARE/SHARESR.ASM b/v4.0/src/CMD/SHARE/SHARESR.ASM new file mode 100644 index 0000000..4da66db --- /dev/null +++ b/v4.0/src/CMD/SHARE/SHARESR.ASM | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | Title Sharesr - IBM CONFIDENTIAL | ||
| 2 | ; $SALUT (0,36,41,44) | ||
| 3 | include SHAREHDR.INC | ||
| 4 | ; | ||
| 5 | ; Label: "The DOS SHARE Utility" | ||
| 6 | ; "Version 4.00 (C) Copyright 1988 Microsoft" | ||
| 7 | ; "Licenced Material - Program Property of Microsoft" | ||
| 8 | ; | ||
| 9 | ;******************* END OF SPECIFICATIONS ************************************* | ||
| 10 | |||
| 11 | NAME Sharsr | ||
| 12 | |||
| 13 | .xlist | ||
| 14 | .xcref | ||
| 15 | |||
| 16 | include SYSMSG.INC | ||
| 17 | |||
| 18 | .cref | ||
| 19 | .list | ||
| 20 | |||
| 21 | MSG_UTILNAME <SHARE> | ||
| 22 | |||
| 23 | Share SEGMENT BYTE PUBLIC 'SHARE' | ||
| 24 | |||
| 25 | PUBLIC SYSDISPMSG, SYSLOADMSG, SYSPARSE | ||
| 26 | |||
| 27 | ASSUME CS:Share,DS:nothing,ES:nothing | ||
| 28 | |||
| 29 | ; include Message Code | ||
| 30 | |||
| 31 | |||
| 32 | .xlist | ||
| 33 | .xcref | ||
| 34 | |||
| 35 | |||
| 36 | MSG_SERVICES <MSGDATA> | ||
| 37 | |||
| 38 | MSG_SERVICES <LOADmsg> | ||
| 39 | |||
| 40 | MSG_SERVICES <DISPLAYmsg,CHARmsg> | ||
| 41 | |||
| 42 | MSG_SERVICES <SHARE.CLA,SHARE.CL1,SHARE.CL2> | ||
| 43 | |||
| 44 | .cref | ||
| 45 | .list | ||
| 46 | |||
| 47 | |||
| 48 | false = 0 | ||
| 49 | |||
| 50 | DateSW equ false | ||
| 51 | TimeSW equ false | ||
| 52 | CmpxSW equ false | ||
| 53 | KeySW equ false | ||
| 54 | DrvSW equ false | ||
| 55 | FileSW equ false | ||
| 56 | QusSW equ false | ||
| 57 | Val2SW equ false | ||
| 58 | Val3SW equ false | ||
| 59 | |||
| 60 | |||
| 61 | ; include parse.asm | ||
| 62 | .xlist | ||
| 63 | .xcref | ||
| 64 | include parse.asm | ||
| 65 | include msgdcl.inc | ||
| 66 | .cref | ||
| 67 | .list | ||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | Share ENDS | ||
| 72 | END | ||
| 73 | \ No newline at end of file | ||