Rev 6462 | Rev 6468 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
6462 | pathoswith | 3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
||
2288 | clevermous | 5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
8 | $Revision: 6464 $ |
||
9 | |||
2889 | turbanoff | 10 | ERROR_SUCCESS = 0 |
11 | ERROR_DISK_BASE = 1 |
||
12 | ERROR_UNSUPPORTED_FS = 2 |
||
13 | ERROR_UNKNOWN_FS = 3 |
||
14 | ERROR_PARTITION = 4 |
||
15 | ERROR_FILE_NOT_FOUND = 5 |
||
16 | ERROR_END_OF_FILE = 6 |
||
17 | ERROR_MEMORY_POINTER = 7 |
||
18 | ERROR_DISK_FULL = 8 |
||
19 | ERROR_FAT_TABLE = 9 ;deprecated |
||
20 | ERROR_FS_FAIL = 9 |
||
21 | ERROR_ACCESS_DENIED = 10 |
||
22 | ERROR_DEVICE = 11 |
||
5994 | pathoswith | 23 | ERROR_OUT_OF_MEMORY = 12 |
2288 | clevermous | 24 | |
25 | image_of_eax EQU esp+32 |
||
26 | image_of_ebx EQU esp+20 |
||
27 | |||
6464 | pathoswith | 28 | ; System function 70 |
2288 | clevermous | 29 | |
3296 | clevermous | 30 | file_system_lfn_protected: |
31 | pushad |
||
32 | call protect_from_terminate |
||
33 | call file_system_lfn |
||
34 | call unprotect_from_terminate |
||
35 | popad |
||
36 | mov [image_of_eax], eax |
||
37 | mov [image_of_ebx], ebx |
||
38 | ret |
||
39 | |||
2288 | clevermous | 40 | file_system_lfn: |
6464 | pathoswith | 41 | ; in: ebx -> parameter structure |
42 | ; operation codes: |
||
43 | ; 0 = read file |
||
44 | ; 1 = read folder |
||
45 | ; 2 = create/rewrite file |
||
46 | ; 3 = write/append to file |
||
47 | ; 4 = set file end |
||
48 | ; 5 = get file info |
||
49 | ; 6 = set file info |
||
50 | ; start application |
||
51 | ; 8 = delete file/folder |
||
52 | ; 9 = create folder |
||
2288 | clevermous | 53 | lea esi, [ebx+20] |
54 | lodsb |
||
55 | test al, al |
||
56 | jnz @f |
||
57 | mov esi, [esi] |
||
58 | lodsb |
||
59 | @@: |
||
6333 | serge | 60 | lea ebp, [esi-1] |
6338 | serge | 61 | if 0 |
62 | cmp [ebx], dword 0 |
||
6464 | pathoswith | 63 | jne .1 |
6338 | serge | 64 | DEBUGF 1,'read file %s\n',ebp |
6464 | pathoswith | 65 | jmp @f |
66 | .1: |
||
6338 | serge | 67 | cmp [ebx], dword 5 |
6464 | pathoswith | 68 | jne @f |
6338 | serge | 69 | DEBUGF 1,'get file attributes %s\n',ebp |
70 | @@: |
||
71 | end if |
||
6464 | pathoswith | 72 | cmp dword[ebx], 7 ; start application |
73 | jne @f |
||
6333 | serge | 74 | mov edx, [ebx+4] |
75 | mov ebx, [ebx+8] |
||
6464 | pathoswith | 76 | call fs_execute ; ebp, ebx, edx |
6333 | serge | 77 | mov [image_of_eax], eax |
78 | ret |
||
6464 | pathoswith | 79 | |
6333 | serge | 80 | @@: |
2288 | clevermous | 81 | cmp al, '/' |
82 | jz .notcurdir |
||
83 | dec esi |
||
84 | mov ebp, esi |
||
85 | test al, al |
||
86 | jnz @f |
||
87 | xor ebp, ebp |
||
88 | @@: |
||
89 | mov esi, [current_slot] |
||
90 | mov esi, [esi+APPDATA.cur_dir] |
||
91 | jmp .parse_normal |
||
6464 | pathoswith | 92 | |
2288 | clevermous | 93 | .notcurdir: |
94 | cmp byte [esi], 0 |
||
95 | jz .rootdir |
||
96 | call process_replace_file_name |
||
97 | .parse_normal: |
||
6464 | pathoswith | 98 | mov ax, [esi] |
99 | or ax, 2020h |
||
100 | cmp ax, 'cd' |
||
101 | jz .CD |
||
102 | call dyndisk_handler ; not returns if success |
||
103 | .notfound: |
||
104 | mov dword[image_of_eax], ERROR_FILE_NOT_FOUND |
||
105 | ret |
||
106 | |||
107 | .CD: |
||
108 | add esi, 2 |
||
109 | xor eax, eax |
||
110 | lodsb ; disk number |
||
111 | sub eax, '0' |
||
112 | cmp eax, 10 |
||
113 | jnc .notfound |
||
114 | mov edi, eax |
||
2288 | clevermous | 115 | lodsb |
6464 | pathoswith | 116 | test eax, eax |
117 | jz .maindir |
||
2288 | clevermous | 118 | cmp al, '/' |
6464 | pathoswith | 119 | jnz .notfound |
120 | lodsb ; partition number |
||
121 | test eax, eax |
||
122 | jz .maindir |
||
123 | cmp al, '1' |
||
124 | jnz .notfound |
||
125 | cmp byte [esi], '/' |
||
126 | jnz @f |
||
127 | inc esi |
||
128 | @@: |
||
129 | cmp byte [esi], 0 |
||
130 | jnz @f |
||
131 | test ebp, ebp |
||
132 | jz @f |
||
133 | mov esi, ebp |
||
134 | xor ebp, ebp |
||
135 | @@: |
||
136 | call reserve_cd |
||
137 | mov eax, edi |
||
138 | bt eax, 0 |
||
139 | setc [DiskNumber] |
||
140 | bt eax, 1 |
||
141 | setc [ChannelNumber] |
||
142 | inc [ChannelNumber] |
||
143 | inc eax |
||
144 | mov [cdpos], eax |
||
145 | call reserve_cd_channel |
||
146 | mov eax, edi |
||
147 | not eax |
||
148 | and eax, 3 |
||
149 | shl eax, 1 |
||
150 | inc eax |
||
151 | shr edi, 2 |
||
152 | mov dword[image_of_eax], ERROR_FILE_NOT_FOUND |
||
153 | bt [edi*5+DRIVE_DATA+1], ax |
||
154 | jnc @f |
||
155 | mov ecx, [ebx+12] |
||
156 | mov edx, [ebx+16] |
||
157 | mov eax, [ebx] |
||
158 | mov dword[image_of_eax], ERROR_UNSUPPORTED_FS |
||
159 | cmp eax, fs_NumCdServices |
||
160 | jae @f |
||
161 | add ebx, 4 |
||
162 | call dword[fs_CdServices + eax*4] |
||
163 | call free_cd_channel |
||
164 | and [cd_status], 0 |
||
165 | mov [image_of_eax], eax |
||
166 | mov [image_of_ebx], ebx |
||
167 | ret |
||
168 | |||
169 | @@: |
||
170 | call free_cd_channel |
||
171 | and [cd_status], 0 |
||
172 | ret |
||
173 | |||
174 | .nextCD: |
||
175 | test eax, eax ; partition number |
||
176 | stc |
||
177 | jnz @f ; no more partitions |
||
178 | mov al, 1 ; /cdX/1 |
||
179 | clc |
||
180 | @@: |
||
181 | ret |
||
182 | |||
183 | .maindir: ; list partitions |
||
184 | mov esi, .nextCD |
||
185 | .maindir_noesi: ; backjump from dyndisk_handler |
||
186 | cmp dword[ebx], 1 |
||
187 | jnz .access_denied ; read folder? |
||
188 | push ecx |
||
189 | mov ebp, [ebx+12] ; the number of blocks to read |
||
190 | mov edx, [ebx+16] ; where to write the result |
||
191 | push dword[ebx+4] ; first block |
||
2288 | clevermous | 192 | mov ebx, [ebx+8] ; flags |
6464 | pathoswith | 193 | mov ecx, 32/4 |
2288 | clevermous | 194 | mov edi, edx |
6464 | pathoswith | 195 | xor eax, eax |
2288 | clevermous | 196 | rep stosd |
197 | mov byte [edx], 1 ; version |
||
198 | .maindir_loop: |
||
199 | call esi |
||
200 | jc .maindir_done |
||
6464 | pathoswith | 201 | inc dword[edx+8] |
202 | dec dword[esp] |
||
2288 | clevermous | 203 | jns .maindir_loop |
204 | dec ebp |
||
205 | js .maindir_loop |
||
6464 | pathoswith | 206 | inc dword[edx+4] |
207 | mov dword[edi], 16 ; attributes: folder |
||
208 | mov dword[edi+4], ebx ; name encoding |
||
2288 | clevermous | 209 | push eax |
6464 | pathoswith | 210 | mov ecx, 32/4 |
211 | add edi, 8 |
||
2288 | clevermous | 212 | xor eax, eax |
213 | rep stosd |
||
214 | pop eax |
||
6464 | pathoswith | 215 | push eax edx edi |
216 | ; convert number in eax to decimal string |
||
2288 | clevermous | 217 | push -'0' |
218 | mov ecx, 10 |
||
219 | @@: |
||
220 | xor edx, edx |
||
221 | div ecx |
||
222 | push edx |
||
223 | test eax, eax |
||
224 | jnz @b |
||
6464 | pathoswith | 225 | cmp ebx, 1 |
226 | jz .uni |
||
2288 | clevermous | 227 | @@: |
228 | pop eax |
||
6464 | pathoswith | 229 | add eax, '0' |
2288 | clevermous | 230 | stosb |
6464 | pathoswith | 231 | test eax, eax |
2288 | clevermous | 232 | jnz @b |
6464 | pathoswith | 233 | pop edi edx eax |
234 | add edi, 264 |
||
235 | jmp .maindir_loop |
||
236 | |||
237 | .uni: |
||
238 | pop eax |
||
239 | add eax, '0' |
||
240 | stosw |
||
241 | test eax, eax |
||
242 | jnz .uni |
||
243 | pop edi edx eax |
||
2288 | clevermous | 244 | add edi, 520 |
245 | jmp .maindir_loop |
||
6464 | pathoswith | 246 | |
2288 | clevermous | 247 | .maindir_done: |
6464 | pathoswith | 248 | pop eax eax |
2288 | clevermous | 249 | mov ebx, [edx+4] |
250 | xor eax, eax |
||
251 | dec ebp |
||
252 | js @f |
||
253 | mov al, ERROR_END_OF_FILE |
||
254 | @@: |
||
255 | mov [image_of_eax], eax |
||
256 | mov [image_of_ebx], ebx |
||
257 | ret |
||
6464 | pathoswith | 258 | |
2288 | clevermous | 259 | .access_denied: |
6464 | pathoswith | 260 | mov dword[image_of_eax], ERROR_ACCESS_DENIED |
2288 | clevermous | 261 | ret |
262 | |||
6464 | pathoswith | 263 | .rootdir: ; / - virtual root folder |
264 | cmp dword[ebx], 1 ; read folder? |
||
265 | jnz .access_denied |
||
266 | mov ebp, [ebx+12] ; number of blocks |
||
267 | mov edx, [ebx+16] ; return area |
||
268 | push dword[ebx+4] ; first block |
||
2288 | clevermous | 269 | mov ebx, [ebx+8] ; flags |
6464 | pathoswith | 270 | mov ecx, 32/4 |
271 | mov edi, edx |
||
2288 | clevermous | 272 | xor eax, eax |
273 | rep stosd |
||
274 | mov byte [edx], 1 ; version |
||
4277 | clevermous | 275 | sub esp, 16 |
6464 | pathoswith | 276 | .rootdir_loop: |
4277 | clevermous | 277 | push edi |
278 | lea edi, [esp+4] |
||
279 | call dyndisk_enum_root |
||
280 | pop edi |
||
281 | test eax, eax |
||
6464 | pathoswith | 282 | jz .rootdirCD |
283 | inc dword[edx+8] |
||
284 | dec dword[esp+16] |
||
285 | jns .rootdir_loop |
||
4277 | clevermous | 286 | dec ebp |
6464 | pathoswith | 287 | js .rootdir_loop |
288 | inc dword[edx+4] |
||
289 | mov dword[edi], 16 ; attributes: folder |
||
290 | mov dword[edi+4], ebx ; name encoding |
||
4277 | clevermous | 291 | push eax |
6464 | pathoswith | 292 | mov ecx, 32/4 |
293 | add edi, 8 |
||
4277 | clevermous | 294 | xor eax, eax |
295 | rep stosd |
||
296 | push esi edi |
||
297 | lea esi, [esp+12] |
||
6464 | pathoswith | 298 | cmp ebx, 1 |
299 | jz .uni2 |
||
4277 | clevermous | 300 | @@: |
301 | lodsb |
||
302 | stosb |
||
6464 | pathoswith | 303 | test eax, eax |
4277 | clevermous | 304 | jnz @b |
305 | pop edi esi eax |
||
6464 | pathoswith | 306 | add edi, 264 |
307 | jmp .rootdir_loop |
||
308 | |||
309 | .uni2: |
||
310 | lodsb |
||
311 | stosw |
||
312 | test eax, eax |
||
313 | jnz .uni2 |
||
314 | pop edi esi eax |
||
4277 | clevermous | 315 | add edi, 520 |
6464 | pathoswith | 316 | jmp .rootdir_loop |
317 | |||
318 | .rootdirCD: |
||
4277 | clevermous | 319 | add esp, 16 |
6464 | pathoswith | 320 | or esi, -1 |
321 | .rootdirCD_loop: |
||
322 | inc esi |
||
323 | cmp esi, 10 |
||
324 | jnc .rootdir_done |
||
325 | mov eax, esi |
||
326 | not eax |
||
327 | and eax, 3 |
||
328 | shl eax, 1 |
||
329 | inc eax |
||
330 | mov ecx, esi |
||
331 | shr ecx, 2 |
||
332 | bt [ecx*5+DRIVE_DATA+1], ax |
||
333 | jnc .rootdirCD_loop |
||
334 | inc dword[edx+8] |
||
335 | dec dword[esp] |
||
336 | jns .rootdirCD_loop |
||
2288 | clevermous | 337 | dec ebp |
6464 | pathoswith | 338 | js .rootdirCD_loop |
339 | inc dword[edx+4] |
||
340 | mov dword[edi], 16 ; attributes: folder |
||
341 | mov dword[edi+4], ebx ; name encoding |
||
342 | mov ecx, 32/4 |
||
2288 | clevermous | 343 | add edi, 8 |
6464 | pathoswith | 344 | xor eax, eax |
2288 | clevermous | 345 | rep stosd |
6464 | pathoswith | 346 | mov eax, esi |
347 | add eax, '0' |
||
348 | cmp ebx, 1 |
||
349 | jz @f |
||
350 | mov word [edi], 'cd' |
||
351 | mov [edi+2], ax |
||
352 | add edi, 264 |
||
353 | jmp .rootdirCD_loop |
||
354 | |||
2288 | clevermous | 355 | @@: |
6464 | pathoswith | 356 | mov dword[edi], 640063h |
357 | mov [edi+4], eax |
||
2288 | clevermous | 358 | add edi, 520 |
6464 | pathoswith | 359 | jmp .rootdirCD_loop |
360 | |||
361 | .rootdir_done: |
||
2288 | clevermous | 362 | pop eax |
363 | mov ebx, [edx+4] |
||
364 | xor eax, eax |
||
365 | dec ebp |
||
366 | js @f |
||
367 | mov al, ERROR_END_OF_FILE |
||
368 | @@: |
||
369 | mov [image_of_eax], eax |
||
370 | mov [image_of_ebx], ebx |
||
371 | ret |
||
372 | |||
373 | fs_NotImplemented: |
||
374 | mov eax, 2 |
||
375 | ret |
||
4700 | mario79 | 376 | |
377 | ;----------------------------------------------------------------------------- |
||
2288 | clevermous | 378 | fs_CdServices: |
379 | dd fs_CdRead |
||
380 | dd fs_CdReadFolder |
||
381 | dd fs_NotImplemented |
||
382 | dd fs_NotImplemented |
||
383 | dd fs_NotImplemented |
||
384 | dd fs_CdGetFileInfo |
||
385 | dd fs_NotImplemented |
||
386 | dd 0 |
||
387 | dd fs_NotImplemented |
||
388 | dd fs_NotImplemented |
||
389 | fs_NumCdServices = ($ - fs_CdServices)/4 |
||
4700 | mario79 | 390 | ;----------------------------------------------------------------------------- |
2288 | clevermous | 391 | process_replace_file_name: |
6464 | pathoswith | 392 | ; in: [esi] = virtual path |
393 | ; out: [esi]+[ebp] = physical path |
||
3689 | mario79 | 394 | pushfd |
395 | cli |
||
2288 | clevermous | 396 | mov ebp, [full_file_name_table] |
3689 | mario79 | 397 | xor edi, edi |
2288 | clevermous | 398 | .loop: |
3711 | clevermous | 399 | cmp edi, [full_file_name_table.size] |
3689 | mario79 | 400 | jae .notfound |
2288 | clevermous | 401 | push esi edi |
6464 | pathoswith | 402 | shl edi, 7 |
3689 | mario79 | 403 | add edi, ebp |
2288 | clevermous | 404 | @@: |
6464 | pathoswith | 405 | cmp byte [edi], 0 |
2288 | clevermous | 406 | jz .dest_done |
407 | lodsb |
||
408 | test al, al |
||
409 | jz .cont |
||
6464 | pathoswith | 410 | or al, 20h |
2288 | clevermous | 411 | scasb |
412 | jz @b |
||
6464 | pathoswith | 413 | .cont: |
414 | pop edi esi |
||
415 | inc edi |
||
416 | jmp .loop |
||
417 | |||
2288 | clevermous | 418 | .dest_done: |
419 | cmp byte [esi], 0 |
||
420 | jz .found |
||
421 | cmp byte [esi], '/' |
||
422 | jnz .cont |
||
423 | inc esi |
||
424 | .found: |
||
425 | pop edi eax |
||
6464 | pathoswith | 426 | shl edi, 7 |
3689 | mario79 | 427 | add edi, ebp |
2288 | clevermous | 428 | mov ebp, esi |
429 | cmp byte [esi], 0 |
||
430 | lea esi, [edi+64] |
||
431 | jnz .ret |
||
432 | .notfound: |
||
433 | xor ebp, ebp |
||
434 | .ret: |
||
3689 | mario79 | 435 | popfd |
2288 | clevermous | 436 | ret |
6464 | pathoswith | 437 | |
3689 | mario79 | 438 | ;----------------------------------------------------------------------------- |
3663 | mario79 | 439 | uglobal |
440 | lock_flag_for_f30_3 rb 1 |
||
441 | endg |
||
6338 | serge | 442 | |
6464 | pathoswith | 443 | sys_current_directory: ; sysfunction 30 |
2288 | clevermous | 444 | mov eax, [current_slot] |
445 | mov edi, [eax+APPDATA.cur_dir] |
||
446 | dec ebx |
||
447 | jz .set |
||
448 | dec ebx |
||
449 | jz .get |
||
3663 | mario79 | 450 | dec ebx |
451 | jz .mount_additional_directory |
||
2288 | clevermous | 452 | ret |
3663 | mario79 | 453 | |
454 | .mount_additional_directory: |
||
6464 | pathoswith | 455 | ; in: ecx -> dir name+dir path (128) |
456 | cmp [lock_flag_for_f30_3], 1 ; check lock |
||
3663 | mario79 | 457 | je @f |
458 | mov esi, ecx |
||
459 | mov edi, sysdir_name1 |
||
460 | mov ecx, 63 |
||
3711 | clevermous | 461 | pushfd |
462 | cli |
||
3663 | mario79 | 463 | cld |
6464 | pathoswith | 464 | rep movsb ; copying fake directory name |
3663 | mario79 | 465 | inc esi |
466 | xor eax, eax |
||
6464 | pathoswith | 467 | stosb ; terminator of name, in case if we get the inlet trash |
3663 | mario79 | 468 | mov ecx, 63 |
6464 | pathoswith | 469 | rep movsb ; copying real directory path for mounting |
3663 | mario79 | 470 | xor eax, eax |
471 | stosb |
||
6338 | serge | 472 | ; increase the pointer of inputs for procedure "process_replace_file_name" |
3663 | mario79 | 473 | mov [full_file_name_table.size], 2 |
6464 | pathoswith | 474 | mov [lock_flag_for_f30_3], 1 ; lock |
3711 | clevermous | 475 | popfd |
3663 | mario79 | 476 | @@: |
477 | ret |
||
6338 | serge | 478 | |
6464 | pathoswith | 479 | max_cur_dir equ 0x1000 ; length |
2288 | clevermous | 480 | |
6464 | pathoswith | 481 | .get: ; in: ecx -> buffer, edx = length |
482 | mov ebx, edi ; buffer |
||
2288 | clevermous | 483 | push ecx |
484 | push edi |
||
485 | xor eax, eax |
||
486 | mov ecx, max_cur_dir |
||
6464 | pathoswith | 487 | repne scasb |
488 | jnz .error |
||
489 | sub edi, ebx |
||
2288 | clevermous | 490 | inc edi |
6464 | pathoswith | 491 | mov [esp+32+8], edi ; return in eax |
2288 | clevermous | 492 | cmp edx, edi |
493 | jbe @f |
||
494 | mov edx, edi |
||
495 | @@: |
||
496 | pop esi |
||
497 | pop edi |
||
498 | cmp edx, 1 |
||
499 | jbe .ret |
||
6464 | pathoswith | 500 | mov al, '/' |
2288 | clevermous | 501 | stosb |
502 | mov ecx, edx |
||
6464 | pathoswith | 503 | rep movsb |
2288 | clevermous | 504 | .ret: |
505 | ret |
||
506 | |||
507 | .error: |
||
508 | add esp, 8 |
||
6464 | pathoswith | 509 | or dword[esp+32], -1 |
2288 | clevermous | 510 | ret |
6464 | pathoswith | 511 | |
2288 | clevermous | 512 | .set: |
6464 | pathoswith | 513 | pop eax |
514 | push max_cur_dir |
||
515 | push edi |
||
516 | push eax |
||
2288 | clevermous | 517 | mov ebx, ecx |
518 | get_full_file_name: |
||
6464 | pathoswith | 519 | ; in: ebx -> file name, [esp+4] -> destination, [esp+8] = max length |
520 | ; destroys all registers |
||
2288 | clevermous | 521 | push ebp |
522 | mov esi, [current_slot] |
||
523 | mov esi, [esi+APPDATA.cur_dir] |
||
524 | mov edx, esi |
||
525 | @@: |
||
526 | inc esi |
||
527 | cmp byte [esi-1], 0 |
||
528 | jnz @b |
||
529 | dec esi |
||
530 | cmp byte [ebx], '/' |
||
531 | jz .set_absolute |
||
6464 | pathoswith | 532 | mov edi, [esp+8] |
2288 | clevermous | 533 | .relative: |
534 | cmp byte [ebx], 0 |
||
535 | jz .set_ok |
||
536 | cmp word [ebx], '.' |
||
537 | jz .set_ok |
||
538 | cmp word [ebx], './' |
||
539 | jnz @f |
||
540 | add ebx, 2 |
||
541 | jmp .relative |
||
6464 | pathoswith | 542 | |
2288 | clevermous | 543 | @@: |
544 | cmp word [ebx], '..' |
||
545 | jnz .doset_relative |
||
546 | cmp byte [ebx+2], 0 |
||
547 | jz @f |
||
548 | cmp byte [ebx+2], '/' |
||
549 | jnz .doset_relative |
||
550 | @@: |
||
551 | dec esi |
||
552 | cmp byte [esi], '/' |
||
553 | jnz @b |
||
554 | add ebx, 3 |
||
555 | jmp .relative |
||
6464 | pathoswith | 556 | |
2288 | clevermous | 557 | .set_ok: |
558 | cmp edx, edi ; is destination equal to APPDATA.cur_dir? |
||
559 | jz .set_ok.cur_dir |
||
560 | sub esi, edx |
||
561 | cmp esi, [esp+12] |
||
562 | jb .set_ok.copy |
||
563 | .fail: |
||
564 | mov byte [edi], 0 |
||
6464 | pathoswith | 565 | xor eax, eax |
2288 | clevermous | 566 | pop ebp |
567 | ret 8 |
||
6464 | pathoswith | 568 | |
2288 | clevermous | 569 | .set_ok.copy: |
570 | mov ecx, esi |
||
571 | mov esi, edx |
||
572 | rep movsb |
||
573 | mov byte [edi], 0 |
||
574 | .ret.ok: |
||
6464 | pathoswith | 575 | mov al, 1 |
2288 | clevermous | 576 | pop ebp |
577 | ret 8 |
||
6464 | pathoswith | 578 | |
2288 | clevermous | 579 | .set_ok.cur_dir: |
580 | mov byte [esi], 0 |
||
581 | jmp .ret.ok |
||
6464 | pathoswith | 582 | |
2288 | clevermous | 583 | .doset_relative: |
584 | cmp edx, edi |
||
585 | jz .doset_relative.cur_dir |
||
586 | sub esi, edx |
||
587 | cmp esi, [esp+12] |
||
588 | jae .fail |
||
589 | mov ecx, esi |
||
590 | mov esi, edx |
||
591 | mov edx, edi |
||
592 | rep movsb |
||
593 | jmp .doset_relative.copy |
||
6464 | pathoswith | 594 | |
2288 | clevermous | 595 | .doset_relative.cur_dir: |
596 | mov edi, esi |
||
597 | .doset_relative.copy: |
||
598 | add edx, [esp+12] |
||
599 | mov byte [edi], '/' |
||
600 | inc edi |
||
601 | cmp edi, edx |
||
602 | jae .overflow |
||
603 | @@: |
||
604 | mov al, [ebx] |
||
605 | inc ebx |
||
606 | stosb |
||
607 | test al, al |
||
608 | jz .ret.ok |
||
609 | cmp edi, edx |
||
610 | jb @b |
||
611 | .overflow: |
||
612 | dec edi |
||
613 | jmp .fail |
||
6464 | pathoswith | 614 | |
2288 | clevermous | 615 | .set_absolute: |
616 | lea esi, [ebx+1] |
||
617 | call process_replace_file_name |
||
618 | mov edi, [esp+8] |
||
619 | mov edx, [esp+12] |
||
620 | add edx, edi |
||
621 | .set_copy: |
||
622 | lodsb |
||
623 | stosb |
||
624 | test al, al |
||
625 | jz .set_part2 |
||
626 | .set_copy_cont: |
||
627 | cmp edi, edx |
||
628 | jb .set_copy |
||
629 | jmp .overflow |
||
6464 | pathoswith | 630 | |
2288 | clevermous | 631 | .set_part2: |
632 | mov esi, ebp |
||
633 | xor ebp, ebp |
||
634 | test esi, esi |
||
635 | jz .ret.ok |
||
636 | mov byte [edi-1], '/' |
||
637 | jmp .set_copy_cont |
||
6462 | pathoswith | 638 | |
639 | include "parse_fn.inc" |
||
640 | include "fs_common.inc" |
||
641 | include "iso9660.inc" ; read for CD filesystem |
||
642 | include "fat.inc" |
||
643 | include "ntfs.inc" |
||
644 | include "ext.inc" |
||
645 | include "xfs.asm" |