Subversion Repositories Kolibri OS

Rev

Rev 6787 | Rev 6798 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6787 Rev 6792
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: 6787 $
8
$Revision: 6792 $
9
 
9
 
10
ERROR_SUCCESS        = 0
10
ERROR_SUCCESS        = 0
11
ERROR_DISK_BASE      = 1
11
ERROR_DISK_BASE      = 1
Line 38... Line 38...
38
        mov     [image_of_ebx], ebx
38
        mov     [image_of_ebx], ebx
39
        ret
39
        ret
Line 40... Line 40...
40
 
40
 
41
file_system_lfn:
41
file_system_lfn:
42
; in: ebx -> parameter structure
-
 
43
;   operation codes:
-
 
44
; 0 = read file
-
 
45
; 1 = read folder
-
 
46
; 2 = create/rewrite file
-
 
47
; 3 = write/append to file
-
 
48
; 4 = set file end
-
 
49
; 5 = get file info
-
 
50
; 6 = set file info
-
 
51
; start application
-
 
52
; 8 = delete file/folder
-
 
53
; 9 = create folder
42
; in: ebx -> parameter structure
54
        lea     ebp, [ebx+20]
43
        lea     ebp, [ebx+20]
55
        cmp     byte [ebp], 0
44
        cmp     byte [ebp], 0
56
        jnz     @f
45
        jnz     @f
57
        mov     ebp, [ebx+21]
46
        mov     ebp, [ebx+21]
Line 67... Line 56...
67
        cmp     byte [ebp], 2
56
        cmp     byte [ebp], 2
68
        jnz     .rootdir
57
        jnz     .rootdir
69
        cmp     word [ebp+3], 0
58
        cmp     word [ebp+3], 0
70
        jz      .rootdir
59
        jz      .rootdir
71
@@:
60
@@:
-
 
61
        stdcall kernel_alloc, maxPathLength
-
 
62
        push    eax ebx
-
 
63
        xchg    eax, edi
-
 
64
        mov     esi, ebp
-
 
65
        xor     eax, eax
-
 
66
        call    getFullPath
-
 
67
        pop     ebx ebp
-
 
68
        test    eax, eax
-
 
69
        jz      .notfound
72
        cmp     dword[ebx], 7   ; start application
70
        cmp     dword[ebx], 7   ; start application
73
        jnz     @f
71
        jnz     @f
74
        mov     edx, [ebx+4]
72
        mov     edx, [ebx+4]
75
        mov     ebx, [ebx+8]
73
        mov     ecx, [ebx+8]
-
 
74
        mov     ebx, ebp
76
        call    fs_execute      ; ebp, ebx, edx
75
        call    fs_execute
77
        mov     [image_of_eax], eax
76
        mov     [image_of_eax], eax
78
        ret
77
        ret
Line 79... Line 78...
79
 
78
 
80
@@:
-
 
81
        stdcall kernel_alloc, maxPathLength
-
 
82
        push    ebx
-
 
83
        mov     ebx, ebp
-
 
84
        mov     ebp, eax
-
 
85
        stdcall get_full_file_name, eax, maxPathLength
-
 
86
        pop     ebx
-
 
87
        test    eax, eax
-
 
88
        jz      .notfound
79
@@:
89
        lea     esi, [ebp+2]
80
        lea     esi, [ebp+2]
90
        mov     ax, [esi]
81
        mov     ax, [esi]
91
        or      ax, 2020h
82
        or      ax, 2020h
92
        cmp     ax, 'cd'
83
        cmp     ax, 'cd'
Line 489... Line 480...
489
@@:
480
@@:
490
        mov     [esp+32], ecx
481
        mov     [esp+32], ecx
491
        ret
482
        ret
Line 492... Line 483...
492
 
483
 
493
.set:
484
.set:
494
        pop     eax
-
 
495
        push    maxPathLength
-
 
496
        push    edi
-
 
497
        push    eax
485
        mov     esi, ecx
498
        mov     ebx, ecx
486
        xor     eax, eax
499
get_full_file_name:
487
getFullPath:
500
; in: ebx -> file name, [esp+4] -> destination, [esp+8] = max length
488
; in: esi -> file path, eax = string encoding, edi -> destination
501
; out: UTF-8 string, eax=0 -> out of length
489
; out: UTF-8 string (with marker), eax = length, 0 -> error
502
        push    ebp ebx
-
 
503
        cmp     byte [ebx], 0
-
 
504
        jz      .set_relative
490
        test    eax, eax
505
        mov     esi, ebx
491
        jnz     @f
506
        cmp     byte [ebx], 4
492
        cmp     byte [esi], 4
-
 
493
        jnc     @f
507
        jnc     @f
494
        cmp     byte [esi], 0
-
 
495
        jz      @f
508
        inc     esi
496
        lodsb
509
@@:
497
@@:
510
        cmp     byte [esi], '/'
498
        cmp     byte [esi], '/'
511
        jnz     .set_relative
499
        jnz     .relative
512
        inc     esi
500
        cmp     eax, 2
513
        cmp     byte [esi], 4
501
        jnz     @f
514
        jnc     @f
502
        cmp     word [esi], '/'
515
        mov     ebx, esi
503
        jnz     .relative
516
        inc     esi
-
 
517
        cmp     byte [esi], '/'
-
 
518
        jnz     .start
504
        inc     esi
-
 
505
        inc     esi
-
 
506
        jmp     .start
519
        inc     esi
507
 
-
 
508
@@:
520
@@:
509
        inc     esi
-
 
510
        cmp     byte [esi], 4
-
 
511
        jnc     .start
-
 
512
        lodsb
521
        cmp     byte [ebx], 2
513
        cmp     byte [esi], '/'
522
        jnz     .start
514
        jnz     .start
523
        inc     esi
515
        inc     esi
-
 
516
.start:
524
.start:
517
        push    eax edi
525
        call    process_replace_file_name
518
        call    process_replace_file_name
526
        mov     edi, [esp+12]
519
        mov     edi, [esp]
527
        mov     ecx, [esp+16]
520
        mov     ecx, maxPathLength
528
        mov     al, 3
521
        mov     al, 3
529
        mov     ah, '/'
522
        mov     ah, '/'
530
        stosw
523
        stosw
531
        sub     ecx, 2
524
        sub     ecx, 2
Line 538... Line 531...
538
        test    al, al
531
        test    al, al
539
        jnz     @b
532
        jnz     @b
540
        mov     esi, ebp
533
        mov     esi, ebp
541
        dec     edi
534
        dec     edi
542
.absolute:
535
.absolute:
543
        cmp     byte [ebx], 2
536
        cmp     byte [esp+4], 2
544
        jz      .utf16
537
        jz      .utf16
545
        cmp     byte [ebx], 3
538
        cmp     byte [esp+4], 3
546
        jz      .utf8
539
        jz      .utf8
547
        call    cp866toUTF8_string
540
        call    cp866toUTF8_string
548
        jns     .end
541
        jns     .end
549
        jmp     .fail
542
        jmp     .fail
Line 560... Line 553...
560
.utf16:
553
.utf16:
561
        call    UTF16to8_string
554
        call    UTF16to8_string
562
        jns     .end
555
        jns     .end
563
.fail:
556
.fail:
564
        mov     byte [edi], 0
557
        mov     byte [edi], 0
-
 
558
        pop     eax eax
565
        xor     eax, eax
559
        xor     eax, eax
566
        pop     ebx ebp
-
 
567
        ret     8
560
        ret
Line 568... Line 561...
568
 
561
 
-
 
562
.relative:
-
 
563
        push    eax edi
569
.set_relative:
564
        mov     ebx, esi
570
        mov     edi, [current_slot]
565
        mov     edi, [current_slot]
571
        mov     edi, [edi+APPDATA.cur_dir]
566
        mov     edi, [edi+APPDATA.cur_dir]
572
        mov     edx, edi
567
        mov     edx, edi
573
        mov     ecx, [esp+16]
568
        mov     ecx, maxPathLength
574
        xor     eax, eax
569
        xor     eax, eax
575
        repnz scasb
570
        repnz scasb
576
        mov     esi, edi
-
 
577
        dec     esi
571
        mov     esi, edi
578
        mov     edi, [esp+12]
572
        mov     edi, [esp]
579
        jecxz   .fail
573
        jecxz   .fail
580
        cmp     byte [ebx], 0
574
        cmp     byte [ebx], 0
581
        jz      .set_ok
-
 
582
        cmp     byte [ebx], 4
-
 
583
        jnc     @f
575
        jz      .set_ok
584
        inc     ebx
-
 
585
@@:
576
        dec     esi
586
        cmp     edx, edi    ; is destination equal to cur_dir?
577
        cmp     edx, edi    ; is destination equal to cur_dir?
587
        mov     edi, esi
578
        mov     edi, esi
588
        jz      @f
579
        jz      @f
589
        mov     edi, [esp+12]
580
        mov     edi, [esp]
590
        mov     ecx, esi
581
        mov     ecx, esi
591
        sub     ecx, edx
582
        sub     ecx, edx
592
        mov     esi, edx
583
        mov     esi, edx
593
        mov     edx, edi
584
        mov     edx, edi
594
        rep movsb
585
        rep movsb
595
@@:
586
@@:
596
        mov     byte [edi], '/'
587
        mov     byte [edi], '/'
597
        inc     edi
588
        inc     edi
598
        mov     esi, ebx
589
        mov     esi, ebx
599
        mov     ecx, edx
590
        mov     ecx, edx
600
        add     ecx, [esp+16]
591
        add     ecx, maxPathLength
601
        sub     ecx, edi
-
 
602
        mov     ebx, [esp]
592
        sub     ecx, edi
Line 603... Line 593...
603
        jmp     .absolute
593
        jmp     .absolute
604
 
594
 
605
.set_ok:
595
.set_ok:
606
        cmp     edx, edi    ; is destination equal to cur_dir?
596
        cmp     edx, edi    ; is destination equal to cur_dir?
607
        jz      @f
597
        jz      @f
608
        mov     ecx, esi
598
        mov     ecx, esi
609
        sub     ecx, edx
599
        sub     ecx, edx
610
        mov     esi, edx
-
 
611
        rep movsb
600
        mov     esi, edx
612
        mov     byte [edi], 0
601
        rep movsb
-
 
602
@@:
613
@@:
603
        pop     eax
-
 
604
        sub     edi, eax
614
        mov     al, 1
605
        pop     eax
Line 615... Line 606...
615
        pop     ebx ebp
606
        mov     eax, edi
616
        ret     8
607
        ret
617
 
608
 
618
.end:
609
.end:
619
        or      ecx, -1
610
        or      ecx, -1
620
        mov     edi, [esp+12]
611
        mov     edi, [esp]
621
        xor     eax, eax
612
        xor     eax, eax
622
        push    edi
613
        push    edi
Line 639... Line 630...
639
        jnz     @f
630
        jnz     @f
640
        cmp     byte [esi], '/'
631
        cmp     byte [esi], '/'
641
        jnz     @f
632
        jnz     @f
642
        mov     edx, ecx
633
        mov     edx, ecx
643
        mov     ecx, edi
634
        mov     ecx, edi
644
        sub     ecx, [esp+12]
635
        sub     ecx, [esp]
645
        sub     ecx, 2
636
        sub     ecx, 2
646
        jc      .fail
637
        jc      .fail
647
        sub     edi, 2
638
        sub     edi, 2
648
        lodsb
639
        lodsb
649
        dec     edx
640
        dec     edx