Rev 6798 | Rev 6872 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6798 | Rev 6845 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 6798 $ |
8 | $Revision: 6845 $ |
9 | 9 | ||
10 | ; CD external functions |
10 | ; CD external functions |
11 | ; in: |
11 | ; in: |
12 | ; esi -> path string in UTF-8 |
12 | ; esi -> path string in UTF-8 |
13 | ; ebx -> offset in file (qword) |
13 | ; ebx -> offset in file (qword) |
14 | ; ecx = bytes to read |
14 | ; ecx = bytes to read |
15 | ; edx -> buffer |
15 | ; edx -> buffer |
16 | ; out: |
16 | ; out: |
17 | ; eax, ebx = return values for sysfunc 70 |
17 | ; eax, ebx = return values for sysfunc 70 |
18 | iglobal |
18 | iglobal |
19 | align 4 |
19 | align 4 |
20 | fs_CdServices: |
20 | fs_CdServices: |
21 | dd fs_CdRead |
21 | dd fs_CdRead |
22 | dd fs_CdReadFolder |
22 | dd fs_CdReadFolder |
23 | dd fs_NotImplemented |
23 | dd fs_NotImplemented |
24 | dd fs_NotImplemented |
24 | dd fs_NotImplemented |
25 | dd fs_NotImplemented |
25 | dd fs_NotImplemented |
26 | dd fs_CdGetFileInfo |
26 | dd fs_CdGetFileInfo |
27 | dd fs_NotImplemented |
27 | dd fs_NotImplemented |
28 | dd 0 |
28 | dd 0 |
29 | dd fs_NotImplemented |
29 | dd fs_NotImplemented |
30 | dd fs_NotImplemented |
30 | dd fs_NotImplemented |
31 | fs_NumCdServices = ($ - fs_CdServices)/4 |
31 | fs_NumCdServices = ($ - fs_CdServices)/4 |
32 | endg |
32 | endg |
33 | 33 | ||
34 | uglobal |
34 | uglobal |
35 | align 4 |
35 | align 4 |
36 | cd_current_pointer_of_input dd 0 |
36 | cd_current_pointer_of_input dd 0 |
37 | cd_current_pointer_of_input_2 dd 0 |
37 | cd_current_pointer_of_input_2 dd 0 |
38 | cd_mem_location dd 0 |
38 | cd_mem_location dd 0 |
39 | cd_counter_block dd 0 |
39 | cd_counter_block dd 0 |
40 | cd_status dd 0 |
40 | cd_status dd 0 |
41 | endg |
41 | endg |
42 | 42 | ||
43 | ;----------------------------------------------------------------------------- |
43 | ;----------------------------------------------------------------------------- |
44 | fs_NotImplemented: |
44 | fs_NotImplemented: |
45 | movi eax, ERROR_UNSUPPORTED_FS |
45 | movi eax, ERROR_UNSUPPORTED_FS |
46 | ret |
46 | ret |
47 | ;----------------------------------------------------------------------------- |
47 | ;----------------------------------------------------------------------------- |
48 | reserve_cd: |
48 | reserve_cd: |
49 | cli |
49 | cli |
50 | cmp [cd_status], 0 |
50 | cmp [cd_status], 0 |
51 | je reserve_ok2 |
51 | je reserve_ok2 |
52 | 52 | ||
53 | sti |
53 | sti |
54 | call change_task |
54 | call change_task |
55 | jmp reserve_cd |
55 | jmp reserve_cd |
56 | ;----------------------------------------------------------------------------- |
56 | ;----------------------------------------------------------------------------- |
57 | reserve_ok2: |
57 | reserve_ok2: |
58 | push eax |
58 | push eax |
59 | mov eax, [CURRENT_TASK] |
59 | mov eax, [CURRENT_TASK] |
60 | shl eax, 5 |
60 | shl eax, 5 |
61 | mov eax, [eax+CURRENT_TASK+TASKDATA.pid] |
61 | mov eax, [eax+CURRENT_TASK+TASKDATA.pid] |
62 | mov [cd_status], eax |
62 | mov [cd_status], eax |
63 | pop eax |
63 | pop eax |
64 | sti |
64 | sti |
65 | ret |
65 | ret |
66 | ;----------------------------------------------------------------------------- |
66 | ;----------------------------------------------------------------------------- |
67 | reserve_cd_channel: |
67 | reserve_cd_channel: |
68 | pushad |
68 | pushad |
69 | mov eax, [cdpos] |
69 | mov eax, [cdpos] |
70 | dec eax |
70 | dec eax |
71 | shr eax, 2 |
71 | shr eax, 2 |
72 | 72 | ||
73 | test eax, eax |
73 | test eax, eax |
74 | jnz .1 |
74 | jnz .1 |
75 | 75 | ||
76 | cmp [ChannelNumber], 1 |
76 | cmp [ChannelNumber], 1 |
77 | jne @f |
77 | jne @f |
78 | 78 | ||
79 | mov ecx, ide_channel1_mutex |
79 | mov ecx, ide_channel1_mutex |
80 | jmp .mutex_lock |
80 | jmp .mutex_lock |
81 | ;-------------------------------------- |
81 | ;-------------------------------------- |
82 | @@: |
82 | @@: |
83 | mov ecx, ide_channel2_mutex |
83 | mov ecx, ide_channel2_mutex |
84 | jmp .mutex_lock |
84 | jmp .mutex_lock |
85 | ;-------------------------------------- |
85 | ;-------------------------------------- |
86 | .1: |
86 | .1: |
87 | dec eax |
87 | dec eax |
88 | jnz .2 |
88 | jnz .2 |
89 | 89 | ||
90 | cmp [ChannelNumber], 1 |
90 | cmp [ChannelNumber], 1 |
91 | jne @f |
91 | jne @f |
92 | 92 | ||
93 | mov ecx, ide_channel3_mutex |
93 | mov ecx, ide_channel3_mutex |
94 | jmp .mutex_lock |
94 | jmp .mutex_lock |
95 | ;-------------------------------------- |
95 | ;-------------------------------------- |
96 | @@: |
96 | @@: |
97 | mov ecx, ide_channel4_mutex |
97 | mov ecx, ide_channel4_mutex |
98 | jmp .mutex_lock |
98 | jmp .mutex_lock |
99 | ;-------------------------------------- |
99 | ;-------------------------------------- |
100 | .2: |
100 | .2: |
101 | cmp [ChannelNumber], 1 |
101 | cmp [ChannelNumber], 1 |
102 | jne @f |
102 | jne @f |
103 | 103 | ||
104 | mov ecx, ide_channel5_mutex |
104 | mov ecx, ide_channel5_mutex |
105 | jmp .mutex_lock |
105 | jmp .mutex_lock |
106 | ;-------------------------------------- |
106 | ;-------------------------------------- |
107 | @@: |
107 | @@: |
108 | mov ecx, ide_channel6_mutex |
108 | mov ecx, ide_channel6_mutex |
109 | .mutex_lock: |
109 | .mutex_lock: |
110 | call mutex_lock |
110 | call mutex_lock |
111 | popad |
111 | popad |
112 | ret |
112 | ret |
113 | ;----------------------------------------------------------------------------- |
113 | ;----------------------------------------------------------------------------- |
114 | free_cd_channel: |
114 | free_cd_channel: |
115 | pushad |
115 | pushad |
116 | mov eax, [cdpos] |
116 | mov eax, [cdpos] |
117 | dec eax |
117 | dec eax |
118 | shr eax, 2 |
118 | shr eax, 2 |
119 | 119 | ||
120 | test eax, eax |
120 | test eax, eax |
121 | jnz .1 |
121 | jnz .1 |
122 | 122 | ||
123 | cmp [ChannelNumber], 1 |
123 | cmp [ChannelNumber], 1 |
124 | jne @f |
124 | jne @f |
125 | 125 | ||
126 | mov ecx, ide_channel1_mutex |
126 | mov ecx, ide_channel1_mutex |
127 | jmp .mutex_unlock |
127 | jmp .mutex_unlock |
128 | ;-------------------------------------- |
128 | ;-------------------------------------- |
129 | @@: |
129 | @@: |
130 | mov ecx, ide_channel2_mutex |
130 | mov ecx, ide_channel2_mutex |
131 | jmp .mutex_unlock |
131 | jmp .mutex_unlock |
132 | ;-------------------------------------- |
132 | ;-------------------------------------- |
133 | .1: |
133 | .1: |
134 | dec eax |
134 | dec eax |
135 | jnz .2 |
135 | jnz .2 |
136 | 136 | ||
137 | cmp [ChannelNumber], 1 |
137 | cmp [ChannelNumber], 1 |
138 | jne @f |
138 | jne @f |
139 | 139 | ||
140 | mov ecx, ide_channel3_mutex |
140 | mov ecx, ide_channel3_mutex |
141 | jmp .mutex_unlock |
141 | jmp .mutex_unlock |
142 | ;-------------------------------------- |
142 | ;-------------------------------------- |
143 | @@: |
143 | @@: |
144 | mov ecx, ide_channel4_mutex |
144 | mov ecx, ide_channel4_mutex |
145 | jmp .mutex_unlock |
145 | jmp .mutex_unlock |
146 | ;-------------------------------------- |
146 | ;-------------------------------------- |
147 | .2: |
147 | .2: |
148 | cmp [ChannelNumber], 1 |
148 | cmp [ChannelNumber], 1 |
149 | jne @f |
149 | jne @f |
150 | 150 | ||
151 | mov ecx, ide_channel5_mutex |
151 | mov ecx, ide_channel5_mutex |
152 | jmp .mutex_unlock |
152 | jmp .mutex_unlock |
153 | ;-------------------------------------- |
153 | ;-------------------------------------- |
154 | @@: |
154 | @@: |
155 | mov ecx, ide_channel6_mutex |
155 | mov ecx, ide_channel6_mutex |
156 | .mutex_unlock: |
156 | .mutex_unlock: |
157 | call mutex_unlock |
157 | call mutex_unlock |
158 | popad |
158 | popad |
159 | ret |
159 | ret |
160 | 160 | ||
161 | ;----------------------------------------------------------------------------- |
161 | ;----------------------------------------------------------------------------- |
162 | fs_CdRead: |
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 | @@: |
- | |
180 | call cd_find_lfn |
163 | call cd_find_lfn |
181 | jnc .found |
164 | jc .notFound |
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: |
- | |
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 |
167 | jnz .noaccess |
195 | - | ||
196 | test ebx, ebx |
168 | test ebx, ebx |
197 | jz .l1 |
169 | jz .l1 |
198 | - | ||
199 | cmp dword [ebx+4], 0 |
170 | cmp dword [ebx+4], 0 |
200 | jz @f |
171 | jz @f |
- | 172 | xor ebx, ebx |
|
- | 173 | movi eax, ERROR_END_OF_FILE |
|
- | 174 | ret |
|
- | 175 | ||
- | 176 | .notFound: |
|
- | 177 | cmp [DevErrorCode], 0 |
|
201 | 178 | jne .noaccess |
|
202 | xor ebx, ebx |
- | |
203 | ;-------------------------------------- |
- | |
204 | .reteof: |
179 | xor ebx, ebx |
205 | mov eax, 6; end of file |
- | |
206 | pop edi |
180 | movi eax, ERROR_FILE_NOT_FOUND |
- | 181 | ret |
|
- | 182 | ||
- | 183 | .noaccess_3: |
|
- | 184 | pop eax edx ecx |
|
- | 185 | .noaccess: |
|
207 | ret |
186 | xor ebx, ebx |
- | 187 | movi eax, ERROR_ACCESS_DENIED |
|
- | 188 | ret |
|
208 | ;-------------------------------------- |
189 | |
209 | @@: |
190 | @@: |
210 | mov ebx, [ebx] |
- | |
211 | ;-------------------------------------- |
191 | mov ebx, [ebx] |
212 | .l1: |
192 | .l1: |
213 | push ecx edx |
- | |
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 |
195 | sub eax, ebx |
217 | jb .eof |
196 | jb .eof |
218 | - | ||
219 | cmp eax, ecx |
197 | cmp eax, ecx |
220 | jae @f |
198 | jae @f |
221 | - | ||
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] |
203 | mov eax, [edi+2] |
227 | mov [CDSectorAddress], eax |
204 | mov [CDSectorAddress], eax |
228 | ;-------------------------------------- |
- | |
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 |
207 | test ecx, ecx |
232 | jz .done |
208 | jz .done |
233 | - | ||
234 | sub ebx, 2048 |
209 | sub ebx, 2048 |
235 | jae .next |
210 | jae .next |
236 | - | ||
237 | add ebx, 2048 |
211 | add ebx, 2048 |
238 | jnz .incomplete_sector |
212 | jnz .incomplete_sector |
239 | - | ||
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 |
218 | cmp [DevErrorCode], 0 |
246 | jne .noaccess_3 |
219 | jne .noaccess_3 |
247 | - | ||
248 | add edx, 2048 |
220 | add edx, 2048 |
249 | sub ecx, 2048 |
221 | sub ecx, 2048 |
250 | ;-------------------------------------- |
- | |
251 | .next: |
222 | .next: |
252 | inc dword [CDSectorAddress] |
223 | inc dword [CDSectorAddress] |
253 | jmp .new_sector |
224 | jmp .new_sector |
- | 225 | ||
- | 226 | .eof: |
|
- | 227 | pop eax |
|
254 | ;-------------------------------------- |
228 | push ERROR_END_OF_FILE |
- | 229 | .done: |
|
255 | .incomplete_sector: |
230 | mov ebx, edx |
- | 231 | pop eax edx ecx |
|
- | 232 | sub ebx, edx |
|
- | 233 | ret |
|
- | 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 |
238 | cmp [DevErrorCode], 0 |
260 | jne .noaccess_3 |
239 | jne .noaccess_3 |
261 | - | ||
262 | push ecx |
240 | push ecx |
263 | add ecx, ebx |
241 | add ecx, ebx |
264 | cmp ecx, 2048 |
242 | cmp ecx, 2048 |
265 | jbe @f |
243 | jbe @f |
266 | - | ||
267 | mov ecx, 2048 |
244 | mov ecx, 2048 |
268 | ;-------------------------------------- |
- | |
269 | @@: |
245 | @@: |
270 | sub ecx, ebx |
246 | sub ecx, ebx |
271 | push edi esi ecx |
247 | push edi esi ecx |
272 | mov edi, edx |
248 | mov edi, edx |
273 | lea esi, [CDDataBuf + ebx] |
249 | lea esi, [CDDataBuf + ebx] |
274 | cld |
250 | cld |
275 | rep movsb |
251 | rep movsb |
276 | pop ecx esi edi |
252 | pop ecx esi edi |
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 |
- | |
294 | 258 | ||
295 | ;----------------------------------------------------------------------------- |
259 | ;----------------------------------------------------------------------------- |
296 | fs_CdReadFolder: |
260 | fs_CdReadFolder: |
297 | push edi |
261 | push edi |
298 | call cd_find_lfn |
262 | call cd_find_lfn |
299 | jnc .found |
263 | jnc .found |
300 | pop edi |
264 | pop edi |
301 | cmp [DevErrorCode], 0 |
265 | cmp [DevErrorCode], 0 |
302 | jne .noaccess_1 |
266 | jne .noaccess_1 |
303 | or ebx, -1 |
267 | or ebx, -1 |
304 | mov eax, ERROR_FILE_NOT_FOUND |
268 | mov eax, ERROR_FILE_NOT_FOUND |
305 | ret |
269 | ret |
306 | 270 | ||
307 | .found: |
271 | .found: |
308 | mov edi, [cd_current_pointer_of_input] |
272 | mov edi, [cd_current_pointer_of_input] |
309 | test byte [edi+25], 10b ; do not allow read directories |
273 | test byte [edi+25], 10b ; do not allow read directories |
310 | jnz .found_dir |
274 | jnz .found_dir |
311 | pop edi |
275 | pop edi |
312 | .noaccess_1: |
276 | .noaccess_1: |
313 | or ebx, -1 |
277 | or ebx, -1 |
314 | mov eax, ERROR_ACCESS_DENIED |
278 | mov eax, ERROR_ACCESS_DENIED |
315 | ret |
279 | ret |
316 | 280 | ||
317 | .end_buffer: |
281 | .end_buffer: |
318 | pop edx eax |
282 | pop edx eax |
319 | sub eax, 2048 ; directory is over? |
283 | sub eax, 2048 ; directory is over? |
320 | ja .read_to_buffer |
284 | ja .read_to_buffer |
321 | mov eax, [cd_counter_block] |
285 | mov eax, [cd_counter_block] |
322 | mov [edx+8], eax |
286 | mov [edx+8], eax |
323 | mov eax, [ebx] |
287 | mov eax, [ebx] |
324 | sub [edx+4], eax |
288 | sub [edx+4], eax |
325 | xor eax, eax |
289 | xor eax, eax |
326 | dec ecx |
290 | dec ecx |
327 | js @f |
291 | js @f |
328 | mov al, ERROR_END_OF_FILE |
292 | mov al, ERROR_END_OF_FILE |
329 | @@: |
293 | @@: |
330 | pop ecx edi |
294 | pop ecx edi |
331 | mov ebx, [edx+4] |
295 | mov ebx, [edx+4] |
332 | ret |
296 | ret |
333 | 297 | ||
334 | .found_dir: |
298 | .found_dir: |
335 | mov eax, [edi+2] ; eax=cluster |
299 | mov eax, [edi+2] ; eax=cluster |
336 | mov [CDSectorAddress], eax |
300 | mov [CDSectorAddress], eax |
337 | mov eax, [edi+10] ; directory size |
301 | mov eax, [edi+10] ; directory size |
338 | push eax ecx |
302 | push eax ecx |
339 | mov edi, edx |
303 | mov edi, edx |
340 | mov ecx, 32/4 |
304 | mov ecx, 32/4 |
341 | xor eax, eax |
305 | xor eax, eax |
342 | rep stosd |
306 | rep stosd |
343 | pop ecx eax |
307 | pop ecx eax |
344 | mov byte [edx], 1 ; version |
308 | mov byte [edx], 1 ; version |
345 | mov [cd_mem_location], edx |
309 | mov [cd_mem_location], edx |
346 | add [cd_mem_location], 32 |
310 | add [cd_mem_location], 32 |
347 | mov [cd_counter_block], dword 0 |
311 | mov [cd_counter_block], dword 0 |
348 | dec dword [CDSectorAddress] |
312 | dec dword [CDSectorAddress] |
349 | push ecx |
313 | push ecx |
350 | .read_to_buffer: |
314 | .read_to_buffer: |
351 | inc dword [CDSectorAddress] |
315 | inc dword [CDSectorAddress] |
352 | mov [CDDataBuf_pointer], CDDataBuf |
316 | mov [CDDataBuf_pointer], CDDataBuf |
353 | call ReadCDWRetr ; read sector of directory |
317 | call ReadCDWRetr ; read sector of directory |
354 | cmp [DevErrorCode], 0 |
318 | cmp [DevErrorCode], 0 |
355 | jne .noaccess_1 |
319 | jne .noaccess_1 |
356 | mov [cd_current_pointer_of_input_2], CDDataBuf |
320 | mov [cd_current_pointer_of_input_2], CDDataBuf |
357 | push eax edx |
321 | push eax edx |
358 | .get_names_from_buffer: |
322 | .get_names_from_buffer: |
359 | call cd_get_name |
323 | call cd_get_name |
360 | jc .end_buffer |
324 | jc .end_buffer |
361 | inc dword [cd_counter_block] |
325 | inc dword [cd_counter_block] |
362 | mov eax, [cd_counter_block] |
326 | mov eax, [cd_counter_block] |
363 | cmp [ebx], eax |
327 | cmp [ebx], eax |
364 | jae .get_names_from_buffer |
328 | jae .get_names_from_buffer |
365 | test ecx, ecx |
329 | test ecx, ecx |
366 | jz .get_names_from_buffer |
330 | jz .get_names_from_buffer |
367 | mov edi, [cd_counter_block] |
331 | mov edi, [cd_counter_block] |
368 | mov [edx+4], edi |
332 | mov [edx+4], edi |
369 | dec ecx |
333 | dec ecx |
370 | mov esi, ebp |
334 | mov esi, ebp |
371 | call cd_get_parameters_of_file |
335 | call cd_get_parameters_of_file |
372 | add edi, 40 |
336 | add edi, 40 |
373 | mov ax, '.' |
337 | mov ax, '.' |
374 | cmp dword[ebx+4], 2 |
338 | cmp dword[ebx+4], 2 |
375 | jz .utf16 |
339 | jz .utf16 |
376 | cmp dword[ebx+4], 3 |
340 | cmp dword[ebx+4], 3 |
377 | jz .utf8 |
341 | jz .utf8 |
378 | cmp [cd_counter_block], 2 |
342 | cmp [cd_counter_block], 2 |
379 | jbe .parentDirectory |
343 | jbe .parentDirectory |
380 | @@: |
344 | @@: |
381 | lodsw |
345 | lodsw |
382 | xchg ah, al |
346 | xchg ah, al |
383 | call uni2ansi_char |
347 | call uni2ansi_char |
384 | stosb |
348 | stosb |
385 | call .checkForEnd |
349 | call .checkForEnd |
386 | jc @b |
350 | jc @b |
387 | @@: |
351 | @@: |
388 | mov [edi], byte 0 |
352 | mov [edi], byte 0 |
389 | add [cd_mem_location], 304 |
353 | add [cd_mem_location], 304 |
390 | jmp .get_names_from_buffer |
354 | jmp .get_names_from_buffer |
391 | 355 | ||
392 | .parentDirectory: |
356 | .parentDirectory: |
393 | stosb |
357 | stosb |
394 | cmp [cd_counter_block], 2 |
358 | cmp [cd_counter_block], 2 |
395 | jnz @b |
359 | jnz @b |
396 | stosb |
360 | stosb |
397 | jmp @b |
361 | jmp @b |
398 | 362 | ||
399 | .utf8: |
363 | .utf8: |
400 | add [cd_mem_location], 256 |
364 | add [cd_mem_location], 256 |
401 | cmp [cd_counter_block], 2 |
365 | cmp [cd_counter_block], 2 |
402 | jbe .parentDirectory |
366 | jbe .parentDirectory |
403 | push ecx |
367 | push ecx |
404 | mov ecx, 519 |
368 | mov ecx, 519 |
405 | @@: |
369 | @@: |
406 | lodsw |
370 | lodsw |
407 | xchg ah, al |
371 | xchg ah, al |
408 | call UTF16to8 |
372 | call UTF16to8 |
409 | js @f |
373 | js @f |
410 | call .checkForEnd |
374 | call .checkForEnd |
411 | jc @b |
375 | jc @b |
412 | @@: |
376 | @@: |
413 | pop ecx |
377 | pop ecx |
414 | mov [edi], byte 0 |
378 | mov [edi], byte 0 |
415 | add [cd_mem_location], 304 |
379 | add [cd_mem_location], 304 |
416 | jmp .get_names_from_buffer |
380 | jmp .get_names_from_buffer |
417 | 381 | ||
418 | .checkForEnd: |
382 | .checkForEnd: |
419 | mov ax, [esi] |
383 | mov ax, [esi] |
420 | cmp ax, 3B00h ; ';' |
384 | cmp ax, 3B00h ; ';' |
421 | jz @f |
385 | jz @f |
422 | ; check for files not ending with separator |
386 | ; check for files not ending with separator |
423 | movzx eax, byte [ebp-33] |
387 | movzx eax, byte [ebp-33] |
424 | add eax, ebp |
388 | add eax, ebp |
425 | sub eax, 34 |
389 | sub eax, 34 |
426 | cmp esi, eax |
390 | cmp esi, eax |
427 | jz @f |
391 | jz @f |
428 | ; check the end of the directory |
392 | ; check the end of the directory |
429 | movzx eax, byte [ebp-1] |
393 | movzx eax, byte [ebp-1] |
430 | add eax, ebp |
394 | add eax, ebp |
431 | cmp esi, eax |
395 | cmp esi, eax |
432 | @@: |
396 | @@: |
433 | ret |
397 | ret |
434 | 398 | ||
435 | .utf16: |
399 | .utf16: |
436 | cmp [cd_counter_block], 2 |
400 | cmp [cd_counter_block], 2 |
437 | jbe .utf16ParentDirectory |
401 | jbe .utf16ParentDirectory |
438 | @@: |
402 | @@: |
439 | lodsw |
403 | lodsw |
440 | xchg ah, al |
404 | xchg ah, al |
441 | stosw |
405 | stosw |
442 | call .checkForEnd |
406 | call .checkForEnd |
443 | jc @b |
407 | jc @b |
444 | @@: |
408 | @@: |
445 | mov [edi], word 0 |
409 | mov [edi], word 0 |
446 | add [cd_mem_location], 560 |
410 | add [cd_mem_location], 560 |
447 | jmp .get_names_from_buffer |
411 | jmp .get_names_from_buffer |
448 | 412 | ||
449 | .utf16ParentDirectory: |
413 | .utf16ParentDirectory: |
450 | stosw |
414 | stosw |
451 | cmp [cd_counter_block], 2 |
415 | cmp [cd_counter_block], 2 |
452 | jnz @b |
416 | jnz @b |
453 | stosw |
417 | stosw |
454 | jmp @b |
418 | jmp @b |
455 | 419 | ||
456 | cd_get_parameters_of_file: |
420 | cd_get_parameters_of_file: |
457 | mov edi, [cd_mem_location] |
421 | mov edi, [cd_mem_location] |
458 | cd_get_parameters_of_file_1: |
422 | cd_get_parameters_of_file_1: |
459 | ; get file attributes |
423 | ; get file attributes |
460 | xor eax, eax |
424 | xor eax, eax |
461 | ; file is not archived |
425 | ; file is not archived |
462 | inc eax |
426 | inc eax |
463 | shl eax, 1 |
427 | shl eax, 1 |
464 | ; is a directory? |
428 | ; is a directory? |
465 | test [ebp-8], byte 2 |
429 | test [ebp-8], byte 2 |
466 | jz .file |
430 | jz .file |
467 | inc eax |
431 | inc eax |
468 | .file: |
432 | .file: |
469 | ; not as a volume label in the FAT, in this form not available |
433 | ; not as a volume label in the FAT, in this form not available |
470 | ; file is not a system |
434 | ; file is not a system |
471 | shl eax, 3 |
435 | shl eax, 3 |
472 | ; file is hidden? (attribute of existence) |
436 | ; file is hidden? (attribute of existence) |
473 | test [ebp-8], byte 1 |
437 | test [ebp-8], byte 1 |
474 | jz .hidden |
438 | jz .hidden |
475 | inc eax |
439 | inc eax |
476 | .hidden: |
440 | .hidden: |
477 | shl eax, 1 |
441 | shl eax, 1 |
478 | ; file is always read-only, as this CD |
442 | ; file is always read-only, as this CD |
479 | inc eax |
443 | inc eax |
480 | mov [edi], eax |
444 | mov [edi], eax |
481 | mov eax, [ebx+4] |
445 | mov eax, [ebx+4] |
482 | mov [edi+4], eax |
446 | mov [edi+4], eax |
483 | ; get the time to file |
447 | ; get the time to file |
484 | ; hour |
448 | ; hour |
485 | movzx eax, byte [ebp-12] |
449 | movzx eax, byte [ebp-12] |
486 | shl eax, 8 |
450 | shl eax, 8 |
487 | ; minute |
451 | ; minute |
488 | mov al, [ebp-11] |
452 | mov al, [ebp-11] |
489 | shl eax, 8 |
453 | shl eax, 8 |
490 | ; second |
454 | ; second |
491 | mov al, [ebp-10] |
455 | mov al, [ebp-10] |
492 | ; file creation time |
456 | ; file creation time |
493 | mov [edi+8], eax |
457 | mov [edi+8], eax |
494 | ; last access time |
458 | ; last access time |
495 | mov [edi+16], eax |
459 | mov [edi+16], eax |
496 | ; last write time |
460 | ; last write time |
497 | mov [edi+24], eax |
461 | mov [edi+24], eax |
498 | ; get date for file |
462 | ; get date for file |
499 | ; year |
463 | ; year |
500 | movzx eax, byte [ebp-15] |
464 | movzx eax, byte [ebp-15] |
501 | add eax, 1900 |
465 | add eax, 1900 |
502 | shl eax, 8 |
466 | shl eax, 8 |
503 | ; month |
467 | ; month |
504 | mov al, [ebp-14] |
468 | mov al, [ebp-14] |
505 | shl eax, 8 |
469 | shl eax, 8 |
506 | ; day |
470 | ; day |
507 | mov al, [ebp-13] |
471 | mov al, [ebp-13] |
508 | ; file creation date |
472 | ; file creation date |
509 | mov [edi+12], eax |
473 | mov [edi+12], eax |
510 | ; last access date |
474 | ; last access date |
511 | mov [edi+20], eax |
475 | mov [edi+20], eax |
512 | ; last write date |
476 | ; last write date |
513 | mov [edi+28], eax |
477 | mov [edi+28], eax |
514 | ; get the file size in bytes |
478 | ; get the file size in bytes |
515 | xor eax, eax |
479 | xor eax, eax |
516 | mov [edi+32+4], eax |
480 | mov [edi+32+4], eax |
517 | mov eax, [ebp-23] |
481 | mov eax, [ebp-23] |
518 | mov [edi+32], eax |
482 | mov [edi+32], eax |
519 | ret |
483 | ret |
520 | 484 | ||
521 | ;----------------------------------------------------------------------------- |
485 | ;----------------------------------------------------------------------------- |
522 | fs_CdGetFileInfo: |
486 | fs_CdGetFileInfo: |
523 | cmp byte [esi], 0 |
487 | cmp byte [esi], 0 |
524 | jnz @f |
488 | jnz @f |
525 | 489 | ||
526 | mov eax, 2 |
490 | mov eax, 2 |
527 | ret |
491 | ret |
528 | ;-------------------------------------- |
492 | ;-------------------------------------- |
529 | @@: |
493 | @@: |
530 | push edi |
494 | push edi |
531 | call cd_find_lfn |
495 | call cd_find_lfn |
532 | pushfd |
496 | pushfd |
533 | cmp [DevErrorCode], 0 |
497 | cmp [DevErrorCode], 0 |
534 | jz @f |
498 | jz @f |
535 | 499 | ||
536 | popfd |
500 | popfd |
537 | pop edi |
501 | pop edi |
538 | mov eax, 11 |
502 | mov eax, 11 |
539 | ret |
503 | ret |
540 | ;-------------------------------------- |
504 | ;-------------------------------------- |
541 | @@: |
505 | @@: |
542 | popfd |
506 | popfd |
543 | jnc @f |
507 | jnc @f |
544 | 508 | ||
545 | pop edi |
509 | pop edi |
546 | mov eax, ERROR_FILE_NOT_FOUND |
510 | mov eax, ERROR_FILE_NOT_FOUND |
547 | ret |
511 | ret |
548 | ;-------------------------------------- |
512 | ;-------------------------------------- |
549 | @@: |
513 | @@: |
550 | 514 | ||
551 | mov edi, edx |
515 | mov edi, edx |
552 | push ebp |
516 | push ebp |
553 | mov ebp, [cd_current_pointer_of_input] |
517 | mov ebp, [cd_current_pointer_of_input] |
554 | add ebp, 33 |
518 | add ebp, 33 |
555 | call cd_get_parameters_of_file_1 |
519 | call cd_get_parameters_of_file_1 |
556 | pop ebp |
520 | pop ebp |
557 | and dword [edi+4], 0 |
521 | and dword [edi+4], 0 |
558 | pop edi |
522 | pop edi |
559 | xor eax, eax |
523 | xor eax, eax |
560 | ret |
524 | ret |
561 | ;----------------------------------------------------------------------------- |
525 | ;----------------------------------------------------------------------------- |
562 | cd_find_lfn: |
526 | cd_find_lfn: |
563 | mov [cd_appl_data], 0 |
527 | mov [cd_appl_data], 0 |
564 | ; in: esi -> path string in UTF-8 |
528 | ; in: esi -> path string in UTF-8 |
565 | ; out: [cd_current_pointer_of_input] -> direntry, CF=1 -> file not found |
529 | ; out: [cd_current_pointer_of_input] -> direntry, CF=1 -> file not found |
566 | push eax esi |
530 | push eax esi |
567 | ; Sector 16 - start set of volume descriptors |
531 | ; Sector 16 - start set of volume descriptors |
568 | call WaitUnitReady |
532 | call WaitUnitReady |
569 | cmp [DevErrorCode], 0 |
533 | cmp [DevErrorCode], 0 |
570 | jne .access_denied |
534 | jne .access_denied |
571 | 535 | ||
572 | call prevent_medium_removal |
536 | call prevent_medium_removal |
573 | ; testing of reading |
537 | ; testing of reading |
574 | mov [CDSectorAddress], dword 16 |
538 | mov [CDSectorAddress], dword 16 |
575 | mov [CDDataBuf_pointer], CDDataBuf |
539 | mov [CDDataBuf_pointer], CDDataBuf |
576 | call ReadCDWRetr;_1 |
540 | call ReadCDWRetr;_1 |
577 | cmp [DevErrorCode], 0 |
541 | cmp [DevErrorCode], 0 |
578 | jne .access_denied |
542 | jne .access_denied |
579 | 543 | ||
580 | ; calculation of the last session |
544 | ; calculation of the last session |
581 | call WaitUnitReady |
545 | call WaitUnitReady |
582 | cmp [DevErrorCode], 0 |
546 | cmp [DevErrorCode], 0 |
583 | jne .access_denied |
547 | jne .access_denied |
584 | 548 | ||
585 | call Read_TOC |
549 | call Read_TOC |
586 | mov ah, [CDDataBuf+4+4] |
550 | mov ah, [CDDataBuf+4+4] |
587 | mov al, [CDDataBuf+4+5] |
551 | mov al, [CDDataBuf+4+5] |
588 | shl eax, 16 |
552 | shl eax, 16 |
589 | mov ah, [CDDataBuf+4+6] |
553 | mov ah, [CDDataBuf+4+6] |
590 | mov al, [CDDataBuf+4+7] |
554 | mov al, [CDDataBuf+4+7] |
591 | add eax, 15 |
555 | add eax, 15 |
592 | mov [CDSectorAddress], eax |
556 | mov [CDSectorAddress], eax |
593 | ; mov [CDSectorAddress],dword 15 |
557 | ; mov [CDSectorAddress],dword 15 |
594 | mov [CDDataBuf_pointer], CDDataBuf |
558 | mov [CDDataBuf_pointer], CDDataBuf |
595 | ;-------------------------------------- |
559 | ;-------------------------------------- |
596 | .start: |
560 | .start: |
597 | inc dword [CDSectorAddress] |
561 | inc dword [CDSectorAddress] |
598 | call ReadCDWRetr;_1 |
562 | call ReadCDWRetr;_1 |
599 | cmp [DevErrorCode], 0 |
563 | cmp [DevErrorCode], 0 |
600 | jne .access_denied |
564 | jne .access_denied |
601 | 565 | ||
602 | .start_check: |
566 | .start_check: |
603 | ; checking for "lice" |
567 | ; checking for "lice" |
604 | cmp [CDDataBuf+1], dword 'CD00' |
568 | cmp [CDDataBuf+1], dword 'CD00' |
605 | jne .access_denied |
569 | jne .access_denied |
606 | 570 | ||
607 | cmp [CDDataBuf+5], byte '1' |
571 | cmp [CDDataBuf+5], byte '1' |
608 | jne .access_denied |
572 | jne .access_denied |
609 | ; sector is the terminator of set of descriptors volumes? |
573 | ; sector is the terminator of set of descriptors volumes? |
610 | cmp [CDDataBuf], byte 0xff |
574 | cmp [CDDataBuf], byte 0xff |
611 | je .access_denied |
575 | je .access_denied |
612 | ; sector is an additional and improved descriptor of volume? |
576 | ; sector is an additional and improved descriptor of volume? |
613 | cmp [CDDataBuf], byte 0x2 |
577 | cmp [CDDataBuf], byte 0x2 |
614 | jne .start |
578 | jne .start |
615 | ; sector is an additional descriptor of volume? |
579 | ; sector is an additional descriptor of volume? |
616 | cmp [CDDataBuf+6], byte 0x1 |
580 | cmp [CDDataBuf+6], byte 0x1 |
617 | jne .start |
581 | jne .start |
618 | 582 | ||
619 | ; parameters of root directory |
583 | ; parameters of root directory |
620 | mov eax, [CDDataBuf+0x9c+2]; start of root directory |
584 | mov eax, [CDDataBuf+0x9c+2]; start of root directory |
621 | mov [CDSectorAddress], eax |
585 | mov [CDSectorAddress], eax |
622 | mov eax, [CDDataBuf+0x9c+10]; size of root directory |
586 | mov eax, [CDDataBuf+0x9c+10]; size of root directory |
623 | cmp byte [esi], 0 |
587 | cmp byte [esi], 0 |
624 | jnz @f |
588 | jnz @f |
625 | 589 | ||
626 | mov [cd_current_pointer_of_input], CDDataBuf+0x9c |
590 | mov [cd_current_pointer_of_input], CDDataBuf+0x9c |
627 | jmp .done |
591 | jmp .done |
628 | ;-------------------------------------- |
592 | ;-------------------------------------- |
629 | @@: |
593 | @@: |
630 | ; start the search |
594 | ; start the search |
631 | .mainloop: |
595 | .mainloop: |
632 | dec dword [CDSectorAddress] |
596 | dec dword [CDSectorAddress] |
633 | ;-------------------------------------- |
597 | ;-------------------------------------- |
634 | .read_to_buffer: |
598 | .read_to_buffer: |
635 | inc dword [CDSectorAddress] |
599 | inc dword [CDSectorAddress] |
636 | mov [CDDataBuf_pointer], CDDataBuf |
600 | mov [CDDataBuf_pointer], CDDataBuf |
637 | call ReadCDWRetr ; read sector of directory |
601 | call ReadCDWRetr ; read sector of directory |
638 | cmp [DevErrorCode], 0 |
602 | cmp [DevErrorCode], 0 |
639 | jne .access_denied |
603 | jne .access_denied |
640 | call cd_find_name_in_buffer |
604 | call cd_find_name_in_buffer |
641 | jnc .found |
605 | jnc .found |
642 | sub eax, 2048 |
606 | sub eax, 2048 |
643 | ; directory is over? |
607 | ; directory is over? |
644 | cmp eax, 0 |
608 | cmp eax, 0 |
645 | ja .read_to_buffer |
609 | ja .read_to_buffer |
646 | ; desired element of chain is not found |
610 | ; desired element of chain is not found |
647 | .access_denied: |
611 | .access_denied: |
648 | pop esi eax |
612 | pop esi eax |
649 | mov [cd_appl_data], 1 |
613 | mov [cd_appl_data], 1 |
650 | stc |
614 | stc |
651 | ret |
615 | ret |
652 | ;-------------------------------------- |
616 | ;-------------------------------------- |
653 | ; desired element of chain found |
617 | ; desired element of chain found |
654 | .found: |
618 | .found: |
655 | ; the end of the file path |
619 | ; the end of the file path |
656 | cmp byte [esi-1], 0 |
620 | cmp byte [esi-1], 0 |
657 | jz .done |
621 | jz .done |
658 | mov eax, [cd_current_pointer_of_input] |
622 | mov eax, [cd_current_pointer_of_input] |
659 | push dword [eax+2] |
623 | push dword [eax+2] |
660 | pop dword [CDSectorAddress] ; beginning of the directory |
624 | pop dword [CDSectorAddress] ; beginning of the directory |
661 | mov eax, [eax+2+8] ; size of directory |
625 | mov eax, [eax+2+8] ; size of directory |
662 | jmp .mainloop |
626 | jmp .mainloop |
663 | ;-------------------------------------- |
627 | ;-------------------------------------- |
664 | ; file pointer found |
628 | ; file pointer found |
665 | .done: |
629 | .done: |
666 | pop esi eax |
630 | pop esi eax |
667 | mov [cd_appl_data], 1 |
631 | mov [cd_appl_data], 1 |
668 | clc |
632 | clc |
669 | ret |
633 | ret |
670 | ;----------------------------------------------------------------------------- |
634 | ;----------------------------------------------------------------------------- |
671 | cd_find_name_in_buffer: |
635 | cd_find_name_in_buffer: |
672 | mov [cd_current_pointer_of_input_2], CDDataBuf |
636 | mov [cd_current_pointer_of_input_2], CDDataBuf |
673 | ;-------------------------------------- |
637 | ;-------------------------------------- |
674 | .start: |
638 | .start: |
675 | call cd_get_name |
639 | call cd_get_name |
676 | jc .not_found |
640 | jc .not_found |
677 | 641 | ||
678 | call cd_compare_name |
642 | call cd_compare_name |
679 | jc .start |
643 | jc .start |
680 | ;-------------------------------------- |
644 | ;-------------------------------------- |
681 | .found: |
645 | .found: |
682 | clc |
646 | clc |
683 | ret |
647 | ret |
684 | ;-------------------------------------- |
648 | ;-------------------------------------- |
685 | .not_found: |
649 | .not_found: |
686 | stc |
650 | stc |
687 | ret |
651 | ret |
688 | ;----------------------------------------------------------------------------- |
652 | ;----------------------------------------------------------------------------- |
689 | cd_get_name: |
653 | cd_get_name: |
690 | push eax |
654 | push eax |
691 | mov ebp, [cd_current_pointer_of_input_2] |
655 | mov ebp, [cd_current_pointer_of_input_2] |
692 | mov [cd_current_pointer_of_input], ebp |
656 | mov [cd_current_pointer_of_input], ebp |
693 | mov eax, [ebp] |
657 | mov eax, [ebp] |
694 | test eax, eax ; entry's is over? |
658 | test eax, eax ; entry's is over? |
695 | jz .next_sector |
659 | jz .next_sector |
696 | 660 | ||
697 | cmp ebp, CDDataBuf+2048 ; buffer is over? |
661 | cmp ebp, CDDataBuf+2048 ; buffer is over? |
698 | jae .next_sector |
662 | jae .next_sector |
699 | 663 | ||
700 | movzx eax, byte [ebp] |
664 | movzx eax, byte [ebp] |
701 | add [cd_current_pointer_of_input_2], eax ; next entry of directory |
665 | add [cd_current_pointer_of_input_2], eax ; next entry of directory |
702 | add ebp, 33; pointer is set to the beginning of the name |
666 | add ebp, 33; pointer is set to the beginning of the name |
703 | pop eax |
667 | pop eax |
704 | clc |
668 | clc |
705 | ret |
669 | ret |
706 | ;-------------------------------------- |
670 | ;-------------------------------------- |
707 | .next_sector: |
671 | .next_sector: |
708 | pop eax |
672 | pop eax |
709 | stc |
673 | stc |
710 | ret |
674 | ret |
711 | ;----------------------------------------------------------------------------- |
675 | ;----------------------------------------------------------------------------- |
712 | cd_compare_name: |
676 | cd_compare_name: |
713 | ; in: esi -> UTF-8 name, ebp -> UTF-16BE name |
677 | ; in: esi -> UTF-8 name, ebp -> UTF-16BE name |
714 | ; out: CF=0 -> names match, esi -> next component of name |
678 | ; out: CF=0 -> names match, esi -> next component of name |
715 | ; CF=1 -> esi is not changed |
679 | ; CF=1 -> esi is not changed |
716 | push edx edi eax esi |
680 | push edx edi eax esi |
717 | mov edi, ebp |
681 | mov edi, ebp |
718 | .loop: |
682 | .loop: |
719 | call utf8to16 |
683 | call utf8to16 |
720 | call utf16toUpper |
684 | call utf16toUpper |
721 | mov edx, eax |
685 | mov edx, eax |
722 | mov ax, [edi] |
686 | mov ax, [edi] |
723 | xchg al, ah |
687 | xchg al, ah |
724 | call utf16toUpper |
688 | call utf16toUpper |
725 | cmp ax, dx |
689 | cmp ax, dx |
726 | jne .name_not_coincide |
690 | jne .name_not_coincide |
727 | add edi, 2 |
691 | add edi, 2 |
728 | cmp [esi], byte '/' ; path separator is end of current element |
692 | cmp [esi], byte '/' ; path separator is end of current element |
729 | je .done |
693 | je .done |
730 | cmp [esi], byte 0 ; path separator end of name |
694 | cmp [esi], byte 0 ; path separator end of name |
731 | jne .loop |
695 | jne .loop |
732 | .done: |
696 | .done: |
733 | ; check end of file |
697 | ; check end of file |
734 | cmp [edi], word 3B00h; separator end of file ';' |
698 | cmp [edi], word 3B00h; separator end of file ';' |
735 | je .done_1 |
699 | je .done_1 |
736 | ; check for files not ending with separator |
700 | ; check for files not ending with separator |
737 | movzx eax, byte [ebp-33] |
701 | movzx eax, byte [ebp-33] |
738 | add eax, ebp |
702 | add eax, ebp |
739 | sub eax, 34 |
703 | sub eax, 34 |
740 | cmp edi, eax |
704 | cmp edi, eax |
741 | je .done_1 |
705 | je .done_1 |
742 | ; check the end of directory |
706 | ; check the end of directory |
743 | movzx eax, byte [ebp-1] |
707 | movzx eax, byte [ebp-1] |
744 | add eax, ebp |
708 | add eax, ebp |
745 | cmp edi, eax |
709 | cmp edi, eax |
746 | jne .name_not_coincide |
710 | jne .name_not_coincide |
747 | .done_1: |
711 | .done_1: |
748 | pop eax eax edi edx |
712 | pop eax eax edi edx |
749 | inc esi |
713 | inc esi |
750 | ret |
714 | ret |
751 | 715 | ||
752 | .name_not_coincide: |
716 | .name_not_coincide: |
753 | pop esi eax edi edx |
717 | pop esi eax edi edx |
754 | stc |
718 | stc |
755 | ret |
719 | ret |