Subversion Repositories Kolibri OS

Rev

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

Rev 86 Rev 91
Line 1592... Line 1592...
1592
        push    flp_notroot_first
1592
        push    flp_notroot_first
1593
        push    flp_notroot_next
1593
        push    flp_notroot_next
1594
.common1:
1594
.common1:
1595
        call    fat_find_lfn
1595
        call    fat_find_lfn
1596
        jc      .notfound
1596
        jc      .notfound
-
 
1597
; found; must not be directory
-
 
1598
        test    byte [edi+11], 10h
-
 
1599
        jz      @f
-
 
1600
        add     esp, 28
-
 
1601
        popad
-
 
1602
        mov     eax, ERROR_ACCESS_DENIED
-
 
1603
        xor     ebx, ebx
-
 
1604
        ret
-
 
1605
@@:
1597
; found, delete FAT chain
1606
; delete FAT chain
1598
        push    edi
1607
        push    edi
1599
        xor     eax, eax
1608
        xor     eax, eax
1600
        mov     dword [edi+28], eax     ; zero size
1609
        mov     dword [edi+28], eax     ; zero size
1601
        xchg    ax, word [edi+26]       ; start cluster
1610
        xchg    ax, word [edi+26]       ; start cluster
1602
        test    eax, eax
1611
        test    eax, eax
Line 1958... Line 1967...
1958
        jz      @f
1967
        jz      @f
1959
        mov     al, 11
1968
        mov     al, 11
1960
@@:
1969
@@:
1961
        ret
1970
        ret
Line -... Line 1971...
-
 
1971
 
-
 
1972
;----------------------------------------------------------------
-
 
1973
;
-
 
1974
;  fs_FloppyExecute - LFN variant for executing from floppy
-
 
1975
;
-
 
1976
;  esi  points to floppy filename (e.g. 'dir1/name')
-
 
1977
;  ebp  points to full filename (e.g. '/fd/1/dir1/name')
-
 
1978
;  dword [ebx] = flags
-
 
1979
;  dword [ebx+4] = cmdline
-
 
1980
;
-
 
1981
;  ret ebx,edx destroyed
-
 
1982
;      eax > 0 - PID, < 0 - error
-
 
1983
;
-
 
1984
;--------------------------------------------------------------
-
 
1985
fs_FloppyExecute:
-
 
1986
        mov     edx, [ebx]
-
 
1987
        mov     ebx, [ebx+4]
-
 
1988
        test    ebx, ebx
-
 
1989
        jz      @f
-
 
1990
        add     ebx, std_application_base_address
-
 
1991
@@:
-
 
1992
 
-
 
1993
;----------------------------------------------------------------
-
 
1994
;
-
 
1995
; fs_FloppyExecute.flags - second entry
-
 
1996
;
-
 
1997
;  esi  points to floppy filename (kernel address)
-
 
1998
;  ebp  points to full filename
-
 
1999
;  edx  flags
-
 
2000
;  ebx  cmdline (kernel address)
-
 
2001
;
-
 
2002
;  ret  eax > 0 - PID, < 0 - error
-
 
2003
;
-
 
2004
;--------------------------------------------------------------
-
 
2005
 
-
 
2006
.flags:
-
 
2007
        call    read_flp_fat
-
 
2008
        cmp     byte [esi], 0
-
 
2009
        jnz     @f
-
 
2010
; cannot execute root!
-
 
2011
        mov     eax, -ERROR_ACCESS_DENIED
-
 
2012
        ret
-
 
2013
@@:
-
 
2014
        push    edi
-
 
2015
        call    fd_find_lfn
-
 
2016
        jnc     .found
-
 
2017
        pop     edi
-
 
2018
        mov     eax, -ERROR_FILE_NOT_FOUND
-
 
2019
        ret
-
 
2020
.found:
-
 
2021
        movzx   eax, word [edi+26]      ; cluster
-
 
2022
        push    eax
-
 
2023
        push    dword [edi+28]          ; size
-
 
2024
        push    .DoRead
-
 
2025
        call    fs_execute
-
 
2026
        add     esp, 12
-
 
2027
        pop     edi
-
 
2028
        ret
-
 
2029
 
-
 
2030
.DoRead:
-
 
2031
; read next block
-
 
2032
; in: eax->parameters, edi->buffer
-
 
2033
; out: eax = error code
-
 
2034
        pushad
-
 
2035
        cmp     dword [eax], 0  ; file size
-
 
2036
        jz      .eof
-
 
2037
        mov     eax, [eax+4]    ; cluster
-
 
2038
        add     eax, 31
-
 
2039
        call    read_chs_sector
-
 
2040
        cmp     [FDC_Status], 0
-
 
2041
        jnz     .err
-
 
2042
        pop     edi
-
 
2043
        mov     esi, 0xD000
-
 
2044
        push    edi
-
 
2045
        mov     ecx, 512/4
-
 
2046
        rep     movsd
-
 
2047
        mov     eax, [esp+28]
-
 
2048
        mov     ecx, [eax]
-
 
2049
        sub     ecx, 512
-
 
2050
        jae     @f
-
 
2051
        add     edi, ecx
-
 
2052
        neg     ecx
-
 
2053
        push    eax
-
 
2054
        xor     eax, eax
-
 
2055
        rep     stosb
-
 
2056
        pop     eax
-
 
2057
@@:
-
 
2058
        mov     [eax], ecx
-
 
2059
        mov     edx, [eax+4]
-
 
2060
        mov     dx, [edx*2+0x282000]
-
 
2061
        mov     [eax+4], dx     ; high word is already zero
-
 
2062
        popad
-
 
2063
        xor     eax, eax
-
 
2064
        ret
-
 
2065
.eof:
-
 
2066
        popad
-
 
2067
        mov     eax, 6
-
 
2068
        ret
-
 
2069
.err:
-
 
2070
        popad
-
 
2071
        mov     eax, 11
-
 
2072
        ret
1962
 
2073