Rev 6798 | Rev 6872 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6798 | Rev 6845 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 6798 $ |
8 | $Revision: 6845 $ |
9 | 9 | ||
10 | ; CD external functions |
10 | ; CD external functions |
11 | ; in: |
11 | ; in: |
Line 158... | Line 158... | ||
158 | popad |
158 | popad |
159 | ret |
159 | ret |
Line 160... | Line 160... | ||
160 | 160 | ||
161 | ;----------------------------------------------------------------------------- |
161 | ;----------------------------------------------------------------------------- |
162 | fs_CdRead: |
- | |
163 | push edi |
- | |
164 | cmp byte [esi], 0 |
- | |
165 | jnz @f |
- | |
166 | ;-------------------------------------- |
- | |
167 | .noaccess: |
- | |
168 | pop edi |
- | |
169 | ;-------------------------------------- |
- | |
170 | .noaccess_2: |
- | |
171 | or ebx, -1 |
- | |
172 | mov eax, ERROR_ACCESS_DENIED |
- | |
173 | ret |
- | |
174 | ;-------------------------------------- |
- | |
175 | .noaccess_3: |
- | |
176 | pop eax edx ecx edi |
- | |
177 | jmp .noaccess_2 |
- | |
178 | ;-------------------------------------- |
- | |
179 | @@: |
162 | fs_CdRead: |
180 | call cd_find_lfn |
163 | call cd_find_lfn |
181 | jnc .found |
- | |
182 | - | ||
183 | pop edi |
- | |
184 | cmp [DevErrorCode], 0 |
- | |
185 | jne .noaccess_2 |
- | |
186 | - | ||
187 | or ebx, -1 |
- | |
188 | mov eax, ERROR_FILE_NOT_FOUND |
- | |
189 | ret |
- | |
190 | ;-------------------------------------- |
- | |
191 | .found: |
164 | jc .notFound |
192 | mov edi, [cd_current_pointer_of_input] |
165 | mov edi, [cd_current_pointer_of_input] |
193 | test byte [edi+25], 10b; do not allow read directories |
166 | test byte [edi+25], 10b ; do not allow read directories |
194 | jnz .noaccess |
- | |
195 | 167 | jnz .noaccess |
|
196 | test ebx, ebx |
168 | test ebx, ebx |
197 | jz .l1 |
- | |
198 | 169 | jz .l1 |
|
199 | cmp dword [ebx+4], 0 |
170 | cmp dword [ebx+4], 0 |
- | 171 | jz @f |
|
- | 172 | xor ebx, ebx |
|
- | 173 | movi eax, ERROR_END_OF_FILE |
|
Line -... | Line 174... | ||
- | 174 | ret |
|
- | 175 | ||
- | 176 | .notFound: |
|
200 | jz @f |
177 | cmp [DevErrorCode], 0 |
201 | - | ||
202 | xor ebx, ebx |
- | |
203 | ;-------------------------------------- |
178 | jne .noaccess |
204 | .reteof: |
- | |
205 | mov eax, 6; end of file |
179 | xor ebx, ebx |
- | 180 | movi eax, ERROR_FILE_NOT_FOUND |
|
- | 181 | ret |
|
- | 182 | ||
- | 183 | .noaccess_3: |
|
- | 184 | pop eax edx ecx |
|
206 | pop edi |
185 | .noaccess: |
- | 186 | xor ebx, ebx |
|
- | 187 | movi eax, ERROR_ACCESS_DENIED |
|
207 | ret |
188 | ret |
208 | ;-------------------------------------- |
189 | |
209 | @@: |
- | |
210 | mov ebx, [ebx] |
190 | @@: |
211 | ;-------------------------------------- |
191 | mov ebx, [ebx] |
212 | .l1: |
- | |
213 | push ecx edx |
192 | .l1: |
214 | push 0 |
193 | push ecx edx 0 |
215 | mov eax, [edi+10] ; real size of the file section |
194 | mov eax, [edi+10] ; real size of the file section |
216 | sub eax, ebx |
- | |
217 | jb .eof |
195 | sub eax, ebx |
218 | 196 | jb .eof |
|
219 | cmp eax, ecx |
- | |
220 | jae @f |
197 | cmp eax, ecx |
221 | 198 | jae @f |
|
222 | mov ecx, eax |
199 | mov ecx, eax |
223 | mov byte [esp], 6 |
200 | pop eax |
224 | ;-------------------------------------- |
201 | push ERROR_END_OF_FILE |
225 | @@: |
202 | @@: |
226 | mov eax, [edi+2] |
- | |
227 | mov [CDSectorAddress], eax |
203 | mov eax, [edi+2] |
228 | ;-------------------------------------- |
204 | mov [CDSectorAddress], eax |
229 | ; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
205 | ; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
230 | .new_sector: |
206 | .new_sector: |
231 | test ecx, ecx |
- | |
232 | jz .done |
207 | test ecx, ecx |
233 | 208 | jz .done |
|
234 | sub ebx, 2048 |
- | |
235 | jae .next |
209 | sub ebx, 2048 |
236 | 210 | jae .next |
|
237 | add ebx, 2048 |
- | |
238 | jnz .incomplete_sector |
211 | add ebx, 2048 |
239 | 212 | jnz .incomplete_sector |
|
240 | cmp ecx, 2048 |
213 | cmp ecx, 2048 |
241 | jb .incomplete_sector |
214 | jb .incomplete_sector |
242 | ; we may read and memmove complete sector |
215 | ; we may read and memmove complete sector |
243 | mov [CDDataBuf_pointer], edx |
216 | mov [CDDataBuf_pointer], edx |
244 | call ReadCDWRetr ; read sector of file |
217 | call ReadCDWRetr |
245 | cmp [DevErrorCode], 0 |
- | |
246 | jne .noaccess_3 |
218 | cmp [DevErrorCode], 0 |
247 | 219 | jne .noaccess_3 |
|
248 | add edx, 2048 |
- | |
249 | sub ecx, 2048 |
220 | add edx, 2048 |
250 | ;-------------------------------------- |
221 | sub ecx, 2048 |
251 | .next: |
222 | .next: |
- | 223 | inc dword [CDSectorAddress] |
|
- | 224 | jmp .new_sector |
|
- | 225 | ||
252 | inc dword [CDSectorAddress] |
226 | .eof: |
- | 227 | pop eax |
|
253 | jmp .new_sector |
228 | push ERROR_END_OF_FILE |
- | 229 | .done: |
|
- | 230 | mov ebx, edx |
|
- | 231 | pop eax edx ecx |
|
- | 232 | sub ebx, edx |
|
254 | ;-------------------------------------- |
233 | ret |
255 | .incomplete_sector: |
234 | |
256 | ; we must read and memmove incomplete sector |
235 | .incomplete_sector: ; we must read and memmove incomplete sector |
257 | mov [CDDataBuf_pointer], CDDataBuf |
236 | mov [CDDataBuf_pointer], CDDataBuf |
258 | call ReadCDWRetr ; read sector of file |
237 | call ReadCDWRetr |
259 | cmp [DevErrorCode], 0 |
- | |
260 | jne .noaccess_3 |
238 | cmp [DevErrorCode], 0 |
261 | 239 | jne .noaccess_3 |
|
262 | push ecx |
240 | push ecx |
263 | add ecx, ebx |
241 | add ecx, ebx |
264 | cmp ecx, 2048 |
- | |
265 | jbe @f |
242 | cmp ecx, 2048 |
266 | - | ||
267 | mov ecx, 2048 |
243 | jbe @f |
268 | ;-------------------------------------- |
244 | mov ecx, 2048 |
269 | @@: |
245 | @@: |
270 | sub ecx, ebx |
246 | sub ecx, ebx |
271 | push edi esi ecx |
247 | push edi esi ecx |
Line 277... | Line 253... | ||
277 | add edx, ecx |
253 | add edx, ecx |
278 | sub [esp], ecx |
254 | sub [esp], ecx |
279 | pop ecx |
255 | pop ecx |
280 | xor ebx, ebx |
256 | xor ebx, ebx |
281 | jmp .next |
257 | jmp .next |
282 | ;-------------------------------------- |
- | |
283 | .done: |
- | |
284 | mov ebx, edx |
- | |
285 | pop eax edx ecx edi |
- | |
286 | sub ebx, edx |
- | |
287 | ret |
- | |
288 | ;-------------------------------------- |
- | |
289 | .eof: |
- | |
290 | mov ebx, edx |
- | |
291 | pop eax edx ecx |
- | |
292 | sub ebx, edx |
- | |
293 | jmp .reteof |
- | |
Line 294... | Line 258... | ||
294 | 258 | ||
295 | ;----------------------------------------------------------------------------- |
259 | ;----------------------------------------------------------------------------- |
296 | fs_CdReadFolder: |
260 | fs_CdReadFolder: |
297 | push edi |
261 | push edi |