]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/DOS/SHARE.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / DOS / SHARE.ASM
1 ; SCCSID = @(#)share.asm 1.1 85/04/10
2 TITLE SHARING ROUTINES - Routines for file Sharing
3 NAME SHARE
4
5 include dosseg.asm
6
7 CODE SEGMENT BYTE PUBLIC 'CODE'
8 ASSUME SS:DOSGROUP,CS:DOSGROUP
9
10 .xlist
11 .xcref
12 INCLUDE DOSSYM.INC
13 INCLUDE DEVSYM.INC
14 .cref
15 .list
16
17 AsmVars <IBM, Installed>
18
19 Installed = True
20
21 i_need THISDPB,DWORD
22 i_need EXTERR,WORD
23 i_need ReadOp,BYTE
24 i_need ThisSFT,DWORD
25 i_need ALLOWED,BYTE
26 I_need RetryCount,WORD
27 i_need JShare,DWORD
28
29 ; Inputs:
30 ; [THISSFT] Points to filled in local file/device SFT for new
31 ; instance of file sf_mode ALWAYS has mode (even on FCB SFTs)
32 ; [WFP_START] has full path of name
33 ; [USER_ID] Set
34 ; [PROC_ID] Set
35 ; Function:
36 ; Check for sharing violations on local file/device access
37 ; Outputs:
38 ; Carry clear
39 ; Sharing approved
40 ; Carry set
41 ; A sharing violation detected
42 ; AX is error code
43 ; USES ALL but DS
44
45 procedure SHARE_CHECK,NEAR
46 DOSAssume CS,<DS>,"Share_Check"
47 ASSUME ES:NOTHING
48
49 if installed
50 call JShare + 1 * 4
51 else
52 Call MFT_Enter
53 endif
54 return
55
56 EndProc SHARE_CHECK
57
58 ; Inputs:
59 ; [THISDPB] Set
60 ; AX has error code
61 ; Function:
62 ; Handle Sharing errors
63 ; Outputs:
64 ; Carry set if user says FAIL, causes error_sharing_violation
65 ; Carry clear if user wants a retry
66 ;
67 ; DS, ES, DI preserved, others destroyed
68
69 procedure SHARE_VIOLATION,NEAR
70 DOSAssume CS,<DS>,"Share_Violation"
71 ASSUME ES:NOTHING
72
73 PUSH DS
74 PUSH ES
75 PUSH DI
76 MOV [READOP],0 ; All share errors are reading
77 MOV [ALLOWED],allowed_FAIL + allowed_RETRY
78 LES BP,[THISDPB]
79 MOV DI,1 ; Fake some registers
80 MOV CX,DI
81 MOV DX,ES:[BP.dpb_dir_sector]
82 invoke HARDERR
83 POP DI
84 POP ES
85 POP DS
86 CMP AL,1
87 retz ; 1 = retry, carry clear
88 STC
89 return
90
91 EndProc SHARE_VIOLATION
92
93 ; ShareEnd - terminate sharing info on a particular SFT/UID/PID. This does
94 ; NOT perform a close, it merely asserts that the sharing information
95 ; for the SFT/UID/PID may be safely released.
96 ;
97 ; Inputs: ES:DI points to an SFT
98 ; Outputs: None
99 ; Registers modified: all except DS,ES,DI
100
101 procedure ShareEnd,Near
102 DOSAssume CS,<DS>,"ShareEnd"
103 ASSUME ES:NOTHING
104
105 if installed
106 Call JShare + 2 * 4
107 else
108 Call MFTClose
109 endif
110 return
111
112 EndProc ShareEnd
113
114 break <ShareEnter - attempt to enter a node into the sharing set>
115
116 ;
117 ; ShareEnter - perform a retried entry of a nodde into the sharing set. If
118 ; the max number of retries is exceeded, we notify the user via int 24.
119 ;
120 ; Inputs: ThisSFT points to the SFT
121 ; WFP_Start points to the WFP
122 ; Outputs: Carry clear => successful entry
123 ; Carry set => failed system call
124 ; Registers modified: all
125
126 Procedure ShareEnter,NEAR
127 DOSAssume CS,<DS>,"ShareEnter"
128 assume es:nothing
129
130 SaveReg <CX>
131 retry:
132 mov cx,RetryCount
133 attempt:
134 les di,ThisSFT ; grab sft
135 XOR AX,AX
136 MOV ES:[DI.sf_MFT],AX ; indicate free SFT
137 SaveReg <CX>
138 call Share_Check ; attempt to enter into the sharing set
139 RestoreReg <CX>
140 jnc done ; success, let the user see this
141 invoke Idle ; wait a while
142 loop attempt ; go back for another attempt
143 call Share_violation ; signal the problem to the user
144 jnc retry ; user said to retry, go do it
145 done:
146 RestoreReg <CX>
147 return
148 EndProc ShareEnter
149
150 CODE ENDS
151 END