Subversion Repositories Kolibri OS

Rev

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

Rev 6462 Rev 6468
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: 6462 $
8
$Revision: 6468 $
9
 
9
 
10
; NTFS external functions
10
; NTFS external functions
11
;   in:
11
;   in:
12
; ebx -> parameter structure of sysfunc 70
12
; ebx -> parameter structure of sysfunc 70
13
; ebp -> NTFS structure
13
; ebp -> NTFS structure
14
; [esi]+[[esp+4]] = name
14
; esi -> path string
15
;   out:
15
;   out:
16
; eax, ebx = return values for sysfunc 70
16
; eax, ebx = return values for sysfunc 70
17
iglobal
17
iglobal
Line 1172... Line 1172...
1172
.unk:
1172
.unk:
1173
        pop     eax
1173
        pop     eax
1174
        ret
1174
        ret
Line 1175... Line 1175...
1175
 
1175
 
1176
ntfs_find_lfn:
1176
ntfs_find_lfn:
1177
; in: [esi]+[esp+4] = name
1177
; in: esi -> path string
1178
;   out:
1178
;   out:
1179
; [ebp+NTFS.cur_iRecord] = target fileRecord
1179
; [ebp+NTFS.cur_iRecord] = target fileRecord
1180
; eax -> target index in the node
1180
; eax -> target index in the node
1181
; [ebp+NTFS.LastRead] = target node location
1181
; [ebp+NTFS.LastRead] = target node location
Line 1278... Line 1278...
1278
        popad
1278
        popad
1279
        stc
1279
        stc
1280
.ret2:
1280
.ret2:
1281
        pop     esi
1281
        pop     esi
1282
.ret:
1282
.ret:
1283
        ret     4
1283
        ret
Line 1284... Line 1284...
1284
 
1284
 
1285
.slash:
1285
.slash:
1286
        pop     eax
1286
        pop     eax
1287
        pop     edi
1287
        pop     edi
Line 1335... Line 1335...
1335
        mov     eax, [esi]
1335
        mov     eax, [esi]
1336
        mov     [ebp+NTFS.cur_iRecord], eax
1336
        mov     [ebp+NTFS.cur_iRecord], eax
1337
        mov     [esp+1Ch], esi
1337
        mov     [esp+1Ch], esi
1338
        mov     [esp+4], edi
1338
        mov     [esp+4], edi
1339
        popad
1339
        popad
1340
        inc     esi
-
 
1341
        cmp     byte [esi-1], 0
1340
        cmp     byte [esi], 0
1342
        jnz     @f
-
 
1343
        cmp     dword [esp+8], 0
-
 
1344
        jz      .ret2
1341
        jz      .ret2
1345
        mov     esi, [esp+8]
1342
        inc     esi
1346
        mov     dword [esp+8], 0
-
 
1347
@@:
-
 
1348
        pop     eax
1343
        pop     eax
1349
        jmp     .doit2
1344
        jmp     .doit2
Line 1350... Line 1345...
1350
 
1345
 
1351
;----------------------------------------------------------------
1346
;----------------------------------------------------------------
Line 1356... Line 1351...
1356
        movi    eax, ERROR_ACCESS_DENIED
1351
        movi    eax, ERROR_ACCESS_DENIED
1357
        ret
1352
        ret
Line 1358... Line 1353...
1358
 
1353
 
1359
@@:
1354
@@:
1360
        call    ntfs_lock
1355
        call    ntfs_lock
1361
        stdcall ntfs_find_lfn, [esp+4]
1356
        call    ntfs_find_lfn
1362
        jnc     .found
1357
        jnc     .found
1363
        call    ntfs_unlock
1358
        call    ntfs_unlock
1364
        or      ebx, -1
1359
        or      ebx, -1
1365
        movi    eax, ERROR_FILE_NOT_FOUND
1360
        movi    eax, ERROR_FILE_NOT_FOUND
Line 1491... Line 1486...
1491
ntfs_ReadFolder:
1486
ntfs_ReadFolder:
1492
        call    ntfs_lock
1487
        call    ntfs_lock
1493
        mov     [ebp+NTFS.cur_iRecord], 5   ; root directory
1488
        mov     [ebp+NTFS.cur_iRecord], 5   ; root directory
1494
        cmp     byte [esi], 0
1489
        cmp     byte [esi], 0
1495
        jz      @f
1490
        jz      @f
1496
        stdcall ntfs_find_lfn, [esp+4]
1491
        call    ntfs_find_lfn
1497
        jc      ntfsNotFound
1492
        jc      ntfsNotFound
1498
@@:
1493
@@:
1499
        mov     [ebp+NTFS.cur_attr], 0x10   ; $STANDARD_INFORMATION
1494
        mov     [ebp+NTFS.cur_attr], 0x10   ; $STANDARD_INFORMATION
1500
        and     [ebp+NTFS.cur_offs], 0
1495
        and     [ebp+NTFS.cur_offs], 0
1501
        mov     [ebp+NTFS.cur_size], 1
1496
        mov     [ebp+NTFS.cur_size], 1
Line 1818... Line 1813...
1818
ntfs_GetFileInfo:
1813
ntfs_GetFileInfo:
1819
        call    ntfs_lock
1814
        call    ntfs_lock
1820
        mov     edi, [ebx+16]
1815
        mov     edi, [ebx+16]
1821
        cmp     byte [esi], 0
1816
        cmp     byte [esi], 0
1822
        jz      .volume
1817
        jz      .volume
1823
        stdcall ntfs_find_lfn, [esp+4]
1818
        call    ntfs_find_lfn
1824
        jnc     .found
1819
        jnc     .found
1825
        test    eax, eax
1820
        test    eax, eax
1826
        jz      ntfsFail
1821
        jz      ntfsFail
1827
        jmp     ntfsNotFound
1822
        jmp     ntfsNotFound
Line 1883... Line 1878...
1883
        movi    eax, ERROR_ACCESS_DENIED
1878
        movi    eax, ERROR_ACCESS_DENIED
1884
        ret
1879
        ret
Line 1885... Line 1880...
1885
 
1880
 
1886
@@: ; 1. Search file
1881
@@: ; 1. Search file
1887
        call    ntfs_lock
1882
        call    ntfs_lock
1888
        stdcall ntfs_find_lfn, [esp+4]
1883
        call    ntfs_find_lfn
1889
        jc      .notFound
1884
        jc      .notFound
1890
; found, rewrite
1885
; found, rewrite
1891
        cmp     [ebp+NTFS.cur_iRecord], 16
1886
        cmp     [ebp+NTFS.cur_iRecord], 16
1892
        jc      ntfsDenied
1887
        jc      ntfsDenied
Line 2170... Line 2165...
2170
        call    writeRecord
2165
        call    writeRecord
2171
        mov     ebx, [ebp+NTFS.frs_buffer]
2166
        mov     ebx, [ebp+NTFS.frs_buffer]
2172
        mov     edx, [ebp+NTFS.rootLastRead]
2167
        mov     edx, [ebp+NTFS.rootLastRead]
2173
        call    writeRecord
2168
        call    writeRecord
2174
        mov     esi, [esp+4]
2169
        mov     esi, [esp+4]
2175
        stdcall ntfs_find_lfn.doit2, 0
2170
        call    ntfs_find_lfn.doit2
2176
        test    eax, eax
2171
        test    eax, eax
2177
        jz      .errorPop3
2172
        jz      .errorPop3
2178
        mov     edi, [ebp+NTFS.cur_index_buf]
2173
        mov     edi, [ebp+NTFS.cur_index_buf]
2179
        mov     edx, [esp]
2174
        mov     edx, [esp]
2180
.indexRecord:
2175
.indexRecord:
Line 3508... Line 3503...
3508
        xor     ebx, ebx
3503
        xor     ebx, ebx
3509
        movi    eax, ERROR_ACCESS_DENIED
3504
        movi    eax, ERROR_ACCESS_DENIED
3510
        ret
3505
        ret
3511
@@:
3506
@@:
3512
        call    ntfs_lock
3507
        call    ntfs_lock
3513
        stdcall ntfs_find_lfn, [esp+4]
3508
        call    ntfs_find_lfn
3514
        jc      ntfsNotFound
3509
        jc      ntfsNotFound
3515
        cmp     [ebp+NTFS.cur_iRecord], 16
3510
        cmp     [ebp+NTFS.cur_iRecord], 16
3516
        jc      ntfsDenied
3511
        jc      ntfsDenied
3517
        test    dword [eax+fileFlags], 10000001h
3512
        test    dword [eax+fileFlags], 10000001h
3518
        jnz     ntfsDenied
3513
        jnz     ntfsDenied
Line 3688... Line 3683...
3688
        movi    eax, ERROR_ACCESS_DENIED
3683
        movi    eax, ERROR_ACCESS_DENIED
3689
        ret
3684
        ret
Line 3690... Line 3685...
3690
 
3685
 
3691
@@:
3686
@@:
3692
        call    ntfs_lock
3687
        call    ntfs_lock
3693
        stdcall ntfs_find_lfn, [esp+4]
3688
        call    ntfs_find_lfn
3694
        jc      ntfsNotFound
3689
        jc      ntfsNotFound
3695
        cmp     [ebp+NTFS.cur_iRecord], 16
3690
        cmp     [ebp+NTFS.cur_iRecord], 16
3696
        jc      ntfsDenied
3691
        jc      ntfsDenied
3697
        test    byte [eax+fileFlags], 1
3692
        test    byte [eax+fileFlags], 1
Line 3781... Line 3776...
3781
        call    fs_write64_sys
3776
        call    fs_write64_sys
3782
.backToIndex:
3777
.backToIndex:
3783
        mov     eax, [ebp+NTFS.newRecord]
3778
        mov     eax, [ebp+NTFS.newRecord]
3784
        mov     [ebp+NTFS.cur_iRecord], eax
3779
        mov     [ebp+NTFS.cur_iRecord], eax
3785
        mov     esi, [ebp+NTFS.indexPointer]
3780
        mov     esi, [ebp+NTFS.indexPointer]
3786
        stdcall ntfs_find_lfn.doit2, 0
3781
        call    ntfs_find_lfn.doit2
3787
        jc      ntfsFail
3782
        jc      ntfsFail
3788
        mov     ebx, [ebp+NTFS.secondIndexBuffer]
3783
        mov     ebx, [ebp+NTFS.secondIndexBuffer]
3789
        mov     byte [ebx], 0
3784
        mov     byte [ebx], 0
3790
        mov     ebx, [ebp+NTFS.LastRead]
3785
        mov     ebx, [ebp+NTFS.LastRead]
3791
        mov     [ebp+NTFS.nodeLastRead], ebx
3786
        mov     [ebp+NTFS.nodeLastRead], ebx
Line 4006... Line 4001...
4006
        xor     ebx, ebx
4001
        xor     ebx, ebx
4007
        movi    eax, ERROR_ACCESS_DENIED
4002
        movi    eax, ERROR_ACCESS_DENIED
4008
        ret
4003
        ret
4009
@@:
4004
@@:
4010
        call    ntfs_lock
4005
        call    ntfs_lock
4011
        stdcall ntfs_find_lfn, [esp+4]
4006
        call    ntfs_find_lfn
4012
        jc      ntfsNotFound
4007
        jc      ntfsNotFound
4013
        cmp     [ebp+NTFS.cur_iRecord], 16
4008
        cmp     [ebp+NTFS.cur_iRecord], 16
4014
        jc      ntfsDenied
4009
        jc      ntfsDenied
4015
        test    dword [eax+fileFlags], 10000001h
4010
        test    dword [eax+fileFlags], 10000001h
4016
        jnz     ntfsDenied
4011
        jnz     ntfsDenied
Line 4140... Line 4135...
4140
        jnz     @f
4135
        jnz     @f
4141
        movi    eax, ERROR_UNSUPPORTED_FS
4136
        movi    eax, ERROR_UNSUPPORTED_FS
4142
        ret
4137
        ret
4143
@@:
4138
@@:
4144
        call    ntfs_lock
4139
        call    ntfs_lock
4145
        stdcall ntfs_find_lfn, [esp+4]
4140
        call    ntfs_find_lfn
4146
        jnc     @f
4141
        jnc     @f
4147
        test    eax, eax
4142
        test    eax, eax
4148
        jz      ntfsFail
4143
        jz      ntfsFail
4149
        jmp     ntfsNotFound
4144
        jmp     ntfsNotFound