1175,14 → 1175,12 |
; in: [esi]+[esp+4] = name |
; out: |
; [ebp+NTFS.cur_iRecord] = target fileRecord |
; eax -> target index in the node |
; [ebp+NTFS.LastRead] = target node location |
; eax -> index in the target node |
; [ebp+NTFS.indexPointer] -> index, that points the target subnode |
; [ebp+NTFS.nodeLastRead] = branch node location |
; [ebp+NTFS.indexRoot] -> attribute |
; [ebp+NTFS.rootLastRead] = directory fileRecord location |
; [ebp+NTFS.cur_size] = index record size in sectors |
; [ebp+NTFS.cur_subnode_size] = index record size in clusters or sectors |
; [ebp+NTFS.rootLastRead] = directory fileRecord sector |
; CF=1 -> file not found, eax=0 -> error |
mov [ebp+NTFS.cur_iRecord], 5 ; start from root directory |
.doit2: |
1283,9 → 1281,6 |
.subnode: |
test byte [esi+indexFlags], 1 |
jz .notfound |
mov eax, [ebp+NTFS.LastRead] |
mov [ebp+NTFS.nodeLastRead], eax |
mov [ebp+NTFS.indexPointer], esi |
movzx eax, word [esi+indexAllocatedSize] |
mov eax, [esi+eax-8] |
mov edx, [ebp+NTFS.cur_size] |
1294,6 → 1289,7 |
jz @f |
mul [ebp+NTFS.sectors_per_cluster] |
@@: |
mov [ebp+NTFS.indexPointer], esi |
mov esi, [ebp+NTFS.cur_index_buf] |
xchg [ebp+NTFS.secondIndexBuffer], esi |
mov [ebp+NTFS.cur_index_buf], esi |
1996,8 → 1992,10 |
mov edi, [ebp+NTFS.cur_index_buf] |
jmp .common |
|
.growTree: ; create indexRecord |
mov edi, [ebp+NTFS.cur_index_buf] |
.growTree: |
xchg [ebp+NTFS.secondIndexBuffer], edi |
mov [ebp+NTFS.cur_index_buf], edi |
; create indexRecord |
mov ecx, 10 |
xor eax, eax |
rep stosd |
2029,8 → 2027,6 |
sub ecx, [esi+indexOffset] |
add eax, ecx |
mov [edi+nodeRealSize], eax |
mov eax, [esi+nonLeafFlag] |
mov [edi+nonLeafFlag], eax |
shr ecx, 2 |
add esi, [esi+indexOffset] |
add edi, [edi+indexOffset] |
2224,7 → 2220,7 |
add eax, 8 |
mov esi, [ebp+NTFS.secondIndexBuffer] |
cmp dword [esi], 'INDX' |
jz @f |
jz .errorPop3 ; move index to the branch node |
; move index to the root node |
mov esi, [ebp+NTFS.frs_buffer] |
mov ecx, eax |
2231,7 → 2227,7 |
add ecx, 8 |
add ecx, [esi+recordRealSize] |
cmp [esi+recordAllocatedSize], ecx |
jc .growTree |
jc .errorPop3 ; tree grow required |
push edi eax |
call .ntfsNodeAlloc |
pop ecx edi |
2273,49 → 2269,7 |
rep movsd ; insert index |
mov eax, [ebp+NTFS.newRecord] |
stosd |
jmp .splitNode |
|
@@: ; move index to the branch node |
add esi, recordNode |
mov ecx, [esi+nodeRealSize] |
add eax, ecx |
cmp [esi+nodeAllocatedSize], eax |
jc .errorPop3 ; tree grow required |
mov [esi+nodeRealSize], eax |
push edi |
lea edi, [esi+eax-4] |
add esi, ecx |
sub eax, ecx |
mov ecx, esi |
sub ecx, [ebp+NTFS.indexPointer] |
shr ecx, 2 |
sub esi, 4 |
std |
rep movsd ; make space |
mov [edi], ecx |
mov edi, esi |
add edi, 4 |
mov esi, [esp] |
add word [esi+indexAllocatedSize], 8 |
mov byte [esi+indexFlags], 1 |
mov ecx, eax |
sub ecx, 8 |
shr ecx, 2 |
cld |
rep movsd ; insert index |
push esi edi |
call .ntfsNodeAlloc |
pop edi esi ecx |
jc ntfsErrorPop3 |
push ecx |
mov eax, [ebp+NTFS.newRecord] |
stosd |
mov ebx, [ebp+NTFS.secondIndexBuffer] |
mov edx, [ebp+NTFS.nodeLastRead] |
push esi |
call writeRecord |
pop esi |
.splitNode: |
; split node |
mov edi, [ebp+NTFS.cur_index_buf] |
mov eax, edi |
add eax, recordNode |