Subversion Repositories Kolibri OS

Rev

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

Rev 5984 Rev 6078
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. 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: 5984 $
8
$Revision: 6078 $
Line 9... Line 9...
9
 
9
 
10
; NTFS driver
10
; NTFS driver
Line 35... Line 35...
35
hardLinkCounter = 12h
35
hardLinkCounter = 12h
36
attributeOffset = 14h
36
attributeOffset = 14h
37
recordFlags = 16h
37
recordFlags = 16h
38
recordRealSize = 18h
38
recordRealSize = 18h
39
recordAllocatedSize = 1ch
39
recordAllocatedSize = 1ch
-
 
40
baseRecordReference = 20h       ; for auxiliary records
-
 
41
baseRecordReuse = 26h
40
newAttributeID = 28h
42
newAttributeID = 28h
41
    ; attribute header
43
    ; attribute header
42
attributeType = 0
44
attributeType = 0
43
sizeWithHeader = 4
45
sizeWithHeader = 4
44
nonResidentFlag = 8
46
nonResidentFlag = 8
45
nameLength = 9
47
nameLength = 9
46
nameOffset = 10
48
nameOffset = 10
-
 
49
attributeFlags = 12
47
attributeID = 14
50
attributeID = 14
48
sizeWithoutHeader = 16
51
sizeWithoutHeader = 16
49
attributeFlags = 16h
52
indexedFlag = 16h
50
    ; non resident attribute header
53
    ; non resident attribute header
51
lastVCN = 18h
54
lastVCN = 18h
52
dataRunsOffset = 20h
55
dataRunsOffset = 20h
53
attributeAllocatedSize = 28h
56
attributeAllocatedSize = 28h
54
attributeRealSize = 30h
57
attributeRealSize = 30h
Line 109... Line 112...
109
fileDataSize            dd  ?   ; in clusters
112
fileDataSize            dd  ?   ; in clusters
110
fileRealSize            dd  ?   ; in bytes
113
fileRealSize            dd  ?   ; in bytes
111
indexOffset             dd  ?
114
indexOffset             dd  ?
112
nodeLastRead            dd  ?
115
nodeLastRead            dd  ?
113
ntfs_bCanContinue       db  ?
116
ntfs_bCanContinue       db  ?
114
ntfsNotFound            db  ?
-
 
115
ntfsFolder              db  ?
117
ntfsFolder              db  ?
-
 
118
ntfsWriteAttr           db  ?   ; Warning: Don't forget to turn off!!!
116
ntfsFragmentCount       db  ?
119
ntfsFragmentCount       db  ?
Line 117... Line 120...
117
 
120
 
118
cur_subnode_size        dd  ?
121
cur_subnode_size        dd  ?
119
ntfs_attr_iRecord       dd  ?
122
ntfs_attr_iRecord       dd  ?
Line 141... Line 144...
141
        dd      ntfs_free
144
        dd      ntfs_free
142
        dd      (ntfs_user_functions_end - ntfs_user_functions - 4) / 4
145
        dd      (ntfs_user_functions_end - ntfs_user_functions - 4) / 4
143
        dd      ntfs_ReadFile
146
        dd      ntfs_ReadFile
144
        dd      ntfs_ReadFolder
147
        dd      ntfs_ReadFolder
145
        dd      ntfs_CreateFile
148
        dd      ntfs_CreateFile
146
        dd      ntfs_Write
149
        dd      ntfs_WriteFile
147
        dd      ntfs_SetFileEnd
150
        dd      ntfs_SetFileEnd
148
        dd      ntfs_GetFileInfo
151
        dd      ntfs_GetFileInfo
149
        dd      ntfs_SetFileInfo
152
        dd      ntfs_SetFileInfo
150
        dd      0
153
        dd      0
151
        dd      ntfs_Delete
154
        dd      ntfs_Delete
Line 268... Line 271...
268
        jz      .exit
271
        jz      .exit
269
        mov     ecx, dword [ebp+PARTITION.FirstSector]
272
        mov     ecx, dword [ebp+PARTITION.FirstSector]
270
        mov     dword [eax+NTFS.FirstSector], ecx
273
        mov     dword [eax+NTFS.FirstSector], ecx
271
        mov     ecx, dword [ebp+PARTITION.FirstSector+4]
274
        mov     ecx, dword [ebp+PARTITION.FirstSector+4]
272
        mov     dword [eax+NTFS.FirstSector+4], ecx
275
        mov     dword [eax+NTFS.FirstSector+4], ecx
273
        mov     ecx, dword [ebp+PARTITION.Length]
-
 
274
        mov     dword [eax+NTFS.Length], ecx
-
 
275
        mov     ecx, dword [ebp+PARTITION.Length+4]
-
 
276
        mov     dword [eax+NTFS.Length+4], ecx
-
 
277
        mov     ecx, [ebp+PARTITION.Disk]
276
        mov     ecx, [ebp+PARTITION.Disk]
278
        mov     [eax+NTFS.Disk], ecx
277
        mov     [eax+NTFS.Disk], ecx
279
        mov     [eax+NTFS.FSUserFunctions], ntfs_user_functions
278
        mov     [eax+NTFS.FSUserFunctions], ntfs_user_functions
-
 
279
        mov     [eax+NTFS.ntfsWriteAttr], 0
Line 280... Line 280...
280
 
280
 
281
        push    ebx ebp esi
281
        push    ebx ebp esi
282
        mov     ebp, eax
282
        mov     ebp, eax
283
        lea     ecx, [ebp+NTFS.Lock]
283
        lea     ecx, [ebp+NTFS.Lock]
Line 542... Line 542...
542
        pop     ebx
542
        pop     ebx
543
        pop     ecx
543
        pop     ecx
544
        ret
544
        ret
Line 545... Line 545...
545
 
545
 
-
 
546
ntfs_read_attr:
546
ntfs_read_attr:
547
; [ebp+NTFS.ntfsWriteAttr]=1 -> write attribute
547
;   in:
548
;   in:
548
; [ebp+NTFS.ntfs_cur_iRecord] = number of fileRecord
549
; [ebp+NTFS.ntfs_cur_iRecord] = number of fileRecord
549
; [ebp+NTFS.ntfs_cur_attr] = attribute type
550
; [ebp+NTFS.ntfs_cur_attr] = attribute type
550
; [ebp+NTFS.ntfs_cur_offs] = attribute VCN in sectors
551
; [ebp+NTFS.ntfs_cur_offs] = attribute VCN in sectors
Line 990... Line 991...
990
        xor     edx, edx
991
        xor     edx, edx
991
        div     [ebp+NTFS.sectors_per_cluster]
992
        div     [ebp+NTFS.sectors_per_cluster]
992
        sub     eax, [ecx+10h]  ; first_vbo
993
        sub     eax, [ecx+10h]  ; first_vbo
993
        jb      .okret
994
        jb      .okret
994
; eax = cluster, edx = starting sector
995
; eax = cluster, edx = starting sector
-
 
996
        cmp     [ebp+NTFS.ntfs_cur_attr], 0x80
-
 
997
        jnz     .sys
-
 
998
        cmp     [ebp+NTFS.ntfs_cur_iRecord], 0
-
 
999
        jz      .sys
-
 
1000
        push    fs_read64_app
-
 
1001
        cmp     [ebp+NTFS.ntfsWriteAttr], 1
-
 
1002
        jnz     @f
-
 
1003
        mov     dword[esp], fs_write64_app
-
 
1004
        jmp     @f
-
 
1005
.sys:
-
 
1006
        push    fs_read64_sys
-
 
1007
@@:
995
        sub     esp, 10h
1008
        sub     esp, 10h
996
        movzx   esi, word [ecx+20h]     ; mcb_info_ofs
1009
        movzx   esi, word [ecx+20h]     ; mcb_info_ofs
997
        add     esi, ecx
1010
        add     esi, ecx
998
        xor     edi, edi
1011
        xor     edi, edi
999
        mov     [ebp+NTFS.ntfsFragmentCount], 0
1012
        mov     [ebp+NTFS.ntfsFragmentCount], 0
Line 1019... Line 1032...
1019
@@:
1032
@@:
1020
        mov     ebx, [ebp+NTFS.ntfs_cur_buf]
1033
        mov     ebx, [ebp+NTFS.ntfs_cur_buf]
1021
        mov     [ebp+NTFS.ntfsLastRead], eax
1034
        mov     [ebp+NTFS.ntfsLastRead], eax
1022
        push    ecx
1035
        push    ecx
1023
        xor     edx, edx
1036
        xor     edx, edx
1024
        cmp     [ebp+NTFS.ntfs_cur_attr], 0x80
-
 
1025
        jnz     .sys
-
 
1026
        cmp     [ebp+NTFS.ntfs_cur_iRecord], 0
-
 
1027
        jz      .sys
-
 
1028
        call    fs_read64_app
1037
        call    dword[esp+18h]
1029
        jmp     .appsys
-
 
1030
.sys:
-
 
1031
        call    fs_read64_sys
-
 
1032
.appsys:
-
 
1033
        pop     ecx
1038
        pop     ecx
1034
        test    eax, eax
1039
        test    eax, eax
1035
        jnz     .errread2
1040
        jnz     .errread2
1036
        sub     [ebp+NTFS.ntfs_cur_size], ecx
1041
        sub     [ebp+NTFS.ntfs_cur_size], ecx
1037
        add     [ebp+NTFS.ntfs_cur_offs], ecx
1042
        add     [ebp+NTFS.ntfs_cur_offs], ecx
Line 1042... Line 1047...
1042
        pop     ecx
1047
        pop     ecx
1043
        xor     eax, eax
1048
        xor     eax, eax
1044
        xor     edx, edx
1049
        xor     edx, edx
1045
        cmp     [ebp+NTFS.ntfs_cur_size], 0
1050
        cmp     [ebp+NTFS.ntfs_cur_size], 0
1046
        jnz     .readloop
1051
        jnz     .readloop
1047
        add     esp, 10h
1052
        add     esp, 14h
1048
        mov     eax, [ebp+NTFS.ntfs_cur_tail]
1053
        mov     eax, [ebp+NTFS.ntfs_cur_tail]
1049
        test    eax, eax
1054
        test    eax, eax
1050
        jz      @f
1055
        jz      @f
1051
        sub     eax, 0x200
1056
        sub     eax, 0x200
1052
        add     [ebp+NTFS.ntfs_cur_read], eax
1057
        add     [ebp+NTFS.ntfs_cur_read], eax
1053
@@:
1058
@@:
1054
        clc
1059
        clc
1055
        ret
1060
        ret
1056
.errread2:
1061
.errread2:
1057
        pop     ecx
1062
        pop     ecx
1058
        add     esp, 10h
1063
        add     esp, 14h
1059
        stc
1064
        stc
1060
        ret
1065
        ret
1061
.break:
1066
.break:
1062
        add     esp, 10h        ; CF=0
1067
        add     esp, 14h        ; CF=0
1063
        mov     [ebp+NTFS.ntfs_bCanContinue], 1
1068
        mov     [ebp+NTFS.ntfs_bCanContinue], 1
1064
        ret
1069
        ret
Line 1065... Line 1070...
1065
 
1070
 
1066
ntfs_read_file_record:
1071
ntfs_read_file_record:
Line 1155... Line 1160...
1155
        popad
1160
        popad
1156
        stc
1161
        stc
1157
        ret
1162
        ret
Line 1158... Line 1163...
1158
 
1163
 
-
 
1164
ntfs_decode_mcb_entry:
-
 
1165
;   in:
-
 
1166
; esi -> mcb entry
-
 
1167
; esp -> buffer (16 bytes)
-
 
1168
;   out:
-
 
1169
; esi -> next mcb entry
-
 
1170
; esp -> data run size
-
 
1171
; esp+8 -> cluster (delta)
1159
ntfs_decode_mcb_entry:
1172
; CF=0 -> mcb end
1160
        push    eax ecx edi
1173
        push    eax ecx edi
1161
        lea     edi, [esp+16]
1174
        lea     edi, [esp+16]
1162
        xor     eax, eax
1175
        xor     eax, eax
1163
        lodsb
1176
        lodsb
Line 1209... Line 1222...
1209
 
1222
 
1210
ntfs_find_lfn:
1223
ntfs_find_lfn:
1211
; in: [esi]+[esp+4] = name
1224
; in: [esi]+[esp+4] = name
1212
;   out:
1225
;   out:
1213
; [ebp+NTFS.ntfs_cur_iRecord] = number of MFT fileRecord
1226
; [ebp+NTFS.ntfs_cur_iRecord] = number of MFT fileRecord
1214
; eax = pointer in parent index node
1227
; eax -> index in the parent index node
1215
; CF=1 -> file not found (or just error)
1228
; CF=1 -> file not found, eax=0 -> error
1216
        mov     [ebp+NTFS.ntfs_cur_iRecord], 5   ; start parse from root cluster
1229
        mov     [ebp+NTFS.ntfs_cur_iRecord], 5   ; start parse from root cluster
1217
.doit2:
1230
.doit2:
1218
        mov     [ebp+NTFS.ntfs_cur_attr], 0x90   ; $INDEX_ROOT
1231
        mov     [ebp+NTFS.ntfs_cur_attr], 0x90   ; $INDEX_ROOT
1219
        and     [ebp+NTFS.ntfs_cur_offs], 0
1232
        and     [ebp+NTFS.ntfs_cur_offs], 0
1220
        mov     eax, [ebp+NTFS.cur_index_size]
1233
        mov     eax, [ebp+NTFS.cur_index_size]
1221
        mov     [ebp+NTFS.ntfs_cur_size], eax
1234
        mov     [ebp+NTFS.ntfs_cur_size], eax
1222
        mov     eax, [ebp+NTFS.cur_index_buf]
1235
        mov     eax, [ebp+NTFS.cur_index_buf]
1223
        mov     [ebp+NTFS.ntfs_cur_buf], eax
1236
        mov     [ebp+NTFS.ntfs_cur_buf], eax
-
 
1237
        call    ntfs_read_attr
1224
        call    ntfs_read_attr
1238
        mov     eax, 0
1225
        jnc     @f
1239
        jnc     @f
1226
.ret:
1240
.ret:
1227
        ret     4
1241
        ret     4
1228
@@:
-
 
1229
        xor     eax, eax
1242
@@:
1230
        cmp     [ebp+NTFS.ntfs_cur_read], 0x20
1243
        cmp     [ebp+NTFS.ntfs_cur_read], 0x20
1231
        jc      .ret
1244
        jc      .ret
1232
        pushad
1245
        pushad
1233
        mov     esi, [ebp+NTFS.cur_index_buf]
1246
        mov     esi, [ebp+NTFS.cur_index_buf]
Line 1343... Line 1356...
1343
        call    ntfs_restore_usa
1356
        call    ntfs_restore_usa
1344
        jc      .err
1357
        jc      .err
1345
        add     esi, 0x18
1358
        add     esi, 0x18
1346
        jmp     .scanloop
1359
        jmp     .scanloop
1347
.notfound:
1360
.notfound:
1348
        mov     [ebp+NTFS.ntfsNotFound], 1
-
 
1349
        mov     [esp+1Ch], esi
1361
        mov     [esp+1Ch], esi
1350
.err:
1362
.err:
1351
        popad
1363
        popad
1352
        stc
1364
        stc
1353
        ret     4
1365
        ret     4
Line 1468... Line 1480...
1468
        mov     edx, [ebx+8]
1480
        mov     edx, [ebx+8]
1469
        add     eax, 511
1481
        add     eax, 511
1470
        adc     edx, 0
1482
        adc     edx, 0
1471
        shrd    eax, edx, 9
1483
        shrd    eax, edx, 9
1472
        pop     edx
1484
        pop     edx
1473
.zero1:
-
 
1474
        mov     [ebp+NTFS.ntfs_cur_offs], eax
1485
        mov     [ebp+NTFS.ntfs_cur_offs], eax
1475
        mov     [ebp+NTFS.ntfs_cur_buf], edx
1486
        mov     [ebp+NTFS.ntfs_cur_buf], edx
1476
        mov     eax, ecx
1487
        mov     eax, ecx
1477
        shr     eax, 9
1488
        shr     eax, 9
1478
        mov     [ebp+NTFS.ntfs_cur_size], eax
1489
        mov     [ebp+NTFS.ntfs_cur_size], eax
Line 1548... Line 1559...
1548
        call    ntfs_read_attr
1559
        call    ntfs_read_attr
1549
        jnc     .ok
1560
        jnc     .ok
1550
        test    eax, eax
1561
        test    eax, eax
1551
        jz      .notfound
1562
        jz      .notfound
1552
        or      ebx, -1
1563
        or      ebx, -1
1553
        push    11
1564
        push    ERROR_DEVICE
1554
        jmp     .pop_ret
1565
        jmp     .pop_ret
1555
.ok:
1566
.ok:
1556
        cmp     [ebp+NTFS.ntfs_cur_read], 0x20
1567
        cmp     [ebp+NTFS.ntfs_cur_read], 0x20
1557
        jae     @f
1568
        jae     @f
1558
        or      ebx, -1
1569
        or      ebx, -1
Line 1585... Line 1596...
1585
        and     [ebp+NTFS.cur_index_buf], 0
1596
        and     [ebp+NTFS.cur_index_buf], 0
1586
.nomem:
1597
.nomem:
1587
        call    ntfs_unlock
1598
        call    ntfs_unlock
1588
        popad
1599
        popad
1589
        or      ebx, -1
1600
        or      ebx, -1
1590
        movi    eax, 12
1601
        movi    eax, ERROR_OUT_OF_MEMORY
1591
        ret
1602
        ret
1592
@@:
1603
@@:
1593
        mov     [ebp+NTFS.cur_index_buf], eax
1604
        mov     [ebp+NTFS.cur_index_buf], eax
1594
        popad
1605
        popad
1595
        jmp     .doit2
1606
        jmp     .doit2
Line 1974... Line 1985...
1974
 
1985
 
1975
;----------------------------------------------------------------
1986
;----------------------------------------------------------------
1976
ntfs_CreateFolder:
1987
ntfs_CreateFolder:
1977
        mov     [ebp+NTFS.ntfsFolder], 1
1988
        mov     [ebp+NTFS.ntfsFolder], 1
-
 
1989
        jmp     @f
1978
        jmp     @f
1990
 
1979
ntfs_CreateFile:
1991
ntfs_CreateFile:
1980
        mov     [ebp+NTFS.ntfsFolder], 0
1992
        mov     [ebp+NTFS.ntfsFolder], 0
1981
@@:
1993
@@:
1982
        cmp     byte [esi], 0
1994
        cmp     byte [esi], 0
1983
        jnz     @f
1995
        jnz     @f
1984
        xor     ebx, ebx
1996
        xor     ebx, ebx
1985
        movi    eax, ERROR_ACCESS_DENIED    ; root directory itself
1997
        movi    eax, ERROR_ACCESS_DENIED
1986
        ret
1998
        ret
1987
@@: ; 1. Search file
1999
@@: ; 1. Search file
1988
        call    ntfs_lock
-
 
1989
        mov     [ebp+NTFS.ntfsNotFound], 0
2000
        call    ntfs_lock
1990
        stdcall ntfs_find_lfn, [esp+4]
2001
        stdcall ntfs_find_lfn, [esp+4]
1991
        jnc     @f      ; found; rewrite
2002
        jnc     .found
1992
        cmp     [ebp+NTFS.ntfsFragmentCount], 1
2003
        cmp     [ebp+NTFS.ntfsFragmentCount], 1
-
 
2004
        jnz     ntfsUnsupported     ; record fragmented
-
 
2005
        test    eax, eax
-
 
2006
        jz      ntfsFail
-
 
2007
        jmp     .notFound
-
 
2008
 
-
 
2009
.found:     ; rewrite
-
 
2010
        cmp     [ebp+NTFS.ntfs_cur_iRecord], 16
1993
        jnz     @f      ; record fragmented
2011
        jc      ntfsDenied
1994
        cmp     [ebp+NTFS.ntfsNotFound], 1
2012
        cmp     [ebp+NTFS.ntfsFolder], 1
-
 
2013
        jz      ntfsDenied
-
 
2014
        mov     [ebp+NTFS.ntfs_cur_attr], 0x80
-
 
2015
        mov     [ebp+NTFS.ntfs_cur_offs], 0
1995
        jz      .notFound
2016
        mov     [ebp+NTFS.ntfs_cur_size], 0
1996
        push    ERROR_FS_FAIL
2017
        call    ntfs_read_attr
-
 
2018
        jc      ntfsDenied
-
 
2019
        mov     eax, [ebp+NTFS.frs_buffer]
-
 
2020
        cmp     word [eax+baseRecordReuse], 0
-
 
2021
        jnz     ntfsUnsupported     ; auxiliary record
-
 
2022
        cmp     byte [eax+hardLinkCounter], 1
-
 
2023
        jnz     ntfsUnsupported     ; file copying required
-
 
2024
        mov     ecx, [ebp+NTFS.ntfs_attr_offs]
-
 
2025
        cmp     byte [ecx+nonResidentFlag], 1
-
 
2026
        jnz     ntfsUnsupported     ; resident $DATA
-
 
2027
        mov     eax, [ebx+4]
-
 
2028
        mov     edx, [ebx+8]
1997
        jmp     ntfsError
2029
        add     eax, [ebx+12]
-
 
2030
        adc     edx, 0
1998
@@:
2031
        cmp     edx, [ecx+attributeRealSize+4]
-
 
2032
        jnz     ntfsUnsupported
1999
        push    ERROR_UNSUPPORTED_FS
2033
        cmp     [ecx+attributeRealSize], eax
-
 
2034
        jnz     ntfsUnsupported
-
 
2035
        jmp     ntfs_WriteFile.write
2000
        jmp     ntfsError
2036
 
2001
.notFound:  ; create; check name
2037
.notFound:  ; create; check path folders
2002
        cmp     dword [esp+4], 0
2038
        cmp     dword [esp+4], 0
2003
        jnz     .bad
2039
        jnz     ntfsNotFound
2004
        cmp     byte [esi], 0
-
 
2005
        jnz     @f
-
 
2006
.bad:       ; path folder not found
-
 
2007
        push    ERROR_FILE_NOT_FOUND
2040
        cmp     byte [esi], 0
2008
        jmp     ntfsError
2041
        jz      ntfsNotFound
2009
@@: ; 2. Prepair directory record
2042
; 2. Prepare directory record
2010
        mov     ecx, esi
2043
        mov     ecx, esi
2011
@@:         ; count characters
2044
@@:         ; count characters
2012
        inc     ecx
2045
        inc     ecx
2013
        cmp     byte [ecx], '/'
2046
        cmp     byte [ecx], '/'
2014
        jz      .bad
2047
        jz      ntfsNotFound
2015
        cmp     byte [ecx], 0
2048
        cmp     byte [ecx], 0
2016
        jnz     @b
2049
        jnz     @b
2017
        sub     ecx, esi
2050
        sub     ecx, esi
2018
        push    ecx
2051
        push    ecx
2019
        lea     ecx, [ecx*2+52h]    ; precalculate index length
2052
        lea     ecx, [ecx*2+52h]    ; precalculate index length
2020
        add     ecx, 7              ; align 8
2053
        add     ecx, 7              ; align 8
2021
        and     ecx, not 7
2054
        and     ecx, not 7
2022
        mov     edi, [ebp+NTFS.cur_index_buf]
2055
        mov     edi, [ebp+NTFS.cur_index_buf]
2023
        push    esi
2056
        push    esi
2024
        push    ecx
2057
        push    ecx
2025
        cmp     dword [edi], 'INDX'         ; where are we?
2058
        cmp     dword [edi], 'INDX'
2026
        jz      .indexRecord
2059
        jz      .indexRecord
2027
        mov     esi, [ebp+NTFS.frs_buffer]  ; mftRecord
2060
        mov     esi, [ebp+NTFS.frs_buffer]  ; indexRoot
2028
        mov     edx, [esi+recordRealSize]
2061
        mov     edx, [esi+recordRealSize]
2029
        add     edx, ecx
2062
        add     edx, ecx
2030
        cmp     [esi+recordAllocatedSize], edx
2063
        cmp     [esi+recordAllocatedSize], edx
2031
        jnc     @f
2064
        jnc     @f
2032
        add     esp, 12
2065
        add     esp, 12
2033
        push    ERROR_UNSUPPORTED_FS    ; indexAllocation required
-
 
2034
        jmp     ntfsError
2066
        jmp     ntfsUnsupported     ; indexAllocation required
2035
@@:         ; index fits in the indexRoot
2067
@@:         ; index fits in the indexRoot
2036
        mov     [esi+recordRealSize], edx
2068
        mov     [esi+recordRealSize], edx
2037
        mov     ecx, edx
2069
        mov     ecx, edx
2038
        shr     ecx, 2
2070
        shr     ecx, 2
Line 2041... Line 2073...
2041
        sub     edi, [ebp+NTFS.frs_buffer]
2073
        sub     edi, [ebp+NTFS.frs_buffer]
2042
        add     edi, [ebp+NTFS.cur_index_buf]
2074
        add     edi, [ebp+NTFS.cur_index_buf]
2043
        mov     esi, [esp]
2075
        mov     esi, [esp]
2044
        add     [edi+sizeWithHeader], esi
2076
        add     [edi+sizeWithHeader], esi
2045
        add     [edi+sizeWithoutHeader], esi
2077
        add     [edi+sizeWithoutHeader], esi
2046
        mov     cx, [edi+attributeOffset]
2078
        mov     cl, [edi+attributeOffset]
2047
        add     edi, ecx
2079
        add     edi, ecx
2048
        add     [edi+16+nodeRealSize], esi
2080
        add     [edi+16+nodeRealSize], esi
2049
        add     [edi+16+nodeAllocatedSize], esi
2081
        add     [edi+16+nodeAllocatedSize], esi
2050
        sub     eax, [ebp+NTFS.cur_index_buf]
2082
        sub     eax, [ebp+NTFS.cur_index_buf]
2051
        add     eax, edi
2083
        add     eax, edi
Line 2053... Line 2085...
2053
        add     edi, edx
2085
        add     edi, edx
2054
        sub     edi, 4
2086
        sub     edi, 4
2055
        jmp     .common
2087
        jmp     .common
Line 2056... Line 2088...
2056
 
2088
 
2057
.indexRecord:
2089
.indexRecord:
2058
        mov     edx, [edi+1ch]
2090
        mov     edx, [edi+28]
2059
        add     edx, ecx
2091
        add     edx, ecx
2060
        cmp     [edi+20h], edx
2092
        cmp     [edi+32], edx
2061
        jnc     @f
2093
        jnc     @f
2062
        add     esp, 12
2094
        add     esp, 12
2063
        push    ERROR_UNSUPPORTED_FS    ; new node required
-
 
2064
        jmp     ntfsError
2095
        jmp     ntfsUnsupported     ; new node required
2065
@@:         ; index fits in the node
2096
@@:         ; index fits in the node
2066
        mov     [edi+1ch], edx
2097
        mov     [edi+28], edx
2067
        lea     edi, [edi+edx+14h]
2098
        lea     edi, [edi+edx+24-4]
2068
.common:
2099
.common:
2069
        mov     esi, edi
2100
        mov     esi, edi
2070
        sub     esi, [esp]
2101
        sub     esi, [esp]
2071
        mov     ecx, esi
2102
        mov     ecx, esi
Line 2130... Line 2161...
2130
        mov     eax, [ebp+NTFS.fileDataSize]
2161
        mov     eax, [ebp+NTFS.fileDataSize]
2131
        shr     eax, 5
2162
        shr     eax, 5
2132
        jz      .small
2163
        jz      .small
2133
        push    eax         ; bitmap dwords
2164
        push    eax         ; bitmap dwords
2134
        add     edi, 4
2165
        add     edi, 4
2135
        xor     edx, edx
-
 
2136
.start:
2166
.start:
2137
        mov     ecx, [ebp+NTFS.BitmapSize]
2167
        mov     ecx, [ebp+NTFS.BitmapSize]
2138
        mov     eax, edi
-
 
2139
        sub     eax, [ebp+NTFS.BitmapBuffer]
2168
        add     ecx, [ebp+NTFS.BitmapBuffer]
2140
        sub     ecx, eax
2169
        sub     ecx, edi
2141
        shr     ecx, 2
2170
        shr     ecx, 2
2142
@@:
2171
@@:
2143
        xor     eax, eax
2172
        xor     eax, eax
2144
        repnz scasd         ; search for empty dword
2173
        repnz scasd         ; search for empty dword
2145
        jz      @f
2174
        jz      @f
Line 2157... Line 2186...
2157
        xor     eax, eax
2186
        xor     eax, eax
2158
        repz scasd          ; check following dwords
2187
        repz scasd          ; check following dwords
2159
        jnz     .start
2188
        jnz     .start
2160
        sub     esi, 4
2189
        sub     esi, 4
2161
        mov     eax, [esi]
2190
        mov     eax, [esi]
-
 
2191
        xor     edx, edx
2162
        bsr     edx, eax
2192
        bsr     edx, eax
2163
        inc     edx
2193
        inc     edx
2164
        push    edx         ; starting bit
2194
        push    edx         ; starting bit
2165
        push    esi         ; starting dword
2195
        push    esi         ; starting dword
2166
        add     esi, 4
2196
        add     esi, 4
Line 2237... Line 2267...
2237
        xor     ecx, ecx
2267
        xor     ecx, ecx
2238
        add     dword [esp], 4
2268
        add     dword [esp], 4
2239
        mov     [esp+4], ecx
2269
        mov     [esp+4], ecx
2240
@@:
2270
@@:
2241
        mov     edi, [esp]
2271
        mov     edi, [esp]
2242
        mov     esi, [ebp+NTFS.fileDataSize]
2272
        xor     eax, eax
-
 
2273
        dec     eax
2243
        mov     edx, [edi]
2274
        shr     eax, cl
2244
        ror     edx, cl
2275
        shl     eax, cl
2245
        neg     ecx
2276
        neg     ecx
2246
        add     ecx, 32
2277
        add     ecx, 32
2247
        mov     eax, -1
-
 
2248
        sub     esi, ecx
2278
        sub     ecx, [ebp+NTFS.fileDataSize]
2249
        jnc     @f
2279
        jc      @f
2250
        mov     esi, ecx    ; fits inside
2280
        shl     eax, cl     ; fits inside dword
2251
        mov     ecx, [ebp+NTFS.fileDataSize]
-
 
2252
        shrd    edx, eax, cl
-
 
2253
        sub     esi, ecx
-
 
2254
        mov     ecx, esi
-
 
2255
        ror     edx, cl
2281
        shr     eax, cl
2256
        mov     [edi], edx
2282
        or      [edi], eax
2257
        jmp     .writeData
2283
        jmp     .writeData
Line 2258... Line 2284...
2258
 
2284
 
2259
@@:
2285
@@:
2260
        shrd    edx, eax, cl
2286
        or      [edi], eax
2261
        mov     [edi], edx
2287
        neg     ecx
2262
        mov     ecx, esi
2288
        push    ecx
2263
        shr     ecx, 5
2289
        shr     ecx, 5
-
 
2290
        add     edi, 4
-
 
2291
        xor     eax, eax
2264
        add     edi, 4
2292
        dec     eax
2265
        rep stosd
2293
        rep stosd
2266
        mov     ecx, esi
2294
        pop     ecx
2267
        and     ecx, 31
2295
        and     ecx, 31
2268
        mov     edx, [edi]
2296
        shr     eax, cl
2269
        shr     edx, cl
2297
        shl     eax, cl
2270
        shld    edx, eax, cl
2298
        not     eax
2271
        mov     [edi], edx
2299
        or      [edi], eax
2272
.writeData:
2300
.writeData:
2273
        pop     edx
2301
        pop     edx
2274
        sub     edx, [ebp+NTFS.BitmapBuffer]
2302
        sub     edx, [ebp+NTFS.BitmapBuffer]
2275
        shl     edx, 3
2303
        shl     edx, 3
Line 2282... Line 2310...
2282
        add     ecx, 511
2310
        add     ecx, 511
2283
        shr     ecx, 9
2311
        shr     ecx, 9
2284
        mov     ebx, [ebx+16]
2312
        mov     ebx, [ebx+16]
2285
        call    fs_write64_app
2313
        call    fs_write64_app
2286
        test    eax, eax
2314
        test    eax, eax
2287
        jz      .mftBitmap
-
 
2288
        push    11
-
 
2289
        jmp     ntfsError
2315
        jnz     ntfsDevice
2290
 
-
 
2291
    ; 4. MFT record
2316
    ; 4. MFT record
2292
.mftBitmap: ; search for free record
2317
.mftBitmap: ; search for free record
2293
        mov     edi, [ebp+NTFS.mftBitmapBuffer]
2318
        mov     edi, [ebp+NTFS.mftBitmapBuffer]
2294
        mov     ecx, [ebp+NTFS.mftBitmapSize]
2319
        mov     ecx, [ebp+NTFS.mftBitmapSize]
2295
        mov     al, -1
2320
        mov     al, -1
Line 2298... Line 2323...
2298
        repz scasb
2323
        repz scasb
2299
        dec     edi
2324
        dec     edi
2300
        movzx   eax, byte [edi]
2325
        movzx   eax, byte [edi]
2301
        not     al
2326
        not     al
2302
        bsf     ecx, eax
2327
        bsf     ecx, eax
2303
        jnz     @f
-
 
2304
        push    ERROR_UNSUPPORTED_FS    ; no free records
2328
        jz      ntfsUnsupported     ; no free records
2305
        jmp     ntfsError
-
 
2306
@@:         ; mark record
-
 
2307
        mov     al, [edi]
-
 
2308
        bts     eax, ecx
2329
        bts     [edi], ecx
2309
        mov     [edi], al
-
 
2310
    ; get record location
2330
; get record location
2311
        sub     edi, [ebp+NTFS.mftBitmapBuffer]
2331
        sub     edi, [ebp+NTFS.mftBitmapBuffer]
2312
        shl     edi, 3
2332
        shl     edi, 3
2313
        add     edi, ecx
2333
        add     edi, ecx
2314
        mov     [ebp+NTFS.newMftRecord], edi
2334
        mov     [ebp+NTFS.newMftRecord], edi
Line 2325... Line 2345...
2325
        cmp     [ebp+NTFS.ntfs_cur_read], 0
2345
        cmp     [ebp+NTFS.ntfs_cur_read], 0
2326
        jnz     .mftRecord
2346
        jnz     .mftRecord
2327
    ; extend MFT $DATA
2347
; extend MFT $DATA
2328
        mov     eax, [ebp+NTFS.mft_cluster]
2348
        mov     eax, [ebp+NTFS.mft_cluster]
2329
        mul     [ebp+NTFS.sectors_per_cluster]
2349
        mul     [ebp+NTFS.sectors_per_cluster]
2330
        push    ERROR_UNSUPPORTED_FS
-
 
2331
        cmp     eax, [ebp+NTFS.ntfsLastRead]
2350
        cmp     eax, [ebp+NTFS.ntfsLastRead]
2332
        jnz     ntfsError       ; auxiliary record
2351
        jnz     ntfsUnsupported     ; auxiliary record
2333
        mov     edi, [ebp+NTFS.ntfs_attr_offs]
2352
        mov     edi, [ebp+NTFS.ntfs_attr_offs]
2334
        mov     ebx, [ebp+NTFS.sectors_per_cluster]
2353
        mov     ebx, [ebp+NTFS.sectors_per_cluster]
2335
        shl     ebx, 9+3
2354
        shl     ebx, 9+3
2336
        add     dword [edi+lastVCN], 8
2355
        add     dword [edi+lastVCN], 8
2337
        add     [edi+attributeAllocatedSize], ebx
2356
        add     [edi+attributeAllocatedSize], ebx
-
 
2357
        adc     byte [edi+attributeAllocatedSize+4], 0
2338
        add     [edi+attributeRealSize], ebx
2358
        add     [edi+attributeRealSize], ebx
-
 
2359
        adc     byte [edi+attributeRealSize+4], 0
2339
        add     [edi+initialDataSize], ebx
2360
        add     [edi+initialDataSize], ebx
-
 
2361
        adc     byte [edi+initialDataSize+4], 0
2340
        add     edi, [edi+dataRunsOffset]
2362
        movzx   eax, byte [edi+dataRunsOffset]
-
 
2363
        add     edi, eax
2341
        movzx   eax, byte [edi]
2364
        mov     al, [edi]
2342
        inc     edi
2365
        inc     edi
2343
        shl     eax, 4
2366
        shl     eax, 4
2344
        shr     al, 4
2367
        shr     al, 4
2345
        mov     cl, 4
2368
        mov     cl, 4
2346
        sub     cl, al
2369
        sub     cl, al
2347
        shl     cl, 3
2370
        shl     cl, 3
2348
        add     ah, al
2371
        add     ah, al
2349
        shr     eax, 8
2372
        shr     eax, 8
2350
        cmp     byte [edi+eax], 0
2373
        cmp     byte [edi+eax], 0
2351
        jnz     ntfsError       ; $MFT fragmented
2374
        jnz     ntfsUnsupported     ; $MFT fragmented
2352
        mov     al, 8
2375
        mov     al, 8
2353
        mov     edx, [edi]
2376
        mov     edx, [edi]
2354
        rol     eax, cl
2377
        rol     eax, cl
2355
        rol     edx, cl
2378
        rol     edx, cl
2356
        add     eax, edx
2379
        add     eax, edx
2357
        jc      ntfsError
2380
        jc      ntfsUnsupported
2358
        ror     eax, cl
2381
        ror     eax, cl
2359
        shr     edx, cl
2382
        shr     edx, cl
2360
        mov     [edi], eax
2383
        mov     [edi], eax
2361
        add     edx, [ebp+NTFS.mft_cluster]
2384
        add     edx, [ebp+NTFS.mft_cluster]
2362
        mov     esi, edx
2385
        mov     esi, edx
2363
        mov     ecx, edx
2386
        mov     ecx, edx
2364
        and     ecx, 7
2387
        and     ecx, 7
2365
        shr     edx, 3
2388
        shr     edx, 3
2366
        add     edx, [ebp+NTFS.BitmapBuffer]
2389
        add     edx, [ebp+NTFS.BitmapBuffer]
2367
        movzx   eax, word [edx]
2390
        mov     ax, [edx]
2368
        shr     eax, cl
2391
        shr     ax, cl
-
 
2392
        test    al, al
2369
        jnz     ntfsError
2393
        jnz     ntfsUnsupported
2370
        mov     al, -1
2394
        dec     al
2371
        xchg    [edx], al
2395
        xchg    [edx], al
2372
        mov     [edx+1], al
2396
        mov     [edx+1], al
2373
        pop     eax
-
 
2374
        push    12
-
 
2375
        stdcall kernel_alloc, ebx
2397
        stdcall kernel_alloc, ebx
2376
        test    eax, eax
2398
        test    eax, eax
2377
        jz      ntfsError
2399
        jz      ntfsNoMemory
2378
        mov     ecx, ebx
2400
        mov     ecx, ebx
2379
        shr     ecx, 2
2401
        shr     ecx, 2
2380
        mov     edi, eax
2402
        mov     edi, eax
2381
        push    ebx
2403
        push    ebx
2382
        mov     ebx, eax
2404
        mov     ebx, eax
Line 2386... Line 2408...
2386
        mul     [ebp+NTFS.sectors_per_cluster]
2408
        mul     [ebp+NTFS.sectors_per_cluster]
2387
        pop     ecx
2409
        pop     ecx
2388
        shr     ecx, 9
2410
        shr     ecx, 9
2389
        call    fs_write64_sys  ; clear new records
2411
        call    fs_write64_sys  ; clear new records
2390
        stdcall kernel_free, ebx
2412
        stdcall kernel_free, ebx
2391
        pop     eax
-
 
2392
        push    11
-
 
2393
        mov     eax, esi
2413
        mov     eax, esi
2394
        shr     eax, 3+9
2414
        shr     eax, 3+9
2395
        mov     ebx, eax
2415
        mov     ebx, eax
2396
        shl     ebx, 9
2416
        shl     ebx, 9
2397
        add     ebx, [ebp+NTFS.BitmapBuffer]
2417
        add     ebx, [ebp+NTFS.BitmapBuffer]
2398
        add     eax, [ebp+NTFS.BitmapLocation]
2418
        add     eax, [ebp+NTFS.BitmapLocation]
2399
        mov     ecx, 1
2419
        mov     ecx, 1
2400
        xor     edx, edx
2420
        xor     edx, edx
2401
        call    fs_write64_app  ; partition bitmap
2421
        call    fs_write64_app  ; partition bitmap
2402
        test    eax, eax
2422
        test    eax, eax
2403
        jnz     ntfsError
2423
        jnz     ntfsDevice
2404
        mov     eax, [ebp+NTFS.frs_buffer]
2424
        mov     eax, [ebp+NTFS.frs_buffer]
2405
        mov     [ebp+NTFS.ntfs_cur_buf], eax
2425
        mov     [ebp+NTFS.ntfs_cur_buf], eax
2406
        call    writeRecord     ; $MFT
2426
        call    writeRecord     ; $MFT
2407
        test    eax, eax
2427
        test    eax, eax
2408
        jnz     ntfsError
2428
        jnz     ntfsDevice
2409
        mov     eax, [ebp+NTFS.mftmirr_cluster]
2429
        mov     eax, [ebp+NTFS.mftmirr_cluster]
2410
        mul     [ebp+NTFS.sectors_per_cluster]
2430
        mul     [ebp+NTFS.sectors_per_cluster]
2411
        mov     ebx, [ebp+NTFS.frs_buffer]
2431
        mov     ebx, [ebp+NTFS.frs_buffer]
2412
        movzx   ecx, word [ebx+updateSequenceSize]
2432
        movzx   ecx, word [ebx+updateSequenceSize]
2413
        dec     ecx
2433
        dec     ecx
2414
        call    fs_write64_sys  ; $MFTMirr
2434
        call    fs_write64_sys  ; $MFTMirr
2415
        test    eax, eax
2435
        test    eax, eax
2416
        jnz     ntfsError
2436
        jnz     ntfsDevice
2417
        pop     eax
-
 
2418
        mov     eax, [ebp+NTFS.ntfs_cur_offs]
2437
        mov     eax, [ebp+NTFS.ntfs_cur_offs]
2419
        add     [ebp+NTFS.ntfsLastRead], eax
2438
        add     [ebp+NTFS.ntfsLastRead], eax
2420
.mftRecord:
2439
.mftRecord:
2421
        mov     esi, [ebp+NTFS.indexOffset]
2440
        mov     esi, [ebp+NTFS.indexOffset]
2422
        mov     edi, [ebp+NTFS.frs_buffer]
2441
        mov     edi, [ebp+NTFS.frs_buffer]
Line 2452... Line 2471...
2452
        mov     [edi+sizeWithoutHeader], ecx
2471
        mov     [edi+sizeWithoutHeader], ecx
2453
        mov     cx, [esi+indexAllocatedSize]
2472
        mov     cx, [esi+indexAllocatedSize]
2454
        add     ecx, 8
2473
        add     ecx, 8
2455
        mov     [edi+sizeWithHeader], ecx
2474
        mov     [edi+sizeWithHeader], ecx
2456
        mov     byte [edi+attributeOffset], 18h
2475
        mov     byte [edi+attributeOffset], 18h
2457
        mov     byte [edi+attributeFlags], 1
2476
        mov     byte [edi+indexedFlag], 1
2458
        add     edi, 18h
2477
        add     edi, 18h
2459
        add     esi, 16
2478
        add     esi, 16
2460
        sub     ecx, 18h
2479
        sub     ecx, 18h
2461
        shr     ecx, 2
2480
        shr     ecx, 2
2462
        rep movsd
2481
        rep movsd
Line 2495... Line 2514...
2495
        mov     byte [edi+nameOffset], 18h
2514
        mov     byte [edi+nameOffset], 18h
2496
        mov     byte [edi+sizeWithoutHeader], 30h
2515
        mov     byte [edi+sizeWithoutHeader], 30h
2497
        mov     byte [edi+attributeOffset], 20h
2516
        mov     byte [edi+attributeOffset], 20h
2498
        mov     dword[edi+18h], 490024h     ; unicode $I30
2517
        mov     dword[edi+18h], 490024h     ; unicode $I30
2499
        mov     dword[edi+18h+4], 300033h
2518
        mov     dword[edi+18h+4], 300033h
2500
        add     edi, 20h
-
 
2501
        mov     byte [edi+attributeType], 30h
2519
        mov     byte [edi+20h+attributeType], 30h
2502
        mov     byte [edi+collationRule], 1
2520
        mov     byte [edi+20h+collationRule], 1
2503
        mov     eax, [ebp+NTFS.sectors_per_cluster]
2521
        mov     eax, [ebp+NTFS.sectors_per_cluster]
2504
        shl     eax, 9
2522
        shl     eax, 9
2505
        mov     [edi+indexRecordSize], eax
2523
        mov     [edi+20h+indexRecordSize], eax
2506
        mov     byte [edi+indexRecordSizeClus], 1
2524
        mov     byte [edi+20h+indexRecordSizeClus], 1
2507
        mov     byte [edi+16+indexOffset], 16
2525
        mov     byte [edi+30h+indexOffset], 16
2508
        mov     byte [edi+16+nodeRealSize], 32
2526
        mov     byte [edi+30h+nodeRealSize], 32
2509
        mov     byte [edi+16+nodeAllocatedSize], 32
2527
        mov     byte [edi+30h+nodeAllocatedSize], 32
2510
        mov     byte [edi+32+indexAllocatedSize], 16
2528
        mov     byte [edi+40h+indexAllocatedSize], 16
2511
        mov     byte [edi+32+indexFlags], 2
2529
        mov     byte [edi+40h+indexFlags], 2
2512
        sub     edi, 20h
-
 
2513
        mov     al, 3
2530
        mov     al, 3
2514
.writeMftRecord:
2531
.writeMftRecord:
2515
        mov     byte [edi+sizeWithHeader], 50h
2532
        mov     byte [edi+sizeWithHeader], 50h
2516
        mov     byte [edi+attributeID], 2
2533
        mov     byte [edi+attributeID], 2
2517
        mov     dword[edi+50h], -1      ; $End
2534
        mov     dword[edi+50h], -1      ; $End
2518
        mov     edi, [ebp+NTFS.frs_buffer]
2535
        mov     edi, [ebp+NTFS.frs_buffer]
2519
        mov     [edi+recordFlags], al
2536
        mov     [edi+recordFlags], al
2520
        mov     [ebp+NTFS.ntfs_cur_buf], edi
2537
        mov     [ebp+NTFS.ntfs_cur_buf], edi
2521
        call    writeRecord
2538
        call    writeRecord
2522
        test    eax, eax
2539
        test    eax, eax
2523
        jz      @f
-
 
2524
        push    11
-
 
2525
        jmp     ntfsError
2540
        jnz     ntfsDevice
2526
@@:
-
 
2527
        mov     esi, [ebp+PARTITION.Disk]
2541
        mov     esi, [ebp+PARTITION.Disk]
2528
        call    disk_sync
2542
        call    disk_sync
2529
    ; write MFT bitmap
2543
; write MFT bitmap
2530
        mov     eax, [ebp+NTFS.newMftRecord]
2544
        mov     eax, [ebp+NTFS.newMftRecord]
2531
        shr     eax, 3+9
2545
        shr     eax, 3+9
Line 2535... Line 2549...
2535
        add     ebx, [ebp+NTFS.mftBitmapBuffer]
2549
        add     ebx, [ebp+NTFS.mftBitmapBuffer]
2536
        mov     ecx, 1
2550
        mov     ecx, 1
2537
        xor     edx, edx
2551
        xor     edx, edx
2538
        call    fs_write64_sys
2552
        call    fs_write64_sys
2539
        test    eax, eax
2553
        test    eax, eax
2540
        jz      @f
-
 
2541
        push    11
-
 
2542
        jmp     ntfsError
2554
        jnz     ntfsDevice
2543
@@: ; 5. Write partition bitmap
2555
; 5. Write partition bitmap
2544
        cmp     [ebp+NTFS.ntfsFolder], 0
2556
        cmp     [ebp+NTFS.ntfsFolder], 0
2545
        jnz     @f
2557
        jnz     @f
2546
        cmp     [ebp+NTFS.fileRealSize], 0
2558
        cmp     [ebp+NTFS.fileRealSize], 0
2547
        jz      @f
2559
        jz      @f
2548
        mov     ecx, [ebp+NTFS.fileDataStart]
2560
        mov     ecx, [ebp+NTFS.fileDataStart]
Line 2557... Line 2569...
2557
        add     eax, [ebp+NTFS.BitmapLocation]
2569
        add     eax, [ebp+NTFS.BitmapLocation]
2558
        add     ebx, [ebp+NTFS.BitmapBuffer]
2570
        add     ebx, [ebp+NTFS.BitmapBuffer]
2559
        xor     edx, edx
2571
        xor     edx, edx
2560
        call    fs_write64_app
2572
        call    fs_write64_app
2561
        test    eax, eax
2573
        test    eax, eax
2562
        jz      @f
-
 
2563
        push    11
-
 
2564
        jmp     ntfsError
2574
        jnz     ntfsDevice
2565
@@:
2575
@@:
2566
        mov     esi, [ebp+PARTITION.Disk]
2576
        mov     esi, [ebp+PARTITION.Disk]
2567
        call    disk_sync
2577
        call    disk_sync
2568
        mov     edi, [ebp+NTFS.indexOffset]
2578
        mov     edi, [ebp+NTFS.indexOffset]
2569
        mov     eax, [ebp+NTFS.newMftRecord]
2579
        mov     eax, [ebp+NTFS.newMftRecord]
Line 2572... Line 2582...
2572
        mov     eax, [ebp+NTFS.nodeLastRead]
2582
        mov     eax, [ebp+NTFS.nodeLastRead]
2573
        mov     [ebp+NTFS.ntfsLastRead], eax
2583
        mov     [ebp+NTFS.ntfsLastRead], eax
2574
        mov     eax, [ebp+NTFS.cur_index_buf]
2584
        mov     eax, [ebp+NTFS.cur_index_buf]
2575
        mov     [ebp+NTFS.ntfs_cur_buf], eax
2585
        mov     [ebp+NTFS.ntfs_cur_buf], eax
2576
        call    writeRecord
2586
        call    writeRecord
2577
        push    eax
2587
        test    eax, eax
-
 
2588
        jnz     ntfsDevice
-
 
2589
        mov     ebx, [ebp+NTFS.fileRealSize]
-
 
2590
ntfsDone:
2578
        mov     esi, [ebp+PARTITION.Disk]
2591
        mov     esi, [ebp+PARTITION.Disk]
2579
        call    disk_sync
2592
        call    disk_sync
2580
        call    ntfs_unlock
2593
        call    ntfs_unlock
2581
        pop     eax
2594
        xor     eax, eax
2582
        mov     ebx, [ebp+NTFS.fileRealSize]
-
 
2583
        ret
2595
        ret
Line 2584... Line 2596...
2584
 
2596
 
2585
writeRecord:
2597
writeRecord:
2586
;   in:
2598
;   in:
Line 2610... Line 2622...
2610
        jmp     fs_write64_sys
2622
        jmp     fs_write64_sys
Line 2611... Line 2623...
2611
 
2623
 
2612
bitmapBuffering:
2624
bitmapBuffering:
2613
; Extend BitmapBuffer and read next 32kb of bitmap
2625
; Extend BitmapBuffer and read next 32kb of bitmap
-
 
2626
; Warning: $Bitmap fragmentation is not foreseen
-
 
2627
; if edi -> position in bitmap buffer,
2614
; Warning: $Bitmap fragmentation is not foreseen
2628
; then ecx = number of buffered dwords left
2615
        push    ebx
2629
        push    ebx
2616
        mov     eax, [ebp+NTFS.BitmapTotalSize]
2630
        mov     eax, [ebp+NTFS.BitmapTotalSize]
2617
        cmp     eax, [ebp+NTFS.BitmapSize]
2631
        cmp     eax, [ebp+NTFS.BitmapSize]
2618
        jz      .end
2632
        jz      .end
Line 2639... Line 2653...
2639
        cmp     eax, [ebp+NTFS.BitmapSize]
2653
        cmp     eax, [ebp+NTFS.BitmapSize]
2640
        jnc     @f
2654
        jnc     @f
2641
        mov     [ebp+NTFS.BitmapSize], eax
2655
        mov     [ebp+NTFS.BitmapSize], eax
2642
@@:
2656
@@:
2643
        mov     ecx, [ebp+NTFS.BitmapSize]
2657
        mov     ecx, [ebp+NTFS.BitmapSize]
2644
        mov     eax, edi
-
 
2645
        sub     eax, [ebp+NTFS.BitmapBuffer]
2658
        add     ecx, [ebp+NTFS.BitmapBuffer]
2646
        sub     ecx, eax
2659
        sub     ecx, edi
2647
        shr     ecx, 2
2660
        shr     ecx, 2
2648
        pop     ebx
2661
        pop     ebx
2649
        ret
2662
        ret
Line 2650... Line 2663...
2650
 
2663
 
Line 2654... Line 2667...
2654
        mov     ecx, 8
2667
        mov     ecx, 8
2655
        call    release_pages
2668
        call    release_pages
2656
.end:
2669
.end:
2657
        add     esp, 12     ; double ret
2670
        add     esp, 12     ; double ret
2658
        push    ERROR_DISK_FULL
2671
        push    ERROR_DISK_FULL
2659
        jmp     ntfsError
2672
        jmp     ntfsOut
Line 2660... Line 2673...
2660
 
2673
 
2661
;----------------------------------------------------------------
2674
;----------------------------------------------------------------
-
 
2675
ntfs_WriteFile:
-
 
2676
        cmp     byte [esi], 0
2662
ntfs_Write:
2677
        jnz     @f
2663
        xor     ebx, ebx
2678
        xor     ebx, ebx
2664
        mov     eax, ERROR_UNSUPPORTED_FS
2679
        movi    eax, ERROR_ACCESS_DENIED
-
 
2680
        ret
-
 
2681
@@:
-
 
2682
        call    ntfs_lock
-
 
2683
        stdcall ntfs_find_lfn, [esp+4]
-
 
2684
        jc      ntfsNotFound
-
 
2685
        cmp     [ebp+NTFS.ntfs_cur_iRecord], 16
-
 
2686
        jc      ntfsDenied
-
 
2687
        mov     [ebp+NTFS.ntfs_cur_attr], 0x80
-
 
2688
        mov     [ebp+NTFS.ntfs_cur_offs], 0
-
 
2689
        mov     [ebp+NTFS.ntfs_cur_size], 0
-
 
2690
        call    ntfs_read_attr
-
 
2691
        jc      ntfsDenied
-
 
2692
        mov     eax, [ebp+NTFS.frs_buffer]
-
 
2693
        cmp     word [eax+baseRecordReuse], 0
-
 
2694
        jnz     ntfsUnsupported     ; auxiliary record
-
 
2695
        cmp     byte [eax+hardLinkCounter], 1
-
 
2696
        jnz     ntfsUnsupported     ; file copying required
-
 
2697
        mov     ecx, [ebp+NTFS.ntfs_attr_offs]
-
 
2698
        cmp     byte [ecx+nonResidentFlag], 1
-
 
2699
        jnz     ntfsUnsupported     ; resident $DATA
-
 
2700
        cmp     word [ecx+attributeFlags], 0
-
 
2701
        jnz     ntfsUnsupported
-
 
2702
        mov     eax, [ebx+4]
-
 
2703
        mov     edx, [ebx+8]
-
 
2704
        add     eax, [ebx+12]
-
 
2705
        adc     edx, 0
-
 
2706
        cmp     edx, [ecx+attributeRealSize+4]
-
 
2707
        jc      .write
-
 
2708
        jnz     ntfsUnsupported     ; end of file
-
 
2709
        cmp     [ecx+attributeRealSize], eax
-
 
2710
        jc      ntfsUnsupported
-
 
2711
.write:
-
 
2712
        mov     eax, [ebx+4]
-
 
2713
        mov     edx, [ebx+8]
-
 
2714
        mov     ecx, [ebx+12]
-
 
2715
        mov     esi, [ebx+16]
-
 
2716
        shrd    eax, edx, 9
-
 
2717
        test    dword[ebx+4], 1FFh
-
 
2718
        jz      .aligned
-
 
2719
        mov     [ebp+NTFS.ntfs_cur_offs], eax
-
 
2720
        mov     [ebp+NTFS.ntfs_cur_size], 1
-
 
2721
        lea     edi, [ebp+NTFS.ntfs_bitmap_buf]
-
 
2722
        mov     [ebp+NTFS.ntfs_cur_buf], edi
-
 
2723
        call    ntfs_read_attr.continue
-
 
2724
        jc      ntfsDevice
-
 
2725
        mov     eax, [ebx+4]
-
 
2726
        and     eax, 1FFh
-
 
2727
        add     edi, eax
-
 
2728
        sub     eax, [ebp+NTFS.ntfs_cur_read]
-
 
2729
        neg     eax
-
 
2730
        push    ecx
-
 
2731
        cmp     ecx, eax
-
 
2732
        jb      @f
-
 
2733
        mov     ecx, eax
-
 
2734
@@:
-
 
2735
        sub     [esp], ecx
-
 
2736
        rep movsb
-
 
2737
        push    ebx
-
 
2738
        mov     eax, [ebp+NTFS.ntfsLastRead]
-
 
2739
        lea     ebx, [ebp+NTFS.ntfs_bitmap_buf]
-
 
2740
        mov     ecx, 1
-
 
2741
        xor     edx, edx
-
 
2742
        call    fs_write64_app
-
 
2743
        pop     ebx
-
 
2744
        pop     ecx
-
 
2745
        test    eax, eax
-
 
2746
        jnz     ntfsDevice
-
 
2747
        test    ecx, ecx
-
 
2748
        jz      @f
-
 
2749
        mov     eax, [ebx+4]
-
 
2750
        mov     edx, [ebx+8]
-
 
2751
        shrd    eax, edx, 9
-
 
2752
        inc     eax
-
 
2753
.aligned:
-
 
2754
        push    ecx
-
 
2755
        shr     ecx, 9
-
 
2756
        mov     [ebp+NTFS.ntfs_cur_offs], eax
-
 
2757
        mov     [ebp+NTFS.ntfs_cur_size], ecx
-
 
2758
        mov     [ebp+NTFS.ntfs_cur_buf], esi
-
 
2759
        add     eax, ecx
-
 
2760
        push    eax
-
 
2761
        mov     [ebp+NTFS.ntfsWriteAttr], 1
-
 
2762
        call    ntfs_read_attr.continue
-
 
2763
        mov     [ebp+NTFS.ntfsWriteAttr], 0
-
 
2764
        pop     [ebp+NTFS.ntfs_cur_offs]
-
 
2765
        pop     ecx
-
 
2766
        jc      ntfsDevice
-
 
2767
        and     ecx, 1FFh
-
 
2768
        jz      @f
-
 
2769
        add     esi, [ebp+NTFS.ntfs_cur_read]
-
 
2770
        mov     [ebp+NTFS.ntfs_cur_size], 1
-
 
2771
        lea     edi, [ebp+NTFS.ntfs_bitmap_buf]
-
 
2772
        mov     [ebp+NTFS.ntfs_cur_buf], edi
-
 
2773
        call    ntfs_read_attr.continue
-
 
2774
        jc      ntfsDevice
-
 
2775
        rep movsb
-
 
2776
        push    ebx
-
 
2777
        mov     eax, [ebp+NTFS.ntfsLastRead]
-
 
2778
        lea     ebx, [ebp+NTFS.ntfs_bitmap_buf]
-
 
2779
        mov     ecx, 1
-
 
2780
        xor     edx, edx
-
 
2781
        call    fs_write64_app
-
 
2782
        pop     ebx
-
 
2783
        test    eax, eax
-
 
2784
        jnz     ntfsDevice
-
 
2785
@@:
-
 
2786
        mov     ebx, [ebx+12]
-
 
2787
        jmp     ntfsDone
-
 
2788
 
-
 
2789
;----------------------------------------------------------------
-
 
2790
ntfs_Delete:
-
 
2791
        cmp     byte [esi], 0
-
 
2792
        jnz     @f
-
 
2793
        xor     ebx, ebx
-
 
2794
        movi    eax, ERROR_ACCESS_DENIED
-
 
2795
        ret
-
 
2796
@@:
-
 
2797
        call    ntfs_lock
-
 
2798
        stdcall ntfs_find_lfn, [esp+4]
-
 
2799
        jc      ntfsNotFound
-
 
2800
        cmp     [ebp+NTFS.ntfs_cur_iRecord], 16
-
 
2801
        jc      ntfsDenied
-
 
2802
        cmp     [ebp+NTFS.ntfsFragmentCount], 1
-
 
2803
        jnz     ntfsUnsupported     ; record fragmented
-
 
2804
        test    byte [eax+indexFlags], 1
-
 
2805
        jnz     ntfsUnsupported     ; index has a subnode
-
 
2806
        mov     edx, [ebp+NTFS.ntfs_cur_iRecord]
-
 
2807
        shr     edx, 3
-
 
2808
        cmp     edx, [ebp+NTFS.mftBitmapSize]
-
 
2809
        jnc     ntfsUnsupported
-
 
2810
; delete index from the node
-
 
2811
        movzx   edx, word [eax+indexAllocatedSize]
-
 
2812
        mov     edi, [ebp+NTFS.cur_index_buf]
-
 
2813
        cmp     dword [edi], 'INDX'
-
 
2814
        jz      .indexRecord
-
 
2815
        mov     esi, [ebp+NTFS.frs_buffer]  ; indexRoot
-
 
2816
        mov     ecx, [esi+recordRealSize]
-
 
2817
        shr     ecx, 2
-
 
2818
        rep movsd
-
 
2819
        mov     esi, [ebp+NTFS.cur_index_buf]
-
 
2820
        mov     edi, [ebp+NTFS.ntfs_attr_offs]
-
 
2821
        sub     edi, [ebp+NTFS.frs_buffer]
-
 
2822
        add     edi, esi
-
 
2823
        sub     [edi+sizeWithHeader], edx
-
 
2824
        sub     [edi+sizeWithoutHeader], edx
-
 
2825
        mov     cl, [edi+attributeOffset]
-
 
2826
        add     edi, ecx
-
 
2827
        sub     [edi+16+nodeRealSize], edx
-
 
2828
        sub     [edi+16+nodeAllocatedSize], edx
-
 
2829
        sub     eax, esi
-
 
2830
        add     eax, edi
-
 
2831
        sub     [esi+recordRealSize], edx
-
 
2832
        mov     ecx, [esi+recordRealSize]
-
 
2833
        jmp     @f
-
 
2834
 
-
 
2835
.indexRecord:
-
 
2836
        sub     [edi+28], edx
-
 
2837
        mov     ecx, [edi+28]
-
 
2838
        add     ecx, 24
-
 
2839
@@:
-
 
2840
        add     ecx, [ebp+NTFS.cur_index_buf]
-
 
2841
        sub     ecx, eax
-
 
2842
        shr     ecx, 2
-
 
2843
        mov     esi, eax
-
 
2844
        add     esi, edx
-
 
2845
        mov     edi, eax
-
 
2846
        rep movsd
-
 
2847
        mov     eax, [ebp+NTFS.ntfsLastRead]
-
 
2848
        mov     [ebp+NTFS.nodeLastRead], eax
-
 
2849
; examine file record
-
 
2850
        mov     [ebp+NTFS.ntfs_cur_attr], 0x80
-
 
2851
        mov     [ebp+NTFS.ntfs_cur_offs], 0
-
 
2852
        mov     [ebp+NTFS.ntfs_cur_size], 0
-
 
2853
        call    ntfs_read_attr
-
 
2854
        jc      .folder
-
 
2855
        mov     esi, [ebp+NTFS.frs_buffer]
-
 
2856
        cmp     word [esi+baseRecordReuse], 0
-
 
2857
        jnz     ntfsUnsupported     ; auxiliary record
-
 
2858
        cmp     byte [esi+hardLinkCounter], 2
-
 
2859
        jnc     .writeFileRecord    ; delete hard link
-
 
2860
        mov     esi, [ebp+NTFS.ntfs_attr_offs]
-
 
2861
        cmp     byte [esi+nonResidentFlag], 0
-
 
2862
        jz      .writeBitmapMFT
-
 
2863
        movzx   eax, byte [esi+dataRunsOffset]
-
 
2864
        add     esi, eax
-
 
2865
        xor     edi, edi
-
 
2866
        sub     esp, 16
-
 
2867
.clearBitmap:       ; "delete" file data
-
 
2868
        call    ntfs_decode_mcb_entry
-
 
2869
        jnc     .mcbEnd
-
 
2870
        cmp     dword[esp+8], 0
-
 
2871
        jz      .clearBitmap
-
 
2872
        add     edi, [esp+8]
-
 
2873
        mov     ebx, [esp]
-
 
2874
        mov     eax, edi
-
 
2875
        add     eax, ebx
-
 
2876
        shr     eax, 3
-
 
2877
        inc     eax
-
 
2878
        cmp     eax, [ebp+NTFS.BitmapSize]
-
 
2879
        jc      .buffered
-
 
2880
        add     eax, [ebp+NTFS.BitmapBuffer]
-
 
2881
        add     esp, 16
-
 
2882
        push    edi
-
 
2883
        mov     edi, eax
-
 
2884
@@:
-
 
2885
        call    bitmapBuffering
-
 
2886
        shl     ecx, 2
-
 
2887
        js      @b
-
 
2888
        pop     edi
-
 
2889
        sub     esp, 16
-
 
2890
.buffered:
-
 
2891
        push    edi
-
 
2892
        mov     ecx, edi
-
 
2893
        shr     edi, 5
-
 
2894
        shl     edi, 2
-
 
2895
        add     edi, [ebp+NTFS.BitmapBuffer]
-
 
2896
        and     ecx, 31
-
 
2897
        xor     eax, eax
-
 
2898
        dec     eax
-
 
2899
        shr     eax, cl
-
 
2900
        shl     eax, cl
-
 
2901
        neg     ecx
-
 
2902
        add     ecx, 32
-
 
2903
        sub     ecx, ebx
-
 
2904
        jc      @f
-
 
2905
        shl     eax, cl     ; fits inside dword
-
 
2906
        shr     eax, cl
-
 
2907
        not     eax
-
 
2908
        and     [edi], eax
-
 
2909
        jmp     .writeBitmap
-
 
2910
 
-
 
2911
@@:
-
 
2912
        not     eax
-
 
2913
        and     [edi], eax
-
 
2914
        neg     ecx
-
 
2915
        push    ecx
-
 
2916
        shr     ecx, 5
-
 
2917
        add     edi, 4
-
 
2918
        xor     eax, eax
-
 
2919
        rep stosd
-
 
2920
        pop     ecx
-
 
2921
        and     ecx, 31
-
 
2922
        dec     eax
-
 
2923
        shr     eax, cl
-
 
2924
        shl     eax, cl
-
 
2925
        and     [edi], eax
-
 
2926
.writeBitmap:
-
 
2927
        pop     edi
-
 
2928
        mov     ecx, edi
-
 
2929
        add     ecx, ebx
-
 
2930
        add     ecx, 4095
-
 
2931
        shr     ecx, 3+9
-
 
2932
        mov     eax, edi
-
 
2933
        shr     eax, 3+9
-
 
2934
        sub     ecx, eax
-
 
2935
        mov     ebx, eax
-
 
2936
        shl     ebx, 9
-
 
2937
        add     eax, [ebp+NTFS.BitmapLocation]
-
 
2938
        add     ebx, [ebp+NTFS.BitmapBuffer]
-
 
2939
        xor     edx, edx
-
 
2940
        call    fs_write64_app
-
 
2941
        jmp     .clearBitmap
-
 
2942
 
-
 
2943
.mcbEnd:
-
 
2944
        add     esp, 16
-
 
2945
        jmp     .writeBitmapMFT
-
 
2946
 
-
 
2947
.folder:    ; empty?
-
 
2948
        lea     esi, [ebp+NTFS.ntfs_bitmap_buf]
-
 
2949
        mov     [ebp+NTFS.ntfs_cur_buf], esi
-
 
2950
        mov     [ebp+NTFS.ntfs_cur_attr], 0x90
-
 
2951
        mov     [ebp+NTFS.ntfs_cur_offs], 0
-
 
2952
        mov     [ebp+NTFS.ntfs_cur_size], 1
-
 
2953
        call    ntfs_read_attr
-
 
2954
        cmp     [ebp+NTFS.ntfs_cur_read], 48
-
 
2955
        jnz     ntfsDenied
-
 
2956
        test    byte [esi+32+indexFlags], 1
-
 
2957
        jnz     ntfsDenied
-
 
2958
.writeBitmapMFT:    ; "delete" file record
-
 
2959
        mov     eax, [ebp+NTFS.ntfs_cur_iRecord]
-
 
2960
        mov     ecx, eax
-
 
2961
        shr     eax, 3
-
 
2962
        and     ecx, 7
-
 
2963
        mov     edi, [ebp+NTFS.mftBitmapBuffer]
-
 
2964
        btr     [edi+eax], ecx
-
 
2965
        shr     eax, 9
-
 
2966
        mov     ebx, eax
-
 
2967
        shl     ebx, 9
-
 
2968
        add     eax, [ebp+NTFS.mftBitmapLocation]
-
 
2969
        add     ebx, edi
-
 
2970
        mov     ecx, 1
-
 
2971
        xor     edx, edx
-
 
2972
        call    fs_write64_sys
-
 
2973
        mov     esi, [ebp+NTFS.frs_buffer]
-
 
2974
        mov     byte [esi+recordFlags], 0
-
 
2975
.writeFileRecord:
-
 
2976
        dec     byte [esi+hardLinkCounter]
-
 
2977
        mov     [ebp+NTFS.ntfs_cur_buf], esi
-
 
2978
        call    writeRecord
-
 
2979
; write directory node
-
 
2980
        mov     eax, [ebp+NTFS.nodeLastRead]
-
 
2981
        mov     [ebp+NTFS.ntfsLastRead], eax
-
 
2982
        mov     eax, [ebp+NTFS.cur_index_buf]
-
 
2983
        mov     [ebp+NTFS.ntfs_cur_buf], eax
-
 
2984
        call    writeRecord
-
 
2985
        test    eax, eax
-
 
2986
        jz      ntfsDone
Line 2665... Line 2987...
2665
        ret
2987
        jmp     ntfsDevice
2666
 
2988
 
2667
;----------------------------------------------------------------
2989
;----------------------------------------------------------------
2668
ntfs_SetFileEnd:
-
 
2669
ntfs_SetFileInfo:
2990
ntfs_SetFileEnd:
2670
ntfs_Delete:
2991
ntfs_SetFileInfo:
Line 2671... Line 2992...
2671
        mov     eax, ERROR_UNSUPPORTED_FS
2992
        movi    eax, ERROR_UNSUPPORTED_FS
2672
        ret
2993
        ret
2673
 
2994
 
2674
;----------------------------------------------------------------
2995
;----------------------------------------------------------------
2675
ntfs_GetFileInfo:
2996
ntfs_GetFileInfo:
2676
        cmp     byte [esi], 0
2997
        cmp     byte [esi], 0
2677
        jnz     @f
2998
        jnz     @f
2678
        movi    eax, 2
2999
        movi    eax, ERROR_UNSUPPORTED_FS
2679
        ret
3000
        ret
2680
@@:
3001
@@:
2681
        call    ntfs_lock
3002
        call    ntfs_lock
2682
        stdcall ntfs_find_lfn, [esp+4]
-
 
2683
        jnc     .doit
3003
        stdcall ntfs_find_lfn, [esp+4]
2684
        test    eax, eax
-
 
2685
        push    ERROR_FILE_NOT_FOUND
-
 
2686
        jz      ntfsError
3004
        jnc     .found
2687
        pop     eax
3005
        test    eax, eax
2688
        push    11
3006
        jz      ntfsFail
2689
        jmp     ntfsError
3007
        jmp     ntfsNotFound
2690
.doit:
3008
.found:
2691
        push    esi edi
3009
        push    esi edi
2692
        mov     esi, eax
3010
        mov     esi, eax
2693
        mov     edi, [ebx+16]
3011
        mov     edi, [ebx+16]
2694
        xor     eax, eax
3012
        xor     eax, eax
2695
        call    ntfs_direntry_to_bdfe
3013
        call    ntfs_direntry_to_bdfe
2696
        pop     edi esi
3014
        pop     edi esi
Line -... Line 3015...
-
 
3015
        call    ntfs_unlock
-
 
3016
        xor     eax, eax
2697
        call    ntfs_unlock
3017
        ret
2698
        xor     eax, eax
3018
 
2699
        ret
3019
ntfsUnsupported:
2700
 
3020
        push    ERROR_UNSUPPORTED_FS
2701
ntfsError:
3021
ntfsOut:
-
 
3022
        call    ntfs_unlock
-
 
3023
        xor     ebx, ebx
-
 
3024
        pop     eax
-
 
3025
        ret
-
 
3026
ntfsDevice:
-
 
3027
        push    ERROR_DEVICE
-
 
3028
        jmp     ntfsOut
-
 
3029
ntfsNotFound:
-
 
3030
        push    ERROR_FILE_NOT_FOUND
-
 
3031
        jmp     ntfsOut
-
 
3032
ntfsDenied:
-
 
3033
        push    ERROR_ACCESS_DENIED
-
 
3034
        jmp     ntfsOut
-
 
3035
ntfsFail:
-
 
3036
        push    ERROR_FS_FAIL