Subversion Repositories Kolibri OS

Rev

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

Rev 6468 Rev 6471
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: 6468 $
8
$Revision: 6471 $
9
 
9
 
10
; CD external functions
10
; CD external functions
11
;   in:
11
;   in:
12
; esi -> path string
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
Line 602... Line 602...
602
        xor     eax, eax
602
        xor     eax, eax
603
        ret
603
        ret
604
;-----------------------------------------------------------------------------
604
;-----------------------------------------------------------------------------
605
cd_find_lfn:
605
cd_find_lfn:
606
        mov     [cd_appl_data], 0
606
        mov     [cd_appl_data], 0
607
; in: esi -> path string
607
; in: esi -> path string in UTF-8
608
; out: CF=1 - file not found
-
 
609
; else CF=0 and [cd_current_pointer_of_input] direntry
608
; out: [cd_current_pointer_of_input] -> direntry, CF=1 -> file not found
610
        push    eax esi
609
        push    eax esi
611
; Sector 16 - start set of volume descriptors
610
; Sector 16 - start set of volume descriptors
612
        call    WaitUnitReady
611
        call    WaitUnitReady
613
        cmp     [DevErrorCode], 0
612
        cmp     [DevErrorCode], 0
614
        jne     .access_denied
613
        jne     .access_denied
Line 752... Line 751...
752
        pop     eax
751
        pop     eax
753
        stc
752
        stc
754
        ret
753
        ret
755
;-----------------------------------------------------------------------------
754
;-----------------------------------------------------------------------------
756
cd_compare_name:
755
cd_compare_name:
757
; compares ASCIIZ-names, case-insensitive (cp866 encoding)
-
 
758
; in: esi->name, ebp->name
756
; in: esi -> UTF-8 name, ebp -> UTF-16BE name
759
; out: if names match: ZF=1 and esi->next component of name
757
; out: CF=0 -> names match, esi -> next component of name
760
;      else: ZF=0, esi is not changed
758
;      CF=1 -> esi is not changed
761
; destroys eax
-
 
762
        push    esi eax edi
759
        push    edx edi eax esi
763
        mov     edi, ebp
760
        mov     edi, ebp
764
;--------------------------------------
-
 
765
.loop:
761
.loop:
766
        cld
-
 
767
        lodsb
-
 
768
        push    eax
-
 
769
        call    char_todown
762
        call    utf8to16
770
        call    ansi2uni_char
763
        call    utf16toUpper
771
        xchg    ah, al
764
        mov     edx, eax
772
        scasw
-
 
773
        pop     eax
765
        mov     ax, [edi]
774
        je      .coincides
766
        xchg    al, ah
775
        call    char_toupper
767
        call    utf16toUpper
776
        call    ansi2uni_char
-
 
777
        xchg    ah, al
768
        cmp     ax, dx
778
        sub     edi, 2
-
 
779
        scasw
-
 
780
        jne     .name_not_coincide
769
        jne     .name_not_coincide
781
;--------------------------------------
-
 
782
.coincides:
770
        add     edi, 2
783
        cmp     [esi], byte '/' ; path separator is end of current element
771
        cmp     [esi], byte '/' ; path separator is end of current element
784
        je      .done
772
        je      .done
785
 
-
 
786
        cmp     [esi], byte 0 ; path separator end of name
773
        cmp     [esi], byte 0 ; path separator end of name
787
        je      .done
-
 
788
 
-
 
789
        jmp     .loop
774
        jne     .loop
790
;--------------------------------------
-
 
791
.name_not_coincide:
-
 
792
        pop     edi eax esi
-
 
793
        stc
-
 
794
        ret
-
 
795
;--------------------------------------
-
 
796
.done:
775
.done:
797
; check end of file
776
; check end of file
798
        cmp     [edi], word 3B00h; separator end of file ';'
777
        cmp     [edi], word 3B00h; separator end of file ';'
799
        je      .done_1
778
        je      .done_1
800
; check for files not ending with separator
779
; check for files not ending with separator
Line 806... Line 785...
806
; check the end of directory
785
; check the end of directory
807
        movzx   eax, byte [ebp-1]
786
        movzx   eax, byte [ebp-1]
808
        add     eax, ebp
787
        add     eax, ebp
809
        cmp     edi, eax
788
        cmp     edi, eax
810
        jne     .name_not_coincide
789
        jne     .name_not_coincide
811
;--------------------------------------
-
 
812
.done_1:
790
.done_1:
813
        pop     edi eax
791
        pop     eax eax edi edx
814
        add     esp, 4
-
 
815
        inc     esi
792
        inc     esi
-
 
793
        ret
-
 
794
 
-
 
795
.name_not_coincide:
-
 
796
        pop     esi eax edi edx
816
        clc
797
        stc
817
        ret
798
        ret